/* X-style three-column desktop layout */
:root {
    --sidebar-left-w: 275px;
    --sidebar-right-w: 320px;
    --center-w: 600px;
}

.hub-layout {
    display: flex;
    justify-content: center;
    min-height: 100%;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    gap: 0;
    overflow-x: hidden;
}

.hub-sidebar-left,
.hub-sidebar-right {
    display: none;
}

.hub-column-center {
    width: 100%;
    max-width: var(--center-w);
    min-height: 100%;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
}

@media (min-width: 769px) {
    .hub-topbar-desktop { display: none !important; }

    .hub-sidebar-left {
        display: flex;
        flex-direction: column;
        width: var(--sidebar-left-w);
        min-height: 100vh;
        padding: 8px 12px 24px;
        position: sticky;
        top: 0;
        align-self: flex-start;
        max-height: 100vh;
        overflow-y: auto;
        flex-shrink: 0;
    }

    .hub-column-center .hub-main {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .hub-column-center .hub-view {
        padding: 0;
    }

    .hub-column-center .hub-view:not(#view-home) {
        padding: 16px 20px 32px;
    }

    #view-home {
        padding: 0;
    }

    .hub-layout.chat-layout {
        max-width: none;
        width: 100%;
        justify-content: flex-start;
    }

    .hub-layout.chat-layout .hub-column-center {
        max-width: none;
        flex: 1;
        min-width: 0;
    }

    .hub-layout.chat-layout #view-chat {
        padding: 0;
        min-height: 100vh;
    }

    .hub-layout.chat-layout .hub-column-center .hub-view:not(#view-home) {
        padding: 0;
    }

    .socials-sticky-head,
    .socials-tabs.hub-main-tabs {
        position: sticky;
        top: 0;
        z-index: 11;
        background: var(--sticky-head-bg);
        backdrop-filter: blur(12px);
    }

    .socials-tab.hub-main-tab {
        flex: 1;
        min-width: 0;
    }

    .feed-scope-tabs {
        top: 53px;
    }
}

@media (min-width: 1200px) {
    .hub-sidebar-right {
        display: block;
        width: var(--sidebar-right-w);
        min-height: 100vh;
        padding: 12px 20px 24px 16px;
        position: sticky;
        top: 0;
        align-self: flex-start;
        max-height: 100vh;
        overflow-y: auto;
        flex-shrink: 0;
        box-sizing: border-box;
    }
}

/* Left sidebar nav */
.sidebar-logo-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 12px 12px 20px 16px;
}

.sidebar-logo {
    font-family: var(--font-display);
    font-size: 1.5rem;
    letter-spacing: 4px;
    padding: 0;
    color: var(--text-primary);
}

.sidebar-notif-btn {
    position: relative;
    width: auto;
    min-width: 40px;
    height: 40px;
    padding: 0 8px;
    gap: 5px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.sidebar-notif-btn:hover {
    background: var(--hover-surface);
}

.sidebar-notif-svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    fill: none;
    transition: fill 0.15s ease;
}

.sidebar-notif-btn.has-unread .sidebar-notif-svg,
.mobile-notif-btn.has-unread .mobile-notif-svg {
    fill: currentColor;
}

.sidebar-notif-count,
.mobile-notif-count {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text-primary);
    min-width: 0;
}

.sidebar-notif-count[hidden],
.mobile-notif-count[hidden] {
    display: none !important;
}

.mobile-notif-btn {
    width: auto;
    min-width: 40px;
    padding: 0 6px;
    gap: 4px;
    border-radius: 999px;
}

.mobile-notif-svg {
    fill: none;
    transition: fill 0.15s ease;
}

.sidebar-notif-btn.notif-pulse,
.mobile-notif-btn.notif-pulse {
    animation: notif-bell-pulse 0.85s ease-in-out 2;
}

@keyframes notif-bell-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

.sidebar-notif-btn.notif-pulse .sidebar-notif-count,
.mobile-notif-btn.notif-pulse .mobile-notif-count {
    animation: notif-count-pop 0.85s ease-in-out 2;
}

