/* Xblivian - Main Stylesheet */

:root {
    /* Permanent dark theme palette. The platform has no light mode. */
    /* MANDATO Sec 2: the one approved grey-button gradient (darker at the
       top, lighter at the bottom) - identical to the gradient already
       used by the dashboard controls and mobile search controls. */
    --xb-grey-btn-gradient: linear-gradient(180deg, rgba(8, 9, 11, 0.96), rgba(74, 80, 89, 0.9));
    --primary-color: #58a6ff;
    --primary-color-dark: #79b8ff;
    --primary-gradient-start: #1d4ed8;
    --primary-gradient-end: #0f3ba7;
    --secondary-color: #4c596a;
    --success-color: #21b187;
    --danger-color: #f05263;
    --warning-color: #f5a524;
    --info-color: #4cb7ff;
    --light-color: #f4f6fb;
    --dark-color: #0f172a;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --body-bg: linear-gradient(160deg, #0d1117 0%, #161b22 100%);
    --card-bg: rgba(30, 35, 42, 0.95);
    --card-header-bg: rgba(36, 41, 48, 0.98);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-color: #e6edf3;
    --muted-color: #8b949e;
    --surface-hover: rgba(255, 255, 255, 0.08);
    --shadow-sm: 0 10px 30px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 20px 35px rgba(15, 23, 42, 0.12);
    --shadow-lg: 0 30px 60px rgba(15, 23, 42, 0.18);
    --transition-base: all 0.25s ease;
    --glass-background: rgba(30, 35, 42, 0.85);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-blur: 18px;
}

/* ===== MANDATO Sec 2.4: universal grey button gradient =====
 * Every grey/neutral button across the platform shares the approved
 * darker-top -> lighter-bottom gradient. Colored buttons (primary,
 * success, warning, danger, info) are intentionally untouched. */
.btn-secondary,
.btn-outline-secondary,
.btn-light,
.btn-dark,
.btn-xb-grey {
    background: var(--xb-grey-btn-gradient) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
}
.btn-secondary:hover, .btn-secondary:focus,
.btn-outline-secondary:hover, .btn-outline-secondary:focus,
.btn-light:hover, .btn-light:focus,
.btn-dark:hover, .btn-dark:focus,
.btn-xb-grey:hover, .btn-xb-grey:focus {
    background: linear-gradient(180deg, rgba(17, 19, 23, 0.96), rgba(88, 95, 106, 0.92)) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}


/* General Styles */
html {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--body-bg);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
}

.app-main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at 3% 10%, rgba(29, 78, 216, 0.18), transparent 45%),
                radial-gradient(circle at 92% 18%, rgba(15, 59, 167, 0.18), transparent 55%),
                radial-gradient(circle at 50% 90%, rgba(37, 99, 235, 0.16), transparent 45%);
    z-index: -2;
}

/* Navigation */
.navbar {
    box-shadow: var(--shadow-sm);
    background: linear-gradient(115deg, #1d4ed8, #0f3ba7);
    background-color: #1d4ed8;
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 1030;
}

.navbar-brand {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    min-width: 0;
}

.site-brand {
    color: inherit;
    text-decoration: none;
}

.site-brand:hover,
.site-brand:focus {
    color: inherit;
}

.navbar-brand span {
    white-space: nowrap;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    flex: 0 0 auto;
}

.brand-mark .xblivian-icon {
    display: block;
    width: 1.2em;
    height: 1.2em;
}

.navbar .site-brand,
.navbar .site-brand:hover,
.navbar .site-brand:focus,
.navbar .site-brand .brand-mobile,
.navbar .site-brand .brand-desktop,
.navbar .site-brand .brand-mark,
.navbar .site-brand .xblivian-icon {
    color: #fff !important;
}

.brand-desktop {
    font-size: 1.35rem;
}

.brand-mobile {
    font-size: 1rem;
}

.navbar .nav-link,
.navbar .dropdown-item {
    font-weight: 500;
}

.navbar .nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    transition: var(--transition-base);
}

.navbar .nav-link:hover,
.navbar .nav-link:focus,
.navbar .nav-link.active {
    color: #fff !important;
}

.navbar-dark .navbar-toggler {
    border: none;
    box-shadow: none;
}

.navbar-dark .navbar-toggler:focus {
    box-shadow: none;
}

.navbar-brand i {
    margin-right: 0.5rem;
    font-size: 1.2em;
}

.navbar-flex {
    width: 100%;
    align-items: center;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: nowrap;
    margin-left: auto;
    flex-shrink: 0;
}

.nav-actions .btn,
.nav-actions .nav-link {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.nav-actions .btn-link {
    min-height: auto;
}

.nav-profile-trigger {
    gap: 0.5rem;
    color: #fff !important;
    text-decoration: none;
    flex-shrink: 0;
}

.nav-profile-trigger:hover,
.nav-profile-trigger:focus {
    color: #fff !important;
}

.header-search {
    flex: 1 1 100%;
    width: 100%;
}

.header-search-form {
    width: 100%;
}

.header-search .search-shell {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    padding: 0.35rem 0.75rem 0.35rem 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.22);
    transition: var(--transition-base);
    width: 100%;
}

.header-search .btn-icon {
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
    color: #fff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
    margin-left: auto;
}

.header-search .btn-icon i {
    color: inherit;
}

/* Voice search mic: subtle, transparent, integrated into the search pill. */
.header-search .btn-icon.header-internet-btn {
    background: rgba(255, 255, 255, 0.14);
    box-shadow: none;
    border: 1px solid rgba(255, 255, 255, 0.28);
    margin-left: 0;
}
.header-search .btn-icon.header-internet-btn:hover {
    background: rgba(255, 255, 255, 0.26);
}
.header-search .btn-icon.header-voice-btn {
    background: transparent;
    box-shadow: none;
    color: rgba(255, 255, 255, 0.78);
    width: 34px;
    height: 34px;
    margin-left: 0;
    margin-right: 0.15rem;
}
.header-search .btn-icon.header-voice-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
}
.header-search .btn-icon.header-voice-btn.is-listening {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.18);
    animation: headerVoicePulse 1.1s ease-in-out infinite;
}
@keyframes headerVoicePulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
    50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}

/* ===== Inline post composer (no modal) ===== */
.inline-composer .inline-composer-input {
    border: 1px solid rgba(148, 163, 184, 0.28);
    resize: vertical;
    min-height: 46px;
}
.inline-composer-tools { row-gap: 0.4rem; }
.inline-composer-privacy { width: auto; min-width: 130px; }
/* Keep the Rewrite/tone dropdown above posts that follow the composer */
.inline-composer { position: relative; }
.inline-composer, .inline-composer .card-body { overflow: visible; }
.inline-composer:has(.dropdown-menu.show) { z-index: 1080; }
.inline-composer .dropdown-menu { z-index: 1080; }
.inline-composer-previews { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.inline-composer-chip {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.2rem 0.55rem; border-radius: 999px;
    background: rgba(148, 163, 184, 0.16); font-size: 0.78rem; font-weight: 600;
}
@media (max-width: 575.98px) {
    .inline-composer-tools .btn { flex: 1 1 auto; }
    .inline-composer-submit { flex-basis: 100%; }
    .inline-composer-privacy { flex: 1 1 auto; }
}

/* ===== Responsive post image gallery (1 / 2 / 3+ images) ===== */
.post-image-single {
    max-height: 520px;
    object-fit: contain;
    background-color: rgba(148, 163, 184, 0.12);
}
.post-image-grid {
    display: grid;
    gap: 0.4rem;
    grid-template-columns: repeat(2, 1fr);
}
.post-images--count-3 .post-image-grid .post-image-cell:first-child { grid-column: 1 / -1; }
.post-image-cell {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius-sm, 8px);
    aspect-ratio: 1 / 1;
}
.post-image-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}
.post-image-more {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, 0.55);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: inherit;
}

.header-search .search-shell:focus-within {
    background: rgba(255, 255, 255, 0.26);
    border-color: rgba(255, 255, 255, 0.35);
}

.header-search input {
    flex: 1 1 auto;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 0.95rem;
    padding: 0.25rem 0;
}

.header-search input::placeholder {
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.9rem;
}

.header-search input:focus {
    outline: none;
    box-shadow: none;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
    transition: var(--transition-base);
    line-height: 1;
}

.btn-icon i {
    font-size: 1rem;
}

.btn-icon:hover,
.btn-icon:focus {
    background: rgba(255, 255, 255, 0.32);
    color: #fff;
}

.btn-icon:active {
    transform: scale(0.96);
}

/* Cards */
.card {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    background-color: var(--card-bg);
    backdrop-filter: blur(10px);
    color: var(--text-color);
    overflow: visible;
    margin-bottom: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-header {
    background-color: var(--card-header-bg);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.card[data-hover-elevate="true"],
[data-hover-elevate] {
    transition: var(--transition-base);
}

.card[data-hover-elevate="true"]:hover,
[data-hover-elevate]:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-md);
}

.glass-card {
    background: var(--glass-background);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
}

/* Post Card */
.post-card {
    transition: var(--transition-base);
}

.post-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-6px);
}

.post-content {
    font-size: 1rem;
    line-height: 1.6;
    word-wrap: break-word;
}

.post-images img {
    display: block;
    width: 100%;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
    border-radius: var(--border-radius);
    background-color: rgba(148, 163, 184, 0.12);
}

.post-images > img,
.post-images > .img-fluid {
    max-height: 420px;
    aspect-ratio: 4 / 3;
    object-fit: contain;
}

.post-images .row .col-6 img {
    aspect-ratio: 1 / 1;
    max-height: none;
    object-fit: cover;
    border-radius: var(--border-radius-sm);
}

.post-images img:hover {
    opacity: 0.92;
}

.post-videos .ratio {
    border-radius: var(--border-radius);
    overflow: hidden;
    background-color: #000;
}

.post-videos video {
    display: block;
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
    border-radius: inherit;
    background-color: #000;
}

.post-documents .bg-light {
    transition: background-color 0.15s ease;
}

.post-documents .bg-light:hover {
    background-color: rgba(148, 163, 184, 0.15) !important;
}

.post-pdf-preview {
    margin-left: 0;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: var(--border-radius-sm);
    background-color: rgba(255, 255, 255, 0.65);
    padding: 0.4rem 0.6rem 0.55rem;
}

.post-pdf-preview summary {
    cursor: pointer;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--primary-color);
    list-style: none;
}

.post-pdf-preview summary::-webkit-details-marker {
    display: none;
}

.post-pdf-preview iframe {
    background-color: #f8fafc;
}

@media (max-width: 575.98px) {
    .post-pdf-preview iframe {
        height: 320px !important;
    }
}

/* Reaction Button */
.reaction-btn:hover {
    background-color: #e9ecef;
}

.reaction-btn i {
    transition: transform 0.2s;
}

.reaction-btn:hover i {
    transform: scale(1.2);
}

/* Buttons */
.btn {
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: var(--transition-base);
    box-shadow: 0 8px 18px rgba(71, 118, 230, 0.2);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-color-dark));
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(71, 118, 230, 0.25);
}

.btn-outline-primary {
    border-color: rgba(71, 118, 230, 0.45);
    color: var(--primary-color);
    background: rgba(71, 118, 230, 0.08);
}

.btn-outline-primary:hover {
    background: rgba(71, 118, 230, 0.18);
    border-color: rgba(71, 118, 230, 0.55);
    color: var(--primary-color-dark);
}

.btn-gradient {
    background: linear-gradient(120deg, var(--primary-gradient-start), var(--primary-gradient-end));
    border: none;
    color: #fff;
}

.btn-gradient:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Form Controls */
.form-control, .form-select {
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.35);
    background-color: rgba(255, 255, 255, 0.9);
    transition: var(--transition-base);
}

.form-control:focus, .form-select:focus {
    border-color: rgba(71, 118, 230, 0.6);
    box-shadow: 0 0 0 4px rgba(71, 118, 230, 0.15);
    background-color: rgba(255, 255, 255, 1);
}

/* Avatar */
.rounded-circle {
    border: 2px solid #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,.1);
}

.avatar-xl {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 50%;
}

.avatar-md {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 50%;
}

/* Notification Badge */
.notification-badge {
    font-size: 0.65rem;
    padding: 0.25em 0.5em;
}

/* Notification Dropdown - Mobile Responsive */
.notification-dropdown {
    right: 0 !important;
    left: auto !important;
}

.notification-dropdown .dropdown-item {
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.notification-dropdown .dropdown-item p {
    word-break: break-word;
    overflow-wrap: break-word;
}

@media (max-width: 576px) {
    .notification-dropdown {
        position: fixed !important;
        top: 60px !important;
        right: 10px !important;
        left: 10px !important;
        width: calc(100vw - 20px) !important;
        transform: none !important;
    }
}

/* Dropdown Menu */
.dropdown-menu {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(148, 163, 184, 0.18);
    background-color: var(--glass-background);
    backdrop-filter: blur(var(--glass-blur));
    z-index: 1300;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    transition: var(--transition-base);
    border-radius: var(--border-radius-sm);
}

.dropdown-item:hover {
    background-color: rgba(71, 118, 230, 0.12);
    color: var(--primary-color-dark);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
    margin-right: 8px;
}

.dropdown-divider {
    margin: 0.35rem 0;
    border-top-color: rgba(148, 163, 184, 0.18);
}

/* Alerts */
.alert {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-sm);
}

.alert svg,
.alert i {
    margin-right: 0.5rem;
}

.nav-link-icon {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border: none;
    text-decoration: none;
}

.nav-link-icon:hover,
.nav-link-icon:focus {
    background: rgba(255, 255, 255, 0.32);
    color: #fff;
    text-decoration: none;
}

@media (max-width: 991.98px) {
    .navbar {
        padding: 0.65rem 5px;
    }

    .navbar .container-fluid {
        padding-left: 5px;
        padding-right: 5px;
    }

    .navbar-flex {
        gap: 0.75rem;
    }

    .header-search {
        order: 1;
        width: 100%;
        margin-bottom: 0.35rem;
    }

    .header-search .search-shell {
        padding: 0.3rem 0.65rem 0.3rem 0.85rem;
        background: rgba(255, 255, 255, 0.96);
        border: 1px solid rgba(15, 59, 167, 0.22);
    }

    .header-search input {
        font-size: 0.9rem;
        color: var(--text-color);
    }

    .header-search input::placeholder {
        color: rgba(71, 85, 105, 0.72);
    }

    .navbar-brand {
        flex: 1 1 0;
        order: 2;
        min-width: 0;
        overflow: hidden;
        gap: 0.45rem !important;
    }

    .site-brand {
        color: #fff !important;
    }

    .brand-mobile {
        font-size: 1.08rem;
        color: #fff;
        letter-spacing: 0.01em;
    }

    .brand-mark .xblivian-icon {
        width: 1.32rem;
        height: 1.32rem;
    }

    .nav-actions {
        order: 3;
        margin-left: auto;
        gap: 0.38rem;
        flex: 0 0 auto;
    }

    .nav-actions .btn-icon,
    .nav-actions .nav-link-icon {
        width: 35px;
        height: 35px;
    }

    .nav-profile-trigger {
        width: 35px;
        height: 35px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
        background: rgba(255, 255, 255, 0.2);
    }

    .nav-profile-trigger:hover,
    .nav-profile-trigger:focus {
        background: rgba(255, 255, 255, 0.3);
    }

    .nav-profile-trigger::after {
        display: none;
    }

    .nav-profile-trigger .avatar-md {
        width: 35px;
        height: 35px;
        margin: 0;
    }

    .nav-actions > .chat-trigger {
        display: none !important;
    }
}

/* Sticky Sidebar */
.sticky-top {
    z-index: 1000;
}

.navbar.sticky-top {
    z-index: 1400;
}

.chat-panel.sticky-top {
    z-index: 950;
}

/* Search Bar */
.header-search {
    width: 100%;
    min-width: 0;
}

@media (min-width: 992px) {
    .header-search {
        width: auto;
        max-width: 500px;
    }
}

.navbar .btn-light {
    color: var(--primary-color);
    border: none;
    box-shadow: none;
}

.navbar-guest {
    background: linear-gradient(115deg, #1d4ed8, #0f3ba7) !important;
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.navbar-guest .navbar-brand,
.navbar-guest .nav-link {
    color: #fff !important;
}

.navbar-guest .guest-auth-btn {
    min-width: 100px;
    justify-content: center;
}

/* Footer */
footer {
    margin-top: auto;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 64, 175, 0.85)) !important;
    color: #f8fafc !important;
    position: relative;
    z-index: 1;
}

footer h5,
footer p,
footer li,
footer .text-muted {
    color: rgba(255, 255, 255, 0.75) !important;
}

footer a {
    color: rgba(255, 255, 255, 0.8) !important;
}

footer a:hover {
    color: #ffffff !important;
}

footer .social-links a {
    display: inline-flex;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    transition: var(--transition-base);
}

footer .social-links a:hover {
    background: rgba(255, 255, 255, 0.2);
}

footer .list-unstyled a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.site-footer .footer-copyright {
    letter-spacing: 0;
}

.site-footer .footer-bottom {
    align-items: center;
    text-align: center;
}

.site-footer .footer-bottom > * {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    text-align: center !important;
}

.site-footer .footer-quick-links,
.site-footer .footer-quick-links a {
    white-space: nowrap;
}

body.page-xblivian-dashboard .site-footer {
    margin-top: 0 !important;
    padding-top: 1.5rem !important;
}

.settings-action-list {
    display: grid;
    gap: 0.85rem;
}

.settings-action {
    display: grid;
    grid-template-columns: 2.7rem minmax(0, 1fr);
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(17, 34, 68, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.78);
    color: var(--dark-color);
    text-align: left;
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.settings-action:hover,
.settings-action:focus {
    color: var(--dark-color);
    border-color: rgba(18, 54, 161, 0.2);
    box-shadow: 0 12px 26px rgba(17, 34, 68, 0.12);
    transform: translateY(-1px);
}

.settings-action-button {
    cursor: pointer;
    font: inherit;
}

.settings-action-icon {
    display: inline-flex;
    width: 2.7rem;
    height: 2.7rem;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(18, 54, 161, 0.08);
    color: var(--primary-color);
}

.settings-action-title,
.settings-action-copy {
    display: block;
}

.settings-action-title {
    color: inherit;
    font-weight: 800;
    line-height: 1.25;
}

.settings-action-copy {
    margin-top: 0.18rem;
    color: var(--muted-color);
    font-size: 0.88rem;
    line-height: 1.4;
}

.settings-action-danger {
    color: #b91c1c;
}

.settings-action-danger:hover,
.settings-action-danger:focus {
    color: #991b1b;
    border-color: rgba(220, 38, 38, 0.24);
}

.settings-action-danger .settings-action-icon {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

.auth-xblivian-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    color: #111111;
}

.auth-xblivian-brand-icon {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.auth-xblivian-brand-text {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

/* Verified Badge */
.verified-badge {
    display: inline-block;
    vertical-align: middle;
    margin-left: 4px;
    flex-shrink: 0;
}

.guest-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    width: max-content;
    max-width: 100%;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(245, 158, 11, 0.35);
    background: rgba(245, 158, 11, 0.14);
    color: #92400e;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
    letter-spacing: 0;
    white-space: nowrap;
    vertical-align: middle;
}

.guest-badge i {
    font-size: 0.78rem;
    margin: 0;
}

.guest-badge-sm {
    padding: 0.22rem 0.45rem;
    font-size: 0.67rem;
}

.register-plan-option {
    display: block;
    cursor: pointer;
}

.register-plan-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.register-plan-card {
    display: block;
    height: 100%;
    padding: 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.36);
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.82);
    transition: var(--transition-base);
}

