/* ==================================================
   NAVBAR - Matching Hero/CTA Navy Theme
   ================================================== */

/* ==================================================
   NAVBAR HEIGHT TOKEN
   Used by sticky elements below the navbar (e.g. compact-controls-bar).
   Update this value if the navbar height changes.
   ================================================== */
:root {
    --navbar-height: 73px;
}

/* ==================================================
   NAVBAR SCOPE RESET - Override base.css bleeding
   ================================================== */
.navbar {
    /* Navy gradient matching hero top and CTA */
    background: linear-gradient(135deg,
        var(--navy-darkest) 0%,
        var(--navy-dark) 50%,
        var(--navy-main) 100%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25); /* Reduced shadow */
    padding: var(--spacing-sm) 0; /* Using token */
    /* STICKY POSITIONING */
    position: sticky !important;
    top: 0 !important;
    z-index: 1030 !important;
    transition: padding 0.25s ease, box-shadow 0.25s ease;
}

/* Ensure navbar dropdowns appear above most content but below toasts */
.navbar .dropdown-menu {
    z-index: 1035 !important;
    position: absolute !important;
}

/* Optional: Compact style when scrolled */
.navbar.scrolled {
    padding: var(--spacing-xs) 0; /* Using token */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4); /* Reduced shadow */
    backdrop-filter: blur(8px); /* Reduced blur */
}

.navbar.scrolled .navbar-logo {
    width: 36px; /* Reduced from 42px */
    height: 36px; /* Reduced from 42px */
}

/* Subtle bottom glow */
.navbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 0.75px; /* Thinner line */
    background: linear-gradient(90deg,
        transparent,
        rgba(91, 163, 208, 0.25), /* Reduced opacity */
        transparent);
    pointer-events: none;
}

.navbar-brand {
    font-size: var(--font-size-xl); /* Using token */
    font-weight: 700;
    color: white !important;
    display: flex;
    align-items: center;
    transition: transform 0.25s ease, filter 0.25s ease;
}

.navbar-brand:hover {
    transform: scale(1.02);
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3)); /* Reduced glow */
}

/* White logo styling - no filter needed */
.navbar-logo {
    width: 44px; /* Reduced from 50px */
    height: 44px; /* Reduced from 50px */
    object-fit: contain;
    vertical-align: middle;
    transition: width 0.25s ease, height 0.25s ease, filter 0.25s ease;
}

.navbar-logo:hover {
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.4)); /* Reduced glow */
}

/* Navigation links */
.nav-link {
    color: rgba(255, 255, 255, 0.85) !important;
    font-weight: 500;
    margin: 0 var(--spacing-sm); /* Using token */
    padding: var(--spacing-sm) var(--spacing-lg) !important; /* Using tokens */
    transition: color 0.25s ease, transform 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
    position: relative;
    font-size: var(--font-size-sm); /* Using token */
}

/* Underline effect on hover */
.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0%;
    height: 1.5px; /* Reduced from 2px */
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.5), /* Reduced opacity */
        rgba(91, 163, 208, 0.7)); /* Reduced opacity */
    transition: width 0.25s ease; /* Faster transition */
}

.nav-link:hover {
    color: white !important;
}

.nav-link:hover::after {
    width: 70%; /* Reduced from 80% */
}

.nav-link.active {
    color: white !important;
}

.nav-link.active::after {
    width: 70%; /* Reduced from 80% */
}

/* Override Bootstrap's btn-outline-light styles */
.navbar .btn-outline-light {
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
}

.navbar .btn-outline-light:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

/* Remove the white background from Bootstrap's default hover */
.navbar .btn-outline-light:not(:hover) {
    background: transparent !important;
}

/* Remove the white background from Bootstrap's default hover */
.navbar .btn-outline-light:not(:hover) {
    background: transparent !important;
}

/* User dropdown */
.user-dropdown .dropdown-toggle {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-lg); /* Using tokens */
    background: rgba(255, 255, 255, 0.08);
    border: 0.75px solid rgba(255, 255, 255, 0.2); /* Thinner border */
    border-radius: 20px; /* Reduced from 25px */
    transition: all 0.25s ease; /* Faster transition */
    font-size: var(--font-size-sm); /* Using token */
}

.user-dropdown .dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35); /* Reduced opacity */
    color: white !important;
}

.user-dropdown .dropdown-toggle::after {
    margin-left: var(--spacing-sm); /* Using token */
}

/* display:contents = this wrapper generates no box of its own; its children
   (username, subscription pill) stay direct flex items of .dropdown-toggle
   exactly as if the wrapper didn't exist - zero desktop layout change. The
   mobile drawer (navbar.css ≤991px block) overrides this to a real flex
   column so the profile row doesn't need to stretch edge-to-edge to fit both. */
.user-dropdown .dropdown-toggle .mob-profile-meta {
    display: contents;
}

/* Dropdown menu */
.user-dropdown .dropdown-menu {
    background: rgba(10, 37, 64, 0.98);
    backdrop-filter: blur(8px); /* Reduced blur */
    border: 0.75px solid rgba(255, 255, 255, 0.15); /* Thinner border */
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.35), /* Reduced shadow */
        0 2px 8px rgba(0, 0, 0, 0.2); /* Reduced shadow */
    border-radius: 10px; /* Reduced from 12px */
    margin-top: var(--spacing-sm); /* Using token */
    padding: var(--spacing-sm); /* Using token */
    min-width: 220px;
    max-height: min(520px, calc(100vh - 90px));
    overflow-y: auto;
    /* Firefox */
    scrollbar-width: thin;
    scrollbar-color: var(--navy-main) rgba(255, 255, 255, 0.05);
}

.user-dropdown .dropdown-menu::-webkit-scrollbar {
    width: 6px;
}

.user-dropdown .dropdown-menu::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    margin: 4px 0;
}

.user-dropdown .dropdown-menu::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--navy-main), #408fc4);
    border-radius: 8px;
}

.user-dropdown .dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #408fc4, var(--navy-lighter));
}

.user-dropdown .dropdown-item {
    color: rgba(255, 255, 255, 0.85);
    padding: var(--spacing-md) var(--spacing-lg); /* Using tokens */
    border-radius: 6px; /* Reduced from 8px */
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: var(--font-size-sm); /* Using token */
}

.user-dropdown .dropdown-item:hover {
    background: linear-gradient(135deg, var(--navy-main), var(--navy-lighter));
    color: white;
    transform: translateX(3px); /* Reduced from 4px */
}

.user-dropdown .dropdown-item i {
    margin-right: var(--spacing-sm); /* Using token */
    opacity: 0.8;
    font-size: 0.9rem; /* Reduced from 1rem */
}

.user-dropdown .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.15);
    margin: var(--spacing-sm) 0; /* Using token */
}

/* Override Bootstrap's .text-muted for user dropdown */
.user-dropdown .text-muted {
    color: rgba(255, 255, 255, 0.7) !important;
    opacity: 1 !important;
}

/* Collaboration dropdown - EXACT SAME styling as user dropdown */
.collab-dropdown .dropdown-toggle {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: var(--spacing-sm) var(--spacing-lg); /* Using tokens */
    background: rgba(255, 255, 255, 0.08);
    border: 0.75px solid rgba(255, 255, 255, 0.2); /* Thinner border */
    border-radius: 20px; /* Reduced from 25px */
    transition: all 0.25s ease; /* Faster transition */
    font-size: var(--font-size-sm); /* Using token */
}

.collab-dropdown .dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35); /* Reduced opacity */
    color: white !important;
}

.collab-dropdown .dropdown-toggle::after {
    margin-left: var(--spacing-sm); /* Using token */
}

