:root{
  /* Mafia Scene palette (tweak if needed) */
  --ms-brand: #7a0b0b;         /* site burgundy */
  --ms-brand-2: #a01616;       /* hover/active */
  --ms-cream: #EEECDA;         /* site bg */
  --ms-cream-box: #FFFCE6;     /* box bg */

  /* Dropdown theme */
  --ms-pm-bg: #1b1414;         /* deep warm charcoal */
  --ms-pm-bg-2: #241a1a;       /* slightly lighter */
  --ms-pm-card: rgba(255,255,255,.06);
  --ms-pm-card2: rgba(255,255,255,.09);
  --ms-pm-border: rgba(255,255,255,.10);

  --ms-pm-text: rgba(255,255,255,.92);
  --ms-pm-muted: rgba(255,255,255,.68);

  --ms-pm-accent: var(--ms-brand);
  --ms-pm-danger: #b00020;
}

/* ===== Header row ===== */
.ms-pm{ position:relative; display:inline-flex; align-items:center; }
.ms-pm__row{ display:flex; align-items:center; gap:10px; }

.ms-pm__icon{
  position:relative;
  width:34px; height:34px;
  display:inline-flex; align-items:center; justify-content:center;
  border-radius:999px;
  text-decoration:none;
  background: rgba(255,255,255,.10);
  transition: background .15s ease, transform .15s ease;
}
.ms-pm__icon:hover{
  background: rgba(255,255,255,.16);
  transform: translateY(-1px);
}