@keyframes notif-count-pop {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 0 0 auto;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

.sidebar-nav-item:hover {
    background: var(--hover-surface);
}

.sidebar-nav-item.active {
    font-weight: 700;
}

.sidebar-nav-icon {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.sidebar-nav-icon svg {
    width: 24px;
    height: 24px;
}

.sidebar-nav-icon svg.nav-icon-svg {
    fill: none;
    stroke: currentColor;
}

.sidebar-nav-item.active .sidebar-nav-icon {
    color: var(--text-primary);
}

.sidebar-apps-wrap {
    position: relative;
}

.sidebar-apps-menu {
    margin: 4px 0 8px 42px;
    padding: 8px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    max-height: 320px;
    overflow-y: auto;
}

.sidebar-apps-menu[hidden] { display: none !important; }

.sidebar-app-link {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
}

.sidebar-app-link:hover { background: rgba(255, 255, 255, 0.06); }

.sidebar-app-link .platform-icon-wrap {
    width: 24px;
    height: 24px;
}

.sidebar-post-btn {
    margin: 16px 16px 12px;
    padding: 14px 24px;
    border: none;
    border-radius: 999px;
    background: var(--text-primary);
    color: var(--app-bg);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s;
}

.sidebar-post-btn:hover { opacity: 0.9; }

.sidebar-user-block {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    flex: 0 0 auto;
}

.sidebar-signout-btn {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.sidebar-signout-btn:hover {
    background: var(--hover-surface);
}

.notif-panel {
    position: fixed;
    z-index: 220;
    width: min(360px, calc(100vw - 24px));
    max-height: min(70vh, 480px);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.notif-panel[hidden] {
    display: none !important;
}

@media (min-width: 769px) {
    .notif-panel {
        left: 12px;
        top: 64px;
    }
}

@media (max-width: 768px) {
    .notif-panel {
        right: 12px;
        top: 56px;
        left: auto;
    }
}

.notif-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.notif-panel-close {
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.notif-panel-list {
    overflow-y: auto;
    max-height: min(60vh, 420px);
}

.notif-item-row {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--border-light);
}

.notif-item-row.unread {
    background: rgba(29, 155, 240, 0.12);
    border-left: 3px solid #1d9bf0;
}

.notif-item-row.unread .notif-item-text {
    font-weight: 700;
    color: var(--text-primary);
}

.notif-item-row.notif-item-removing {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.notif-item {
    position: relative;
    display: block;
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    padding: 12px 8px 12px 28px;
    cursor: pointer;
    font: inherit;
}

.notif-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notif-item-row.unread .notif-item {
    padding-left: 25px;
}

.notif-item-dismiss {
    flex-shrink: 0;
    align-self: flex-start;
    margin: 8px 8px 0 0;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    opacity: 0.55;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.notif-item-row:hover .notif-item-dismiss,
.notif-item-dismiss:focus-visible {
    opacity: 1;
}

.notif-item-dismiss:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.notif-item-unread-dot {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #1d9bf0;
    box-shadow: 0 0 8px rgba(29, 155, 240, 0.65);
}

.notif-item-text {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.35;
}

.notif-item-preview {
    display: block;
    margin-top: 4px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.35;
}

.notif-item-time {
    display: block;
    margin-top: 4px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.notif-empty {
    padding: 20px 16px;
    color: var(--text-muted);
    font-size: 0.88rem;
    margin: 0;
    text-align: center;
}

.sidebar-suggest-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.sidebar-suggest-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.sidebar-suggest-text {
    flex: 1;
    min-width: 0;
}

.sidebar-follow-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--text-primary);
    color: var(--app-bg);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.sidebar-follow-btn.following {
    background: transparent;
    color: var(--text-primary);
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s;
}

.sidebar-user-card:hover { background: rgba(255, 255, 255, 0.06); }

.sidebar-user-avatar-slot {
    position: relative;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.sidebar-user-avatar-slot .sidebar-user-avatar,
.sidebar-user-avatar-slot .sidebar-user-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.sidebar-user-avatar-slot .is-hidden {
    display: none !important;
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-elevated);
}

.sidebar-user-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
    line-height: 1.25;
}

.sidebar-user-name {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-handle {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-unread-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--chat-unread-badge-fill);
    color: var(--chat-unread-badge-ink);
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 8px var(--chat-unread-badge-glow);
}

.sidebar-nav-item.has-chat-unread {
    color: var(--text-primary);
}

.sidebar-nav-item.has-chat-unread .sidebar-nav-icon {
    filter: none;
}

.sidebar-nav-item.chat-pulse {
    animation: chat-nav-pulse 0.85s ease-in-out 2;
}

.sidebar-unread-badge.chat-badge-pulse,
.tab-unread-badge.chat-badge-pulse {
    animation: chat-badge-pop 0.85s ease-in-out 2;
}

@keyframes chat-nav-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

@keyframes chat-badge-pop {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.18); }
}

.sidebar-unread-badge[hidden],
.tab-unread-badge[hidden] {
    display: none !important;
}

/* Right sidebar widgets */
.sidebar-search {
    margin-bottom: 16px;
}

.sidebar-search input,
.sidebar-search-wrap input {
    padding: 12px 16px 12px 44px;
    border: none;
    border-radius: 999px;
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
}

.sidebar-search-wrap input {
    flex: 1;
    min-width: 0;
    width: auto;
}

.sidebar-search-wrap {
    position: relative;
    display: flex;
    gap: 8px;
    align-items: center;
}

.sidebar-search-btn {
    flex-shrink: 0;
    border: none;
    border-radius: 999px;
    background: var(--search-btn-bg);
    color: var(--search-btn-text);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 8px 14px;
    cursor: pointer;
}

.sidebar-search-btn:hover { opacity: 0.9; }

.sidebar-search-results {
    margin-top: 8px;
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    background: var(--search-panel-bg);
    max-height: min(420px, 55vh);
    overflow-y: auto;
    box-shadow: var(--dropdown-shadow);
}

.sidebar-search-results-head {
    padding: 12px 16px 8px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    position: sticky;
    top: 0;
    background: var(--search-panel-bg);
    z-index: 1;
    border-bottom: 1px solid var(--border);
}

.sidebar-search-status,
.sidebar-search-empty {
    padding: 16px;
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.sidebar-search-result {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-bottom: 1px solid var(--border);
    background: transparent;
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: background 0.12s;
}

.sidebar-search-result:last-child { border-bottom: none; }

.sidebar-search-result:hover { background: var(--hover-surface); }

.sidebar-search-result .sidebar-suggest-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.sidebar-search-result strong {
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-search-handle {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-search-bio {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.sidebar-search-avatar-ph {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--avatar-ph-bg);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.sidebar-suggest-link {
    cursor: pointer;
}

.sidebar-suggest-link:hover strong {
    text-decoration: underline;
}

.sidebar-search-wrap::before {
    content: '⌕';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
}

.sidebar-widget {
    background: var(--bg-elevated);
    border-radius: 16px;
    margin-bottom: 16px;
    overflow: hidden;
}

.sidebar-widget-head {
    padding: 16px 16px 8px;
    font-size: 1.15rem;
    font-weight: 800;
}

.sidebar-widget-body {
    padding: 0 16px 16px;
}

.sidebar-widget-item {
    padding: 12px 0;
    border-top: 1px solid var(--border);
}

.sidebar-widget-item:first-child { border-top: none; }

.sidebar-widget-item strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 2px;
}

.sidebar-widget-item span {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.sidebar-premium-btn {
    margin-top: 12px;
    padding: 10px 20px;
    border: none;
    border-radius: 999px;
    background: #1d9bf0;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
}

.sidebar-show-more {
    display: block;
    padding: 12px 16px;
    color: #1d9bf0;
    font-size: 0.85rem;
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

/* X-style composer */
.socials-composer-x {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 12px 16px 0;
    border-bottom: 1px solid var(--border);
}

.socials-composer-x .socials-composer-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    width: 100%;
}

.socials-composer-x .socials-composer-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.socials-composer-x .socials-composer-avatar,
.socials-composer-avatar-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-elevated);
}

.socials-composer-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-muted);
}

.socials-composer-x .socials-composer-input {
    border: none;
    background: transparent;
    min-height: 56px;
    font-size: 1.25rem;
    line-height: 1.35;
    padding: 10px 0 12px;
    resize: none;
    width: 100%;
}

.socials-composer-x .socials-composer-input::placeholder {
    color: var(--text-muted);
}

.socials-composer-x .socials-composer-actions {
    display: flex;
    padding: 4px 0 16px;
    padding-left: 0;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

.socials-composer-tools {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    flex: 1;
    min-width: 0;
}

.socials-composer-tool {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #1d9bf0;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

.socials-composer-tool:hover:not(:disabled):not(.is-disabled) {
    background: rgba(29, 155, 240, 0.1);
}

.socials-composer-tool.is-disabled,
.socials-composer-tool:disabled {
    color: #1d9bf0;
    opacity: 0.45;
    cursor: default;
}

.composer-ico {
    display: block;
    width: 20px;
    height: 20px;
    position: relative;
    flex-shrink: 0;
}

/* Media — landscape frame + mountain */
.composer-ico-media::before {
    content: '';
    position: absolute;
    inset: 1px 0 3px;
    border: 2px solid currentColor;
    border-radius: 2px;
}

.composer-ico-media::after {
    content: '';
    position: absolute;
    left: 3px;
    bottom: 5px;
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-bottom: 6px solid currentColor;
}

/* GIF label box */
.composer-ico-gif::before {
    content: 'GIF';
    position: absolute;
    inset: 3px 0;
    font-size: 0.52rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 14px;
    text-align: center;
    border: 2px solid currentColor;
    border-radius: 2px;
}

/* Poll — three bars */
.composer-ico-poll::before {
    content: '';
    position: absolute;
    left: 2px;
    top: 4px;
    width: 14px;
    height: 2px;
    background: currentColor;
    box-shadow: 0 5px 0 currentColor, 0 10px 0 currentColor;
    border-radius: 1px;
}

.composer-ico-poll::after {
    content: '';
    position: absolute;
    left: 0;
    top: 3px;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 5px 0 currentColor, 0 10px 0 currentColor;
}

/* Emoji — smiley */
.composer-ico-emoji::before {
    content: '';
    position: absolute;
    inset: 1px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.composer-ico-emoji::after {
    content: '';
    position: absolute;
    left: 5px;
    bottom: 5px;
    width: 8px;
    height: 4px;
    border-bottom: 2px solid currentColor;
    border-radius: 0 0 8px 8px;
}

/* Schedule — calendar */
.composer-ico-schedule::before {
    content: '';
    position: absolute;
    inset: 2px 1px 1px;
    border: 2px solid currentColor;
    border-radius: 2px;
}

.composer-ico-schedule::after {
    content: '';
    position: absolute;
    top: 0;
    left: 4px;
    width: 2px;
    height: 5px;
    background: currentColor;
    box-shadow: 8px 0 0 currentColor;
    border-radius: 1px;
}

.socials-composer-post-x {
    width: auto !important;
    min-width: 68px;
    padding: 8px 18px !important;
    border-radius: 999px !important;
    font-size: 0.9375rem !important;
    font-weight: 700 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    background: #1d9bf0 !important;
    color: #fff !important;
    border: none !important;
}

.socials-composer-post-x:disabled {
    opacity: 1;
    background: #0a4a6e !important;
    color: rgba(255, 255, 255, 0.35) !important;
    cursor: default;
}

/* X-style profile */
.x-profile-banner {
    height: 200px;
    background: linear-gradient(135deg, #1a3a5c 0%, #0d1b2a 50%, #1b263b 100%);
    position: relative;
    overflow: hidden;
}

.x-profile-banner-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.x-profile-banner-uploading {
    opacity: 0.6;
    filter: grayscale(0.15);
}

/* Profile / banner image editor */
.image-editor-modal {
    max-width: min(520px, 96vw);
    text-align: left;
}

.image-editor-modal h3 {
    text-align: center;
}

.image-editor-hint {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    margin: 0 0 16px;
    line-height: 1.45;
}

.image-editor-stage {
    position: relative;
    margin: 0 auto 16px;
    width: 100%;
    max-width: 360px;
    aspect-ratio: 1;
    background: var(--editor-stage-bg);
    border-radius: 50%;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    border: 2px solid var(--editor-border);
}

.image-editor-stage-banner {
    max-width: 100%;
    aspect-ratio: 3 / 1;
    border-radius: 12px;
}

.image-editor-viewport {
    position: absolute;
    inset: 0;
    overflow: hidden;
    cursor: grab;
    background: var(--editor-viewport-bg);
}

.image-editor-viewport.is-dragging {
    cursor: grabbing;
}

.image-editor-viewport img {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: center center;
    max-width: none;
    pointer-events: none;
}

.image-editor-zoom-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding: 0 4px;
}

.image-editor-zoom-label {
    color: var(--text-muted);
    font-size: 1.1rem;
    line-height: 1;
    flex-shrink: 0;
}

.image-editor-zoom-row input[type="range"] {
    flex: 1;
    accent-color: var(--accent, #1d9bf0);
}

.image-editor-overlay .hub-modal-actions {
    justify-content: center;
}

.x-profile-banner-editable:hover .x-profile-banner-edit {
    opacity: 1;
}

.x-profile-banner-edit {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.x-profile-banner-edit-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid #fff;
    position: relative;
}

.x-profile-banner-edit-icon::before {
    content: '';
    position: absolute;
    inset: 6px;
    border: 2px solid #fff;
    border-radius: 3px;
}

.x-profile-stat-clickable {
    cursor: pointer;
}

.x-profile-stat-clickable:hover strong {
    text-decoration: underline;
}

.follow-list-items {
    max-height: min(60vh, 420px);
    overflow-y: auto;
    margin-top: 8px;
}

.follow-list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-light);
}

.follow-list-row:last-child {
    border-bottom: none;
}

.follow-list-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}

.follow-list-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.follow-list-text {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    text-align: left;
    color: inherit;
    cursor: pointer;
    padding: 0;
    font: inherit;
}

.follow-list-text strong {
    display: block;
    font-size: 0.95rem;
}

.follow-list-text span {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.hub-modal-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: -4px 0 16px;
}

.form-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 6px 0 0;
}

.mobile-search-wrap {
    margin-bottom: 12px;
}

.mobile-search-wrap input {
    width: 100%;
    box-sizing: border-box;
}

.mobile-search-results {
    max-height: min(50vh, 360px);
}

.settings-account-actions {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.settings-account-actions-top {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.settings-account-label {
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 12px;
}

.btn-settings-signout {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-light);
    border-radius: 999px;
    font-weight: 600;
    color: var(--danger, #e55);
    background: transparent;
    cursor: pointer;
}

.profile-danger-zone {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.profile-danger-label {
    font-size: 0.72rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--danger, #e55);
    margin: 0 0 8px;
}

.profile-danger-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0 0 12px;
}

.btn-account-delete {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid rgba(204, 68, 68, 0.45);
    border-radius: 999px;
    font-weight: 600;
    color: var(--danger, #e55);
    background: transparent;
    cursor: pointer;
}

.btn-account-delete:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.x-profile-signout-btn {
    border-color: rgba(204, 68, 68, 0.45);
    color: #f88;
}

.x-profile-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0;
    min-height: 52px;
}

#account-profile-bio {
    width: 100%;
    box-sizing: border-box;
}

.x-profile-header {
    padding: 0 16px 12px;
    position: relative;
}

.x-profile-edit-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-light);
    border-radius: 999px;
    background: transparent;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
}

.x-profile-chat-btn {
    border-color: rgba(29, 155, 240, 0.55);
    color: #1d9bf0;
}

.x-profile-chat-btn:hover {
    background: rgba(29, 155, 240, 0.12);
}

.x-profile-follow-btn.following {
    opacity: 0.92;
}

@media (max-width: 768px) {
    #view-settings.active {
        padding-bottom: calc(var(--tabbar-h, 56px) + 24px);
    }

    .btn-settings-signout {
        min-height: 44px;
    }

    .x-profile-actions .x-profile-signout-btn {
        min-height: 36px;
    }
}

.mobile-search-modal .sidebar-search-result {
    width: 100%;
    text-align: left;
    padding: 8px 16px;
    border: 1px solid var(--border-light);
    border-radius: 999px;
    background: transparent;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
}

.x-profile-avatar-row {
    margin-top: -68px;
    margin-bottom: 12px;
    position: relative;
    display: inline-block;
}

.x-profile-avatar-wrap {
    display: inline-block;
}

.x-profile-avatar-editable {
    cursor: pointer;
}

.x-profile-photo-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.x-profile-avatar-cam {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1d9bf0;
    border: 3px solid var(--shell-bg);
    box-sizing: border-box;
    pointer-events: none;
}

.x-profile-avatar-cam::before {
    content: '';
    position: absolute;
    inset: 8px;
    border: 2px solid #fff;
    border-radius: 3px;
}

.x-profile-avatar-cam::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 4px;
    border: 2px solid #fff;
    border-bottom: none;
    border-radius: 3px 3px 0 0;
}