/* Collaboration dropdown menu - matching user dropdown */
.collab-dropdown .dropdown-menu {
    background: rgba(10, 37, 64, 0.98);
    backdrop-filter: blur(8px); /* Reduced blur */
    border: 0.75px solid rgba(255, 255, 255, 0.15); /* Thinner border */
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.35), /* Reduced shadow */
        0 2px 8px rgba(0, 0, 0, 0.2); /* Reduced shadow */
    border-radius: 10px; /* Reduced from 12px */
    margin-top: var(--spacing-sm); /* Using token */
    padding: var(--spacing-sm); /* Using token */
    min-width: 260px; /* Reduced from 300px */
}

.collab-dropdown .dropdown-item {
    color: rgba(255, 255, 255, 0.85);
    padding: var(--spacing-md) var(--spacing-lg); /* Using tokens */
    border-radius: 6px; /* Reduced from 8px */
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: var(--font-size-sm); /* Using token */
}

.collab-dropdown .dropdown-item:hover {
    background: linear-gradient(135deg, var(--navy-main), var(--navy-lighter));
    color: white;
    transform: translateX(3px); /* Reduced from 4px */
}

.collab-dropdown .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.15);
    margin: var(--spacing-sm) 0; /* Using token */
}

.collab-dropdown .dropdown-header {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    font-size: var(--font-size-base); /* Using token */
}

/* ==================================================
   GLOBAL PRESENCE INDICATOR - Enhanced Styles
   ================================================== */

/* Presence activity text */
.presence-activity {
    color: rgba(255, 255, 255, 0.75);
    font-size: var(--font-size-xs); /* Using token */
    margin-top: var(--spacing-xs); /* Using token */
    font-style: italic;
}

/* Presence firm info */
.presence-firm {
    color: rgba(255, 255, 255, 0.6);
    font-size: var(--font-size-xs); /* Using token */
    margin-top: var(--spacing-xs); /* Using token */
}

/* Presence timestamp */
.presence-timestamp {
    color: rgba(255, 255, 255, 0.5);
    font-size: var(--font-size-xs); /* Using token */
    margin-top: var(--spacing-xs); /* Using token */
}

/* Presence user item hover in dropdown */
.presence-user-item {
    padding: var(--spacing-md) var(--spacing-lg); /* Using tokens */
    border-radius: 6px; /* Reduced from 8px */
    transition: all 0.2s ease;
    margin-bottom: var(--spacing-xs); /* Using token */
}

.presence-user-item:hover {
    background: linear-gradient(135deg, rgba(45, 122, 175, 0.15), rgba(64, 143, 196, 0.1));
    transform: translateX(2px); /* Reduced from 3px */
}

/* Make clickable items have pointer cursor */
.presence-user-item[onclick] {
    cursor: pointer;
}

.presence-user-item[onclick]:hover {
    background: linear-gradient(135deg, rgba(45, 122, 175, 0.25), rgba(64, 143, 196, 0.15));
}

/* Avatar for presence users */
.presence-user-avatar {
    width: 28px; /* Reduced from 32px */
    height: 28px; /* Reduced from 32px */
    border-radius: 50%;
    background: linear-gradient(135deg, var(--navy-main), var(--navy-lighter));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: var(--font-size-xs); /* Using token */
    color: white;
    border: 1.5px solid rgba(255, 255, 255, 0.25); /* Reduced from 2px */
    flex-shrink: 0;
}

/* Username styling */
.presence-user-name {
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    font-size: var(--font-size-sm); /* Using token */
}

/* ==================================================
   ROLE BADGES - Unified Team Role Badges
   ================================================== */

.team-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.7rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.75rem;
    color: white;
    border: 1px solid;
    white-space: nowrap;
    transition: all 0.25s ease;
}

.team-role-badge i { font-size: 0.72rem; }