.register-plan-option input:checked + .register-plan-card {
    border-color: transparent;
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.register-plan-option input:checked + .register-plan-card .text-muted {
    color: rgba(255, 255, 255, 0.78) !important;
}

.register-plan-option input:focus-visible + .register-plan-card {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.join-auth-page {
    width: 100%;
    flex: 1 0 auto;
    display: flex;
    align-items: center;
}

.join-auth-page > .row {
    width: 100%;
}

.join-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.join-choice-box {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    padding: 1.25rem;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: var(--border-radius-sm);
    background: rgba(255, 255, 255, 0.84);
    color: var(--text-color);
    text-align: center;
    text-decoration: none;
    transition: var(--transition-base);
}

.join-choice-box:hover,
.join-choice-box:focus {
    color: var(--text-color);
    border-color: rgba(29, 78, 216, 0.38);
    background: rgba(29, 78, 216, 0.08);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.join-choice-icon {
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(29, 78, 216, 0.1);
    color: var(--primary-color);
    font-size: 1.2rem;
}

.join-choice-label {
    display: block;
    max-width: 100%;
    color: inherit;
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.3;
}

.fa-check-circle.text-primary {
    margin-left: 4px;
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
}

/* Xblivian AI Icon */
.xblivian-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    color: #1236A1;
}

.xblivian-icon.fa-fw {
    width: 1.25em;
    text-align: center;
}

.xblivian-icon.text-primary {
    color: #1236A1;
}

.xblivian-icon.text-success,
.xblivian-icon.xb-green {
    color: #10a37f;
}

a {
    color: var(--primary-color);
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-color-dark);
}

/* Empty State */
.empty-state {
    padding: 3rem 1rem;
    text-align: center;
}

.empty-state i {
    font-size: 3rem;
    color: #adb5bd;
    margin-bottom: 1rem;
}

.empty-state .btn {
    box-shadow: none;
}

/* Comments Section */
.comments-section {
    background-color: var(--card-header-bg);
    padding: 1rem;
    border-radius: var(--border-radius);
}

.comment-item {
    background-color: var(--card-bg);
    padding: 0.75rem;
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
}

.comment-form .input-group .form-control {
    border-right: none;
}

.comment-form .input-group .btn {
    border-left: none;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.comment-form .input-group .form-control:focus {
    border-right: none;
    box-shadow: none;
}

.comment-form .input-group .form-control:focus + .btn {
    border-color: var(--primary-color);
}

/* Modal – force above all other stacking contexts including navbar (1400) */
.modal {
    z-index: 1500 !important;
}

.modal-backdrop {
    z-index: 1450 !important;
}

.modal-content {
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background-color: var(--card-bg);
    color: var(--text-color);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
}

.modal[data-theme="glass"] .modal-content {
    background: var(--glass-background);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(var(--glass-blur));
}

#createPostModal .modal-dialog {
    margin: 1rem auto;
    max-width: min(760px, calc(100vw - 1.5rem));
}

#createPostModal .modal-content {
    max-height: calc(100dvh - 2rem);
    overflow: hidden;
    box-shadow: 0 16px 70px rgba(0, 0, 0, 0.35);
}

#createPostModal .modal-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#createPostModal textarea.form-control {
    min-height: 100px;
}

@media (max-width: 767.98px) {
    #createPostModal .modal-dialog {
        margin: 0;
        max-width: 100%;
        min-height: 100dvh;
        display: flex;
        align-items: flex-end;
    }

    #createPostModal .modal-content {
        max-height: 92dvh;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        animation: slideInUp 0.3s ease-out;
    }

    #createPostModal .modal-header,
    #createPostModal .modal-footer {
        padding: 0.75rem 1rem;
    }

    #createPostModal .modal-body {
        padding: 1rem;
    }

    #createPostModal .modal-body .d-flex.gap-2 {
        flex-wrap: wrap;
    }

    #createPostModal .btn-group-sm > .btn,
    #createPostModal .btn.btn-sm {
        font-size: 0.78rem;
        padding: 0.3rem 0.55rem;
    }

    #createPostModal textarea.form-control {
        min-height: 80px;
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .header-search .btn-icon,
    .nav-actions .btn-icon,
    .nav-actions .nav-link-icon {
        width: 44px;
        height: 44px;
        min-width: 44px;
        aspect-ratio: 1 / 1;
        border-radius: 50%;
    }

    .header-search .btn-icon i,
    .nav-actions .btn-icon i,
    .nav-actions .nav-link-icon i {
        font-size: 1.15rem;
    }
}

/* Last-in-file responsive rules intentionally win over legacy dashboard
   presets above. They keep the launcher and global chrome on one rhythm. */
@media (min-width: 992px) {
    body > .navbar .navbar-flex { flex-wrap: nowrap !important; gap: clamp(.45rem, 1.1vw, 1rem) !important; }
    body > .navbar .navbar-brand { flex: 0 0 auto; margin-right: 0 !important; white-space: nowrap; }
    body > .navbar .header-search { flex: 1 1 clamp(220px, 42vw, 560px) !important; width: auto !important; max-width: none !important; min-width: 0; }
    body > .navbar .header-search-form, body > .navbar .header-search .search-shell { min-width: 0; }
    body > .navbar .header-search input { min-width: 0; }
    body > .navbar .nav-actions { flex: 0 0 auto; gap: clamp(.25rem, .6vw, .55rem); }
    body > .navbar .nav-actions .nav-profile-trigger span { max-width: clamp(80px, 12vw, 180px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

body.page-xblivian-dashboard .xblivian-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 720px);
    grid-template-rows: repeat(var(--dashboard-grid-rows, 4), minmax(96px, 1fr));
    justify-content: center;
    align-content: stretch;
    gap: clamp(.65rem, 1.8vw, 1.2rem);
    margin-block: clamp(.7rem, 2.2vw, 1.5rem);
    padding-block: 0;
    min-height: 0;
}

body.page-xblivian-dashboard .xblivian-dashboard-card,
body.page-xblivian-dashboard .xblivian-dashboard-assistant-card {
    width: 100%; min-width: 0; min-height: 96px; height: auto; aspect-ratio: auto;
    align-items: center; justify-content: center; text-align: center;
    gap: clamp(.2rem, 1vw, .45rem); padding: clamp(.8rem, 2vw, 1.25rem);
}
body.page-xblivian-dashboard .xblivian-dashboard-card-title,
body.page-xblivian-dashboard .xblivian-dashboard-card-description { max-width: 100%; text-align: center; overflow-wrap: anywhere; }
body.page-xblivian-dashboard .xblivian-dashboard-card-title { font-size: clamp(1.05rem, 2.2vw, 1.55rem); line-height: 1.15; }
body.page-xblivian-dashboard .xblivian-dashboard-card-description { margin-top: 0; font-size: clamp(.78rem, 1.25vw, .95rem); line-height: 1.3; }
body.page-xblivian-dashboard .site-footer { margin-top: 0 !important; }
.site-footer .footer-bottom { width: 100%; text-align: initial; }
.site-footer .footer-bottom > * { width: auto; margin-inline: 0; text-align: initial !important; }
.site-footer .footer-copyright, .site-footer .footer-powered { white-space: nowrap; font-size: clamp(.68rem, 1.2vw, .88rem); line-height: 1.25; }

@media (max-width: 767.98px) {
    body.page-xblivian-dashboard .xblivian-dashboard-grid { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(var(--dashboard-grid-rows, 4), minmax(70px, 1fr)); gap: clamp(.55rem, 2.4vw, .9rem); margin-block: clamp(.55rem, 2.5vw, 1rem); }
    body.page-xblivian-dashboard .xblivian-dashboard-card,
    body.page-xblivian-dashboard .xblivian-dashboard-assistant-card { min-height: 70px; padding: clamp(.65rem, 3vw, 1rem); border-radius: 16px; }
    body.page-xblivian-dashboard .xblivian-dashboard-card-title { font-size: clamp(.95rem, 4.2vw, 1.2rem); }
    body.page-xblivian-dashboard .xblivian-dashboard-card-description { font-size: clamp(.72rem, 3.2vw, .86rem); }
    .site-footer { padding-top: 1rem !important; padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px)) !important; }
    .site-footer .footer-bottom { gap: .5rem !important; }
    .site-footer .footer-copyright, .site-footer .footer-powered { font-size: clamp(.62rem, 2.4vw, .78rem); }
}
@media (max-width: 380px) {
    .site-footer .footer-bottom { gap: .3rem !important; }
    .site-footer .footer-copyright, .site-footer .footer-powered { font-size: .6rem; }
}

/* Final responsive corrections for the production dashboard and header. */
@media (min-width: 992px) {
    body > .navbar .navbar-flex {
        flex-wrap: nowrap !important;
        gap: clamp(.45rem, 1.1vw, 1rem) !important;
    }

    body > .navbar .navbar-brand {
        flex: 0 0 auto;
        margin-right: 0 !important;
        white-space: nowrap;
    }

    body > .navbar .header-search {
        flex: 1 1 clamp(220px, 42vw, 560px) !important;
        width: auto !important;
        max-width: none !important;
        min-width: 0;
    }

    body > .navbar .header-search-form,
    body > .navbar .header-search .search-shell {
        min-width: 0;
    }

    body > .navbar .header-search input {
        min-width: 0;
    }

    body > .navbar .nav-actions {
        flex: 0 0 auto;
        gap: clamp(.25rem, .6vw, .55rem);
    }

    body > .navbar .nav-actions .nav-profile-trigger span {
        max-width: clamp(80px, 12vw, 180px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* One-column launcher: the four cards share one grid rhythm at every size. */
body.page-xblivian-dashboard .xblivian-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 720px);
    grid-template-rows: repeat(var(--dashboard-grid-rows, 4), minmax(96px, 1fr));
    justify-content: center;
    align-content: stretch;
    gap: clamp(.65rem, 1.8vw, 1.2rem);
    margin-block: clamp(.7rem, 2.2vw, 1.5rem);
    padding-block: 0;
    min-height: 0;
}

body.page-xblivian-dashboard .xblivian-dashboard-card,
body.page-xblivian-dashboard .xblivian-dashboard-assistant-card {
    width: 100%;
    min-width: 0;
    min-height: 96px;
    height: auto;
    aspect-ratio: auto;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: clamp(.2rem, 1vw, .45rem);
    padding: clamp(.8rem, 2vw, 1.25rem);
}

body.page-xblivian-dashboard .xblivian-dashboard-card-title,
body.page-xblivian-dashboard .xblivian-dashboard-card-description {
    max-width: 100%;
    text-align: center;
    overflow-wrap: anywhere;
}

body.page-xblivian-dashboard .xblivian-dashboard-card-title {
    font-size: clamp(1.05rem, 2.2vw, 1.55rem);
    line-height: 1.15;
}

body.page-xblivian-dashboard .xblivian-dashboard-card-description {
    margin-top: 0;
    font-size: clamp(.78rem, 1.25vw, .95rem);
    line-height: 1.3;
}

body.page-xblivian-dashboard .site-footer {
    margin-top: 0 !important;
}

.site-footer .footer-bottom {
    width: 100%;
    text-align: initial;
}

.site-footer .footer-bottom > * {
    width: auto;
    margin-inline: 0;
    text-align: initial !important;
}

.site-footer .footer-copyright,
.site-footer .footer-powered {
    white-space: nowrap;
    font-size: clamp(.68rem, 1.2vw, .88rem);
    line-height: 1.25;
}

@media (max-width: 767.98px) {
    body.page-xblivian-dashboard .xblivian-dashboard-grid {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: repeat(var(--dashboard-grid-rows, 4), minmax(70px, 1fr));
        gap: clamp(.55rem, 2.4vw, .9rem);
        margin-block: clamp(.55rem, 2.5vw, 1rem);
    }

    body.page-xblivian-dashboard .xblivian-dashboard-card,
    body.page-xblivian-dashboard .xblivian-dashboard-assistant-card {
        min-height: 70px;
        padding: clamp(.65rem, 3vw, 1rem);
        border-radius: 16px;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-card-title {
        font-size: clamp(.95rem, 4.2vw, 1.2rem);
    }

    body.page-xblivian-dashboard .xblivian-dashboard-card-description {
        font-size: clamp(.72rem, 3.2vw, .86rem);
    }

    .site-footer {
        padding-top: 1rem !important;
        padding-bottom: max(1rem, env(safe-area-inset-bottom, 0px)) !important;
    }

    .site-footer .footer-bottom {
        gap: .5rem !important;
    }

    .site-footer .footer-copyright,
    .site-footer .footer-powered {
        font-size: clamp(.62rem, 2.4vw, .78rem);
    }
}

@media (max-width: 380px) {
    .site-footer .footer-bottom { gap: .3rem !important; }
    .site-footer .footer-copyright,
    .site-footer .footer-powered { font-size: .6rem; }
}

/* Section Intro */
.section-intro {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.section-intro .headline-group {
    max-width: 680px;
}

.section-intro .section-title {
    font-size: 1.9rem;
    line-height: 1.2;
    font-weight: 700;
    margin-bottom: 0.4rem;
}

.section-intro .section-subtitle {
    color: var(--muted-color);
    font-size: 1rem;
}

.section-intro .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.section-intro .kpi-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.kpi-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.95rem;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.18);
    box-shadow: var(--shadow-sm);
}

.kpi-badge i {
    font-size: 0.95rem;
    color: var(--primary-color);
}

/* Metric Cards */
.metric-card {
    border-radius: var(--border-radius);
    padding: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.metric-card:before {
    content: '';
    position: absolute;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(71, 118, 230, 0.12), transparent 70%);
    top: -40px;
    right: -40px;
}

.metric-card .metric-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-color);
    margin-bottom: 0.25rem;
}

.metric-card .metric-value {
    font-size: 2rem;
    font-weight: 700;
}

.metric-card .metric-trend {
    margin-top: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

/* Tables */
.table {
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    color: var(--muted-color);
    border-bottom: 1px solid rgba(148, 163, 184, 0.35);
    background-color: rgba(71, 118, 230, 0.04);
}

.table tbody tr {
    transition: var(--transition-base);
}

.table tbody tr:hover {
    background-color: rgba(71, 118, 230, 0.06);
}

.table tbody td {
    border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.table-responsive {
    border-radius: var(--border-radius);
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
    overflow: hidden;
}

/* Badges */
.badge {
    border-radius: 50rem;
    padding: 0.45em 0.85em;
    font-weight: 600;
}

.badge-soft {
    background: rgba(71, 118, 230, 0.1);
    color: var(--primary-color);
}

/* List Group */
.list-group-item {
    padding: 0.8rem 1.25rem;
    border-color: rgba(148, 163, 184, 0.16);
}

.list-group-item-action:hover,
.list-group-item-action:focus {
    background: rgba(71, 118, 230, 0.08);
    color: var(--primary-color-dark);
}

.list-group-item.active {
    background: linear-gradient(120deg, var(--primary-gradient-start), var(--primary-gradient-end));
    border-color: transparent;
    box-shadow: var(--shadow-sm);
}

/* Pagination */
.pagination .page-link {
    border-radius: var(--border-radius-sm);
    border: none;
    margin: 0 0.25rem;
    color: var(--secondary-color);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.pagination .page-item.active .page-link {
    background: linear-gradient(120deg, var(--primary-gradient-start), var(--primary-gradient-end));
    color: #fff;
}

/* Marketplace */
.marketplace-hero {
    background: linear-gradient(135deg, rgba(29,78,216,0.08), rgba(15,59,167,0.12));
    border: 1px solid rgba(148, 163, 184, 0.18);
}

.marketplace-card {
    overflow: hidden;
}

.marketplace-card-image {
    position: relative;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    overflow: hidden;
}

.marketplace-card-image img {
    width: 100%;
    height: 210px;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.marketplace-card:hover .marketplace-card-image img {
    transform: scale(1.03);
}

.marketplace-type-badge,
.marketplace-featured {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
}

.marketplace-featured {
    top: auto;
    bottom: 12px;
}

.marketplace-price {
    font-weight: 700;
    color: var(--primary-color);
}

.marketplace-stat {
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    background: rgba(71, 118, 230, 0.08);
}

.marketplace-thumb {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
}

.marketplace-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Portal Cards */
.portal-card {
    position: relative;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid rgba(148, 163, 184, 0.18);
    transition: var(--transition-base);
}

.portal-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
}

.portal-card .portal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    color: var(--muted-color);
}

.portal-card .portal-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.portal-card .portal-meta i {
    color: var(--primary-color);
}

/* Connections */
.connection-card {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    transition: var(--transition-base);
}

.connection-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-md);
}

.connection-actions .btn {
    box-shadow: none;
}

.connection-avatar {
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 50%;
}

/* Responsive */
@media (max-width: 768px) {
    .container-fluid {
        padding-left: 5px;
        padding-right: 5px;
    }

    .card {
        border-radius: 0;
    }

    .section-intro {
        align-items: flex-start;
    }

    .header-search {
        order: 1;
    }

    .btn-icon {
        width: 34px;
        height: 34px;
    }

    .header-search .btn-icon {
        width: 34px;
        height: 34px;
    }
}

@media (max-width: 480px) {
    .brand-mobile {
        font-size: 1rem;
    }

    .nav-actions {
        gap: 0.3rem;
    }

    .nav-actions .btn-icon,
    .nav-actions .nav-link-icon {
        width: 33px;
        height: 33px;
    }

    .nav-profile-trigger {
        width: 33px;
        height: 33px;
    }

    .nav-profile-trigger .avatar-md {
        width: 33px;
        height: 33px;
    }

    .brand-mark .xblivian-icon {
        width: 1.22rem;
        height: 1.22rem;
    }
}

@media (min-width: 992px) {
    .header-search {
        flex: 1 1 auto;
        max-width: 520px;
        order: 2;
        width: auto;
        margin-bottom: 0;
    }

    .header-search .search-shell {
        padding: 0.45rem 1rem 0.45rem 1.15rem;
    }

    .btn-icon {
        width: 42px;
        height: 42px;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

.fade-in-up {
    animation: fadeIn 0.4s ease-out, moveUp 0.4s ease-out;
}

@keyframes moveUp {
    from {
        transform: translateY(12px);
    }
    to {
        transform: translateY(0);
    }
}

/* Utilities */
.cursor-pointer {
    cursor: pointer;
}

.text-truncate-2 {
    display: -webkit-box;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.shadow-hover {
    transition: var(--transition-base);
}

.shadow-hover:hover {
    box-shadow: var(--shadow-md) !important;
}

.gradient-border {
    position: relative;
    border-radius: var(--border-radius);
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(29, 78, 216, 0.6), rgba(15, 59, 167, 0.6));
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gradient-border:hover::before {
    opacity: 1;
}

.link-quiet {
    color: inherit;
    text-decoration: none;
}

.link-quiet:hover {
    color: var(--primary-color);
}

.badge-pill-soft {
    border-radius: 999px;
    background: rgba(71, 118, 230, 0.12);
    color: var(--primary-color);
    padding: 0.35rem 0.75rem;
}

.divider {
    height: 1px;
    background: rgba(148, 163, 184, 0.18);
    margin: 1.5rem 0;
}

.subtle-link {
    color: var(--muted-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.subtle-link:hover {
    color: var(--primary-color-dark);
}

/* Mention Autocomplete */
.mention-suggestions {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 8px rgba(0,0,0,.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.mention-suggestion-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.mention-suggestion-item:hover {
    background-color: #f8f9fa;
}

.mention-suggestion-item img {
    width: 32px;
    height: 32px;
    margin-right: 0.5rem;
}

.reaction-summary {
    min-height: 24px;
}

.reaction-summary-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    background-color: rgba(13, 110, 253, 0.08);
    font-weight: 600;
    font-size: 0.85rem;
}

.reaction-summary-item i {
    font-size: 0.85rem;
}

.reaction-summary-total {
    font-size: 0.9rem;
}

.reaction-summary-empty {
    font-size: 0.85rem;
}

.reaction-label {
    margin-left: 0.35rem;
    font-weight: 600;
}

.reaction-picker {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 0;
    display: inline-flex;
    gap: 0.5rem;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.4rem 0.8rem;
    z-index: 1100;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
}

.reaction-picker::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 24px;
    width: 12px;
    height: 12px;
    background-color: inherit;
    border-left: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    transform: rotate(45deg);
}

.reaction-picker-item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-width: 48px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--muted-color);
    transition: transform 0.15s ease, color 0.15s ease;
}

.reaction-picker-item i {
    font-size: 1.2rem;
}

.reaction-picker-item:hover {
    transform: translateY(-2px) scale(1.05);
    color: var(--primary-color);
}

.reaction-picker-item:hover i {
    color: var(--primary-color);
}

.reaction-color-like {
    color: #0d6efd;
}

.reaction-color-love {
    color: #d63384;
}

.reaction-color-celebrate {
    color: #fd7e14;
}

.reaction-color-insightful {
    color: #20c997;
}

.reaction-color-support {
    color: #6610f2;
}

.reaction-summary-item--love {
    background-color: rgba(214, 51, 132, 0.12);
}

.reaction-summary-item--celebrate {
    background-color: rgba(253, 126, 20, 0.12);
}

.reaction-summary-item--insightful {
    background-color: rgba(32, 201, 151, 0.12);
}

.reaction-summary-item--support {
    background-color: rgba(102, 16, 242, 0.12);
}

.reaction-btn.active {
    background-color: rgba(13, 110, 253, 0.08);
    color: var(--primary-color);
    font-weight: 600;
}

.comment-toggle-btn.active,
.share-btn.active {
    background-color: var(--surface-hover);
}

.connection-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(13, 110, 253, 0.85), rgba(102, 16, 242, 0.85));
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 3px 6px rgba(13, 110, 253, 0.25);
    position: relative;
}

.connection-card {
    padding: 0.75rem;
    border: 1px solid rgba(13, 110, 253, 0.08);
    border-radius: var(--border-radius);
    background-color: var(--card-bg);
    transition: transform 0.2s, box-shadow 0.2s;
}

.connection-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(13, 110, 253, 0.12);
}