.x-profile-avatar-uploading {
    opacity: 0.55;
    filter: grayscale(0.2);
}

.x-profile-avatar-editable:hover .x-profile-avatar,
.x-profile-avatar-editable:hover .x-profile-avatar-placeholder {
    filter: brightness(0.92);
}

.x-profile-avatar {
    width: 134px;
    height: 134px;
    border-radius: 50%;
    border: 4px solid var(--shell-bg);
    object-fit: cover;
    background: var(--bg-elevated);
}

.x-profile-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 700;
}

.x-profile-name {
    font-size: 1.35rem;
    font-weight: 800;
    margin: 0 0 4px;
}

.x-profile-handle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin: 0 0 12px;
}

.x-profile-bio {
    font-size: 0.95rem;
    line-height: 1.4;
    margin-bottom: 12px;
}

.x-profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.x-profile-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.x-profile-stat {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 0;
    cursor: default;
    font: inherit;
}

.x-profile-stat strong {
    color: var(--text-primary);
    font-weight: 800;
}

.x-profile-joined {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 0 12px;
}

.x-profile-bio-wrap {
    margin-bottom: 12px;
}

.x-profile-bio-edit {
    margin-top: 6px;
    border: none;
    background: transparent;
    color: #1d9bf0;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.x-profile-bio-edit:hover { text-decoration: underline; }

.x-profile-links {
    padding: 16px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.sidebar-suggest-meta {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.x-profile-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin: 0 -16px;
}

.x-profile-tab {
    flex: 1;
    padding: 16px 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px;
}

.x-profile-tab.active {
    color: var(--text-primary);
    border-bottom-color: #1d9bf0;
}

.x-profile-posts {
    padding: 12px 12px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.x-profile-posts .feed-empty {
    margin: 0;
}

.x-profile-posts .socials-post {
    margin-bottom: 0;
}

/* ── Mobile layout polish ── */
@media (max-width: 768px) {
    .hub-layout {
        max-width: 100%;
        overflow-x: hidden;
    }

    .hub-column-center {
        max-width: 100%;
        min-width: 0;
        border-left: none;
        border-right: none;
    }

    .x-profile-banner {
        height: 132px;
    }

    .x-profile-header {
        padding: 0 12px 8px;
        overflow: hidden;
    }

    .x-profile-actions {
        flex-wrap: wrap;
        gap: 8px;
        padding: 8px 0 4px;
        min-height: 44px;
    }

    .x-profile-edit-btn {
        font-size: 0.78rem;
        padding: 6px 14px;
        white-space: nowrap;
    }

    .x-profile-avatar-row {
        margin-top: -44px;
        margin-bottom: 10px;
    }

    .x-profile-avatar,
    .x-profile-avatar-placeholder {
        width: 88px;
        height: 88px;
        border-width: 3px;
        font-size: 2rem;
    }

    .x-profile-avatar-cam {
        width: 28px;
        height: 28px;
        right: 2px;
        bottom: 2px;
        border-width: 2px;
    }

    .x-profile-name {
        font-size: 1.15rem;
        word-break: break-word;
    }

    .x-profile-handle {
        font-size: 0.88rem;
        margin-bottom: 8px;
    }

    .x-profile-stats {
        gap: 14px;
        flex-wrap: wrap;
        font-size: 0.85rem;
    }

    .x-profile-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .x-profile-tabs::-webkit-scrollbar { display: none; }

    .x-profile-tab {
        flex: 1;
        min-width: 72px;
        white-space: nowrap;
    }

    .x-profile-posts {
        padding: 0;
        gap: 0;
    }

    .x-profile-links {
        padding: 12px;
    }

    .x-profile-banner-edit {
        opacity: 1;
        font-size: 0.82rem;
    }

    .socials-composer-x {
        padding: 10px 12px;
    }

    .socials-composer-x .socials-composer-row {
        gap: 10px;
    }

    .socials-composer-x .socials-composer-avatar,
    .socials-composer-avatar-placeholder {
        width: 40px;
        height: 40px;
        flex-shrink: 0;
    }

    .socials-composer-x .socials-composer-actions {
        padding-left: 0;
    }

    .socials-composer-tools {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        max-width: 100%;
    }

    .socials-composer-tools::-webkit-scrollbar { display: none; }

    .socials-composer-post-x {
        flex-shrink: 0;
    }

    .feed-scope-tabs {
        position: sticky;
        top: 0;
        z-index: 10;
        background: var(--sticky-head-bg);
        backdrop-filter: blur(12px);
    }

    .hub-modal {
        width: 100%;
        max-height: min(88dvh, 640px);
        overflow-y: auto;
    }

    .hub-modal-wide {
        max-width: 100%;
    }

    .follow-list-row {
        gap: 10px;
    }

    .follow-list-row .sidebar-follow-btn {
        flex-shrink: 0;
        font-size: 0.78rem;
        padding: 6px 12px;
    }

    .btn-profile-back {
        display: inline-flex;
        margin-bottom: 8px;
        padding: 8px 12px;
        font-size: 0.78rem;
    }
}

@media (min-width: 769px) {
    .x-profile-banner-editable:hover .x-profile-banner-edit {
        opacity: 1;
    }
}