.team-role-badge.team-role-primary_owner {
    background: linear-gradient(135deg, rgba(245,158,11,0.85), rgba(217,119,6,0.85));
    border-color: rgba(245,158,11,0.35);
    box-shadow: 0 2px 8px rgba(245,158,11,0.2);
}
.team-role-badge.team-role-primary_owner i { color: #fcd34d; }

.team-role-badge.team-role-co_owner {
    background: linear-gradient(135deg, rgba(217,119,6,0.85), rgba(180,83,9,0.85));
    border-color: rgba(217,119,6,0.35);
    box-shadow: 0 2px 8px rgba(217,119,6,0.2);
}
.team-role-badge.team-role-co_owner i { color: #fbbf24; }

/* legacy 'owner' alias = same colours as primary_owner */
.team-role-badge.team-role-owner {
    background: linear-gradient(135deg, rgba(245,158,11,0.85), rgba(217,119,6,0.85));
    border-color: rgba(245,158,11,0.35);
    box-shadow: 0 2px 8px rgba(245,158,11,0.2);
}
.team-role-badge.team-role-owner i { color: #fcd34d; }

.team-role-badge.team-role-admin {
    background: linear-gradient(135deg, rgba(139,92,246,0.85), rgba(124,58,237,0.85));
    border-color: rgba(139,92,246,0.35);
    box-shadow: 0 2px 8px rgba(139,92,246,0.2);
}
.team-role-badge.team-role-admin i { color: #c4b5fd; }

.team-role-badge.team-role-editor {
    background: linear-gradient(135deg, rgba(59,130,246,0.85), rgba(37,99,235,0.85));
    border-color: rgba(59,130,246,0.35);
    box-shadow: 0 2px 8px rgba(59,130,246,0.2);
}
.team-role-badge.team-role-editor i { color: #93c5fd; }

.team-role-badge.team-role-viewer {
    background: linear-gradient(135deg, rgba(107,114,128,0.85), rgba(75,85,99,0.85));
    border-color: rgba(107,114,128,0.35);
    box-shadow: 0 2px 8px rgba(107,114,128,0.15);
}
.team-role-badge.team-role-viewer i { color: #d1d5db; }

/* ==================================================================================
   GLOBAL PRESENCE DROPDOWN - SQUARE COMPACT VARIANT
   ================================================================================== */

/* Square 22×22 icon-only override - presence dropdown only */
#globalPresenceDropdown .presence-user-item .team-role-badge,
#globalPresenceUserList .presence-user-item .team-role-badge,
.navbar .presence-user-item .team-role-badge {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    padding: 0 !important;
    border-radius: 5px !important;
    font-size: 0.75rem !important;
    border-width: 0.75px !important;
    border-color: rgba(255,255,255,0.2) !important;
    backdrop-filter: blur(3px) !important;
    margin-left: var(--spacing-xs, 0.25rem) !important;
    gap: 0 !important;
    transition: all 0.25s ease !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Hide text label inside square badges - icon only */
#globalPresenceDropdown .presence-user-item .team-role-badge span,
#globalPresenceUserList .presence-user-item .team-role-badge span,
.navbar .presence-user-item .team-role-badge span {
    display: none !important;
}

/* Icon centered inside the square */
#globalPresenceDropdown .presence-user-item .team-role-badge i,
#globalPresenceUserList .presence-user-item .team-role-badge i,
.navbar .presence-user-item .team-role-badge i {
    font-size: 0.7rem !important;
    margin: 0 !important;
    line-height: 1 !important;
}

/* Tooltip offset for compact badge height */
#globalPresenceDropdown .presence-user-item .team-role-badge:hover::after {
    bottom: -22px;
    padding: 3px 6px;
    font-size: 0.7rem;
}

/* ==================================================================================
   REFRESH PRESENCE BUTTON - Circular & Glassmorphic (Restored First Design)
   ================================================================================== */

.btn-presence-refresh {
    /* Reset & Prevent Inheritance */
    padding: 0 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    outline: none !important;
    box-sizing: border-box !important;
    cursor: pointer !important;

    /* Circular Dimensions (First Design) */
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    border-radius: 50% !important;

    /* Colors & Thickness (First Design Preferred) */
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1.25px solid rgba(255, 255, 255, 0.1) !important;
    
    /* Layout & Transition */
    margin-left: 0.85rem !important; /* Move right */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.btn-presence-refresh:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
    transform: rotate(15deg) scale(1.1);
}

.btn-presence-refresh:active {
    transform: scale(0.95);
}

.btn-presence-refresh i {
    font-size: 0.85rem !important;
    color: rgba(255, 255, 255, 0.7) !important;
    margin: 0 !important;
    display: block !important;
    line-height: 1 !important;
    transition: color 0.3s ease;
}

.btn-presence-refresh:hover i {
    color: white !important;
}

/* Icon spin state */
.btn-presence-refresh .fa-spin {
    animation: fa-spin 0.8s linear infinite !important;
    color: var(--primary-lighter, #5ba3d0) !important;
}

@keyframes fa-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ==================================================
   STATUS DOTS - Online/Idle Indicators
   ================================================== */

.status-dot {
    display: inline-block;
    width: 7px; /* Reduced from 8px */
    height: 7px; /* Reduced from 8px */
    border-radius: 50%;
    margin-right: var(--spacing-xs); /* Using token */
    flex-shrink: 0;
}

/* Active user - Green dot with pulse */
.status-dot.status-active {
    background-color: #4ade80;
    box-shadow: 0 0 3px rgba(74, 222, 128, 0.5); /* Reduced shadow */
    animation: pulse-dot 1.6s ease-in-out infinite; /* Faster animation */
}

/* Idle user - Yellow/orange dot */
.status-dot.status-idle {
    background-color: #fbbf24;
    box-shadow: 0 0 3px rgba(251, 191, 36, 0.3); /* Reduced shadow */
}

/* ==================================================
   CURRENT USER HIGHLIGHT
   ================================================== */

.presence-user-item.current-user {
    background: rgba(59, 130, 246, 0.1);
    border-left: 2px solid rgba(59, 130, 246, 0.6); /* Reduced from 3px */
}

.presence-user-item.current-user .presence-user-avatar {
    border-color: rgba(59, 130, 246, 0.6);
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.25); /* Reduced shadow */
}

/* ==================================================
   NOTIFICATION BELL & DROPDOWN - Navy Blue Theme
   ================================================== */

/* Notification Bell Icon */
.notification-bell .nav-link {
    position: relative;
    background: rgba(255, 255, 255, 0.08);
    border: 0.75px solid rgba(255, 255, 255, 0.2); /* Thinner border */
    border-radius: 50%;
    width: 36px; /* Reduced from 40px */
    height: 36px; /* Reduced from 40px */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease; /* Faster transition */
}

.notification-bell .nav-link::after {
    display: none !important;
}

.notification-bell .nav-link:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.35); /* Reduced opacity */
    transform: scale(1.08); /* Reduced from 1.1 */
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.12); /* Reduced shadow */
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: linear-gradient(135deg, var(--error), #dc2626);
    color: white;
    border-radius: 8px; /* Reduced from 10px */
    padding: 1px 5px; /* Reduced padding */
    font-size: var(--font-size-xs); /* Using token */
    font-weight: 700;
    min-width: 16px; /* Reduced from 18px */
    text-align: center;
    box-shadow:
        0 1px 4px rgba(239, 68, 68, 0.4), /* Reduced shadow */
        0 0 0 1.5px rgba(10, 37, 64, 1); /* Reduced border */
}

/* Notification Dropdown Menu - Matching Navbar Dropdowns */
.notification-dropdown {
    background: rgba(10, 37, 64, 0.98);
    backdrop-filter: blur(8px); /* Reduced blur */
    border: 0.75px solid rgba(255, 255, 255, 0.15); /* Thinner border */
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.35), /* Reduced shadow */
        0 2px 8px rgba(0, 0, 0, 0.2); /* Reduced shadow */
    border-radius: 10px; /* Reduced from 12px */
    margin-top: var(--spacing-sm); /* Using token */
    padding: 0;
    overflow: hidden;
}

.notification-dropdown::-webkit-scrollbar {
    width: 6px; /* Reduced from 8px */
}

.notification-dropdown::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px; /* Reduced from 10px */
}

.notification-dropdown::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--navy-main), #408fc4);
    border-radius: 8px; /* Reduced from 10px */
}

.notification-dropdown::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #408fc4, var(--navy-lighter));
}

/* Notification Header - Navy Blue Gradient */
.notification-dropdown .dropdown-header {
    background: linear-gradient(135deg, var(--navy-main), #2d7aaf, #408fc4);
    color: white;
    padding: var(--spacing-md) var(--spacing-lg); /* Using tokens */
    font-weight: 600;
    border-radius: 0;
    position: relative;
    box-shadow: 0 1px 4px rgba(26, 90, 142, 0.25); /* Reduced shadow */
    font-size: var(--font-size-sm); /* Using token */
}

.notification-dropdown .dropdown-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 0.75px; /* Thinner line */
    background: linear-gradient(90deg,
        transparent,
        rgba(255, 255, 255, 0.25), /* Reduced opacity */
        transparent);
}

.notification-dropdown .dropdown-header .btn-link {
    color: white !important;
    text-decoration: none;
    opacity: 0.9;
    transition: opacity 0.2s ease;
    font-size: var(--font-size-sm); /* Using token */
}

.notification-dropdown .dropdown-header .btn-link:hover {
    opacity: 1;
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.4); /* Reduced glow */
}

/* Notification Divider */
.notification-dropdown .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.15);
    margin: 0;
}

/* Notification Items */
.notification-item {
    padding: var(--spacing-md) var(--spacing-lg); /* Using tokens */
    border-left: 2px solid transparent; /* Reduced from 3px */
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    background: rgba(10, 37, 64, 0.3);
}

.notification-item:not(:last-child) {
    border-bottom: 0.75px solid rgba(255, 255, 255, 0.08); /* Thinner border */
}

.notification-item:hover {
    background: linear-gradient(135deg,
        rgba(45, 122, 175, 0.2) 0%,
        rgba(64, 143, 196, 0.15) 100%);
    border-left-color: rgba(87, 169, 216, 0.5);
    transform: translateX(2px); /* Reduced from 3px */
}

/* Unread Notification Styling */
.notification-item.unread {
    background: linear-gradient(135deg,
        rgba(26, 90, 142, 0.15) 0%,
        rgba(45, 122, 175, 0.1) 100%);
    border-left-color: var(--navy-main);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px; /* Reduced from 3px */
    background: linear-gradient(135deg, var(--navy-main), #2d7aaf, #408fc4);
    box-shadow: 0 0 6px rgba(45, 122, 175, 0.4); /* Reduced shadow */
}

.notification-item.unread:hover {
    background: linear-gradient(135deg,
        rgba(45, 122, 175, 0.25) 0%,
        rgba(64, 143, 196, 0.2) 100%);
}

/* Ensure empty state and muted text is visible */
.notification-dropdown .text-muted {
    color: rgba(255, 255, 255, 0.6) !important;
}

.notification-dropdown .text-muted i {
    color: rgba(255, 255, 255, 0.4) !important;
}

/* Notification Icon Container */
.notification-item .notification-icon {
    width: 34px; /* Reduced from 38px */
    height: 34px; /* Reduced from 38px */
    border-radius: 8px; /* Reduced from 10px */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem; /* Reduced from 1rem */
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); /* Reduced shadow */
    border: 0.75px solid rgba(255, 255, 255, 0.1); /* Thinner border */
}