.suggested-connections-card .btn-outline-primary {
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
}

.for-you-insights li {
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.for-you-insights li:last-child {
    border-bottom: none;
}

.for-you-insights .badge {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.for-you-insights small {
    display: block;
}

.insight-icon {
    font-size: 1rem;
}

.insight-icon i {
    font-size: 1rem;
}

.post-comment-count {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: transparent;
    border: none;
    padding: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.post-comment-count:hover,
.post-comment-count:focus-visible {
    color: var(--primary-gradient-start);
}

.post-comment-count:focus-visible {
    outline: 2px solid rgba(29, 78, 216, 0.35);
    outline-offset: 2px;
    border-radius: 999px;
}

.post-comment-count.is-open {
    color: var(--primary-gradient-start);
    font-weight: 600;
}

.post-comment-count .comment-count-number {
    font-weight: 600;
}

.post-comment-count .comment-count-label {
    text-transform: lowercase;
}

.comments-list {
    max-height: 260px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.comments-list::-webkit-scrollbar {
    width: 6px;
}

.comments-list::-webkit-scrollbar-thumb {
    background: rgba(13, 110, 253, 0.35);
    border-radius: 3px;
}

.dark-mode-surface {
    transition: background-color 0.2s ease;
}

body.dark-mode .dark-mode-surface {
    background-color: rgba(255, 255, 255, 0.04) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

/* Chat Panel */
.chat-panel {
    border: none;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.chat-trigger.has-unread i {
    color: #ffc107;
}

.chat-column {
    display: none;
}

body.chat-open .chat-column {
    display: block;
}

@media (min-width: 992px) {
    .chat-column {
        display: block;
    }
}

.chat-panel .card-header {
    background-color: var(--card-header-bg);
    border-bottom: 1px solid var(--border-color);
}

.chat-panel-body {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 150px);
    padding: 0;
}

.chat-connections {
    padding: 1rem 1rem 0.5rem;
    border-bottom: 1px solid var(--border-color);
    max-height: 220px;
    overflow-y: auto;
}

.chat-connections-header {
    margin-bottom: 0.75rem;
}

.chat-connections ul {
    margin: 0;
    padding: 0;
}

.chat-connections li + li {
    margin-top: 0.35rem;
}

.chat-contact {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid rgba(13, 110, 253, 0.08);
    border-radius: var(--border-radius);
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
    transition: border-color 0.2s, transform 0.2s;
    position: relative;
}

.chat-contact:hover {
    border-color: rgba(13, 110, 253, 0.4);
    transform: translateY(-1px);
}

.chat-contact.active {
    border-color: var(--primary-color);
    box-shadow: 0 6px 16px rgba(13, 110, 253, 0.15);
}

.chat-contact-avatar {
    position: relative;
    width: 38px;
    height: 38px;
}

.chat-contact-avatar img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(13, 110, 253, 0.15);
}

.chat-status-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #22c55e;
    border: 2px solid var(--card-bg);
}

.chat-contact-body {
    flex: 1;
    min-width: 0;
}

.chat-contact-name {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
    color: var(--text-color);
}

.chat-contact-status {
    display: block;
    font-size: 0.75rem;
    color: var(--muted-color);
}

.chat-placeholder {
    padding: 2.5rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.chat-placeholder-icon {
    width: 48px;
    height: 48px;
    font-size: 1.2rem;
}

.chat-conversation {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
}

.chat-conversation-header {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.75rem;
    background-color: var(--card-header-bg);
}

.chat-messages {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    background-color: var(--card-header-bg);
    overflow-y: auto;
    max-height: 320px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(13, 110, 253, 0.25);
    border-radius: 3px;
}

.chat-message {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 0.75rem;
}

.chat-message:last-child {
    margin-bottom: 0;
}

.chat-message--own {
    justify-content: flex-end;
}

.chat-message-bubble {
    max-width: 78%;
    padding: 0.6rem 0.85rem;
    border-radius: var(--border-radius);
    background-color: rgba(13, 110, 253, 0.08);
    color: var(--text-color);
    position: relative;
    font-size: 0.925rem;
    line-height: 1.4;
}

.chat-message--own .chat-message-bubble {
    background-color: var(--primary-color);
    color: #fff;
}

.chat-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    display: none;
}

@media (max-width: 991.98px) {
    .chat-backdrop {
        display: block;
    }
    body.chat-open .chat-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
}

@media (max-width: 991.98px) {
    body.chat-open {
        overflow: hidden;
    }

    body.chat-open .chat-column {
        position: fixed;
        top: 72px;
        right: 0;
        width: min(100%, 380px);
        height: calc(100vh - 72px);
        padding: 0.75rem;
        z-index: 1045;
        overflow-y: auto;
    }

    body.chat-open .chat-panel {
        height: 100%;
        position: relative;
        top: 0;
    }

    body.chat-open .chat-panel.sticky-top {
        position: relative;
    }

    body.chat-open .chat-panel-body {
        max-height: none;
        height: calc(100% - 70px);
    }

    body.chat-open .chat-conversation {
        flex: 1;
    }
}

.chat-message-bubble p {
    margin: 0 0 0.35rem;
}

.chat-message-time {
    font-size: 0.7rem;
    color: rgba(0, 0, 0, 0.55);
}

.chat-message--own .chat-message-time {
    color: rgba(255, 255, 255, 0.75);
}

.chat-status {
    font-size: 0.75rem;
    margin-left: 3px;
    font-weight: 600;
}

.chat-status--sent {
    opacity: 0.6;
}

.chat-status--delivered {
    opacity: 0.8;
}

.chat-status--seen {
    color: #34b7f1;
    opacity: 1;
}

.chat-composer {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.chat-composer .form-control {
    border: 1px solid var(--border-color);
    border-right: none;
    padding: 0.65rem 0.75rem;
}

.chat-composer .btn {
    border-radius: 0;
    padding: 0.65rem 0.9rem;
}

body.dark-mode .chat-panel .card-header,
body.dark-mode .chat-conversation-header,
body.dark-mode .chat-messages {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .chat-contact {
    background-color: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .chat-contact.active {
    border-color: rgba(13, 110, 253, 0.6);
}

body.dark-mode .chat-message-bubble {
    background-color: rgba(13, 110, 253, 0.28);
}

body.dark-mode .chat-message--own .chat-message-bubble {
    background-color: rgba(13, 110, 253, 0.85);
}

body.dark-mode {
    background: var(--body-bg);
}

body.dark-mode .auth-xblivian-brand {
    color: #ffffff;
}

body.dark-mode .join-choice-box {
    background: rgba(30, 35, 42, 0.86);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-color);
}

body.dark-mode .join-choice-box:hover,
body.dark-mode .join-choice-box:focus {
    border-color: rgba(88, 166, 255, 0.44);
    background: rgba(88, 166, 255, 0.1);
    color: var(--text-color);
}

body.dark-mode .join-choice-icon {
    background: rgba(88, 166, 255, 0.12);
    color: var(--primary-color);
}

body.dark-mode::before {
    background: radial-gradient(circle at 3% 10%, rgba(88, 166, 255, 0.08), transparent 45%),
                radial-gradient(circle at 92% 18%, rgba(139, 148, 158, 0.06), transparent 55%),
                radial-gradient(circle at 50% 90%, rgba(88, 166, 255, 0.06), transparent 45%);
}

body.dark-mode .navbar-light {
    background-color: #1e1e1e !important;
    box-shadow: none;
    border-bottom: 1px solid var(--border-color);
}

body.dark-mode .navbar-light .navbar-brand {
    color: var(--text-color) !important;
}

body.dark-mode .navbar-light .btn-outline-primary {
    color: #58a6ff;
    border-color: #58a6ff;
}

body.dark-mode .navbar-light .btn-outline-primary:hover {
    background-color: #58a6ff;
    color: #0d1117;
}

/* Dark mode card and background fixes */
body.dark-mode .card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .card-header {
    background-color: var(--card-header-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .card-body {
    color: var(--text-color);
}

body.dark-mode .list-group-item {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .list-group-item-action:hover,
body.dark-mode .list-group-item-action:focus {
    background-color: var(--surface-hover);
    color: var(--text-color);
}

body.dark-mode .list-group-item.active {
    background: linear-gradient(120deg, #58a6ff, #1f6feb);
    border-color: transparent;
}

body.dark-mode .settings-action {
    background: rgba(9, 16, 29, 0.72);
    border-color: rgba(148, 163, 184, 0.16);
    color: var(--light-color);
}

body.dark-mode .settings-action:hover,
body.dark-mode .settings-action:focus {
    color: var(--light-color);
    border-color: rgba(148, 163, 184, 0.32);
    box-shadow: 0 12px 26px rgba(2, 8, 23, 0.34);
}

body.dark-mode .settings-action-icon {
    background: rgba(148, 163, 184, 0.12);
    color: #f8fafc;
}

body.dark-mode .settings-action-danger {
    color: #fecaca;
}

body.dark-mode .settings-action-danger .settings-action-icon {
    background: rgba(248, 113, 113, 0.14);
    color: #fecaca;
}

body.dark-mode .dropdown-menu {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-mode .dropdown-item {
    color: var(--text-color);
}

body.dark-mode .dropdown-item:hover,
body.dark-mode .dropdown-item:focus {
    background-color: var(--surface-hover);
    color: #58a6ff;
}

body.dark-mode .dropdown-divider {
    border-color: var(--border-color);
}

body.dark-mode .modal-content {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .modal-header,
body.dark-mode .modal-footer {
    border-color: var(--border-color);
}

body.dark-mode .form-control,
body.dark-mode .form-select {
    background-color: rgba(13, 17, 23, 0.8);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus {
    background-color: rgba(13, 17, 23, 0.95);
    border-color: #58a6ff;
    color: var(--text-color);
    box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.15);
}

body.dark-mode .form-control::placeholder {
    color: var(--muted-color);
}

body.dark-mode .input-group-text {
    background-color: rgba(36, 41, 48, 0.9);
    border-color: var(--border-color);
    color: var(--muted-color);
}

body.dark-mode .table {
    color: var(--text-color);
}

body.dark-mode .table thead th {
    background-color: rgba(36, 41, 48, 0.6);
    border-color: var(--border-color);
    color: var(--muted-color);
}

body.dark-mode .table tbody td {
    border-color: var(--border-color);
}

body.dark-mode .table tbody tr:hover {
    background-color: var(--surface-hover);
}

body.dark-mode .table-responsive {
    border-color: var(--border-color);
}

body.dark-mode .btn-light {
    background-color: rgba(48, 54, 61, 0.9);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .btn-light:hover {
    background-color: rgba(56, 62, 71, 0.95);
    color: var(--text-color);
}

/* Outline button visibility in dark mode */
body.dark-mode .btn-outline-primary {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: transparent;
}

body.dark-mode .btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

body.dark-mode .btn-outline-secondary {
    border-color: var(--border-color);
    color: var(--muted-color);
}

body.dark-mode .btn-outline-secondary:hover {
    background-color: var(--surface-hover);
    color: var(--text-color);
}

body.dark-mode .btn-outline-success {
    border-color: #238636;
    color: #3fb950;
}

body.dark-mode .btn-outline-success:hover {
    background-color: #238636;
    color: #fff;
}

body.dark-mode .btn-outline-danger {
    border-color: #da3633;
    color: #f85149;
}

body.dark-mode .btn-outline-danger:hover {
    background-color: #da3633;
    color: #fff;
}

body.dark-mode .btn-outline-warning {
    border-color: #9e6a03;
    color: #f0b429;
}

body.dark-mode .btn-outline-warning:hover {
    background-color: #9e6a03;
    color: #fff;
}

body.dark-mode .btn-outline-info {
    border-color: #1f6feb;
    color: #58a6ff;
}

body.dark-mode .btn-outline-info:hover {
    background-color: #1f6feb;
    color: #fff;
}

body.dark-mode .btn-secondary {
    background-color: rgba(48, 54, 61, 0.9);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .alert {
    border-color: var(--border-color);
}

body.dark-mode .alert-warning {
    background-color: rgba(133, 89, 0, 0.2);
    color: #f0b429;
    border-color: rgba(133, 89, 0, 0.3);
}

body.dark-mode .alert-success {
    background-color: rgba(35, 134, 54, 0.2);
    color: #56d364;
    border-color: rgba(35, 134, 54, 0.3);
}

body.dark-mode .alert-danger {
    background-color: rgba(139, 32, 38, 0.2);
    color: #f85149;
    border-color: rgba(139, 32, 38, 0.3);
}

body.dark-mode .alert-info {
    background-color: rgba(31, 111, 235, 0.2);
    color: #58a6ff;
    border-color: rgba(31, 111, 235, 0.3);
}

body.dark-mode h1, body.dark-mode h2, body.dark-mode h3,
body.dark-mode h4, body.dark-mode h5, body.dark-mode h6,
body.dark-mode .h1, body.dark-mode .h2, body.dark-mode .h3,
body.dark-mode .h4, body.dark-mode .h5, body.dark-mode .h6 {
    color: var(--text-color);
}

body.dark-mode .text-body {
    color: var(--text-color) !important;
}

body.dark-mode .text-dark {
    color: var(--text-color) !important;
}

body.dark-mode a {
    color: #58a6ff;
}

body.dark-mode a:hover {
    color: #79b8ff;
}

body.dark-mode .section-title {
    color: var(--text-color);
}

body.dark-mode .metric-card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-mode .metric-card .metric-value {
    color: #58a6ff;
}

body.dark-mode .metric-card .metric-label {
    color: var(--muted-color);
}

body.dark-mode .glass-card {
    background: var(--glass-background);
    border-color: var(--glass-border);
}

body.dark-mode .kpi-badge {
    background: rgba(48, 54, 61, 0.85);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .kpi-badge i {
    color: #58a6ff;
}

body.dark-mode .marketplace-stat {
    background-color: rgba(48, 54, 61, 0.85);
}

body.dark-mode .marketplace-attribute {
    background-color: rgba(48, 54, 61, 0.85);
    color: var(--text-color);
}

body.dark-mode .marketplace-attribute .label {
    color: var(--muted-color);
}

body.dark-mode .marketplace-thumb {
    background-color: rgba(48, 54, 61, 0.85);
}

body.dark-mode .invoice-table th {
    background-color: rgba(36, 41, 48, 0.6);
    color: var(--muted-color);
}

body.dark-mode hr {
    border-color: var(--border-color);
    opacity: 0.5;
}

body.dark-mode .border,
body.dark-mode .border-top,
body.dark-mode .border-bottom,
body.dark-mode .border-start,
body.dark-mode .border-end {
    border-color: var(--border-color) !important;
}

body.dark-mode .shadow,
body.dark-mode .shadow-sm,
body.dark-mode .shadow-lg {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

body.dark-mode .post-card {
    background-color: var(--card-bg);
}

body.dark-mode .post-documents .bg-light {
    background-color: rgba(255, 255, 255, 0.06) !important;
}

body.dark-mode .post-documents .text-dark {
    color: var(--text-color) !important;
}

body.dark-mode .post-pdf-preview {
    background-color: rgba(30, 36, 46, 0.8);
    border-color: rgba(148, 163, 184, 0.15);
}

body.dark-mode .post-pdf-preview iframe {
    background-color: #1e242e;
}

body.dark-mode .comments-section {
    background-color: var(--card-header-bg);
}

body.dark-mode .comment-item {
    background-color: var(--card-bg);
}

body.dark-mode footer {
    background: linear-gradient(135deg, rgba(13, 17, 23, 0.98), rgba(21, 26, 35, 0.95)) !important;
}

body.dark-mode .admin-sidebar {
    background-color: #161b22;
}

body.dark-mode .stats-card {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-mode .bg-white {
    background-color: var(--card-bg) !important;
}

body.dark-mode .bg-light {
    background-color: rgba(48, 54, 61, 0.6) !important;
}

body.dark-mode .bg-primary-subtle {
    background-color: rgba(88, 166, 255, 0.15) !important;
}

body.dark-mode .bg-success-subtle {
    background-color: rgba(35, 134, 54, 0.15) !important;
}

body.dark-mode .text-primary {
    color: #58a6ff !important;
}

body.dark-mode .text-success {
    color: #56d364 !important;
}

body.dark-mode .text-danger {
    color: #f85149 !important;
}

body.dark-mode .text-warning {
    color: #f0b429 !important;
}

body.dark-mode .badge.bg-light {
    background-color: rgba(48, 54, 61, 0.85) !important;
    color: var(--text-color) !important;
}

body.dark-mode .badge-soft {
    background: rgba(88, 166, 255, 0.15);
    color: #58a6ff;
}

body.dark-mode .badge-pill-soft {
    background: rgba(88, 166, 255, 0.15);
    color: #58a6ff;
}

body.dark-mode .pagination .page-link {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .pagination .page-link:hover {
    background-color: var(--surface-hover);
}

body.dark-mode .pagination .page-item.active .page-link {
    background: linear-gradient(120deg, #58a6ff, #1f6feb);
    border-color: transparent;
}

body.dark-mode ::-webkit-scrollbar-track {
    background: #161b22;
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: #30363d;
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* Additional dark mode fixes for specific Bootstrap classes */
body.dark-mode .card-header.bg-white,
body.dark-mode .card-footer.bg-white,
body.dark-mode .bg-white {
    background-color: var(--card-bg) !important;
    color: var(--text-color) !important;
}

body.dark-mode .card-header.bg-light,
body.dark-mode .card-footer.bg-light {
    background-color: var(--card-header-bg) !important;
    color: var(--text-color) !important;
}

body.dark-mode .border-0 {
    border-color: transparent !important;
}

body.dark-mode .text-dark {
    color: var(--text-color) !important;
}

body.dark-mode .badge.text-dark {
    color: var(--text-color) !important;
}

body.dark-mode .shadow,
body.dark-mode .shadow-sm,
body.dark-mode .shadow-lg {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.35) !important;
}

body.dark-mode .rounded-3 {
    background-color: var(--card-bg);
}

body.dark-mode pre {
    background-color: rgba(48, 54, 61, 0.85) !important;
    color: var(--text-color);
    border-color: var(--border-color) !important;
}

body.dark-mode code {
    background-color: rgba(48, 54, 61, 0.6);
    color: #f0b429;
}

body.dark-mode .nav-tabs {
    border-color: var(--border-color);
}

body.dark-mode .nav-tabs .nav-link {
    color: var(--muted-color);
}

body.dark-mode .nav-tabs .nav-link:hover {
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .nav-tabs .nav-link.active {
    background-color: var(--card-bg);
    border-color: var(--border-color) var(--border-color) var(--card-bg);
    color: var(--text-color);
}

body.dark-mode .nav-pills .nav-link {
    color: var(--muted-color);
}

body.dark-mode .nav-pills .nav-link:hover {
    background-color: var(--surface-hover);
    color: var(--text-color);
}

body.dark-mode .nav-pills .nav-link.active {
    background: linear-gradient(135deg, #58a6ff, #1f6feb);
    color: #fff;
}

body.dark-mode .accordion-item {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-mode .accordion-button {
    background-color: var(--card-bg);
    color: var(--text-color);
}

body.dark-mode .accordion-button:not(.collapsed) {
    background-color: rgba(88, 166, 255, 0.08);
    color: #58a6ff;
}

body.dark-mode .accordion-button::after {
    filter: invert(1);
}

body.dark-mode .accordion-body {
    background-color: var(--card-bg);
}

body.dark-mode .offcanvas {
    background-color: var(--card-bg);
    color: var(--text-color);
}

body.dark-mode .offcanvas-header {
    border-color: var(--border-color);
}

body.dark-mode .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

body.dark-mode .popover {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-mode .popover-header {
    background-color: var(--card-header-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .popover-body {
    color: var(--text-color);
}

body.dark-mode .tooltip-inner {
    background-color: var(--card-bg);
    color: var(--text-color);
}

body.dark-mode .toast {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .toast-header {
    background-color: var(--card-header-bg);
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .form-check-input {
    background-color: rgba(48, 54, 61, 0.85);
    border-color: var(--border-color);
}

body.dark-mode .form-check-input:checked {
    background-color: #58a6ff;
    border-color: #58a6ff;
}

body.dark-mode .form-check-label {
    color: var(--text-color);
}

body.dark-mode .form-switch .form-check-input {
    background-color: rgba(48, 54, 61, 0.85);
}

body.dark-mode .form-switch .form-check-input:checked {
    background-color: #58a6ff;
}

body.dark-mode .progress {
    background-color: rgba(48, 54, 61, 0.85);
}

body.dark-mode .input-group-text.bg-light {
    background-color: rgba(48, 54, 61, 0.85) !important;
}

body.dark-mode .email-shell .bg-light {
    background-color: rgba(48, 54, 61, 0.6) !important;
}

body.dark-mode .email-item {
    border-color: var(--border-color);
}

body.dark-mode .email-body {
    background-color: var(--card-bg);
}

body.dark-mode .mention-suggestions {
    background-color: var(--card-bg);
    border-color: var(--border-color);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

body.dark-mode .mention-suggestion-item:hover {
    background-color: var(--surface-hover);
}

/* Additional dark mode table fixes */
body.dark-mode .table-light,
body.dark-mode .table-light th,
body.dark-mode .table-light td,
body.dark-mode thead.table-light,
body.dark-mode thead.table-light th {
    background-color: rgba(48, 54, 61, 0.6) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

body.dark-mode .table-hover tbody tr:hover {
    background-color: var(--surface-hover) !important;
}

body.dark-mode .table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: rgba(48, 54, 61, 0.3);
}

/* Dark mode specific badge fixes */
body.dark-mode .badge.bg-light.text-dark,
body.dark-mode .badge.text-dark {
    background-color: rgba(48, 54, 61, 0.85) !important;
    color: var(--text-color) !important;
}

body.dark-mode .badge.bg-primary-subtle {
    background-color: rgba(88, 166, 255, 0.15) !important;
    color: #58a6ff !important;
}

body.dark-mode .badge.bg-success-subtle {
    background-color: rgba(35, 134, 54, 0.15) !important;
    color: #56d364 !important;
}

body.dark-mode .badge.bg-warning-subtle {
    background-color: rgba(133, 89, 0, 0.15) !important;
    color: #f0b429 !important;
}

body.dark-mode .badge.bg-danger-subtle {
    background-color: rgba(139, 32, 38, 0.15) !important;
    color: #f85149 !important;
}

body.dark-mode .badge.bg-info-subtle {
    background-color: rgba(31, 111, 235, 0.15) !important;
    color: #58a6ff !important;
}

body.dark-mode .badge.bg-secondary-subtle {
    background-color: rgba(110, 118, 129, 0.2) !important;
    color: #8b949e !important;
}

body.dark-mode .form-control-plaintext {
    color: var(--text-color);
}

body.dark-mode .reaction-summary-item {
    background-color: rgba(13, 110, 253, 0.18);
}

body.dark-mode .reaction-summary-item--love {
    background-color: rgba(214, 51, 132, 0.25);
}

body.dark-mode .reaction-summary-item--celebrate {
    background-color: rgba(253, 126, 20, 0.25);
}

body.dark-mode .reaction-summary-item--insightful {
    background-color: rgba(32, 201, 151, 0.25);
}

body.dark-mode .reaction-summary-item--support {
    background-color: rgba(102, 16, 242, 0.25);
}

body.dark-mode .connection-card {
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .reaction-picker {
    background-color: var(--card-bg);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.55);
}

body.dark-mode .reaction-picker::after {
    background-color: var(--card-bg);
    border-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .reaction-picker-item {
    color: var(--muted-color);
}

body.dark-mode .for-you-insights li {
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .connection-avatar {
    box-shadow: 0 3px 6px rgba(13, 110, 253, 0.35);
}

body.dark-mode .bg-light {
    background-color: rgba(255,255,255,0.06) !important;
}

body.dark-mode .text-muted {
    color: var(--muted-color) !important;
}

body.dark-mode .mention-suggestions {
    background-color: var(--card-bg);
    border-color: var(--border-color);
}

body.dark-mode .mention-suggestion-item:hover {
    background-color: var(--surface-hover);
}

/* Marketplace */
.marketplace-container {
    max-width: 1240px;
}

.marketplace-hero {
    background: linear-gradient(135deg, rgba(13,110,253,0.08), rgba(13,110,253,0.02));
    border: 1px solid rgba(13, 110, 253, 0.15);
}

.marketplace-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.marketplace-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(13, 110, 253, 0.15);
}

.marketplace-card-image {
    position: relative;
    overflow: hidden;
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
    height: 200px;
}

.marketplace-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.marketplace-type-badge,
.marketplace-featured {
    position: absolute;
    top: 12px;
    left: 12px;
    border-radius: 999px;
    font-size: 0.7rem;
    padding: 0.35rem 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.marketplace-featured {
    left: auto;
    right: 12px;
}

.marketplace-price {
    font-weight: 700;
    color: var(--primary-color);
}

.marketplace-price-main {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.marketplace-stat {
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
}

.marketplace-thumb {
    width: 64px;
    height: 64px;
    border-radius: var(--border-radius);
    overflow: hidden;
    flex-shrink: 0;
    background-color: #f8f9fa;
}

.marketplace-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.marketplace-related {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(13,110,253,0.08);
}

.marketplace-related:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(13,110,253,0.12);
}

.marketplace-related-thumb {
    height: 150px;
    overflow: hidden;
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}

.marketplace-related-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.marketplace-hero-image {
    height: 360px;
    object-fit: cover;
    border-top-left-radius: var(--border-radius);
    border-top-right-radius: var(--border-radius);
}

.marketplace-attribute {
    background-color: #f8f9fa;
    border-radius: var(--border-radius);
    padding: 1rem;
    height: 100%;
}

.marketplace-attribute .label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6c757d;
    margin-bottom: 0.35rem;
}

.marketplace-description p,
.marketplace-description ul,
.marketplace-description ol {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.marketplace-description ul,
.marketplace-description ol {
    padding-left: 1.1rem;
}

.marketplace-description li {
    margin-bottom: 0.25rem;
}

.marketplace-gallery-tile img {
    width: 100%;
    height: 160px;
    object-fit: cover;
}

.marketplace-delivery-options {
    background-color: #f8f9fa;
}

.marketplace-orders table td,
.marketplace-orders table th {
    vertical-align: middle;
}

.marketplace-orders .badge {
    letter-spacing: 0.05em;
    font-size: 0.7rem;
}

.marketplace-detail .card,
.marketplace-orders .card,
.marketplace-container .card {
    border-radius: var(--border-radius);
}

.bg-indigo {
    background-color: #4c3fef !important;
    color: #fff !important;
}

@media (max-width: 992px) {
    .marketplace-hero-image {
        height: 260px;
    }

    .marketplace-card-image {
        height: 180px;
    }
}

@media (max-width: 576px) {
    .marketplace-card-image {
        height: 160px;
    }

    .marketplace-thumb {
        width: 56px;
        height: 56px;
    }
}

/* Invoice Styles */
.invoice-table th {
    background-color: #f8f9fa;
}

.invoice-total {
    font-size: 1.25rem;
    font-weight: bold;
}

/* Product Card */
.product-card {
    transition: transform 0.2s;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(0,0,0,.15);
}

.product-image {
    height: 200px;
    object-fit: cover;
}

/* Portal Card */
.portal-card {
    border-left: 4px solid var(--primary-color);
}

.email-shell .card {
    border-radius: var(--border-radius-lg);
}

.email-grid .email-list {
    max-height: 70vh;
    overflow-y: auto;
}

.reaction-animate {
    animation: pop-react 250ms ease;
}

@keyframes pop-react {
    0% { transform: scale(0.9); }
    60% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.reaction-btn.active i {
    color: var(--primary-color);
}

.comment-like-btn.active i {
    color: #e11d48;
}

.email-item {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition-base);
    border-left: 3px solid transparent;
}

.email-item:hover {
    background: var(--surface-hover);
    border-left-color: var(--primary-color);
}

.email-item.active {
    background: rgba(29, 78, 216, 0.08);
    border-left-color: var(--primary-color);
}

.email-body {
    border-radius: var(--border-radius);
}

.email-shell .list-group-item {
    border: none;
    border-radius: var(--border-radius-sm);
    margin-bottom: 6px;
}

.email-shell .list-group-item.active {
    background: linear-gradient(115deg, #1d4ed8, #0f3ba7);
    color: #fff;
}

[data-voice-recorder] {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, #0d6efd, #0b5ed7);
    color: #fff !important;
    border: 1px solid #0a58ca;
    box-shadow: 0 6px 18px rgba(13, 110, 253, 0.25);
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

[data-voice-recorder]:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(13, 110, 253, 0.35);
    opacity: 0.95;
}

[data-voice-recorder] i {
    opacity: 0.9;
}

[data-voice-recorder].is-recording {
    background: linear-gradient(135deg, #dc3545, #b02a37);
    border-color: #a52834;
    box-shadow: 0 8px 22px rgba(220, 53, 69, 0.35);
}

[data-voice-recorder].is-processing {
    background: linear-gradient(135deg, #6c757d, #5c636a);
    border-color: #565e64;
    box-shadow: none;
    cursor: wait;
}

.voice-recording-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
    font-weight: 600;
    color: #dc3545;
}

.voice-recording-indicator.is-hidden {
    display: none;
}

.voice-recording-indicator .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 6px rgba(220, 53, 69, 0.18);
    animation: voicePulse 1.2s infinite;
}

.voice-recording-indicator.is-recording {
    animation: voiceBlink 1.2s infinite;
}

.voice-recording-indicator.is-processing {
    color: #0d6efd;
}

.voice-recording-indicator.is-processing .dot {
    background: currentColor;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.15);
    animation: none;
}

.voice-recording-indicator.is-success {
    color: #198754;
}

.voice-recording-indicator.is-error {
    color: #d63384;
}

@keyframes voiceBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}

@keyframes voicePulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

#voiceModal textarea {
    min-height: 120px;
}

@media (max-width: 991px) {
    .email-grid .border-end {
        border-right: none !important;
    }
    .email-grid .email-list {
        max-height: none;
    }
}

/* Admin Styles */
.admin-sidebar {
    background: linear-gradient(180deg, #1e3a5f 0%, #0f2847 100%);
    min-height: calc(100vh - 56px);
    color: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.admin-sidebar a {
    color: rgba(255,255,255,.8);
    padding: 0.85rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.admin-sidebar a i {
    width: 20px;
    text-align: center;
}

.admin-sidebar a:hover, .admin-sidebar a.active {
    background-color: rgba(255,255,255,.1);
    color: white;
    text-decoration: none;
    border-left-color: var(--primary-color);
}

.admin-sidebar a.active {
    background: linear-gradient(90deg, rgba(29, 78, 216, 0.3), transparent);
}

.stats-card {
    border-left: 4px solid var(--primary-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.stats-card.success {
    border-left-color: var(--success-color);
}

.stats-card.warning {
    border-left-color: var(--warning-color);
}

.stats-card.danger {
    border-left-color: var(--danger-color);
}

.glass-card {
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(255,255,255,0.35);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    box-shadow: var(--shadow-md);
}

body.dark-mode .glass-card {
    background: rgba(30, 35, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

body.dark-mode .admin-sidebar {
    background: linear-gradient(180deg, #161b22 0%, #0d1117 100%);
}

.hero-icon {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.metric-card {
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
}

.metric-kicker {
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.8rem;
    margin-bottom: 0.25rem;
}

.metric-value {
    font-size: 2.1rem;
    font-weight: 700;
    line-height: 1.1;
}

/* ========================================
   Enhanced Mobile Responsive Styles
   ======================================== */

/* Extra small devices (phones, 576px and down) */
@media (max-width: 575.98px) {
    .container-fluid {
        padding-left: 12px;
        padding-right: 12px;
    }
    
    .section-intro {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .section-intro .headline-group {
        max-width: 100%;
    }
    
    .section-intro .section-title {
        font-size: 1.5rem;
    }
    
    .section-intro .section-subtitle {
        font-size: 0.9rem;
    }
    
    .section-intro .actions {
        width: 100%;
        justify-content: center;
    }
    
    .section-intro .actions .btn {
        flex: 1;
        min-width: 0;
    }
    
    .metric-card {
        padding: 1rem;
    }
    
    .metric-card .metric-value {
        font-size: 1.6rem;
    }
    
    .card {
        border-radius: var(--border-radius-sm);
        margin-bottom: 0.75rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .join-choice-grid {
        grid-template-columns: 1fr;
    }

    .join-choice-box {
        min-height: 120px;
        padding: 1rem;
    }
    
    .btn {
        padding: 0.5rem 0.85rem;
        font-size: 0.875rem;
    }
    
    .btn-lg {
        padding: 0.65rem 1rem;
        font-size: 1rem;
    }
    
    .btn-sm {
        padding: 0.35rem 0.65rem;
        font-size: 0.8rem;
    }
    
    .table-responsive {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
    
    .dropdown-menu {
        min-width: 200px;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .modal-content {
        border-radius: var(--border-radius);
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .form-control,
    .form-select {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 0.6rem 0.75rem;
    }
    
    .post-card .card-body {
        padding: 0.75rem;
    }
    
    .post-images > img,
    .post-images > .img-fluid {
        max-height: 300px;
        aspect-ratio: 1 / 1;
    }
    
    .connection-card {
        padding: 0.6rem;
    }
    
    .connection-avatar {
        width: 40px;
        height: 40px;
    }
    
    .avatar-md {
        width: 36px;
        height: 36px;
    }
    
    .avatar-xl {
        width: 56px;
        height: 56px;
    }
    
    .py-4 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    
    .py-5 {
        padding-top: 2rem !important;
        padding-bottom: 2rem !important;
    }
    
    footer {
        padding: 2rem 0 !important;
    }
    
    footer .row {
        gap: 1.5rem;
    }

    .site-footer .footer-quick-links {
        font-size: 0.78rem;
    }

    .site-footer .footer-quick-links .mx-2 {
        margin-left: 0.35rem !important;
        margin-right: 0.35rem !important;
    }

    .site-footer .footer-bottom {
        gap: 0.75rem !important;
        align-items: center !important;
        text-align: center;
    }

    .site-footer .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .site-footer .footer-copyright {
        white-space: nowrap;
        font-size: clamp(0.65rem, 2.25vw, 0.82rem);
        line-height: 1.3;
        max-width: 100%;
    }

    .site-footer .footer-bottom > span {
        white-space: nowrap;
        font-size: clamp(0.68rem, 2.35vw, 0.85rem);
        line-height: 1.3;
    }
    
    footer h5 {
        font-size: 1.1rem;
    }
    
    footer h6 {
        font-size: 0.85rem;
    }
    
    .marketplace-card-image {
        height: 140px;
    }
    
    .marketplace-hero-image {
        height: 180px;
    }
    
    .kpi-badge {
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
    }
    
    .badge {
        font-size: 0.7rem;
        padding: 0.35em 0.65em;
    }
    
    h1, .h1 { font-size: 1.6rem; }
    h2, .h2 { font-size: 1.35rem; }
    h3, .h3 { font-size: 1.15rem; }
    h4, .h4 { font-size: 1rem; }
    h5, .h5 { font-size: 0.9rem; }
    h6, .h6 { font-size: 0.85rem; }
}

/* Small devices (landscape phones, 576px to 768px) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .section-intro .section-title {
        font-size: 1.6rem;
    }
    
    .metric-card .metric-value {
        font-size: 1.8rem;
    }
    
    .marketplace-card-image {
        height: 160px;
    }
}

/* Medium devices (tablets, 768px to 992px) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .section-intro .section-title {
        font-size: 1.75rem;
    }
    
    .metric-card .metric-value {
        font-size: 1.9rem;
    }
    
    .card-body {
        padding: 1.25rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .dropdown-item,
    .list-group-item-action,
    .nav-link {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }
    
    .btn-sm {
        min-height: 36px;
    }
    
    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }
    
    .form-control,
    .form-select {
        min-height: 44px;
    }
    
    .dropdown-item {
        padding: 0.75rem 1rem;
    }
    
    .list-group-item {
        padding: 0.85rem 1rem;
    }
    
    /* Remove hover effects that don't work on touch */
    .card[data-hover-elevate="true"]:hover,
    [data-hover-elevate]:hover {
        transform: none;
    }
    
    .hover-lift:hover {
        transform: none;
    }
    
    .post-card:hover {
        transform: none;
    }
    
    .connection-card:hover {
        transform: none;
    }
    
    .marketplace-card:hover {
        transform: none;
    }
    
    .portal-card:hover {
        transform: none;
    }
}

@media (max-width: 991.98px) {
    .nav-actions .btn-icon,
    .nav-actions .nav-link-icon,
    .nav-actions .nav-profile-trigger {
        width: 35px;
        height: 35px;
        min-width: 35px;
        min-height: 35px;
        flex: 0 0 35px;
        padding: 0;
    }
}

@media (max-width: 480px) {
    .nav-actions .btn-icon,
    .nav-actions .nav-link-icon,
    .nav-actions .nav-profile-trigger {
        width: 33px;
        height: 33px;
        min-width: 33px;
        min-height: 33px;
        flex-basis: 33px;
    }
}

/* Safe area padding for notched devices */
@supports (padding: max(0px)) {
    .navbar {
        padding-left: max(0.65rem, env(safe-area-inset-left));
        padding-right: max(0.65rem, env(safe-area-inset-right));
    }
    
    footer {
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }
    
    .container-fluid {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }
}

/* ========================================
   Professional Layout Enhancements
   ======================================== */

/* Enhanced card styles */
.card {
    backdrop-filter: blur(12px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced glass effect */
.glass-effect {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

body.dark-mode .glass-effect {
    background: rgba(30, 35, 42, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.dark-mode .gradient-text {
    background: linear-gradient(135deg, #58a6ff, #79b8ff);
    -webkit-background-clip: text;
    background-clip: text;
}

/* Enhanced section styling */
.section-intro {
    padding: 1rem 0;
    margin-bottom: 2rem;
}

/* Enhanced metric cards */
.metric-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-gradient-start), var(--primary-gradient-end));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.metric-card:hover::before {
    opacity: 1;
}

/* Enhanced table styling */
.table-modern {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table-modern thead th {
    background: linear-gradient(180deg, rgba(71, 118, 230, 0.06), rgba(71, 118, 230, 0.02));
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    padding: 1rem;
}

body.dark-mode .table-modern thead th {
    background: linear-gradient(180deg, rgba(88, 166, 255, 0.08), rgba(88, 166, 255, 0.02));
}

/* Enhanced form styling */
.form-floating > .form-control,
.form-floating > .form-select {
    border-radius: var(--border-radius-sm);
}

.form-group-enhanced {
    position: relative;
    margin-bottom: 1.25rem;
}

.form-group-enhanced .form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.form-group-enhanced .form-text {
    font-size: 0.8rem;
    color: var(--muted-color);
}

/* Enhanced empty states */
.empty-state {
    padding: 4rem 2rem;
    text-align: center;
    background: linear-gradient(180deg, rgba(71, 118, 230, 0.03), transparent);
    border-radius: var(--border-radius-lg);
    border: 2px dashed var(--border-color);
}

.empty-state i {
    font-size: 4rem;
    color: var(--muted-color);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h5 {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.empty-state p {
    max-width: 400px;
    margin: 0 auto 1.5rem;
}

/* Enhanced sidebar navigation */
.sidebar-nav {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
    color: var(--text-color);
    font-weight: 500;
    transition: all 0.2s ease;
}

.sidebar-nav .nav-link:hover {
    background: var(--surface-hover);
    color: var(--primary-color);
}

.sidebar-nav .nav-link.active {
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
    color: #fff;
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
}

/* Status indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.status-indicator.status-success {
    background: rgba(33, 177, 135, 0.1);
    color: var(--success-color);
}

.status-indicator.status-warning {
    background: rgba(245, 165, 36, 0.1);
    color: var(--warning-color);
}

.status-indicator.status-danger {
    background: rgba(240, 82, 99, 0.1);
    color: var(--danger-color);
}

.status-indicator.status-info {
    background: rgba(76, 183, 255, 0.1);
    color: var(--info-color);
}

/* Enhanced breadcrumb */
.breadcrumb-enhanced {
    background: var(--card-bg);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.breadcrumb-enhanced .breadcrumb-item {
    font-size: 0.875rem;
}

.breadcrumb-enhanced .breadcrumb-item.active {
    color: var(--text-color);
    font-weight: 500;
}

/* Enhanced loading states */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: inherit;
}

body.dark-mode .loading-overlay {
    background: rgba(13, 17, 23, 0.9);
}

/* Enhanced dividers */
.divider-with-text {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
}

.divider-with-text::before,
.divider-with-text::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider-with-text span {
    padding: 0 1rem;
    color: var(--muted-color);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Quick actions floating button */
.quick-action-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
    color: #fff;
    border: none;
    box-shadow: 0 6px 20px rgba(29, 78, 216, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

.quick-action-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(29, 78, 216, 0.45);
}

.quick-action-fab:active {
    transform: scale(0.95);
}

@media (max-width: 575.98px) {
    .quick-action-fab {
        bottom: max(16px, env(safe-area-inset-bottom));
        right: 16px;
        width: 50px;
        height: 50px;
    }
}

/* ========================================
   Additional Utility Classes
   ======================================== */

/* Text utilities */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.dark-mode .text-gradient {
    background: linear-gradient(135deg, #58a6ff, #79b8ff);
    -webkit-background-clip: text;
    background-clip: text;
}

/* Backdrop utilities */
.backdrop-blur {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.backdrop-blur-lg {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* Border utilities */
.border-gradient {
    border: 2px solid transparent;
    background: linear-gradient(var(--card-bg), var(--card-bg)) padding-box,
                linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end)) border-box;
    border-radius: var(--border-radius);
}

/* Interactive link styles */
.link-underline {
    text-decoration: none;
    background-image: linear-gradient(transparent calc(100% - 2px), currentColor 2px);
    background-repeat: no-repeat;
    background-size: 0% 100%;
    transition: background-size 0.3s ease;
}

.link-underline:hover {
    background-size: 100% 100%;
}

/* Focus visible styles for accessibility */
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.nav-link:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    z-index: 9999;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 10px;
    color: #fff;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

/* Selection styling */
::selection {
    background: rgba(29, 78, 216, 0.3);
    color: inherit;
}

body.dark-mode ::selection {
    background: rgba(88, 166, 255, 0.3);
}

/* Enhanced focus states */
.focus-ring:focus {
    box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.25);
}

body.dark-mode .focus-ring:focus {
    box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.25);
}

/* Aspect ratio utilities */
.aspect-square {
    aspect-ratio: 1 / 1;
}

.aspect-video {
    aspect-ratio: 16 / 9;
}

.aspect-portrait {
    aspect-ratio: 3 / 4;
}

/* Object fit utilities */
.object-cover {
    object-fit: cover;
}

.object-contain {
    object-fit: contain;
}

/* Transition utilities */
.transition-fast {
    transition: all 0.15s ease;
}

.transition-normal {
    transition: all 0.25s ease;
}

.transition-slow {
    transition: all 0.4s ease;
}

/* Z-index utilities */
.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }

/* Overflow utilities */
.overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.overflow-y-auto {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar but keep functionality */
.scrollbar-hidden {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.scrollbar-hidden::-webkit-scrollbar {
    display: none;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ==========================================
   MESSENGER / FULL-PAGE INBOX STYLES
   ========================================== */

.messenger-shell {
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--body-bg);
    z-index: 100;
}

.messenger-container {
    display: flex;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    background: var(--card-bg);
    box-shadow: var(--shadow-lg);
}

/* Sidebar */
.messenger-sidebar {
    width: 340px;
    min-width: 280px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
}

.messenger-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.messenger-search {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.messenger-conversations {
    flex: 1;
    overflow-y: auto;
}

.messenger-conversation-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    text-decoration: none;
    color: var(--text-color);
    border-bottom: 1px solid rgba(0,0,0,0.04);
    transition: background-color 0.15s ease;
    position: relative;
}

.messenger-conversation-item:hover {
    background: var(--surface-hover);
}

.messenger-conversation-item.active {
    background: rgba(13, 110, 253, 0.08);
    border-left: 3px solid var(--primary-color);
}

.messenger-conversation-item.unread {
    background: rgba(13, 110, 253, 0.04);
}

.messenger-conversation-item.unread .conversation-name {
    font-weight: 700;
}

.conversation-avatar {
    position: relative;
    flex-shrink: 0;
}

.conversation-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.conversation-avatar .online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #22c55e;
    border: 2px solid var(--card-bg);
    border-radius: 50%;
}

.conversation-content {
    flex: 1;
    min-width: 0;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
}

.conversation-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color);
}

.conversation-time {
    font-size: 0.75rem;
    color: var(--muted-color);
    flex-shrink: 0;
}

.conversation-preview {
    font-size: 0.85rem;
    color: var(--muted-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    background: var(--primary-color);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    min-width: 20px;
    text-align: center;
}

/* Chat Area */
.messenger-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--card-bg);
}

.messenger-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-header-bg);
}

.messenger-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: linear-gradient(180deg, rgba(13, 110, 253, 0.02) 0%, transparent 100%);
}

.messenger-message {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    max-width: 70%;
}

.messenger-message.own {
    margin-left: auto;
    flex-direction: row-reverse;
}

.message-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.message-bubble {
    padding: 0.65rem 1rem;
    border-radius: 1.25rem;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-color);
    position: relative;
}

.message-bubble p {
    margin: 0;
    line-height: 1.4;
    word-break: break-word;
}

.messenger-message.own .message-bubble {
    background: var(--primary-color);
    color: #fff;
    border-bottom-right-radius: 0.25rem;
}

.messenger-message:not(.own) .message-bubble {
    border-bottom-left-radius: 0.25rem;
}

.message-time {
    display: block;
    font-size: 0.65rem;
    color: var(--muted-color);
    margin-top: 0.25rem;
}

.messenger-message.own .message-time {
    color: rgba(255,255,255,0.7);
}

.messenger-message.sending .message-bubble {
    opacity: 0.7;
}

.messenger-message.failed .message-bubble {
    background: var(--danger-color);
}

/* Compose */
.messenger-compose {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--card-header-bg);
}

.compose-input-group {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.5rem;
}

.compose-input-group textarea {
    flex: 1;
    border: none;
    resize: none;
    background: transparent;
    padding: 0.5rem;
    font-size: 0.95rem;
    line-height: 1.4;
    max-height: 120px;
    color: var(--text-color);
}

.compose-input-group textarea:focus {
    outline: none;
}

.compose-input-group .btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Placeholder */
.messenger-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(13, 110, 253, 0.03) 0%, transparent 100%);
}

.placeholder-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(13, 110, 253, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--primary-color);
    margin: 0 auto 1.5rem;
}

/* Connection list in modal */
.connection-item:hover {
    background: var(--surface-hover);
}

/* Mobile Responsive */
@media (max-width: 767.98px) {
    .messenger-container {
        flex-direction: column;
    }
    
    .messenger-sidebar {
        width: 100%;
        min-width: 0;
        display: none;
    }
    
    .messenger-chat-area {
        display: none;
    }
    
    /* Show sidebar when no chat selected */
    .messenger-shell:not(.has-chat) .messenger-sidebar {
        display: flex;
    }
    
    /* Show chat when chat selected */
    .messenger-shell.has-chat .messenger-chat-area {
        display: flex;
    }
    
    .messenger-message {
        max-width: 85%;
    }
}

@media (min-width: 768px) {
    .messenger-sidebar,
    .messenger-chat-area {
        display: flex !important;
    }
}

/* ==========================================
   FLOATING CHAT BUBBLE
   ========================================== */

.chat-bubble-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
    color: #fff;
    border: none;
    box-shadow: 0 4px 20px rgba(13, 110, 253, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 1050;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-bubble-trigger:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 28px rgba(13, 110, 253, 0.5);
}

.chat-bubble-trigger:active {
    transform: scale(0.98);
}

.chat-bubble-trigger .unread-indicator {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 22px;
    height: 22px;
    background: #ef4444;
    color: #fff;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--card-bg);
}

/* Floating Chat Panel */
.chat-bubble-panel {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 360px;
    max-height: 500px;
    background: var(--card-bg);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1049;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.chat-bubble-panel.show {
    display: flex;
    animation: chatPanelSlideUp 0.25s ease;
}

@keyframes chatPanelSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-bubble-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-header-bg);
}

.chat-bubble-header h6 {
    margin: 0;
    font-weight: 600;
}

.chat-bubble-body {
    flex: 1;
    overflow-y: auto;
    max-height: 380px;
}

.chat-bubble-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--card-header-bg);
}

/* Mobile adjustments for bubble */
@media (max-width: 575.98px) {
    .chat-bubble-trigger {
        bottom: 16px;
        right: 16px;
        width: 54px;
        height: 54px;
        font-size: 1.25rem;
    }
    
    .chat-bubble-panel {
        bottom: 80px;
        right: 12px;
        left: 12px;
        width: auto;
        max-height: 60vh;
    }
}

/* New-message notification (soft-blinking green pill) */
.chat-msg-notif {
    position: fixed;
    left: 50%;
    bottom: calc(1.15rem + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%) translateY(1.4rem);
    z-index: 2200;
    display: none;
    align-items: center;
    gap: 0.5rem;
    max-width: 92vw;
    padding: 0.45rem 0.5rem 0.45rem 0.95rem;
    border-radius: 999px;
    background: #16a34a;
    color: #ffffff;
    box-shadow: 0 12px 30px rgba(16, 163, 74, 0.4);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.chat-msg-notif.is-visible {
    display: flex;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    animation: chatMsgNotifPulse 2s ease-in-out infinite;
}

@keyframes chatMsgNotifPulse {
    0%, 100% {
        background: #16a34a;
        box-shadow: 0 12px 28px rgba(16, 163, 74, 0.38);
    }
    50% {
        background: #22c55e;
        box-shadow: 0 14px 34px rgba(34, 197, 94, 0.62);
    }
}

.chat-msg-notif-main {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    background: none;
    border: none;
    color: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.2rem 0.25rem;
}

.chat-msg-notif-icon {
    display: inline-flex;
    font-size: 1.05rem;
}

.chat-msg-notif-text {
    white-space: nowrap;
}

.chat-msg-notif-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.chat-msg-notif-close:hover {
    background: rgba(255, 255, 255, 0.38);
}

@media (prefers-reduced-motion: reduce) {
    .chat-msg-notif.is-visible {
        animation: none;
    }
}

/* Dark Mode Messenger */
body.dark-mode .messenger-sidebar,
body.dark-mode .messenger-chat-area,
body.dark-mode .messenger-chat-header,
body.dark-mode .messenger-compose {
    background: rgba(255, 255, 255, 0.03);
}

body.dark-mode .messenger-conversation-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .messenger-conversation-item.active {
    background: rgba(13, 110, 253, 0.15);
}

body.dark-mode .message-bubble {
    background: rgba(255, 255, 255, 0.08);
}

body.dark-mode .messenger-message.own .message-bubble {
    background: var(--primary-color);
}

body.dark-mode .compose-input-group {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .chat-bubble-panel {
    background: #1a1a2e;
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .chat-bubble-header,
body.dark-mode .chat-bubble-footer {
    background: rgba(255, 255, 255, 0.03);
}

.xb-current-color {
    color: currentColor !important;
}

.xblivian-sidebar-icon {
    vertical-align: -0.16em;
}

.xblivian-dropdown-icon {
    vertical-align: -0.12em;
    margin-right: 0.35rem;
}

.xblivian-dashboard-page {
    --xbd-bg-1: #f3f7ff;
    --xbd-bg-2: #fbfdff;
    --xbd-text: #112244;
    --xbd-muted: #5d6f8e;
    --xbd-card-accent: #1f2937;
    --xbd-card-accent-soft: rgba(31, 41, 55, 0.82);
    --xbd-card-glow: rgba(31, 41, 55, 0.16);
    --xbd-surface: rgba(255, 255, 255, 0.82);
    --xbd-border: rgba(17, 34, 68, 0.1);
    --xbd-shadow: 0 26px 60px rgba(17, 34, 68, 0.12);
    --xbd-shadow-hover: 0 34px 80px rgba(17, 34, 68, 0.18);
    position: relative;
    width: 100%;
    overflow-x: clip;
    overflow-y: visible;
    isolation: isolate;
    background:
        radial-gradient(circle at 12% 18%, rgba(59, 130, 246, 0.16), transparent 28%),
        radial-gradient(circle at 88% 12%, rgba(16, 185, 129, 0.12), transparent 24%),
        linear-gradient(180deg, var(--xbd-bg-1) 0%, var(--xbd-bg-2) 100%);
}

.xblivian-dashboard-page::before,
.xblivian-dashboard-page::after {
    content: '';
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
    opacity: 0.55;
    filter: blur(2px);
}

.xblivian-dashboard-page::before {
    width: 360px;
    height: 360px;
    top: -120px;
    right: -120px;
    background: radial-gradient(circle, rgba(18, 54, 161, 0.18) 0%, rgba(18, 54, 161, 0) 68%);
}

.xblivian-dashboard-page::after {
    width: 280px;
    height: 280px;
    left: -80px;
    bottom: 12%;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.15) 0%, rgba(14, 165, 233, 0) 70%);
}

.xblivian-dashboard-shell,
.xblivian-placeholder-shell {
    position: relative;
    z-index: 1;
    width: 100%;
}

.xblivian-dashboard-hero,
.xblivian-placeholder-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--xbd-border);
    border-radius: 30px;
    background: var(--xbd-surface);
    backdrop-filter: blur(20px);
    box-shadow: var(--xbd-shadow);
}

.xblivian-dashboard-hero {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 0;
    margin-bottom: 1.5rem;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
}

.xblivian-dashboard-hero::before {
    display: none;
}

.xblivian-dashboard-hero::before,
.xblivian-placeholder-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(18, 54, 161, 0.08), transparent 45%),
        radial-gradient(circle at top right, rgba(59, 130, 246, 0.16), transparent 28%);
    pointer-events: none;
}

.xblivian-dashboard-hero-actions,
.xblivian-placeholder-card > * {
    position: relative;
    z-index: 1;
}

.xblivian-dashboard-title-row,
.xblivian-dashboard-hero-meta-row {
    position: relative;
    z-index: 1;
}

.xblivian-dashboard-title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
}

.xblivian-dashboard-title-row .xblivian-dashboard-live-pill {
    grid-column: 1;
    justify-self: start;
}

.xblivian-dashboard-title-row .xblivian-dashboard-title {
    grid-column: 2;
    justify-self: center;
}

.xblivian-dashboard-title-row .xblivian-dashboard-hero-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    grid-column: 3;
    justify-self: end;
}

.xblivian-dashboard-mobile-control {
    display: none;
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(17, 34, 68, 0.12);
    background: rgba(255, 255, 255, 0.82);
    color: var(--xbd-text);
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 10px 24px rgba(17, 34, 68, 0.08);
}

.xblivian-dashboard-mobile-control i {
    font-size: 1em;
    line-height: 1;
}

.xblivian-dashboard-mobile-control:hover {
    color: var(--xbd-text);
}

.xblivian-dashboard-mobile-notification-badge {
    position: absolute;
    top: -0.25rem;
    right: -0.2rem;
    min-width: 1rem;
    padding: 0.16rem 0.28rem;
    font-size: 0.58rem;
    line-height: 1;
}

.xblivian-dashboard-mobile-search[hidden] {
    display: none !important;
}

.xblivian-dashboard-mobile-search {
    display: grid;
    gap: 0.65rem;
}

.xblivian-dashboard-mobile-search-form {
    margin: 0;
}

.xblivian-dashboard-mobile-search-shell {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.85rem;
    border-radius: 18px;
    border: 1px solid rgba(17, 34, 68, 0.08);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 16px 30px rgba(17, 34, 68, 0.08);
}

.xblivian-dashboard-mobile-search-shell input {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--xbd-text);
    font-size: 0.96rem;
    outline: none;
}

.xblivian-dashboard-mobile-search-shell input::placeholder {
    color: var(--xbd-muted);
}

.xblivian-dashboard-mobile-search-shell button {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
    color: #ffffff;
    flex-shrink: 0;
}

.xblivian-dashboard-kicker,
.xblivian-placeholder-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.48rem 0.9rem;
    border-radius: 999px;
    background: rgba(18, 54, 161, 0.08);
    color: #1236a1;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.xblivian-dashboard-title,
.xblivian-placeholder-card h1 {
    margin: 0;
    color: var(--xbd-text);
    font-size: clamp(1.75rem, 2vw + 0.8rem, 2.35rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    text-align: center;
}

.xblivian-placeholder-card h1 {
    font-size: clamp(2.1rem, 4vw, 3.5rem);
}

.xblivian-dashboard-tagline,
.xblivian-placeholder-card p {
    max-width: 760px;
    margin: 0;
    color: var(--xbd-muted);
    font-size: clamp(1rem, 0.3vw + 0.95rem, 1.12rem);
    line-height: 1.75;
}

.xblivian-dashboard-hero-meta,
.xblivian-dashboard-hero-meta-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.xblivian-dashboard-hero-meta-row {
    justify-content: space-between;
}

.xblivian-dashboard-live-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    max-width: 100%;
    padding: 0.5rem 1.05rem;
    border-radius: 18px;
    background: rgba(17, 34, 68, 0.06);
    color: var(--xbd-text);
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0;
    white-space: nowrap;
    transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.xblivian-dashboard-live-text {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.06rem;
    min-width: 0;
    line-height: 1.15;
}

.xblivian-dashboard-live-heading {
    display: inline-flex;
    min-width: 0;
    align-items: center;
    gap: 0.42rem;
}

.xblivian-dashboard-live-title {
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0;
}

/* §26: the stamp is two centered lines under "● UPDATED" — the date
   ("Thu, Nov 5, 2026") and the 12-hour time ("10:45 AM"). */
.xblivian-dashboard-live-stamp {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.74rem;
    font-weight: 600;
    opacity: 0.82;
    white-space: nowrap;
    line-height: 1.25;
}

.xblivian-dashboard-live-date,
.xblivian-dashboard-live-time {
    display: block;
    text-align: center;
}

.xblivian-dashboard-live-stamp:empty {
    display: none;
}

.xblivian-dashboard-live-pill.is-refreshing {
    background: rgba(37, 99, 235, 0.1);
    color: #1d4ed8;
}

.xblivian-dashboard-live-pill.is-live {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.xblivian-dashboard-live-pill.is-error {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.xblivian-dashboard-live-dot {
    width: 0.68rem;
    height: 0.68rem;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 0 currentColor;
}

.xblivian-dashboard-live-icon-wrap {
    position: relative;
    display: inline-flex;
    width: 1rem;
    height: 1rem;
    align-items: center;
    justify-content: center;
    color: #047857;
    flex-shrink: 0;
    isolation: isolate;
}

.xblivian-dashboard-live-icon-wrap::after {
    content: '';
    position: absolute;
    inset: -0.14rem;
    border-radius: 999px;
    background: currentColor;
    opacity: 0;
    transform: scale(0.75);
    z-index: -1;
}

.xblivian-dashboard-live-icon {
    position: relative;
    display: block;
    width: 100% !important;
    height: 100% !important;
    color: inherit !important;
    z-index: 1;
}

.xblivian-dashboard-live-pill.is-refreshing .xblivian-dashboard-live-dot,
.xblivian-dashboard-live-pill.is-live .xblivian-dashboard-live-dot {
    animation: xblivianLivePulse 1.8s ease infinite;
}

.xblivian-dashboard-live-pill.is-refreshing .xblivian-dashboard-live-icon-wrap::after,
.xblivian-dashboard-live-pill.is-live .xblivian-dashboard-live-icon-wrap::after {
    animation: xblivianLiveLogoPulse 1.8s ease infinite;
}

.xblivian-dashboard-live-timestamp {
    color: var(--xbd-muted);
    font-size: 0.88rem;
    font-weight: 500;
}

.xblivian-dashboard-back {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.2rem;
    border-radius: 16px;
    border: 1px solid rgba(17, 34, 68, 0.1);
    background: rgba(255, 255, 255, 0.78);
    color: var(--xbd-text);
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.xblivian-dashboard-back:hover {
    transform: translateY(-2px);
    color: var(--xbd-text);
    border-color: rgba(18, 54, 161, 0.18);
    box-shadow: 0 16px 28px rgba(17, 34, 68, 0.1);
}

.xblivian-dashboard-create-btn,
.xblivian-tools-toggle-btn {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.08rem;
    min-width: 7.8rem;
    height: 3.18rem;
    min-height: 3.18rem;
    padding: 0.72rem 1.08rem;
    border-radius: 14px;
    border: 0;
    background: linear-gradient(135deg, #1236a1, #1d4ed8);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.84rem;
    letter-spacing: 0;
    line-height: 1.05;
    text-align: center;
    box-shadow: 0 16px 32px rgba(18, 54, 161, 0.32);
    cursor: pointer;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    text-decoration: none;
}

.xblivian-dashboard-create-label,
.xblivian-dashboard-create-shortcut {
    display: block;
}

.xblivian-dashboard-create-shortcut {
    font-size: 0.68rem;
    font-weight: 600;
    opacity: 0.86;
}

.xblivian-dashboard-create-btn:hover,
.xblivian-tools-toggle-btn:hover {
    transform: translateY(-2px);
    color: #ffffff;
    box-shadow: 0 22px 42px rgba(18, 54, 161, 0.42);
}

@media (max-width: 575.98px) {
    .xblivian-dashboard-create-btn {
        padding: 0.58rem 0.9rem;
    }
}

.xblivian-dashboard-mobile-create-row {
    display: none;
}

.xblivian-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.2rem;
    align-items: stretch;
    transform-style: preserve-3d;
}

/* ==========================================
   XBLIVIAN TOOLS DASHBOARD - FLIP ANIMATION
   ========================================== */

/* Perspective container for 3D flip effect */
.xblivian-dashboard-shell {
    perspective: 1200px;
}

.xblivian-tools-toggle-btn:active {
    transform: translateY(0);
}

.xblivian-tools-toggle-label,
.xblivian-tools-toggle-shortcut {
    display: block;
    white-space: nowrap;
}

.xblivian-tools-toggle-shortcut {
    font-size: 0.68rem;
    font-weight: 600;
    opacity: 0.86;
}

/* Back button for tools dashboard */
.xblivian-dashboard-back-to-main {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.2rem;
    border-radius: 16px;
    border: 1px solid rgba(17, 34, 68, 0.1);
    background: rgba(255, 255, 255, 0.78);
    color: var(--xbd-text, #112244);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.xblivian-dashboard-back-to-main:hover {
    transform: translateY(-2px);
    color: var(--xbd-text, #112244);
    border-color: rgba(18, 54, 161, 0.18);
    box-shadow: 0 16px 28px rgba(17, 34, 68, 0.1);
}

.xblivian-dashboard-back-to-main i {
    transition: transform 0.22s ease;
}

.xblivian-dashboard-back-to-main:hover i {
    transform: translateX(-4px);
}

/* Tools grid - hidden by default, shows after flip */
.xblivian-tools-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.2rem;
    align-items: stretch;
    opacity: 0;
    pointer-events: none;
    position: absolute;
    inset: 0;
    transition: opacity 0.45s ease 0.15s;
}

.xblivian-dashboard-grid.is-flipped ~ .xblivian-tools-grid {
    opacity: 1;
    pointer-events: auto;
    position: relative;
    inset: auto;
}

/* Loading state for flip animation */
.xblivian-dashboard-grid.is-loading {
    opacity: 0.7;
    pointer-events: none;
}

.xblivian-dashboard-grid.is-loading .xblivian-dashboard-card {
    animation: xblivianShimmer 1.5s ease-in-out infinite;
}

@keyframes xblivianShimmer {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Flip animation on mobile - adjusted duration */
@media (max-width: 575.98px) {
    .xblivian-tools-grid {
        transition: opacity 0.35s ease 0.12s;
    }
    
    .xblivian-tools-toggle-btn {
        padding: 0.58rem 0.9rem;
    }

    .xblivian-dashboard-mobile-create-row .xblivian-tools-toggle-btn,
    .xblivian-dashboard-mobile-create-row .xblivian-dashboard-create-btn {
        min-width: 8.4rem;
        flex: 1;
    }
}

/* Dark mode adjustments for toggle button */
body.dark-mode .xblivian-tools-toggle-btn {
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.22);
}

body.dark-mode .xblivian-tools-toggle-btn:hover {
    background: linear-gradient(135deg, var(--primary-gradient-start), #5a616b);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.22);
}

body.dark-mode .xblivian-dashboard-back-to-main {
    background: rgba(12, 22, 38, 0.92);
    border-color: rgba(148, 163, 184, 0.18);
    color: var(--xbd-text, #eef4ff);
}

body.dark-mode .xblivian-dashboard-back-to-main:hover {
    border-color: rgba(148, 163, 184, 0.32);
    box-shadow: 0 16px 28px rgba(2, 8, 23, 0.3);
}

.xblivian-dashboard-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 280px;
    min-width: 0;
    padding: 1.35rem;
    border-radius: 26px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(245, 249, 255, 0.88));
    box-shadow: 0 18px 38px rgba(17, 34, 68, 0.08);
    text-decoration: none;
    color: var(--card-accent, var(--xbd-card-accent));
    overflow: hidden;
    isolation: isolate;
    transform: rotateY(0deg);
    transform-style: preserve-3d;
    backface-visibility: hidden;
    will-change: transform, opacity;
    transition: transform 0.32s ease, box-shadow 0.32s ease, border-color 0.32s ease;
}

.xblivian-dashboard-grid.is-card-flipping-out,
.xblivian-dashboard-grid.is-card-flipping-in {
    pointer-events: none;
}

.xblivian-dashboard-grid.is-card-flipping-out .xblivian-dashboard-card {
    animation: xblivianCardFlipOut 220ms cubic-bezier(0.4, 0, 0.2, 1) both;
    animation-delay: calc(var(--flip-index, 0) * 28ms);
}

.xblivian-dashboard-grid.is-card-flipping-in .xblivian-dashboard-card {
    animation: xblivianCardFlipIn 220ms cubic-bezier(0.4, 0, 0.2, 1) both;
    animation-delay: calc(var(--flip-index, 0) * 28ms);
}

@keyframes xblivianCardFlipOut {
    0% {
        transform: rotateY(0deg);
        opacity: 1;
    }
    100% {
        transform: rotateY(90deg);
        opacity: 0.68;
    }
}

@keyframes xblivianCardFlipIn {
    0% {
        transform: rotateY(-90deg);
        opacity: 0.68;
    }
    100% {
        transform: rotateY(0deg);
        opacity: 1;
    }
}

@media (max-width: 575.98px) {
    .xblivian-dashboard-grid.is-card-flipping-out .xblivian-dashboard-card,
    .xblivian-dashboard-grid.is-card-flipping-in .xblivian-dashboard-card {
        animation-duration: 170ms;
        animation-delay: calc(var(--flip-index, 0) * 20ms);
    }
}

.xblivian-dashboard-card::before {
    content: '';
    position: absolute;
    inset: -20% auto auto -10%;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: var(--card-glow, var(--xbd-card-glow));
    opacity: 0.42;
    transform: scale(0.86);
    transition: transform 0.32s ease, opacity 0.32s ease;
    z-index: -2;
}

.xblivian-dashboard-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.36), transparent 48%, rgba(255, 255, 255, 0.08));
    opacity: 0.8;
    z-index: -1;
}

.xblivian-dashboard-card:hover {
    transform: translateY(-8px);
    color: var(--card-accent, var(--xbd-card-accent));
    border-color: rgba(18, 54, 161, 0.18);
    box-shadow: var(--xbd-shadow-hover);
}

.xblivian-dashboard-card:hover::before {
    transform: scale(1.05) translate(10px, 8px);
    opacity: 0.62;
}

.xblivian-dashboard-card:hover .xblivian-dashboard-icon-wrap {
    transform: translateY(-2px) scale(1.04);
}

.xblivian-dashboard-card:hover .xblivian-dashboard-card-foot i {
    transform: translateX(4px);
}

.xblivian-dashboard-card-top,
.xblivian-dashboard-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.9rem;
}

.xblivian-dashboard-icon-wrap {
    width: 62px;
    height: 62px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.84);
    border: 1px solid rgba(17, 34, 68, 0.08);
    color: var(--card-accent, var(--xbd-card-accent));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: transform 0.28s ease;
}

.xblivian-dashboard-icon {
    font-size: 1.55rem;
}

.xblivian-dashboard-xb-icon {
    width: 2.05rem !important;
    height: 2.05rem !important;
}

.xblivian-dashboard-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.38rem 0.7rem;
    border-radius: 999px;
    background: rgba(17, 34, 68, 0.08);
    color: var(--card-accent, var(--xbd-card-accent));
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.xblivian-dashboard-card-body {
    padding-top: 1.35rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.xblivian-dashboard-card-kicker {
    display: inline-block;
    margin-bottom: 0.75rem;
    color: var(--card-accent, var(--xbd-card-accent));
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.xblivian-dashboard-card h2 {
    margin: 0 0 0.8rem;
    color: var(--card-accent, var(--xbd-card-accent));
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.xblivian-dashboard-stat {
    display: grid;
    gap: 0.22rem;
    margin-bottom: 1rem;
    min-width: 0;
}

.xblivian-dashboard-stat-value {
    display: block;
    min-height: 2.75rem;
    max-width: 100%;
    color: var(--card-accent, var(--xbd-card-accent));
    font-size: clamp(2.15rem, 1.7rem + 1vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -0.06em;
    line-height: 1;
}

.xblivian-dashboard-stat-label {
    display: block;
    min-height: 1rem;
    max-width: 100%;
    color: var(--xbd-card-accent-soft);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.35;
    text-transform: uppercase;
}

.xblivian-dashboard-card[data-live="false"] .xblivian-dashboard-stat-value {
    color: var(--card-accent, var(--xbd-card-accent));
    letter-spacing: -0.03em;
}

.xblivian-dashboard-card p {
    margin: 0;
    color: var(--xbd-card-accent-soft);
    line-height: 1.7;
    font-size: 0.96rem;
}

.xblivian-dashboard-card.is-stat-loading .xblivian-dashboard-stat-value,
.xblivian-dashboard-card.is-stat-loading .xblivian-dashboard-stat-label {
    color: transparent;
    background: linear-gradient(90deg, rgba(203, 213, 225, 0.35), rgba(255, 255, 255, 0.9), rgba(203, 213, 225, 0.35));
    background-size: 220% 100%;
    animation: xblivianStatShimmer 1.5s ease-in-out infinite;
    border-radius: 999px;
}

.xblivian-dashboard-card.is-stat-loading .xblivian-dashboard-stat-value {
    width: 7rem;
}

.xblivian-dashboard-card.is-stat-loading .xblivian-dashboard-stat-label {
    width: 9.25rem;
}

.xblivian-dashboard-card.is-stat-error .xblivian-dashboard-stat-label {
    color: #b45309;
}

.xblivian-dashboard-card.accent-mail {
    --card-accent: #2563eb;
    --card-glow: rgba(37, 99, 235, 0.2);
}

.xblivian-dashboard-card.accent-ai {
    --card-accent: #1236a1;
    --card-glow: rgba(18, 54, 161, 0.22);
}

.xblivian-dashboard-card.accent-marketplace {
    --card-accent: #b45309;
    --card-glow: rgba(245, 158, 11, 0.24);
}

.xblivian-dashboard-card.accent-messages {
    --card-accent: #0f766e;
    --card-glow: rgba(20, 184, 166, 0.22);
}

.xblivian-dashboard-card.accent-calendar {
    --card-accent: #7c3aed;
    --card-glow: rgba(124, 58, 237, 0.22);
}

.xblivian-dashboard-card.accent-invoices {
    --card-accent: #dc2626;
    --card-glow: rgba(239, 68, 68, 0.22);
}

.xblivian-dashboard-card.accent-client-portals {
    --card-accent: #0284c7;
    --card-glow: rgba(14, 165, 233, 0.2);
}

.xblivian-dashboard-card.accent-team-portals {
    --card-accent: #4f46e5;
    --card-glow: rgba(99, 102, 241, 0.22);
}

.xblivian-dashboard-card.accent-phone-system {
    --card-accent: #16a34a;
    --card-glow: rgba(34, 197, 94, 0.2);
}

.xblivian-dashboard-card.accent-mail,
.xblivian-dashboard-card.accent-ai,
.xblivian-dashboard-card.accent-marketplace,
.xblivian-dashboard-card.accent-messages,
.xblivian-dashboard-card.accent-calendar,
.xblivian-dashboard-card.accent-invoices,
.xblivian-dashboard-card.accent-client-portals,
.xblivian-dashboard-card.accent-team-portals,
.xblivian-dashboard-card.accent-phone-system {
    --card-accent: var(--xbd-card-accent);
    --card-glow: var(--xbd-card-glow);
}

.xblivian-placeholder-card {
    padding: clamp(1.8rem, 2vw + 1rem, 3rem);
    text-align: center;
}

.xblivian-placeholder-card p {
    max-width: 640px;
    margin: 0.25rem auto 0;
}

.xblivian-placeholder-actions {
    display: flex;
    justify-content: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin-top: 1.75rem;
}

@media (max-width: 575.98px) {
    .xblivian-placeholder-card {
        padding: 1.25rem 1rem;
    }

    .xblivian-placeholder-actions {
        gap: 0.65rem;
        margin-top: 1.25rem;
    }

    .xblivian-placeholder-actions .btn {
        width: 100%;
        min-height: 44px;
    }
}

body.dark-mode .xblivian-dashboard-page {
    --xbd-bg-1: #08111f;
    --xbd-bg-2: #0e1627;
    --xbd-text: #eef4ff;
    --xbd-muted: #9db0cf;
    --xbd-card-accent: #f8fafc;
    --xbd-card-accent-soft: rgba(248, 250, 252, 0.82);
    --xbd-card-glow: rgba(248, 250, 252, 0.08);
    --xbd-surface: rgba(10, 18, 33, 0.78);
    --xbd-border: rgba(148, 163, 184, 0.16);
    --xbd-shadow: 0 26px 60px rgba(2, 8, 23, 0.38);
    --xbd-shadow-hover: 0 34px 80px rgba(2, 8, 23, 0.52);
}

body.dark-mode .xblivian-dashboard-kicker,
body.dark-mode .xblivian-placeholder-kicker {
    background: rgba(96, 165, 250, 0.14);
    color: #b8d4ff;
}

body.dark-mode .xblivian-dashboard-live-pill {
    background: rgba(148, 163, 184, 0.1);
    color: #dce8ff;
}

body.dark-mode .xblivian-dashboard-live-pill.is-refreshing {
    background: rgba(59, 130, 246, 0.16);
    color: #bfdbfe;
}

body.dark-mode .xblivian-dashboard-live-pill.is-live {
    background: rgba(16, 185, 129, 0.16);
    color: #a7f3d0;
}

body.dark-mode .xblivian-dashboard-live-pill.is-error {
    background: rgba(248, 113, 113, 0.16);
    color: #fecaca;
}

body.dark-mode .xblivian-dashboard-back {
    background: rgba(12, 22, 38, 0.92);
    border-color: rgba(148, 163, 184, 0.18);
    color: var(--xbd-text);
}

body.dark-mode .xblivian-dashboard-card {
    background: linear-gradient(180deg, rgba(11, 18, 32, 0.95), rgba(14, 23, 40, 0.9));
    border-color: rgba(148, 163, 184, 0.12);
    box-shadow: 0 18px 38px rgba(2, 8, 23, 0.35);
}

body.dark-mode .xblivian-dashboard-icon-wrap {
    background: rgba(7, 12, 23, 0.78);
    border-color: rgba(148, 163, 184, 0.12);
}

body.dark-mode .xblivian-dashboard-badge {
    background: rgba(148, 163, 184, 0.12);
    color: var(--card-accent, var(--xbd-card-accent));
}

body.dark-mode .xblivian-dashboard-card.is-stat-loading .xblivian-dashboard-stat-value,
body.dark-mode .xblivian-dashboard-card.is-stat-loading .xblivian-dashboard-stat-label {
    background: linear-gradient(90deg, rgba(51, 65, 85, 0.55), rgba(148, 163, 184, 0.5), rgba(51, 65, 85, 0.55));
    background-size: 220% 100%;
}

@media (max-width: 1199.98px) {
    .xblivian-dashboard-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    body.page-xblivian-dashboard .navbar {
        display: none !important;
    }

    body.page-xblivian-dashboard .app-main {
        padding-top: 0;
    }

    .xblivian-dashboard-page .container-fluid {
        padding-top: 1.5rem !important;
        padding-bottom: 0 !important;
        padding-left: 0.8rem;
        padding-right: 0.8rem;
    }

    .xblivian-dashboard-hero {
        margin-bottom: 1.5rem;
        gap: 0.65rem;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        backdrop-filter: none;
        box-shadow: none;
    }

    .xblivian-dashboard-hero::before {
        display: none;
    }

    .xblivian-dashboard-title-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
        gap: 0.5rem;
    }

    .xblivian-dashboard-mobile-control {
        display: inline-flex;
        grid-column: 1;
        justify-self: start;
        align-self: center;
        width: 66px;
        height: 66px;
        margin-inline-start: 0.35rem;
        font-size: 1.42rem;
        line-height: 1;
        background: linear-gradient(180deg, rgba(8, 9, 11, 0.96), rgba(74, 80, 89, 0.9));
        border-color: rgba(255, 255, 255, 0.12);
        color: #ffffff !important;
        box-shadow: 0 10px 22px rgba(17, 34, 68, 0.18);
    }

    .xblivian-dashboard-mobile-control:hover,
    .xblivian-dashboard-mobile-control:focus {
        color: #ffffff !important;
    }

    .xblivian-dashboard-mobile-notifications {
        grid-column: 3;
        justify-self: end;
        align-self: center;
        margin-inline-end: 0.35rem;
    }

    .xblivian-dashboard-title {
        display: none;
    }

    .xblivian-dashboard-hero-meta-row {
        align-items: center;
        flex-wrap: nowrap;
        gap: 0.6rem;
    }

    .xblivian-dashboard-title-row .xblivian-dashboard-live-pill {
        grid-column: 2;
        justify-self: center;
        align-self: center;
        flex: none;
        width: min(100%, 18rem);
        min-height: 52px;
        box-sizing: border-box;
        min-width: 0;
        padding: 0.5rem 0.85rem;
        gap: 0;
        font-size: 0.92rem;
        line-height: 1.15;
    }

    .xblivian-dashboard-live-pill [data-dashboard-live-message] {
        min-width: 0;
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
    }

    .xblivian-dashboard-live-text {
        width: 100%;
        align-items: center;
        gap: 0.16rem;
    }

    .xblivian-dashboard-live-heading {
        justify-content: center;
        gap: 0.46rem;
    }

    .xblivian-dashboard-live-icon-wrap {
        width: 1.15rem;
        height: 1.15rem;
    }

    .xblivian-dashboard-hero-actions,
    .xblivian-dashboard-title-row .xblivian-dashboard-hero-actions {
        display: none;
    }

    .xblivian-dashboard-mobile-search-shell {
        border-color: rgba(255, 255, 255, 0.12);
        background: linear-gradient(180deg, rgba(8, 9, 11, 0.96), rgba(74, 80, 89, 0.9));
        box-shadow: 0 16px 30px rgba(17, 34, 68, 0.18);
    }

    .xblivian-dashboard-mobile-search-shell input {
        color: #ffffff;
    }

    .xblivian-dashboard-mobile-search-shell input::placeholder {
        color: rgba(255, 255, 255, 0.62);
    }

    .xblivian-dashboard-mobile-search-shell button {
        background: rgba(255, 255, 255, 0.1);
        color: #ffffff;
    }

    .xblivian-dashboard-mobile-create-row {
        display: flex;
        justify-content: center;
        gap: 0.55rem;
        margin-top: 1rem;
    }

    .xblivian-dashboard-mobile-create-row .xblivian-tools-toggle-btn,
    .xblivian-dashboard-mobile-create-row .xblivian-dashboard-create-btn {
        min-width: 8.4rem;
        height: 3.18rem;
        min-height: 3.18rem;
        padding: 0.72rem 1.08rem;
    }

    body.page-xblivian-dashboard .site-footer {
        margin-top: 0 !important;
        padding-top: 0.85rem !important;
        padding-bottom: 1.25rem !important;
    }

    body.page-xblivian-dashboard .site-footer .divider {
        margin: 0.85rem 0;
    }

    .xblivian-dashboard-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 0.48rem;
    }

    .xblivian-dashboard-card {
        min-height: 0;
        aspect-ratio: 1 / 1;
        padding: 0.66rem 0.42rem 0.28rem;
        border-radius: 18px;
        border: 1.5px solid rgba(18, 54, 161, 0.24);
        box-shadow: 0 10px 22px rgba(17, 34, 68, 0.13);
        align-items: center;
        justify-content: center;
        gap: 0.32rem;
        text-align: center;
    }

    body.dark-mode .xblivian-dashboard-card {
        border-color: rgba(148, 163, 184, 0.36);
        box-shadow: 0 10px 24px rgba(2, 8, 23, 0.42);
    }

    /* Hide secondary content on mobile - keep only icon, title, stat number, stat label */
    .xblivian-dashboard-card-kicker,
    .xblivian-dashboard-card h2,
    .xblivian-dashboard-card p,
    .xblivian-dashboard-badge {
        display: none !important;
    }

    .xblivian-dashboard-card::before,
    .xblivian-dashboard-card::after {
        display: none;
    }

    .xblivian-dashboard-card-top {
        justify-content: center;
        gap: 0;
    }

    .xblivian-dashboard-icon-wrap {
        width: auto;
        height: auto;
        border-radius: 0;
        background: transparent;
        border: 0;
        box-shadow: none;
    }

    .xblivian-dashboard-icon {
        font-size: 1.6rem;
    }

    .xblivian-dashboard-xb-icon {
        width: 1.9rem !important;
        height: 1.9rem !important;
    }

    .xblivian-dashboard-card-body {
        flex: 0 1 auto;
        padding-top: 0;
        align-items: center;
        justify-content: center;
        text-align: center;
    }

    .xblivian-dashboard-stat {
        gap: 0.24rem;
        margin-bottom: 0;
        justify-items: center;
    }

    .xblivian-dashboard-stat-value {
        font-size: 1.55rem;
        min-height: 1.52rem;
        line-height: 1.05;
    }

    .xblivian-dashboard-stat-label {
        width: 100%;
        min-height: 2.15em;
        font-size: 0.64rem;
        letter-spacing: 0;
        line-height: 1.05;
        text-transform: uppercase;
        text-align: center;
        white-space: pre-line;
        overflow: visible;
        text-overflow: clip;
    }

    .xblivian-dashboard-card.is-stat-loading .xblivian-dashboard-stat-value {
        width: 4rem;
    }

    .xblivian-dashboard-card.is-stat-loading .xblivian-dashboard-stat-label {
        width: 5.5rem;
    }
}

@media (max-width: 360px) {
    .xblivian-dashboard-page .container-fluid {
        padding-left: 0.7rem;
        padding-right: 0.7rem;
    }

    .xblivian-dashboard-title-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 0.3rem;
    }

    .xblivian-dashboard-mobile-control {
        width: 56px;
        height: 56px;
        font-size: 1.22rem;
    }

    .xblivian-dashboard-title-row .xblivian-dashboard-live-pill {
        min-height: 46px;
        padding: 0.52rem 0.54rem;
        gap: 0.36rem;
        font-size: 0.78rem;
    }

    .xblivian-dashboard-live-icon-wrap {
        width: 0.95rem;
        height: 0.95rem;
    }

    .xblivian-dashboard-mobile-create-row .xblivian-tools-toggle-btn,
    .xblivian-dashboard-mobile-create-row .xblivian-dashboard-create-btn {
        padding-left: 0.72rem;
        padding-right: 0.72rem;
    }
}

@media (max-width: 300px) {
    .xblivian-dashboard-title-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 0.22rem;
    }

    .xblivian-dashboard-mobile-control {
        width: 46px;
        height: 46px;
        font-size: 1.08rem;
    }

    .xblivian-dashboard-title-row .xblivian-dashboard-live-pill {
        min-height: 40px;
        padding: 0.4rem 0.36rem;
        gap: 0.26rem;
        font-size: 0.68rem;
    }

    .xblivian-dashboard-live-icon-wrap {
        width: 0.8rem;
        height: 0.8rem;
    }
}

@media (max-width: 575.98px) {
    .xblivian-dashboard-page::before {
        width: 240px;
        height: 240px;
        top: -80px;
        right: -90px;
    }

    .xblivian-dashboard-page::after {
        width: 200px;
        height: 200px;
        left: -70px;
        bottom: 8%;
    }

    .xblivian-dashboard-hero,
    .xblivian-placeholder-card {
        border-radius: 24px;
    }

    .xblivian-dashboard-card {
        border-radius: 16px;
        padding: 0.66rem 0.42rem 0.28rem;
    }

    .xblivian-dashboard-title {
        font-size: 1.45rem;
    }
}

@keyframes xblivianLivePulse {
    0% {
        box-shadow: 0 0 0 0 currentColor;
        opacity: 1;
    }
    70% {
        box-shadow: 0 0 0 10px transparent;
        opacity: 0.45;
    }
    100% {
        box-shadow: 0 0 0 0 transparent;
        opacity: 1;
    }
}

@keyframes xblivianLiveLogoPulse {
    0% {
        opacity: 0.34;
        transform: scale(0.75);
    }
    70% {
        opacity: 0;
        transform: scale(2.35);
    }
    100% {
        opacity: 0;
        transform: scale(2.35);
    }
}

@keyframes xblivianStatShimmer {
    0% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0 50%;
    }
}

/* Stealth theme overrides */
:root {
    --primary-color: #32373f;
    --primary-color-dark: #131519;
    --primary-gradient-start: #08090b;
    --primary-gradient-end: #4a5059;
    --secondary-color: #5e646d;
    --info-color: #6b7280;
    --body-bg: linear-gradient(160deg, #f5f5f5 0%, #e5e7eb 100%);
    --card-bg: rgba(255, 255, 255, 0.94);
    --card-header-bg: rgba(248, 249, 250, 0.96);
    --border-color: rgba(32, 37, 44, 0.14);
    --muted-color: #6b7280;
    --surface-hover: rgba(32, 37, 44, 0.08);
    --glass-background: rgba(255, 255, 255, 0.78);
    --glass-border: rgba(255, 255, 255, 0.42);
}

body::before {
    background: radial-gradient(circle at 3% 10%, rgba(15, 23, 42, 0.14), transparent 45%),
                radial-gradient(circle at 92% 18%, rgba(75, 85, 99, 0.16), transparent 55%),
                radial-gradient(circle at 50% 90%, rgba(148, 163, 184, 0.18), transparent 45%);
}

.navbar,
.navbar-guest,
body.dark-mode .navbar-light {
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end)) !important;
    background-color: var(--primary-gradient-start) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.header-search .btn-icon,
.btn-primary,
.btn-gradient,
.xcu-launcher,
.xblivian-dashboard-create-btn,
.xblivian-tools-toggle-btn {
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
    color: #ffffff;
}

.btn {
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
}

.btn-primary:hover,
.btn-gradient:hover,
.xcu-launcher:hover,
.xblivian-dashboard-create-btn:hover,
.xblivian-tools-toggle-btn:hover {
    background: linear-gradient(135deg, var(--primary-gradient-start), #5a616b);
    box-shadow: 0 18px 32px rgba(15, 23, 42, 0.22);
}

.btn-outline-primary {
    border-color: rgba(32, 37, 44, 0.28);
    color: var(--primary-color);
    background: rgba(32, 37, 44, 0.05);
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background: rgba(32, 37, 44, 0.14);
    border-color: rgba(32, 37, 44, 0.4);
    color: var(--primary-color-dark);
}

.form-control:focus,
.form-select:focus,
.form-control:focus-visible,
.form-select:focus-visible {
    border-color: rgba(32, 37, 44, 0.36);
    box-shadow: 0 0 0 4px rgba(32, 37, 44, 0.12);
}

.navbar .btn-light {
    color: var(--primary-color-dark);
}

a,
.fa-check-circle.text-primary,
.xblivian-icon,
.xblivian-icon.text-primary,
.text-primary {
    color: var(--primary-color) !important;
}

a:hover {
    color: var(--primary-color-dark) !important;
}

.badge-soft,
.badge-pill-soft,
.bg-primary-subtle,
.badge.bg-primary-subtle.text-primary {
    background: rgba(32, 37, 44, 0.08) !important;
    color: var(--primary-color-dark) !important;
}

.metric-card:before {
    background: radial-gradient(circle, rgba(32, 37, 44, 0.12), transparent 70%);
}

.admin-sidebar a.active {
    background: linear-gradient(90deg, rgba(32, 37, 44, 0.22), transparent);
}

.table-modern thead th {
    background: linear-gradient(180deg, rgba(32, 37, 44, 0.08), rgba(32, 37, 44, 0.02));
}

.card-header,
.card-header[class*="bg-"],
.chat-panel .card-header,
.chat-conversation-header {
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end)) !important;
    background-color: transparent !important;
    border-color: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.card-header .text-muted,
.card-header .small,
.card-header .badge.text-dark,
.card-header .text-body,
.card-header .text-dark {
    color: rgba(255, 255, 255, 0.72) !important;
}

.card-header a:not(.btn),
.card-header .dropdown-toggle,
.card-header .nav-link,
.card-header i {
    color: inherit;
}

.card-header .btn-close {
    filter: invert(1) grayscale(1);
}

.list-group-item.active,
.nav-pills .nav-link.active,
.pagination .page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
    border-color: transparent;
    color: #ffffff;
}

.alert-info {
    background-color: rgba(32, 37, 44, 0.08);
    color: var(--primary-color-dark);
    border-color: rgba(32, 37, 44, 0.12);
}

.xblivian-dashboard-hero::before,
.xblivian-placeholder-card::before {
    background: linear-gradient(135deg, rgba(8, 9, 11, 0.08), transparent 45%),
                radial-gradient(circle at top right, rgba(90, 97, 107, 0.18), transparent 28%);
}

.xblivian-dashboard-kicker,
.xblivian-placeholder-kicker {
    background: rgba(19, 21, 25, 0.08);
    color: var(--primary-color-dark);
}

.xblivian-dashboard-live-pill.is-refreshing {
    background: rgba(32, 37, 44, 0.1);
    color: var(--primary-color-dark);
}

.xblivian-dashboard-card {
    background: linear-gradient(180deg, rgba(8, 9, 11, 0.96), rgba(74, 80, 89, 0.9));
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.18);
    color: #f8fafc;
}

.xblivian-dashboard-card::after {
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.12), transparent 48%, rgba(255, 255, 255, 0.04));
}

.xblivian-dashboard-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 28px 54px rgba(15, 23, 42, 0.3);
}

.xblivian-dashboard-icon-wrap,
.xblivian-dashboard-badge {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    color: #f8fafc;
}

.xblivian-dashboard-card.accent-mail,
.xblivian-dashboard-card.accent-ai,
.xblivian-dashboard-card.accent-marketplace,
.xblivian-dashboard-card.accent-messages,
.xblivian-dashboard-card.accent-calendar,
.xblivian-dashboard-card.accent-invoices,
.xblivian-dashboard-card.accent-client-portals,
.xblivian-dashboard-card.accent-team-portals,
.xblivian-dashboard-card.accent-phone-system {
    --card-accent: #f8fafc;
    --card-glow: rgba(255, 255, 255, 0.1);
}

.xblivian-dashboard-card-kicker,
.xblivian-dashboard-card h2,
.xblivian-dashboard-stat-value,
.xblivian-dashboard-stat-label,
.xblivian-dashboard-card p,
.xblivian-dashboard-card-foot {
    color: rgba(248, 250, 252, 0.88);
}

body.dark-mode {
    --primary-color: #d9dde3;
    --primary-color-dark: #f8fafc;
    --primary-gradient-start: #040506;
    --primary-gradient-end: #4a4f57;
    --body-bg: #0b0d10;
    --card-bg: rgba(16, 18, 22, 0.94);
    --card-header-bg: rgba(21, 24, 29, 0.96);
    --border-color: rgba(255, 255, 255, 0.09);
    --muted-color: #a9b0ba;
    --surface-hover: rgba(255, 255, 255, 0.06);
    --glass-background: rgba(18, 20, 24, 0.84);
    --glass-border: rgba(255, 255, 255, 0.08);
}

body.dark-mode::before {
    background: radial-gradient(circle at 3% 10%, rgba(255, 255, 255, 0.07), transparent 45%),
                radial-gradient(circle at 92% 18%, rgba(148, 163, 184, 0.06), transparent 55%),
                radial-gradient(circle at 50% 90%, rgba(71, 85, 105, 0.08), transparent 45%);
}

body.dark-mode .btn-outline-primary,
body.dark-mode .btn-outline-info,
body.dark-mode .navbar-light .btn-outline-primary {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.04);
}

body.dark-mode .btn-outline-primary:hover,
body.dark-mode .btn-outline-info:hover,
body.dark-mode .navbar-light .btn-outline-primary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
    color: #ffffff;
}

body.dark-mode .form-control:focus,
body.dark-mode .form-select:focus,
body.dark-mode .form-control:focus-visible,
body.dark-mode .form-select:focus-visible {
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.08);
}

body.dark-mode a,
body.dark-mode .text-primary,
body.dark-mode .metric-card .metric-value,
body.dark-mode .kpi-badge i,
body.dark-mode .badge-soft,
body.dark-mode .badge-pill-soft {
    color: var(--primary-color) !important;
}

body.dark-mode a:hover,
body.dark-mode .dropdown-item:hover,
body.dark-mode .dropdown-item:focus {
    color: #ffffff;
}

body.dark-mode .dropdown-item:hover,
body.dark-mode .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .bg-primary-subtle,
body.dark-mode .badge.bg-primary-subtle.text-primary,
body.dark-mode .badge-soft,
body.dark-mode .badge-pill-soft {
    background: rgba(255, 255, 255, 0.08) !important;
}

body.dark-mode .alert-info {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--primary-color);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .nav-pills .nav-link.active,
body.dark-mode .list-group-item.active,
body.dark-mode .pagination .page-item.active .page-link {
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
}

body.dark-mode .accordion-button:not(.collapsed) {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--primary-color);
}

body.dark-mode .xblivian-dashboard-kicker,
body.dark-mode .xblivian-placeholder-kicker,
body.dark-mode .xblivian-dashboard-live-pill.is-refreshing {
    background: rgba(255, 255, 255, 0.08);
    color: #eef2f7;
}

body.dark-mode .xblivian-dashboard-card {
    background: linear-gradient(180deg, rgba(4, 5, 6, 0.98), rgba(42, 45, 50, 0.92));
}

.chat-contact:hover,
.chat-contact.active,
body.dark-mode .chat-contact.active {
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.18);
}

.chat-message-bubble {
    background-color: rgba(32, 37, 44, 0.08);
}

.chat-message--own .chat-message-bubble,
body.dark-mode .chat-message-bubble,
body.dark-mode .chat-message--own .chat-message-bubble {
    background: linear-gradient(135deg, var(--primary-gradient-start), var(--primary-gradient-end));
    color: #ffffff;
}

.chat-status--seen {
    color: rgba(248, 250, 252, 0.82);
}

body.page-xblivian-dashboard .xblivian-dashboard-live-pill.is-refreshing {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

body.dark-mode.page-xblivian-dashboard .xblivian-dashboard-live-pill.is-refreshing {
    background: rgba(16, 185, 129, 0.16);
    color: #a7f3d0;
}

body.page-xblivian-dashboard .xblivian-dashboard-live-icon-wrap {
    color: #047857 !important;
}

body.dark-mode.page-xblivian-dashboard .xblivian-dashboard-live-icon-wrap {
    color: #22c55e !important;
}

body.page-xblivian-dashboard .xblivian-dashboard-card .xblivian-dashboard-xb-icon,
body.page-xblivian-dashboard .xblivian-dashboard-live-icon {
    color: inherit !important;
}
.min-w-0 {
    min-width: 0 !important;
}

.search-result-card .search-result-content {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.search-result-card,
.search-result-card .card-body,
.search-result-card .d-flex {
    min-width: 0;
    overflow: hidden;
}

.search-result-card .fw-semibold {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-card .search-result-url {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-ai-card {
    border-color: rgba(76, 183, 255, 0.28);
}

.search-ai-card .search-result-content {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.search-ai-answer {
    white-space: pre-line;
    overflow-wrap: break-word;
    line-height: 1.65;
}

.search-ai-section {
    min-width: 0;
}

.search-ai-list {
    padding-left: 1.1rem;
    color: var(--text-color);
}

.search-ai-list li + li {
    margin-top: 0.35rem;
}

.search-ai-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.search-ai-source {
    min-width: 0;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--primary-color);
    text-decoration: none;
}

.search-ai-source:hover {
    background: var(--surface-hover);
}

.search-ai-source-number {
    width: 1.25rem;
    height: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 999px;
    background: var(--surface-hover);
    font-size: 0.75rem;
    font-weight: 700;
}

.search-ai-source .search-result-url {
    display: block;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-ai-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.search-ai-question {
    max-width: 100%;
    padding: 0.35rem 0.55rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--muted-color);
    overflow-wrap: break-word;
}

/* =========================================================================
   Dark-only platform — neutralize Bootstrap's fixed light surfaces.
   The app ships a single permanent dark theme, so utility classes that paint
   a hard light background (bg-light / table-light panels) must never render as
   light islands. Scoped to [data-bs-theme="dark"] so it also covers standalone
   and public pages that set the attribute on <html>. Intentional light chips
   that pair a light background with dark text (e.g. .badge.bg-light.text-dark)
   keep their look via the guards.
   ========================================================================= */
[data-bs-theme="dark"] .bg-light:not(.text-dark):not(.badge) {
    background-color: var(--card-bg) !important;
    color: var(--text-color);
}

[data-bs-theme="dark"] .card-header.bg-light,
[data-bs-theme="dark"] .card-footer.bg-light {
    background-color: var(--card-header-bg) !important;
    color: var(--text-color);
}

[data-bs-theme="dark"] .table-light,
[data-bs-theme="dark"] thead.table-light th,
[data-bs-theme="dark"] .table-light > th,
[data-bs-theme="dark"] .table-light > td {
    background-color: rgba(255, 255, 255, 0.04) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

/* =========================================================================
   Dashboard viewport-fit layout
   Keep the 3 x 4 launch grid visible on ordinary screens, distribute extra
   vertical room cleanly, and fall back to natural scrolling on short displays.
   ========================================================================= */
body.page-xblivian-dashboard .xblivian-dashboard-page {
    min-height: calc(100vh - 4rem);
    min-height: calc(100dvh - 4rem);
}

body.page-xblivian-dashboard .xblivian-dashboard-page > .container-fluid {
    padding-top: clamp(0.75rem, 2.4dvh, 3rem) !important;
    padding-bottom: clamp(0.75rem, 2.4dvh, 3rem) !important;
}

body.page-xblivian-dashboard .xblivian-dashboard-hero {
    margin-bottom: clamp(0.55rem, 1.8dvh, 1.5rem);
}

.xblivian-dashboard-tools-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: clamp(0.5rem, 1.4dvh, 1rem);
}

.xblivian-dashboard-tools-toolbar[hidden] {
    display: none !important;
}

.xblivian-dashboard-tools-context {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--xbd-text);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.xblivian-dashboard-tools-toolbar .xblivian-dashboard-back-to-main {
    min-height: 44px;
    padding: 0.65rem 0.9rem;
}

@media (min-width: 768px) {
    body.page-xblivian-dashboard .xblivian-dashboard-grid {
        height: max(560px, calc(100vh - 190px));
        height: max(560px, calc(100dvh - 190px));
        grid-template-rows: repeat(var(--dashboard-grid-rows, 2), minmax(0, 1fr));
        column-gap: clamp(0.55rem, 1.4vw, 1.2rem);
        row-gap: clamp(0.625rem, 1.8dvh, 2.5rem);
    }

    body.page-xblivian-dashboard .xblivian-dashboard-shell.is-tools-view .xblivian-dashboard-grid {
        height: max(520px, calc(100vh - 245px));
        height: max(520px, calc(100dvh - 245px));
    }

    body.page-xblivian-dashboard .xblivian-dashboard-card {
        align-self: center;
        width: 100%;
        height: 100%;
        max-height: 300px;
        min-height: 0;
        padding: clamp(0.65rem, 1.3dvh, 1.1rem);
        border-radius: clamp(18px, 2.4dvh, 26px);
    }

    body.page-xblivian-dashboard .xblivian-dashboard-icon-wrap {
        width: clamp(40px, 5.2dvh, 56px);
        height: clamp(40px, 5.2dvh, 56px);
        border-radius: clamp(13px, 1.8dvh, 18px);
    }

    body.page-xblivian-dashboard .xblivian-dashboard-card-body {
        padding-top: clamp(0.35rem, 1dvh, 0.9rem);
    }

    body.page-xblivian-dashboard .xblivian-dashboard-card h2 {
        margin-bottom: clamp(0.3rem, 0.8dvh, 0.65rem);
        font-size: clamp(1rem, 1.8dvh, 1.3rem);
    }

    body.page-xblivian-dashboard .xblivian-dashboard-stat {
        gap: 0.12rem;
        margin-bottom: clamp(0.25rem, 0.7dvh, 0.7rem);
    }

    body.page-xblivian-dashboard .xblivian-dashboard-stat-value {
        min-height: 0;
        font-size: clamp(1.45rem, 3dvh, 2.2rem);
    }

    body.page-xblivian-dashboard .xblivian-dashboard-stat-label {
        min-height: 0;
        font-size: clamp(0.66rem, 1.05dvh, 0.76rem);
        line-height: 1.2;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-card p {
        display: -webkit-box;
        overflow: hidden;
        font-size: clamp(0.76rem, 1.2dvh, 0.9rem);
        line-height: 1.35;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }
}

@media (min-width: 768px) and (max-height: 1100px) {
    body.page-xblivian-dashboard .xblivian-dashboard-card p {
        display: none;
    }

    body.page-xblivian-dashboard .site-footer {
        padding-top: 0.75rem !important;
        padding-bottom: 0.85rem !important;
    }

    body.page-xblivian-dashboard .site-footer .divider {
        margin-block: 0.65rem;
    }
}

@media (max-width: 767.98px) {
    body.page-xblivian-dashboard .xblivian-dashboard-page {
        min-height: 100vh;
        min-height: 100dvh;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-page > .container-fluid {
        padding-top: clamp(0.6rem, 2.4dvh, 1.5rem) !important;
        padding-bottom: max(0.6rem, env(safe-area-inset-bottom, 0px)) !important;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-hero {
        margin-bottom: clamp(0.5rem, 2dvh, 1.25rem);
    }

    body.page-xblivian-dashboard .xblivian-dashboard-grid {
        height: max(440px, calc(100vh - 7.5rem - env(safe-area-inset-bottom, 0px)));
        height: max(440px, calc(100dvh - 7.5rem - env(safe-area-inset-bottom, 0px)));
        grid-template-rows: repeat(var(--dashboard-grid-rows, 2), minmax(96px, 1fr));
        column-gap: clamp(0.35rem, 1.6vw, 0.55rem);
        row-gap: clamp(0.625rem, 2dvh, 1.3rem);
        align-content: stretch;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-shell.is-tools-view .xblivian-dashboard-grid {
        height: max(440px, calc(100vh - 10.8rem - env(safe-area-inset-bottom, 0px)));
        height: max(440px, calc(100dvh - 10.8rem - env(safe-area-inset-bottom, 0px)));
    }

    body.page-xblivian-dashboard .xblivian-dashboard-card {
        align-self: center;
        width: 100%;
        height: 100%;
        max-height: 140px;
        min-height: 0;
        aspect-ratio: auto;
    }

    .xblivian-dashboard-tools-toolbar {
        margin-bottom: clamp(0.4rem, 1.2dvh, 0.75rem);
    }

    .xblivian-dashboard-tools-context {
        font-size: 0.72rem;
        letter-spacing: 0.04em;
    }

    .xblivian-dashboard-tools-toolbar .xblivian-dashboard-back-to-main {
        min-height: 44px;
        padding: 0.55rem 0.7rem;
        border-radius: 12px;
        font-size: 0.78rem;
    }

    body.page-xblivian-dashboard .site-footer {
        padding-top: 0.7rem !important;
        padding-bottom: max(0.8rem, env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* Main Dashboard only: make the navbar, launch grid, and footer share exactly
   one viewport. The Tools workspace deliberately opts out and keeps natural
   document scrolling because its card count can grow over time. */
body.page-xblivian-dashboard:not(.dashboard-tools-open) {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
}

body.page-xblivian-dashboard.dashboard-tools-open {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-y: auto;
}

body.page-xblivian-dashboard:not(.dashboard-tools-open) .navbar,
body.page-xblivian-dashboard:not(.dashboard-tools-open) .site-footer {
    flex: 0 0 auto;
}

body.page-xblivian-dashboard:not(.dashboard-tools-open) .app-main {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-page,
body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-page > .container-fluid,
body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-page > .container-fluid > .row,
body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-page > .container-fluid > .row > [class*="col-"],
body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-shell {
    min-height: 0;
    height: 100%;
}

body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-page {
    display: flex;
    overflow: hidden;
}

body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-page > .container-fluid {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
}

body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-page > .container-fluid > .row {
    display: flex;
    flex-direction: row;
    flex: 1 1 0;
}

body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-page > .container-fluid > .row > [class*="col-"] {
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
}

body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-shell {
    display: flex;
    flex-direction: column;
}

body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-hero {
    flex: 0 0 auto;
}

body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-grid {
    flex: 1 1 0;
    height: auto !important;
    min-height: 0;
    grid-template-rows: repeat(var(--dashboard-grid-rows, 2), minmax(0, 1fr));
    row-gap: clamp(0.3rem, 1.35dvh, 1.4rem);
    align-content: stretch;
}

body.page-xblivian-dashboard:not(.dashboard-tools-open) .site-footer {
    margin-top: 0 !important;
    padding-top: clamp(0.45rem, 1.2dvh, 0.85rem) !important;
    padding-bottom: max(clamp(0.5rem, 1.25dvh, 0.9rem), env(safe-area-inset-bottom, 0px)) !important;
}

body.page-xblivian-dashboard:not(.dashboard-tools-open) .site-footer .divider {
    margin-block: clamp(0.3rem, 0.8dvh, 0.6rem);
}

body.page-xblivian-dashboard:not(.dashboard-tools-open) .site-footer .footer-bottom {
    gap: clamp(0.1rem, 0.45dvh, 0.35rem) !important;
}

@media (max-width: 767.98px) {
    body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-page > .container-fluid {
        padding-top: clamp(0.4rem, 1.6dvh, 0.9rem) !important;
        padding-bottom: clamp(0.35rem, 1.3dvh, 0.75rem) !important;
    }

    body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-hero {
        margin-bottom: clamp(0.3rem, 1.25dvh, 0.75rem);
    }

    body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-grid {
        grid-template-rows: repeat(var(--dashboard-grid-rows, 2), minmax(0, 1fr));
        row-gap: clamp(0.25rem, 1dvh, 0.7rem);
    }

    body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-card {
        padding-top: clamp(0.22rem, 1dvh, 0.66rem);
        padding-bottom: clamp(0.16rem, 0.7dvh, 0.4rem);
        gap: clamp(0.08rem, 0.45dvh, 0.32rem);
    }

    body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-icon {
        font-size: clamp(1.1rem, 3.6dvh, 1.6rem);
    }

    body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-xb-icon {
        width: clamp(1.3rem, 4dvh, 1.9rem) !important;
        height: clamp(1.3rem, 4dvh, 1.9rem) !important;
    }

    body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-stat-value {
        min-height: 0;
        font-size: clamp(1.05rem, 3.4dvh, 1.55rem);
    }

    body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-stat-label {
        min-height: 0;
        font-size: clamp(0.54rem, 1.35dvh, 0.64rem);
    }
}

@media (max-width: 380px) {
    .xblivian-dashboard-tools-context {
        display: none;
    }

    .xblivian-dashboard-tools-toolbar {
        justify-content: flex-end;
    }
}

/* The compact global navigation is intentionally absent below the desktop
   breakpoint. Individual modules keep their own in-page controls/navigation. */
@media (max-width: 991.98px) {
    body > .navbar {
        display: none !important;
    }
}

/* The shared legal footer belongs to the Main Dashboard only. When its Tools
   workspace is open, restore the full-height, footer-free workspace. */
body.page-xblivian-dashboard.dashboard-tools-open > .site-footer {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    body.page-xblivian-dashboard .xblivian-dashboard-card {
        animation-duration: 1ms !important;
        animation-delay: 0ms !important;
    }
}

/* ===================================================================
   Shared compact UI kit — one header/stat/panel system for module pages
   (Invoices, Marketplace, Wallet, Search). Dark / stealth palette.
   =================================================================== */
.ui-page { padding-top: 1.25rem; padding-bottom: 2.5rem; }

.ui-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem 1rem;
    margin: 0 0 1rem;
}
.ui-page-head-text { min-width: 0; }
.ui-page-title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -.01em;
    color: #f4f6f8;
}
.ui-page-sub { margin: .2rem 0 0; font-size: .85rem; color: var(--muted-color, #a9b0ba); }
.ui-page-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.ui-page-actions .btn { white-space: nowrap; }

.ui-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}
.ui-stat {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: .2rem;
    min-width: 0;
    padding: .85rem 1rem .85rem 1.15rem;
    border: 1px solid var(--border-color, rgba(255, 255, 255, .09));
    border-radius: 12px;
    background: var(--card-bg, rgba(16, 18, 22, .94));
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color .15s ease, background .15s ease;
}
a.ui-stat:hover { border-color: rgba(255, 255, 255, .2); background: rgba(24, 27, 32, .96); }
.ui-stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--ui-accent, rgba(255, 255, 255, .25)); }
.ui-stat--info { --ui-accent: #38bdf8; }
.ui-stat--warn { --ui-accent: #f59e0b; }
.ui-stat--danger { --ui-accent: #f43f5e; }
.ui-stat--ok { --ui-accent: #22c55e; }
.ui-stat-label {
    display: flex;
    align-items: center;
    gap: .45rem;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--muted-color, #a9b0ba);
}
.ui-stat-label i { color: var(--ui-accent, #a9b0ba); }
.ui-stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.15; color: #f8fafc; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ui-stat-sub { font-size: .78rem; color: var(--muted-color, #a9b0ba); }

.ui-panel {
    border: 1px solid var(--border-color, rgba(255, 255, 255, .09));
    border-radius: 12px;
    background: var(--card-bg, rgba(16, 18, 22, .94));
    margin-bottom: 1rem;
}
.ui-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .4rem 1rem;
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, .09));
}
.ui-panel-title { display: flex; align-items: center; gap: .5rem; margin: 0; font-size: .95rem; font-weight: 600; color: #eef1f4; }
.ui-panel-title i { color: var(--muted-color, #a9b0ba); font-size: .85rem; }
.ui-panel-hint { margin: .15rem 0 0; font-size: .78rem; color: var(--muted-color, #a9b0ba); }
.ui-panel-meta { font-size: .78rem; color: var(--muted-color, #a9b0ba); }
.ui-panel-body { padding: 1rem; }
.ui-panel .table { margin-bottom: 0; }
.ui-panel .table > :not(caption) > * > * { padding: .65rem 1rem; }
.ui-panel .table thead th {
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted-color, #a9b0ba);
    border-bottom-color: var(--border-color, rgba(255, 255, 255, .09));
    white-space: nowrap;
}
.ui-empty { padding: 2.25rem 1rem; text-align: center; color: var(--muted-color, #a9b0ba); }
.ui-empty > i { display: block; font-size: 1.5rem; margin-bottom: .6rem; opacity: .7; }
.ui-empty p { margin: 0 0 .75rem; font-size: .88rem; }

.ui-tabs { display: flex; gap: .25rem; flex-wrap: wrap; margin-bottom: 1rem; border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, .09)); }

@media (max-width: 575.98px) {
    .ui-page { padding-top: .75rem; }
    .ui-page-title { font-size: 1.2rem; }
    .ui-page-actions { width: 100%; }
    .ui-page-actions .btn { flex: 1 1 auto; }
    .ui-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
    .ui-stat { padding: .7rem .8rem .7rem .95rem; }
    .ui-stat-value { font-size: 1.15rem; }
    .ui-panel .table > :not(caption) > * > * { padding: .55rem .75rem; }
}

/* ===== Xblivian Boss mobile dashboard card + mobile refinements ===== */
.xblivian-boss-mobile-card {
    display: none;
    border: 0;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

@media (max-width: 767.98px) {
    /* Full-width Xblivian Boss card under the 6 dashboard boxes */
    body.page-xblivian-dashboard .xblivian-boss-mobile-card {
        display: flex;
        grid-column: 1 / -1;
        flex-direction: row;
        align-items: center;
        gap: 0.85rem;
        width: 100%;
        height: auto;
        max-height: none;
        aspect-ratio: auto;
        padding: 0.85rem 1rem;
    }

    body.page-xblivian-dashboard .xblivian-boss-mobile-card .xblivian-dashboard-card-top,
    body.page-xblivian-dashboard .xblivian-boss-mobile-card .xblivian-dashboard-card-body {
        padding-top: 0;
    }

    body.page-xblivian-dashboard .xblivian-boss-mobile-card h2 {
        margin-bottom: 0.1rem;
    }


    /* 6 boxes: 2 rows x 3 columns, squarer cards, larger labels, more air */
    body.page-xblivian-dashboard .xblivian-dashboard-grid {
        column-gap: clamp(0.5rem, 2.4vw, 0.9rem);
    }

    body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-grid {
        row-gap: clamp(0.55rem, 2dvh, 1.15rem);
    }

    body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-card {
        max-height: none;
    }

    body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-card h2 {
        font-size: clamp(0.98rem, 2.5dvh, 1.2rem);
        line-height: 1.12;
    }

    body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-stat-value {
        font-size: clamp(1.25rem, 3.8dvh, 1.75rem);
    }

    body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-stat-label {
        font-size: clamp(0.74rem, 1.9dvh, 0.88rem);
        letter-spacing: 0.04em;
        line-height: 1.25;
    }

    body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-icon-wrap {
        width: clamp(44px, 6.5dvh, 58px);
        height: clamp(44px, 6.5dvh, 58px);
    }

    body.page-xblivian-dashboard:not(.dashboard-tools-open) .xblivian-dashboard-icon {
        font-size: clamp(1.3rem, 4.2dvh, 1.8rem);
    }

    /* Mobile header: no filled pill behind Updated — just the blinking dot
       and text; larger, perfectly round bell/search buttons. */
    body.page-xblivian-dashboard .xblivian-dashboard-title-row .xblivian-dashboard-live-pill,
    body.page-xblivian-dashboard .xblivian-dashboard-title-row .xblivian-dashboard-live-pill.is-refreshing,
    body.page-xblivian-dashboard .xblivian-dashboard-title-row .xblivian-dashboard-live-pill.is-live,
    body.page-xblivian-dashboard .xblivian-dashboard-title-row .xblivian-dashboard-live-pill.is-error {
        background: transparent;
        box-shadow: none;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-mobile-control {
        width: 66px;
        height: 66px;
        border-radius: 50%;
        font-size: 1.5rem;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-title-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-title-row .xblivian-dashboard-live-title {
        font-size: 1.02rem;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-title-row .xblivian-dashboard-live-stamp {
        font-size: 0.8rem;
    }
}

@media (max-width: 380px) {
    body.page-xblivian-dashboard .xblivian-dashboard-title-row .xblivian-dashboard-live-stamp {
        font-size: 0.68rem;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-mobile-control {
        width: 56px;
        height: 56px;
        font-size: 1.3rem;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-title-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }
}

@media (max-width: 300px) {
    body.page-xblivian-dashboard .xblivian-dashboard-mobile-control {
        width: 48px;
        height: 48px;
        font-size: 1.14rem;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-title-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }
}

/* Final dashboard layout: a compact vertical launcher with Assistant included. */
body.page-xblivian-dashboard .xblivian-dashboard-grid {
    grid-template-columns: minmax(0, 720px);
    justify-content: center;
    gap: 0.7rem;
}

body.page-xblivian-dashboard .xblivian-dashboard-card {
    min-height: 96px;
    height: auto;
    aspect-ratio: auto;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.15rem;
    padding: 1rem 1.15rem;
    text-align: left;
}

body.page-xblivian-dashboard .xblivian-dashboard-card::before,
body.page-xblivian-dashboard .xblivian-dashboard-card::after {
    display: none;
}

body.page-xblivian-dashboard .xblivian-dashboard-card h2 {
    display: block;
    margin: 0;
}

body.page-xblivian-dashboard .xblivian-dashboard-card .xblivian-dashboard-card-top {
    flex: 0 0 auto;
}

body.page-xblivian-dashboard .xblivian-dashboard-card .xblivian-dashboard-stat {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
    margin-top: 0.2rem;
}

body.page-xblivian-dashboard .xblivian-dashboard-card-title,
body.page-xblivian-dashboard .xblivian-dashboard-card-description {
    display: block;
    width: 100%;
}

body.page-xblivian-dashboard .xblivian-dashboard-card-title {
    color: inherit;
    font-size: clamp(1.15rem, 2.2vw, 1.65rem);
    font-weight: 800;
    letter-spacing: 0.03em;
    line-height: 1.15;
}

body.page-xblivian-dashboard .xblivian-dashboard-card-description {
    margin-top: 0.25rem;
    color: var(--xb-muted, #94a3b8);
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.25;
}

body.page-xblivian-dashboard .xblivian-dashboard-assistant-card {
    display: flex;
    cursor: pointer;
}

/* Spec Part 18.3: floating BOSS is hidden on the DESKTOP dashboard only.
   The mobile dashboard keeps it as the only BOSS access point. */
@media (min-width: 768px) {
    body.page-xblivian-dashboard .xba-root .xba-fab,
    body.page-xblivian-dashboard .xba-root .xba-chooser {
        display: none !important;
    }
}

.notifications-boss {
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid rgba(96, 165, 250, 0.24);
    border-radius: 16px;
    background: rgba(59, 130, 246, 0.06);
}
.notifications-boss[hidden] { display: none; }
.notifications-boss-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 0.7rem; }
.notifications-boss-kicker { color: #93c5fd; font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; }
.notifications-boss h2 { margin: 0.15rem 0 0; font-size: 1.05rem; }
.notifications-boss-count { color: #94a3b8; font-size: 0.78rem; }
.notifications-boss-list { display: grid; gap: 0.5rem; }
.notifications-boss-item { display: flex; align-items: center; gap: 0.65rem; width: 100%; padding: 0.7rem 0.8rem; border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; background: rgba(15,18,22,0.72); color: inherit; text-align: left; cursor: pointer; }
.notifications-boss-item:hover, .notifications-boss-item:focus-visible { border-color: rgba(96,165,250,0.45); }
.notifications-boss-dot { width: 8px; height: 8px; border-radius: 50%; background: #60a5fa; flex: 0 0 auto; }
.notifications-boss-copy { display: flex; flex-direction: column; gap: 0.12rem; min-width: 0; flex: 1; }
.notifications-boss-copy strong, .notifications-boss-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notifications-boss-copy strong { font-size: 0.86rem; }
.notifications-boss-copy small { color: #94a3b8; font-size: 0.76rem; }
.notifications-boss-item > i { color: #94a3b8; font-size: 0.7rem; }

@media (max-width: 767.98px) {
    body.page-xblivian-dashboard .xblivian-dashboard-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.55rem;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-card {
        min-height: 70px;
        padding: 0.7rem 0.8rem;
        border-radius: 16px;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-card h2 {
        font-size: 1rem;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-card-title {
        font-size: 1.05rem;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-card-description {
        margin-top: 0.2rem;
        font-size: 0.78rem;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-card .xblivian-dashboard-stat-value {
        font-size: 0.82rem;
    }

    body.page-xblivian-dashboard .xblivian-dashboard-card .xblivian-dashboard-stat-label {
        font-size: 0.62rem;
    }
}

@media (max-width: 768px) {
    .header-search .btn-icon,
    .nav-actions .btn-icon,
    .nav-actions .nav-link-icon {
        width: 44px;
        height: 44px;
        min-width: 44px;
        aspect-ratio: 1 / 1;
        border-radius: 50%;
    }

    .header-search .btn-icon i,
    .nav-actions .btn-icon i,
    .nav-actions .nav-link-icon i {
        font-size: 1.15rem;
    }
}
