/* =========================================================
   TOPBAR
========================================================= */

.topbar {
    height: var(--topbar);
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.mobile-menu {
    display: none;
    background: transparent;
    color: var(--text);
}

.mobile-menu svg {
    width: 20px;
    height: 20px;
}

/* ---------- page title ---------- */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.breadcrumb::before {
    content: "";
    width: 4px;
    height: 22px;
    border-radius: 4px;
    background: var(--primary-gradient);
    flex: none;
}

.breadcrumb-main {
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-spacer {
    flex: 1;
}

/* ---------- avatar ---------- */

.avatar {
    position: relative;
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: .02em;
}

.avatar::after {
    content: "";
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--success);
    border: 2px solid #fff;
}

.avatar--lg {
    width: 42px;
    height: 42px;
    font-size: 14px;
}

/* ---------- account menu ---------- */

.profile {
    position: relative;
}

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 12px 4px 4px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.profile-trigger:hover,
.profile.open .profile-trigger {
    border-color: var(--primary-soft);
    box-shadow: 0 4px 14px rgba(0, 113, 219, .14);
}

.profile-trigger:focus-visible,
.profile-item:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.profile-meta {
    display: flex;
    flex-direction: column;
    text-align: left;
    line-height: 1.25;
}

.profile-name {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text);
}

.profile-role {
    font-size: 10.5px;
    color: var(--text-3);
}

.profile-chevron {
    width: 14px;
    height: 14px;
    color: var(--text-3);
    transition: transform var(--transition);
}

.profile.open .profile-chevron {
    transform: rotate(180deg);
}

.profile-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 290px;
    padding: 8px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    box-shadow: 0 1px 2px rgba(0, 40, 80, .06), 0 24px 48px -16px rgba(0, 58, 112, .28);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(.98);
    transform-origin: top right;
    transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
}

.profile.open .profile-dropdown {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.profile-card {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    margin-bottom: 6px;
    border-radius: 12px;
    background: var(--identity-gradient);
}

/* faint upright emblem in the card corner */
.profile-card::after {
    content: "";
    position: absolute;
    width: 96px;
    aspect-ratio: 1;
    right: -22px;
    bottom: -30px;
    background: var(--primary);
    opacity: .08;
    -webkit-mask: var(--emblem-mask-image) center / contain no-repeat;
    mask: var(--emblem-mask-image) center / contain no-repeat;
}

.profile-card-text {
    position: relative;
    z-index: 1;
    min-width: 0;
}

.profile-card-name {
    font-size: 13.5px;
    font-weight: 800;
}

.profile-card-email {
    font-size: 11px;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Shared "role chip" look, also used by .acct-role-chip in account.css
   (account-details/change-password modals); each keeps its own size. */
.profile-card-chip,
.acct-role-chip {
    display: inline-block;
    margin-top: 6px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 700;
}

.profile-card-chip {
    padding: 2px 8px;
    font-size: 10px;
}

.profile-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.profile-item svg {
    width: 16px;
    height: 16px;
    color: var(--text-3);
    transition: color var(--transition);
}

.profile-item:hover {
    background: var(--primary-soft-2);
    color: var(--primary-dark);
}

.profile-item:hover svg {
    color: var(--primary);
}

.profile-item--danger,
.profile-item--danger svg {
    color: var(--danger);
}

.profile-item--danger:hover {
    background: var(--danger-soft);
    color: var(--danger);
}

.profile-item--danger:hover svg {
    color: var(--danger);
}

.profile-sep {
    height: 1px;
    margin: 6px 4px;
    background: var(--border);
}

@media (max-width: 760px) {
    .topbar {
        padding: 0 16px;
    }
    .profile-meta,
    .profile-chevron {
        display: none;
    }
    .profile-trigger {
        padding: 3px;
    }
    .profile-dropdown {
        width: min(290px, calc(100vw - 32px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .profile-dropdown,
    .profile-chevron {
        transition: none;
    }
}