/* Notification Icon Backgrounds by Type */
.notification-icon.invited          { background: linear-gradient(135deg, #6366f1, #4f46e5); } /* Indigo */
.notification-icon.invite_sent      { background: linear-gradient(135deg, #3b82f6, #2563eb); } /* Blue */
.notification-icon.role_changed     { background: linear-gradient(135deg, #8b5cf6, #7c3aed); } /* Violet */
.notification-icon.removed          { background: linear-gradient(135deg, #ef4444, #dc2626); } /* Red */
.notification-icon.mention          { background: linear-gradient(135deg, #f59e0b, #d97706); } /* Amber */
.notification-icon.mapping_complete  { background: linear-gradient(135deg, #10b981, #059669); } /* Emerald */
.notification-icon.crm_reminder      { background: linear-gradient(135deg, #2d7aaf, #1a5a8e); } /* Blue - matches CRM branding */

/* Notification Content */
.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-message {
    color: rgba(255, 255, 255, 0.9);
    font-size: var(--font-size-sm); /* Using token */
    margin: 0;
    line-height: 1.4; /* Reduced from 1.5 */
}

.notification-time {
    color: rgba(255, 255, 255, 0.5);
    font-size: var(--font-size-xs); /* Using token */
    margin-top: var(--spacing-xs); /* Using token */
    display: flex;
    align-items: center;
    gap: var(--spacing-sm); /* Using token */
}

/* ==================================================
   NOTIFICATION ACTION BUTTONS - Accept/Decline Invitations
   ================================================== */

/* Action buttons container */
.notification-actions {
    display: flex;
    flex-direction: row;
    gap: var(--spacing-sm); /* Using token */
    margin-top: var(--spacing-md); /* Using token */
    padding-top: var(--spacing-md); /* Using token */
    border-top: 0.75px solid rgba(255, 255, 255, 0.1); /* Thinner border */
}

/* Accept button - Green gradient matching success theme */
.btn-accept-invitation {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md); /* Using tokens */
    font-size: var(--font-size-xs); /* Using token */
    font-weight: 600;
    border-radius: 6px; /* Reduced from 8px */
    border: 0.75px solid rgba(16, 185, 129, 0.4); /* Thinner border */
    background: linear-gradient(135deg, 
        rgba(16, 185, 129, 0.15) 0%, 
        rgba(5, 150, 105, 0.15) 100%);
    color: var(--success);
    transition: all 0.25s ease; /* Faster transition */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs); /* Using token */
}

.btn-accept-invitation:hover {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    border-color: var(--success);
    transform: translateY(-1px); /* Reduced from -2px */
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25); /* Reduced shadow */
}

.btn-accept-invitation:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(16, 185, 129, 0.2); /* Reduced shadow */
}

.btn-accept-invitation i {
    font-size: 0.85rem; /* Reduced from 0.9rem */
}

/* Decline button - Subtle gray with hover to red */
.btn-decline-invitation {
    flex: 1;
    padding: var(--spacing-sm) var(--spacing-md); /* Using tokens */
    font-size: var(--font-size-xs); /* Using token */
    font-weight: 600;
    border-radius: 6px; /* Reduced from 8px */
    border: 0.75px solid rgba(255, 255, 255, 0.2); /* Thinner border */
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.25s ease; /* Faster transition */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-xs); /* Using token */
}

.btn-decline-invitation:hover {
    background: linear-gradient(135deg, var(--error), #dc2626);
    color: white;
    border-color: var(--error);
    transform: translateY(-1px); /* Reduced from -2px */
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25); /* Reduced shadow */
}

.btn-decline-invitation:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(239, 68, 68, 0.2); /* Reduced shadow */
}

.btn-decline-invitation i {
    font-size: 0.85rem; /* Reduced from 0.9rem */
}

/* Inline Loading Spinner for Buttons */
.btn-invitation-loading {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.8s linear infinite;
    margin-right: var(--spacing-xs);
}

/* Notification Feedback - Status messages inside dropdown */
.notification-feedback {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 6px;
    font-size: var(--font-size-xs);
    font-weight: 500;
    border: 0.75px solid transparent;
    animation: fadeIn 0.3s ease;
}

.notification-feedback span {
    color: white !important;
}

.notification-feedback.success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.15));
    border-color: rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.notification-feedback.error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.15));
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--error);
}

.notification-feedback.warning {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.15));
    border-color: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

/* Notification Bell Status Modifiers */
.notification-bell.success .nav-link { 
    border-color: var(--success) !important; 
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}
.notification-bell.error .nav-link { 
    border-color: var(--error) !important; 
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}
.notification-bell.warning .nav-link { 
    border-color: #fbbf24 !important; 
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.3);
}

/* ==================================================
   LANGUAGE SELECTOR - Matching Navy Theme
   ================================================== */

.language-selector .dropdown-toggle {
    border: 0.75px solid rgba(255, 255, 255, 0.2) !important; /* Thinner border */
    background: rgba(255, 255, 255, 0.08) !important;
    transition: all 0.25s ease; /* Faster transition */
    border-radius: 50%;
    width: 36px; /* Reduced from 40px */
    height: 36px; /* Reduced from 40px */
    display: flex;
    align-items: center;
    justify-content: center;
}

.language-selector .dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.35) !important; /* Reduced opacity */
    transform: scale(1.08); /* Reduced from 1.1 */
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.12); /* Reduced shadow */
}

.language-selector .dropdown-toggle::after {
    display: none;
}

/* Dropdown menu matching navbar dropdowns */
.language-dropdown {
    background: rgba(10, 37, 64, 0.98);
    backdrop-filter: blur(8px); /* Reduced blur */
    border: 0.75px solid rgba(255, 255, 255, 0.15); /* Thinner border */
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.35), /* Reduced shadow */
        0 2px 8px rgba(0, 0, 0, 0.2); /* Reduced shadow */
    border-radius: 10px; /* Reduced from 12px */
    margin-top: var(--spacing-sm); /* Using token */
    min-width: 140px; /* Reduced from 160px */
    padding: var(--spacing-sm); /* Using token */
}

.language-dropdown .dropdown-item {
    color: rgba(255, 255, 255, 0.85);
    padding: var(--spacing-md) var(--spacing-lg); /* Using tokens */
    border-radius: 6px; /* Reduced from 8px */
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-weight: 500;
    font-size: var(--font-size-sm); /* Using token */
}

.language-dropdown .dropdown-item:hover {
    background: linear-gradient(135deg, var(--navy-main), var(--navy-lighter));
    color: white;
    transform: translateX(3px); /* Reduced from 4px */
}

.language-dropdown .dropdown-item.active {
    background: linear-gradient(135deg, var(--navy-main), var(--navy-main));
    color: white;
    box-shadow: 0 1px 4px rgba(26, 90, 142, 0.25); /* Reduced shadow */
}