.ms-pm__svg svg{ width:18px; height:18px; fill:#fff; opacity:.92; display:block; }

.ms-pm__badge{
  position:absolute; top:-6px; right:-6px;
  min-width:18px; height:18px;
  padding:0 6px;
  border-radius:999px;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:11px; font-weight:800;
  background: var(--ms-pm-danger);
  color:#fff;
  box-shadow:0 0 0 2px rgba(0,0,0,.25);
}

.ms-pm__toggle{
  display:flex; align-items:center; gap:6px;
  border:0; background:transparent; cursor:pointer;
  padding:4px 6px; border-radius:999px;
}
.ms-pm__avatar{ border-radius:999px; display:block; }
.ms-pm__caret{ font-size:12px; opacity:.85; color:#fff; }
.ms-pm__dot{
  position:absolute; top:0px; right:0px;
  width:10px; height:10px; border-radius:999px;
  background:#ff3b30;
  box-shadow:0 0 0 2px rgba(0,0,0,.25);
}

/* ===== Panel ===== */
.ms-pm__panel{
  position:absolute; right:0; top:calc(100% + 10px);
  width:360px; max-width:min(92vw, 420px);
  background: linear-gradient(180deg, var(--ms-pm-bg), var(--ms-pm-bg-2));
  border:1px solid var(--ms-pm-border);
  border-radius:14px;
  box-shadow:0 18px 55px rgba(0,0,0,.38);
  overflow:hidden;
  display:none;
  z-index:99999;
  color:var(--ms-pm-text);

  /* TYPOGRAPHY FIX */
  font-size:13px;
  line-height:1.25;
  letter-spacing:.1px;
}
.ms-pm[data-open="1"] .ms-pm__panel{ display:block; }

/* ===== Head ===== */
.ms-pm__head{
  padding:14px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.ms-pm__profile{
  display:flex; gap:12px; align-items:center;
  text-decoration:none;
  color:var(--ms-pm-text);
}
.ms-pm__avatar-lg{ border-radius:12px; }
.ms-pm__meta{ min-width:0; }
.ms-pm__name{
  font-weight:900;
  font-size:13px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.ms-pm__sub{
  opacity:.72;
  font-size:12px;
  margin-top:2px;
}

/* ===== Sections ===== */
.ms-pm__section{
  padding:12px 14px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.ms-pm__title{
  font-weight:900;
  font-size:12px;
  letter-spacing:.2px;
  opacity:.92;
  margin-bottom:8px;
}

/* ===== Lists / items (TEXT FIX) ===== */
.ms-pm__list{
  display:grid;
  gap:8px;
}

.ms-pm__item{
  display:grid;
  grid-template-columns:34px 1fr;
  gap:10px;
  align-items:center;
  padding:10px 10px;
  border-radius:12px;
  background: rgba(255,255,255,.05);
  text-decoration:none;
  color:var(--ms-pm-text);
  transition: background .15s ease, transform .15s ease;
}

.ms-pm__item:hover{
  background: rgba(255,255,255,.08);
  transform: translateY(-1px);
}

/* Empty state item should not look like a "link" */
.ms-pm__item--loading{
  display:block;
  padding:10px 12px;
  background: rgba(255,255,255,.04);
  color: var(--ms-pm-muted);
  border-radius:12px;

  /* prevent awkward wrapping */
  white-space:normal;
  word-break:normal;
}

.ms-pm__tmeta{
  display:flex;
  justify-content:space-between;
  gap:10px;
  align-items:baseline;
}

.ms-pm__tname{
  font-weight:900;
  font-size:13px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  max-width: 210px;
}

.ms-pm__ttime{
  opacity:.62;
  font-size:11px;
  white-space:nowrap;
  flex: 0 0 auto;
}

.ms-pm__texcerpt{
  opacity:.84;
  font-size:12px;
  margin-top:3px;

  /* Fix weird line breaks */
  line-height:1.3;
  display:-webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow:hidden;
}

/* Unread highlight */
.ms-pm__item[data-unread="1"]{
  outline:2px solid rgba(122,11,11,.35);
  background: rgba(122,11,11,.10);
}

/* ===== CTAs ===== */
.ms-pm__cta{
  display:block;
  margin-top:10px;
  text-align:center;
  text-decoration:none;
  color:#fff;
  padding:10px 12px;
  border-radius:12px;
  background: var(--ms-brand);
  font-weight:900;
  transition: filter .15s ease, transform .15s ease, background .15s ease;
}
.ms-pm__cta:hover{
  background: var(--ms-brand-2);
  transform: translateY(-1px);
}
.ms-pm__cta--soft{
  background: rgba(255,255,255,.10);
  color: var(--ms-pm-text);
}
.ms-pm__cta--soft:hover{
  background: rgba(255,255,255,.14);
}

/* ===== Links block ===== */
.ms-pm__links{
  padding:10px 14px;
  display:grid;
  gap:8px;
}
.ms-pm__link{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 10px;
  border-radius:12px;
  background: rgba(255,255,255,.05);
  text-decoration:none;
  color: var(--ms-pm-text);
  font-weight:900;
  transition: background .15s ease, transform .15s ease;
}
.ms-pm__link:hover{
  background: rgba(255,255,255,.08);
  transform: translateY(-1px);
}
.ms-pm__link .ms-pm__svg svg{ width:16px; height:16px; opacity:.92; }

/* ===== Footer ===== */
.ms-pm__foot{
  padding:12px 14px;
  border-top:1px solid rgba(255,255,255,.08);
}
.ms-pm__logout{
  display:block;
  text-decoration:none;
  color:#ffd2d2;
  padding:10px;
  border-radius:12px;
  background: rgba(255,255,255,.05);
  text-align:center;
  font-weight:900;
  transition: background .15s ease, transform .15s ease;
}
.ms-pm__logout:hover{
  background: rgba(255,255,255,.08);
  transform: translateY(-1px);
}

/* ===== Mobile slideout ===== */
@media (max-width: 780px){
  .ms-pm__panel{
    position:fixed;
    top:0; right:0;
    height:100vh;
    width:min(92vw, 380px);
    border-radius:0;
    transform: translateX(110%);
    display:block;
  }
  .ms-pm[data-open="1"] .ms-pm__panel{ transform: translateX(0); }
  .ms-pm[data-open="1"]::before{
    content:"";
    position:fixed; inset:0;
    background: rgba(0,0,0,.45);
    z-index:99998;
  }
  .ms-pm__panel{ z-index:99999; }
}

/* ===== Guest links ===== */
.ms-pm--guest .ms-pm__guest-links{
  display:flex;
  align-items:center;
  gap:8px;
}

.ms-pm__guest-link{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:34px;
  padding:0 12px;
  border-radius:999px;
  text-decoration:none;
  font-weight:800;
  font-size:12px;
  transition: transform .15s ease, background .15s ease;
}

.ms-pm__guest-link--login{
  background: rgba(255,255,255,.10);
  color:#fff;
}

.ms-pm__guest-link--login:hover{
  background: rgba(255,255,255,.16);
  transform: translateY(-1px);
}

.ms-pm__guest-link--register{
  background: var(--ms-brand);
  color:#fff;
}

.ms-pm__guest-link--register:hover{
  background: var(--ms-brand-2);
  transform: translateY(-1px);
}

/* Ensure profile menu remains visible inside mobile header containers */
@media (max-width: 780px){
  .ms-pm,
  .ms-pm__row{
    display:inline-flex;
    align-items:center;
  }
}
