/* Navbar profile dropdown (buyer layout) */
.pm { position: relative; display: inline-flex; align-items: center; flex-shrink: 0; }

.pm-trigger {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; padding: 2px; margin: 0;
    border-radius: 9999px; background: transparent;
    border: 1px solid #1E293B; cursor: pointer;
    transition: border-color .15s ease, background-color .15s ease;
}
.pm-trigger:hover,
.pm-trigger[aria-expanded="true"] { border-color: rgba(16,185,129,.55); background: rgba(16,185,129,.08); }
.pm-trigger:focus-visible { outline: 2px solid #10B981; outline-offset: 2px; }

.pm-avatar {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9999px; overflow: hidden; flex-shrink: 0;
    background: #1E293B; color: #34D399; font-weight: 700;
    font-family: var(--font-display, 'Plus Jakarta Sans', sans-serif);
}
.pm-avatar-sm { width: 100%; height: 100%; font-size: 12px; }
.pm-avatar-lg { width: 44px; height: 44px; font-size: 15px; border: 1px solid #334155; }
.pm-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.pm-initials { line-height: 1; letter-spacing: .02em; }

.pm-panel {
    position: absolute; top: calc(100% + 10px); right: 0; z-index: 10000;
    width: 300px; max-width: calc(100vw - 24px);
    background: #111827; border: 1px solid #1E293B; border-radius: 14px;
    box-shadow: 0 14px 32px rgba(0,0,0,.45);
    padding: 6px; text-align: left;
    opacity: 0; transform: translateY(-6px); visibility: hidden; pointer-events: none;
    transition: opacity .16s ease, transform .16s ease, visibility 0s linear .16s;
}
.pm-panel[hidden] { display: block; }
.pm-panel.is-open {
    opacity: 1; transform: translateY(0); visibility: visible; pointer-events: auto;
    transition: opacity .16s ease, transform .16s ease, visibility 0s;
}
/* Invisible bridge so the cursor can travel from avatar to panel without closing it */
.pm-panel::before { content: ""; position: absolute; left: 0; right: 0; top: -12px; height: 12px; }

.pm-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 8px; }
.pm-head-text { min-width: 0; flex: 1; }
.pm-name { font-size: 14px; font-weight: 700; color: #F8FAFC; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pm-email { margin-top: 1px; font-size: 12px; color: #94A3B8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pm-badges { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 10px 10px; border-bottom: 1px solid #1E293B; margin-bottom: 6px; }
.pm-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 9px; border-radius: 9999px; font-size: 11.5px; font-weight: 600; line-height: 1.4;
    border: 1px solid #334155; color: #CBD5E1; background: rgba(30,41,59,.6);
}
.pm-chip i { font-size: 12px; color: #34D399; }
.pm-dot { width: 6px; height: 6px; border-radius: 9999px; background: currentColor; }
.pm-chip-ok { color: #34D399; border-color: rgba(16,185,129,.35); background: rgba(16,185,129,.1); }
.pm-chip-warn { color: #FBBF24; border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.1); }
.pm-chip-bad { color: #F87171; border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.1); }

.pm-list, .pm-foot { display: flex; flex-direction: column; gap: 2px; }
.pm-foot { margin-top: 6px; padding-top: 6px; border-top: 1px solid #1E293B; }

.pm-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    min-height: 40px; padding: 8px 10px; border-radius: 8px;
    background: transparent; border: 0; text-align: left; text-decoration: none; cursor: pointer;
    color: #CBD5E1; font-size: 13.5px; font-weight: 500;
    transition: background-color .15s ease, color .15s ease;
}
.pm-item i { font-size: 16px; width: 18px; text-align: center; color: #94A3B8; transition: color .15s ease; }
.pm-item:hover, .pm-item:focus-visible { background: rgba(30,41,59,.85); color: #F8FAFC; outline: none; }
.pm-item:hover i, .pm-item:focus-visible i { color: #10B981; }
.pm-item:focus-visible { box-shadow: inset 0 0 0 1px rgba(16,185,129,.5); }

.pm-logout, .pm-logout i { color: #F87171; }
.pm-logout:hover, .pm-logout:focus-visible { background: rgba(239,68,68,.1); color: #FCA5A5; }
.pm-logout:hover i, .pm-logout:focus-visible i { color: #FCA5A5; }

.pm-login {
    display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px;
    border-radius: 9px; background: #111827; border: 1px solid #1E293B; color: #CBD5E1;
    font-size: 13px; font-weight: 600; text-decoration: none;
    transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.pm-login:hover { color: #10B981; border-color: rgba(16,185,129,.45); background: rgba(16,185,129,.08); }

@media (max-width: 575.98px) {
    /* The Menu button sits to the right of the avatar here, so anchor to the viewport instead */
    .pm { position: static; }
    .pm-panel { position: fixed; top: 64px; right: 12px; left: auto; width: min(320px, calc(100vw - 24px)); }
}

@media (prefers-reduced-motion: reduce) {
    .pm-panel, .pm-panel.is-open { transition: none; }
}