.language-dropdown .dropdown-item.active:hover {
    background: linear-gradient(135deg, var(--navy-main), #408fc4);
    color: white;
}

/* Override Bootstrap's .text-muted for language dropdown */
.language-dropdown .text-muted {
    color: rgba(255, 255, 255, 0.7) !important;
    opacity: 1 !important;
}

.flag-icon {
    font-size: 1rem; /* Reduced from 1.1rem */
    width: 18px; /* Reduced from 20px */
    text-align: center;
    margin-right: var(--spacing-sm); /* Using token */
}

/* Spinner matching navy theme */
.spinner {
    width: 36px; /* Reduced from 40px */
    height: 36px; /* Reduced from 40px */
    border: 3px solid rgba(91, 163, 208, 0.2); /* Reduced from 4px */
    border-top: 3px solid var(--navy-lighter); /* Reduced from 4px */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==================================================
   ГИЛДИЯТА CIRCLE - Matches language/bell circle style
   ================================================== */
.gildiyata-circle {
    border: 0.75px solid rgba(201, 162, 39, 0.35) !important;
    background: rgba(201, 162, 39, 0.08) !important;
    border-radius: 50% !important;
    width: 36px !important;
    height: 36px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.25s ease;
    padding: 0 !important;
}

.gildiyata-circle::after { display: none !important; }

.gildiyata-circle:hover {
    background: rgba(201, 162, 39, 0.16) !important;
    border-color: rgba(201, 162, 39, 0.7) !important;
    transform: scale(1.08);
    box-shadow: 0 2px 10px rgba(201, 162, 39, 0.2);
}

.gildiyata-circle-logo {
    width: 18px;
    height: 18px;
    object-fit: contain;
    filter: drop-shadow(0 0 3px rgba(201, 162, 39, 0.35));
}

/* Гилдията section inside user dropdown */
.gildiyata-dropdown-header {
    display: flex !important;
    align-items: center;
    gap: 7px;
    padding: 8px 16px 4px !important;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #c9a227 !important;
    opacity: 1 !important;
}

.gildiyata-dropdown-logo {
    width: 16px;
    height: 16px;
    object-fit: contain;
    flex-shrink: 0;
    vertical-align: middle;
    filter: drop-shadow(0 0 3px rgba(201, 162, 39, 0.3));
}

.gildiyata-dropdown-item:hover {
    background: linear-gradient(135deg, rgba(201,162,39,.12), rgba(201,162,39,.07)) !important;
    color: #e8c84a !important;
}

/* ==================================================
   GUIDE LINK - Pill-shaped, distinct from utility icons
   ================================================== */
.guide-link {
    border: 0.75px solid rgba(255, 255, 255, 0.2) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border-radius: 18px !important;
    transition: all 0.25s ease;
    padding: 0 var(--spacing-md) !important;
    height: 36px;
    white-space: nowrap;
}

.guide-link::after {
    display: none !important;
}

.guide-link:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
    transform: scale(1.04);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.12);
}

/* ==================================================
   SAF-T RESOURCES MEGA-MENU
   Full-bleed panel below the navbar, opens on hover (desktop) or tap
   (.is-open, toggled by saft-resources-mega.js). Background + glow reuse
   the site's real signature: the teal/cyan "spiral" concentric rings from
   the homepage hero (home.css .hero-section::after / .cta-section::after),
   not an invented palette.
   ================================================== */
.saft-resources { position: relative; }

button.saft-resources-trigger {
    font: inherit;
    color: inherit;
    cursor: pointer;
    outline-offset: 2px;
}

.saft-resources-caret {
    font-size: 0.68rem;
    margin-left: 0.45rem;
    color: rgba(255, 255, 255, 0.55);
    transition: transform 0.25s ease;
}

.saft-resources.is-open .saft-resources-caret { transform: rotate(180deg); }

/* Panel: hidden by default (mobile-first - inline accordion under the
   trigger, no glow, no absolute break-out). Promoted to a full-bleed
   floating panel at >=992px below. */
.saft-mega {
    display: none;
    background: #0a1929;
    border-top: 1px solid rgba(34, 184, 200, 0.18);
}
.saft-resources.is-open .saft-mega { display: block; }

.saft-mega-glow { display: none; } /* only meaningful on the full-bleed desktop panel */

.saft-mega-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 1rem 1rem;
}

.saft-mega-col-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem 0.4rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}
.saft-mega-col-logo { width: 18px; height: 18px; object-fit: contain; }
.saft-mega-col-head--gildiyata { color: rgba(244, 197, 66, 0.75); }

.saft-mega-cards {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.saft-mega-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.7rem;
    border-radius: 12px;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.saft-mega-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(34, 184, 200, 0.45);
    box-shadow: 0 6px 20px rgba(34, 184, 200, 0.16);
    transform: translateY(-1px);
}
.saft-mega-card--feature:hover {
    border-color: rgba(244, 197, 66, 0.5);
    box-shadow: 0 6px 20px rgba(244, 197, 66, 0.18);
}

.saft-mega-card-icon {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(34, 184, 200, 0.14);
    color: #4fd6e6;
    font-size: 1rem;
}
.saft-mega-card-icon--gildiyata {
    background: rgba(244, 197, 66, 0.14);
    color: #f4c542;
}

.saft-mega-card-text {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}
.saft-mega-card-text strong {
    color: #fff;
    font-size: 0.86rem;
    font-weight: 700;
}
.saft-mega-card-text small {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.74rem;
    line-height: 1.3;
}

/* ── Desktop: full-bleed floating mega-panel ──
   position:fixed anchored to the viewport (not the trigger <li>) so it is
   always truly full-width and centered no matter where the trigger sits in
   the flex nav (it's pushed right by ms-auto). top uses the same
   --navbar-height token every other "sits right below the sticky navbar"
   element in this codebase uses (sidebar.css, controls-bar.css, etc.) so it
   starts flush with the navbar's bottom edge, not the shorter trigger <li>.
   Open/close state has exactly one owner - the .is-open class, toggled only
   by saft-resources-mega.js (hover-intent + click + outside-click + Escape).
   No CSS :hover/:focus-within here on purpose: mixing a CSS-driven reveal
   with the JS-driven one is what caused the "won't close" bug. will-change
   promotes the panel (and its blurred glow child) to its own GPU layer so
   the transition doesn't repaint that glow every frame - that repaint was
   the source of the slow/jagged animation. */
@media (min-width: 992px) {
    .saft-mega {
        display: block;
        position: fixed;
        /* --saft-mega-top is set by saft-resources-mega.js from the navbar's
           actual measured height right before opening - the static
           --navbar-height token is only an approximation (documented as
           such) and was off by a few px, leaving a visible seam. */
        top: var(--saft-mega-top, var(--navbar-height, 73px));
        left: 0;
        width: 100%;
        overflow: hidden; /* clip the glow's radial gradients to the panel - they
                              were bleeding past the bottom edge onto the page */
        transform: translateY(-10px);
        border-top: 1px solid rgba(34, 184, 200, 0.22);
        border-bottom: 1px solid rgba(34, 184, 200, 0.12);
        box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        will-change: transform, opacity;
        transition: opacity 0.16s cubic-bezier(0.4, 0, 0.2, 1),
                    transform 0.16s cubic-bezier(0.4, 0, 0.2, 1),
                    visibility 0s linear 0.16s;
        z-index: 1050;
    }

    .saft-resources.is-open .saft-mega {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: translateY(0);
        transition: opacity 0.16s cubic-bezier(0.4, 0, 0.2, 1),
                    transform 0.16s cubic-bezier(0.4, 0, 0.2, 1),
                    visibility 0s;
    }

    .saft-mega-glow {
        display: block;
        position: absolute;
        top: -120px;
        left: 12%;
        width: 900px;
        height: 900px;
        pointer-events: none;
        opacity: 0.55;
        background:
            radial-gradient(ellipse 60px 55px at 50% 40%,
                rgba(255,255,255,0.9) 0%, rgba(220,240,255,0.8) 65%,
                rgba(120,200,220,0.6) 85%, transparent 95%),
            radial-gradient(ellipse 140px 125px at 49% 41%,
                transparent 74%, rgba(93,188,210,0.55) 82%,
                rgba(93,188,210,0.28) 89%, transparent 96%),
            radial-gradient(ellipse 260px 230px at 51% 39%,
                transparent 68%, rgba(60,180,200,0.5) 76%,
                rgba(60,180,200,0.24) 88%, transparent 97%),
            radial-gradient(ellipse 420px 375px at 50% 40%,
                transparent 62%, rgba(34,184,200,0.4) 70%,
                rgba(34,184,200,0.16) 87%, transparent 98%);
        filter: blur(2px);
    }

    .saft-mega-inner {
        max-width: 1080px;
        margin: 0 auto;
        padding: 2.1rem 2rem 2.3rem;
        flex-direction: row;
        gap: 2.5rem;
    }

    .saft-mega-col--magi { flex: 1 1 66%; }
    .saft-mega-col--gildiyata {
        flex: 1 1 34%;
        border-left: 1px solid rgba(244, 197, 66, 0.16);
        padding-left: 2rem;
    }

    .saft-mega-col-head { padding-top: 0; }

    .saft-mega-col--magi .saft-mega-cards {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }

    /* Odd card count (currently 5, since "Как работи Magi" moved out to its
       own navbar pill) would otherwise leave one card orphaned alone on the
       last row of this 2-column grid. Stretching it full-width reads as a
       deliberate closing highlight instead of a layout gap - and this rule
       is harmless if the count ever goes back to even. */
    .saft-mega-col--magi .saft-mega-cards a:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .saft-mega-card { padding: 0.85rem 0.9rem; }
}

/* ==================================================
   THEME TOGGLE BUTTON - Matching other navbar icons
   ================================================== */
.theme-toggle .theme-toggle-btn {
    border: 0.75px solid rgba(255, 255, 255, 0.2) !important;
    background: rgba(255, 255, 255, 0.08) !important;
    transition: all 0.25s ease;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    padding: 0;
}

.theme-toggle .theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
    transform: scale(1.08);
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.12);
}

.theme-toggle .theme-toggle-btn i {
    font-size: 1rem;
    transition: transform 0.25s ease;
}

.theme-toggle .theme-toggle-btn:active i {
    transform: rotate(15deg);
}

/* Light mode active state - button stays visible with sun icon */
body.light-mode .theme-toggle .theme-toggle-btn {
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
}

@media (max-width: 768px) {
    .theme-toggle .theme-toggle-btn {
        width: 32px;
        height: 32px;
    }
    
    .theme-toggle .theme-toggle-btn i {
        font-size: 0.9rem;
    }
}

/* ==================================================
   GUEST LOGIN / REGISTER - Desktop pair
   Anonymous visitor's Login link + Register pill, sized/aligned to match
   the other icon+label navbar pills (.guide-link, .language-selector).
   Scoped to >=992px on purpose - the mobile drawer already handles both
   fully via .mob-row / .mob-row--cta in the max-width:991px block below,
   and the signed-out intro paragraph (.mob-guest-intro) is d-lg-none in
   the template so it never reaches desktop at all.
   ================================================== */
@media (min-width: 992px) {
    /* Deliberately smaller/quieter than .guest-access-link below - Login is
       the secondary action here, Request Access is the one real front door. */
    .navbar .guest-login-link {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        white-space: nowrap;
        border: 0.75px solid rgba(255, 255, 255, 0.18);
        background: rgba(255, 255, 255, 0.06);
        border-radius: 18px;
        padding: 0.4rem 1rem !important;
        margin: 0 !important;
        font-size: 0.78rem;
        line-height: 1.2;
        transition: all 0.25s ease;
    }
    .navbar .guest-login-link::after { display: none !important; }
    .navbar .guest-login-link:hover {
        background: rgba(255, 255, 255, 0.13);
        border-color: rgba(255, 255, 255, 0.3);
        color: white !important;
        transform: translateY(-1px);
    }
    .navbar .guest-login-link i { font-size: 0.78rem; }

    /* More specific than the base .navbar .btn-primary rule (which fixes a
       32px height for every other navbar button) - this one needs to read
       as clearly the biggest, boldest thing in the bar. */
    .navbar .btn-primary.guest-access-link {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
        white-space: nowrap;
        height: auto;
        padding: 0.6rem 1.5rem !important;
        font-size: 0.92rem;
        font-weight: 700;
        line-height: 1.2;
        box-shadow: 0 3px 14px rgba(45, 122, 175, 0.45);
    }
    .navbar .btn-primary.guest-access-link:hover {
        box-shadow: 0 5px 18px rgba(45, 122, 175, 0.55);
    }
    .navbar .guest-access-link i { font-size: 0.92rem; }
}

/* CTA button in navbar */
.navbar .btn-primary {
    background: linear-gradient(135deg, var(--navy-main), var(--navy-lighter));
    color: white;
    border: 1.5px solid rgba(255, 255, 255, 0.25); /* Reduced from 2px */
    padding: var(--spacing-sm) var(--spacing-xl); /* Using tokens */
    border-radius: 20px; /* Reduced from 25px */
    font-weight: 600;
    transition: all 0.25s ease; /* Faster transition */
    box-shadow: 0 2px 8px rgba(45, 122, 175, 0.25); /* Reduced shadow */
    font-size: var(--font-size-sm); /* Using token */
    height: var(--button-height-md); /* Using token */
}

.navbar .btn-primary:hover {
    background: linear-gradient(135deg, var(--navy-lighter), #7dbee0);
    border-color: rgba(255, 255, 255, 0.5); /* Reduced opacity */
    transform: translateY(-1px); /* Reduced from -2px */
    box-shadow: 0 4px 12px rgba(45, 122, 175, 0.3); /* Reduced shadow */
}

/* Mobile navbar toggler */
.navbar-toggler {
    border: 0.75px solid rgba(255, 255, 255, 0.25); /* Thinner border */
    padding: var(--spacing-sm) var(--spacing-md); /* Using tokens */
    transition: all 0.25s ease; /* Faster transition */
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.15rem rgba(255, 255, 255, 0.2); /* Reduced shadow */
}

/* Responsive adjustments */
/* GPU-only open/close keyframes - opacity + translateY, zero layout cost */
@keyframes nav-open {
    from { opacity: 0; transform: translateY(-6px) translateZ(0); }
    to   { opacity: 1; transform: translateY(0)    translateZ(0); }
}
@keyframes nav-close {
    from { opacity: 1; transform: translateY(0)    translateZ(0); }
    to   { opacity: 0; transform: translateY(-4px) translateZ(0); }
}

@media (max-width: 991px) {
    /* ==================================================
       MOBILE NAV REDESIGN (≤991px, matches navbar-expand-lg)
       #navbarNav stops being a Bootstrap accordion dropdown and becomes a
       fixed off-canvas drawer on the right, opened/closed by navbar-mobile.js
       toggling .mob-drawer-open (Bootstrap's own collapse plugin is no longer
       wired to the toggler - see navbar.html, the data-bs-toggle attribute
       was removed there on purpose). Every item keeps its real id/JS wiring;
       nothing here is a duplicate.
       ================================================== */

    .nav-link::after { display: none; } /* remove desktop underline animation */

    /* Backdrop behind the drawer */
    .mob-drawer-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 1049;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease;
    }
    .mob-drawer-backdrop.is-visible {
        opacity: 1;
        visibility: visible;
    }

    /* The drawer itself */
    .navbar-collapse {
        display: flex !important; /* override Bootstrap's .collapse{display:none} unconditionally -
                                      we no longer rely on Bootstrap's .show class at all */
        flex-direction: column;
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(320px, 86vw);
        margin-top: 0;
        /* Bottom clearance for the fixed .mob-bottom-nav / .mob-guest-cta-bar:
           those bars are siblings of <nav>, and <nav> itself only has
           z-index:1030 (see .mob-drawer-backdrop comment above on why a
           sibling outside .navbar's stacking context ignores this drawer's
           own higher z-index) - so they visually paint over the last item(s)
           of a scrolled-to-bottom drawer (was clipping the SAF-T Resources
           accordion's "Общност на счетоводителите" card). Padding keeps real
           content out of that zone instead of relying on stacking order. */
        padding: 0 0 90px;
        background: rgba(10, 25, 41, 0.98);
        border: none;
        border-left: 0.75px solid rgba(255, 255, 255, 0.15);
        border-radius: 0;
        box-shadow: -12px 0 32px rgba(0, 0, 0, 0.45);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateX(100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1050;
        will-change: transform;
    }
    .navbar-collapse.mob-drawer-open {
        transform: translateX(0);
    }

    .mob-drawer-close {
        align-self: flex-end;
        margin: 12px 12px 0 0;
        width: 34px;
        height: 34px;
        border-radius: 50%;
        border: 0.75px solid rgba(255, 255, 255, 0.2);
        background: rgba(255, 255, 255, 0.08);
        color: rgba(255, 255, 255, 0.85);
        font-size: 1rem;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    .mob-drawer-close:active { background: rgba(255, 255, 255, 0.16); }

    /* Vertical list, one item per row, in document order except where
       reordered below. Every top-level <li> gets a full-width block row -
       no more grid-of-circles. */
    .navbar-collapse .navbar-nav {
        display: flex !important;
        flex-direction: column;
        gap: 0;
        width: 100%;
        padding: 4px 8px 28px;
    }
    .navbar-collapse .navbar-nav > .nav-item {
        display: block;
        width: 100%;
        margin: 0 !important;
    }

    /* Redundant with the "Гилдията" row already inside the user-dropdown menu below */
    .navbar-collapse .mob-drawer-hide { display: none !important; }

    /* Section order inside the drawer: account/profile block first (it already
       contains My Profile / Settings / Companies / ... / Гилдията / Logout as
       nested rows), then team presence, language, theme, guide links. */
    .navbar-collapse .user-dropdown     { order: 1; }
    .navbar-collapse .collab-dropdown   { order: 2; }
    .navbar-collapse .language-selector { order: 3; }
    .navbar-collapse .theme-toggle      { order: 4; }
    .navbar-collapse .mob-order-guide      { order: 5; }
    .navbar-collapse .mob-order-resources  { order: 6; }

    /* Force every nested Bootstrap dropdown-menu permanently open, in normal
       document flow, instead of a Popper-positioned overlay - this is what
       turns "tap to reveal a popover" into "always-visible labeled section". */
    .navbar-collapse .dropdown-menu {
        position: static !important;
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        inset: auto !important;
        margin: 4px 0 14px !important;
        padding: 0 !important;
        width: 100% !important;
        min-width: 0 !important;
        max-height: none !important;
        background: transparent !important;
        backdrop-filter: none !important;
        border: none !important;
        border-radius: 0 !important;
        box-shadow: none !important;
    }

    /* The toggle row above each forced-open menu becomes a static section
       header - real toggle/Popper behavior only exists on desktop. Rows
       *inside* the menu (dropdown-item links/buttons) are untouched and
       stay fully interactive. */
    .navbar-collapse .dropdown-toggle {
        pointer-events: none;
    }
    .navbar-collapse .dropdown-toggle::after { display: none; }

    /* Reveal the icon+label pairs that only show on desktop >=lg */
    .navbar-collapse .mob-drawer-inline { display: inline !important; }
    .navbar-collapse .mob-drawer-label  { display: inline !important; }

    /* ==================================================
       .mob-row - the ONE plain list-row style for every navigable item in
       the drawer: team presence, language, Гилдията, guide links, theme
       toggle, and the signed-out login/register prompt. Deliberately a
       brand-new class carrying no history, not an override layered on top
       of each element's old desktop pill/circle CSS - several of those
       (.guide-link, .theme-toggle-btn) hardcode their own padding/background
       with !important, which silently won over the previous attempt to
       reskin them in place. A fresh class sidesteps that fight entirely.
       Visually it's the same continuous, hairline-divided list as the
       existing "My Profile / Account Settings" rows (.dropdown-item) -
       plain icon + label, no cards, no accent color, no chips.
       ================================================== */
    .navbar-collapse .mob-row {
        display: flex !important;
        align-items: center;
        flex-wrap: wrap;
        justify-content: flex-start !important;
        gap: 12px;
        width: 100% !important;
        height: auto !important;
        margin: 0 !important;
        padding: 13px 4px !important;
        background: none !important;
        border: none !important;
        border-bottom: 0.75px solid rgba(255, 255, 255, 0.08);
        border-radius: 0 !important;
        color: rgba(255, 255, 255, 0.85) !important;
        font-size: 0.85rem;
        font-weight: 500;
        transition: background-color 0.15s ease;
    }
    .navbar-collapse .mob-row:active { background: rgba(255, 255, 255, 0.06) !important; }

    /* Every row's leading icon: plain glyph, fixed width so labels line up
       in a column, no box/chip/accent color behind it. Team presence is
       excluded - its status dot's size/color is meaningful (JS-driven
       online/offline indicator, see global-presence.js), not decorative,
       so it keeps its own inline styling untouched. */
    .navbar-collapse .mob-row:not(.collab-dropdown .dropdown-toggle) > i:first-child,
    .navbar-collapse .mob-row > img:first-child {
        width: 20px;
        flex-shrink: 0;
        text-align: center;
        font-size: 0.95rem !important;
        color: rgba(255, 255, 255, 0.6); /* deliberately NOT !important - lets .mob-row--cta i below win on specificity-independent cascade order */
    }
    .navbar-collapse .mob-row > img:first-child { height: 20px; object-fit: contain; }

    /* A small uppercase caption marks the second group (presence onward)
       as distinct from the account list above it - not a border/box, just
       type, which is what most native settings screens use */
    .navbar-collapse .collab-dropdown {
        margin-top: 14px;
        position: relative;
    }
    .navbar-collapse .collab-dropdown::before {
        content: "Екип и настройки";
        display: block;
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: rgba(255, 255, 255, 0.4);
        padding: 4px;
        margin-bottom: 2px;
    }

    /* ---- Profile header: quiet, not a card - just more breathing room and
       a divider to read as the top of the list, no color accent at all ---- */
    .navbar-collapse .user-dropdown .dropdown-toggle {
        display: flex !important;
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 8px 4px 16px !important;
        background: none !important;
        border: none !important;
        border-bottom: 0.75px solid rgba(255, 255, 255, 0.12);
        border-radius: 0 !important;
        margin-bottom: 10px;
    }
    .navbar-collapse .user-dropdown .dropdown-toggle > .fa-user-circle {
        font-size: 2.1rem !important;
        color: rgba(255, 255, 255, 0.5);
        flex-shrink: 0;
        margin: 0 !important;
    }
    .navbar-collapse .mob-profile-meta {
        display: flex !important;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        min-width: 0;
    }
    .navbar-collapse .mob-profile-meta span.d-none {
        font-size: 0.95rem;
        font-weight: 700;
        color: #fff;
    }
    .navbar-collapse .mob-profile-meta .sub-pill { margin: 0 !important; }

    /* ---- Signed-out prompt ---- */
    .navbar-collapse .mob-guest-intro {
        order: -2;
        padding: 4px 4px 14px;
    }
    .navbar-collapse .mob-guest-intro p {
        margin: 0;
        font-size: 0.82rem;
        line-height: 1.5;
        color: rgba(255, 255, 255, 0.6);
    }
    .navbar-collapse .mob-guest-intro + .nav-item,
    .navbar-collapse .mob-guest-intro + .nav-item + .nav-item { order: -1; }
    /* "Login" is the primary action for a signed-out visitor - the only
       filled row in the whole drawer, using the site's own brand blue
       rather than an accent color borrowed from nowhere in this palette */
    .navbar-collapse .mob-row--cta {
        background: var(--navy-main) !important;
        border: none !important;
        border-radius: 8px !important;
        padding: 13px 14px !important;
        color: #fff !important;
        font-weight: 700;
    }
    .navbar-collapse .mob-row--cta:active { background: var(--navy-light) !important; }
    .navbar-collapse .mob-row--cta i { color: #fff !important; }

    /* Dropdown item rows (My Profile, Settings, language options, presence
       list, logout...) - full width, comfortable tap targets */
    .navbar-collapse .dropdown-item {
        display: flex;
        align-items: center;
        width: 100%;
    }
    .navbar-collapse .dropdown-header {
        padding-left: 0;
        padding-right: 0;
    }
}

/* ==================================================
   MOBILE BOTTOM NAVIGATION BAR (≤991px)
   Persistent one-thumb-reach bar for the highest-frequency destinations.
   Hidden entirely on desktop via d-lg-none (Bootstrap utility).
   ================================================== */
.mob-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1040;
    display: none;
}
@media (max-width: 991px) {
    .mob-bottom-nav {
        display: flex;
        align-items: stretch;
        height: 60px;
        background: rgba(10, 25, 41, 0.98);
        backdrop-filter: blur(10px);
        border-top: 0.75px solid rgba(255, 255, 255, 0.15);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
    }

    .mob-bn-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        color: rgba(255, 255, 255, 0.6);
        text-decoration: none;
        background: none;
        border: none;
        font-family: inherit;
        -webkit-tap-highlight-color: transparent;
    }
    .mob-bn-item:active { opacity: 0.65; }
    .mob-bn-item--active { color: var(--navy-pale); }
    .mob-bn-icon { font-size: 1.1rem; line-height: 1; }
    .mob-bn-label { font-size: 0.6rem; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }

    /* The real #notifBellNavItem, once reparented in here by navbar-mobile.js,
       needs to shed its "circular icon button" desktop look and match the
       other bottom-nav items instead. */
    .mob-bottom-nav .notification-bell {
        flex: 1;
        margin: 0 !important;
        list-style: none;
    }
    .mob-bottom-nav .notification-bell .nav-link {
        width: 100%;
        height: 100%;
        border-radius: 0;
        background: none;
        border: none;
        flex-direction: column;
        gap: 3px;
        color: rgba(255, 255, 255, 0.6);
    }
    .mob-bottom-nav .notification-bell .nav-link i { font-size: 1.1rem; }
    .mob-bottom-nav .notification-bell .mob-bn-label { display: block !important; }
    .mob-bottom-nav .notification-badge {
        top: 2px;
        right: 26%;
    }
    /* Popper flips the menu above the trigger by default when there's no room
       below (true here, the trigger sits at the very bottom of the screen) -
       just make sure it fits a narrow phone and the spacing reads right either way. */
    .notification-dropdown {
        width: min(360px, calc(100vw - 24px)) !important;
    }
    .notification-dropdown[data-popper-placement^="top"] {
        margin-top: 0;
        margin-bottom: var(--spacing-sm);
    }
}

@media (max-width: 991px) {
    /* Room for the fixed bottom bar so it never covers page content.
       Applied to body (after the footer), not main - main is followed
       directly by the footer in base.html, so padding on main would show
       up as a visible empty gap between page content and the footer
       instead of clearance at the true bottom of the page. */
    body.has-mobile-bottom-nav {
        padding-bottom: 68px;
    }
}

/* ==================================================
   GUEST MOBILE STICKY CTA BAR (≤991px, signed-out only)
   Same fixed-bar slot as .mob-bottom-nav, shown instead of it for
   anonymous visitors so there is always a tappable primary action.
   ================================================== */
.mob-guest-cta-bar { display: none; }
@media (max-width: 991px) {
    .mob-guest-cta-bar {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.15rem;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1040;
        padding: 0.55rem 1rem 0.7rem;
        background: rgba(10, 25, 41, 0.98);
        backdrop-filter: blur(10px);
        border-top: 0.75px solid rgba(255, 255, 255, 0.15);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
    }
    .mob-guest-cta-bar__btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
        max-width: 420px;
        padding: 0.7rem 1rem;
        border-radius: 10px;
        background: linear-gradient(135deg, #14b4b4, #0a94a8);
        color: #fff;
        font-weight: 700;
        font-size: 0.9rem;
        text-decoration: none;
        -webkit-tap-highlight-color: transparent;
    }
    .mob-guest-cta-bar__btn:active { opacity: 0.85; }
    .mob-guest-cta-bar__note {
        font-size: 0.68rem;
        color: rgba(255, 255, 255, 0.6);
        font-weight: 600;
    }
}

@media (max-width: 768px) {
    .navbar-logo {
        width: 36px; /* Reduced from 40px */
        height: 36px; /* Reduced from 40px */
    }
    
    .navbar-brand {
        font-size: var(--font-size-lg); /* Using token */
    }
    
    .notification-bell .nav-link {
        width: 32px; /* Reduced from 35px */
        height: 32px; /* Reduced from 35px */
    }
    
    .notification-badge {
        font-size: var(--font-size-xs); /* Using token */
        padding: 1px 4px; /* Reduced padding */
    }
    
    .language-selector .dropdown-toggle {
        width: 32px; /* Reduced from 35px */
        height: 32px; /* Reduced from 35px */
    }
    
    .flag-icon {
        font-size: 0.95rem; /* Reduced from 1rem */
    }
}
/* ==========================================================================
   Subscription pill (navbar trigger)
   ========================================================================== */

.sub-pill {
    display: inline-flex;
    align-items: center;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 20px;
    border: 1px solid transparent;
    white-space: nowrap;
    line-height: 1.4;
}

.sub-pill--trial {
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.35);
}

.sub-pill--active {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border-color: rgba(34, 197, 94, 0.3);
}

.sub-pill--danger {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.35);
}

.sub-pill--member {
    background: rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.35);
}

/* ==========================================================================
   Subscription info row (inside dropdown)
   ========================================================================== */

.sub-dropdown-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px 8px;
    font-size: 0.8rem;
}

.sub-dropdown-icon {
    font-size: 0.75rem;
    flex-shrink: 0;
}

.user-dropdown .dropdown-menu .sub-dropdown-icon--trial  { color: #fbbf24 !important; }
.user-dropdown .dropdown-menu .sub-dropdown-icon--active { color: #4ade80 !important; }
.user-dropdown .dropdown-menu .sub-dropdown-icon--danger { color: #f87171 !important; }
.user-dropdown .dropdown-menu .sub-dropdown-icon--member { color: #cbd5e1 !important; }

.sub-dropdown-label {
    flex-grow: 1;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
}

.user-dropdown .dropdown-menu .sub-dropdown-label {
    color: rgba(255, 255, 255, 0.75) !important;
}

.sub-dropdown-action {
    font-size: 0.75rem;
    font-weight: 700;
    color: #60a5fa;
    text-decoration: none;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(96, 165, 250, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.25);
    white-space: nowrap;
    flex-shrink: 0;
}

.user-dropdown .dropdown-menu .sub-dropdown-action {
    color: #60a5fa !important;
}

.sub-dropdown-action:hover {
    background: rgba(96, 165, 250, 0.2);
    color: #93c5fd;
    text-decoration: none;
}

.sub-dropdown-action--danger {
    color: #f87171;
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
}

.sub-dropdown-action--danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

@media (max-width: 768px) {
    .sub-pill { display: none; }
}
