/* ==========================================
   HANIHO NOBLE OVERRIDES v16 - THE FINAL CONTRAST
   ========================================== */

/* ── Stamp Check-in Bar ─────────────────────────────── */
.stamp-bar {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border, #1a1a2e);
    background: var(--bg, #0d0d1a);
}
.stamp-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
}
.stamp-bar-location {
    font-size: 14px;
    color: var(--text, #e0e0e0);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 40%;
}
.stamp-bar-presence {
    font-size: 12px;
    color: #888;
    flex: 1;
    text-align: center;
    white-space: nowrap;
}
.stamp-btn {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s;
}
.stamp-btn:active { opacity: 0.8; }
.stamp-btn.checked-in {
    background: #1a3a1a;
    color: #4ade80;
    cursor: default;
}

/* ── Stamp Floating Button ─────────────────────────── */
.stamp-float {
    position: fixed;
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
    right: 16px;
    z-index: 48;
    display: flex;
    align-items: center;
    gap: 4px;
}
.stamp-float-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59,130,246,0.4);
    animation: stamp-float-pulse 2s ease-in-out infinite;
}
.stamp-float-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0,0,0,0.7);
    border: 1px solid rgba(255,255,255,0.2);
    color: #ccc;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    position: absolute;
    top: -8px;
    right: -8px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 49;
}
@keyframes stamp-float-pulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(59,130,246,0.4); }
    50% { box-shadow: 0 4px 20px rgba(139,92,246,0.6); }
}

/* ── Stamp Presence Badge on Feed Cards ─────────────── */
.stamp-presence-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    color: #4ade80;
    background: rgba(74,222,128,0.1);
    border: 1px solid rgba(74,222,128,0.2);
    padding: 1px 6px;
    border-radius: 999px;
    vertical-align: middle;
    margin-left: 4px;
}

/* Card text truncation — max 3 lines on all feed cards */
.xf-card-desc,
#streamPostsList [style*="pre-wrap"],
#streamPostsList [style*="line-height:1.52"],
.news-inbox-row .news-excerpt,
.news-pub-card .news-excerpt {
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    white-space: normal !important;
}

/* FORCE DARK THEME ON ALL CRITICAL AREAS */
[data-theme="dark"] .puls-stage-topbar,
[data-theme="dark"] .puls-header,
[data-theme="dark"] .trending-section,
[data-theme="dark"] .top-themen-area,
[data-theme="dark"] .puls-trend-bundle-grid,
[data-theme="dark"] .puls-trend-bundle-grid *,
[data-theme="dark"] .puls-news-card,
[data-theme="dark"] #homeHero {
    background: var(--surface2) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}

/* Fix Badges & Pills (LIVE, SIGNAL, TRENDING, HEUTE) */
.puls-badge, .puls-scope-label, .puls-toggle-btn, .puls-label, .puls-trend-tag, .puls-type-pill,
[style*="background:#ff0080"], [style*="background: #ff0080"], [style*="background:#f08"],
.puls-news-head span, .figma-badge, .trend-badge {
    background: var(--surface3) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    padding: 6px 14px !important;
    border-radius: 10px !important;
    font-size: 0.75rem !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Fix Active/Accent Badges */
.puls-toggle-btn.is-active, .puls-badge.active, .puls-badge.is-active, .is-hero .puls-badge {
    background: var(--accent) !important;
    color: #fff !important;
    border-color: var(--accent) !important;
}

/* Fix Hashtags & Trend Buttons in Dark Mode */
[data-theme="dark"] .puls-trend-topic-btn,
[data-theme="dark"] .puls-trend-tag {
    background: var(--surface) !important;
    color: var(--accent) !important;
    border-color: var(--border) !important;
}

/* Tab Content Visibility Fix */
.tab-panel {
    display: none !important;
    pointer-events: none;
    visibility: hidden;
}
.tab-panel.active {
    display: block !important;
    pointer-events: auto;
    visibility: visible;
    overflow-x: hidden;
    max-width: 100%;
    box-sizing: border-box;
}
#tab-chat.tab-panel.active {
    display: flex !important;
}

/* ── Right Panel Tab System ─────────────────────────── */
.right-panel-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border, #1a1a2e);
    background: var(--surface, #0b0f19);
    flex: 0 0 auto;
}
.right-panel-toggle-btn {
    flex: 1;
    padding: 10px 0;
    border: none;
    background: none;
    color: var(--text-muted, #666);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.right-panel-toggle-btn.is-active {
    color: var(--text, #eee);
    border-bottom-color: var(--accent, #3b82f6);
}

/* All content panels: hidden by default */
.right-panel-content { display: none !important; }

/* Show active panel */
#panel-right[data-right-panel-mode="context"] #rightPanelContext {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
}

/* ── Chat Panel ─────────────────────────────────────── */
#panel-right[data-right-panel-mode="chat"] #rightPanelChat {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    background: var(--surface, #0b0f19) !important;
}
#rightPanelChat .chat-header {
    flex: 0 0 auto !important;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
    background: var(--surface, #0b0f19);
    border-bottom: 1px solid var(--border, #1a1a2e);
    min-height: 48px;
}
#rightPanelChat #chatMessages {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    background: var(--surface, #0b0f19);
}
#rightPanelChat .chat-input-container {
    flex: 0 0 auto !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 3 !important;
    padding: 8px 12px !important;
    border-top: 1px solid var(--border, #1a1a2e) !important;
    background: var(--surface, #0b0f19) !important;
}

/* ── Community Panel ───────────────────────────────── */
#panel-right[data-right-panel-mode="community"] #rightPanelCommunity {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow: hidden !important;
    background: var(--surface, #0b0f19);
}
#sidebar-community-mount {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
#rightPanelCommunity .community-sidebar-wrap {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 !important;
    background: var(--surface, #0b0f19);
}
#rightPanelCommunity .community-sidebar-posts {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}
/* Community input (rendered by JS) sticks to bottom */
#rightPanelCommunity .community-sidebar-input-wrap {
    flex: 0 0 auto !important;
    position: sticky !important;
    bottom: 0 !important;
    z-index: 2 !important;
    margin-top: auto !important;
    padding: 8px 12px;
    border-top: 1px solid var(--border, #1a1a2e);
    background: var(--surface, #0b0f19);
}

.right-chat-inline-note {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
}

.right-chat-inline-note p {
    margin: 8px 0 14px;
    color: var(--text2);
}

#rightPanelContext .sidebar-scroll-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
}

#rightPanelContext section {
    border: 1px solid var(--border);
    background: var(--surface2);
    border-radius: 16px;
    padding: 16px;
}

/* ── Präsenz buchen (right sidebar) ── */
.sidebar-presence-card { display: flex; flex-direction: column; gap: 4px; }
.sidebar-presence-head { font-size: 13px; font-weight: 800; color: var(--text); }
.sidebar-presence-sub { font-size: 11px; color: var(--text2); line-height: 1.4; margin-bottom: 10px; }
.sidebar-presence-btns { display: flex; gap: 8px; }
.sidebar-presence-btn {
    flex: 1; padding: 9px 0; border-radius: 10px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--text); font-size: 11px; font-weight: 700;
    cursor: pointer; transition: all .15s; text-align: center;
}
.sidebar-presence-btn:hover { background: var(--text); color: var(--bg); border-color: var(--text); }

.sidebar-primary-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border-radius: 14px;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    text-decoration: none;
    text-align: center;
    font-size: 0.85rem;
    line-height: 1.3;
    padding: 10px 14px;
    transition: opacity 0.15s;
}
.sidebar-primary-cta:hover { opacity: 0.85; }

.sidebar-status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.sidebar-status-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
}

.sidebar-status-item span {
    font-size: 11px;
    font-weight: 700;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sidebar-status-item strong {
    font-size: 20px;
    font-family: "Syne", "DM Sans", sans-serif;
}

.sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-item-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    min-width: 0 !important;
    min-height: 0 !important;
    padding: 12px 14px !important;
    border-radius: 14px !important;
    text-align: left;
}

.sidebar-item-title {
    font-weight: 700;
    color: var(--text);
}

.sidebar-item-meta,
.sidebar-empty {
    font-size: 12px;
    color: var(--text2);
    line-height: 1.45;
}

.sidebar-item-source {
    font-size: 11px;
    color: var(--text2);
    opacity: 0.7;
    margin-top: 2px;
}

/* chat-header defined in right-panel tab system above */

/* Chat messages + input handled by flex layout in desktop media query */

/* Fix Card Buttons & Quelle Button */
.stream-card button, .news-card button, .puls-news-actions-main button, .hani-card button, 
.pm-action-btn, .pm-sc-btn, .puls-news-source-btn, .pm-btn, .btn-primary, .puls-secondary-link {
    height: 44px !important;
    padding: 0 24px !important;
    border-radius: 12px !important;
    font-weight: 700 !important;
    background: var(--surface3) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    min-width: 140px !important;
}

.pm-btn--primary, .btn-primary, .puls-primary-discuss, .pm-sc-btn--primary {
    background: var(--accent) !important;
    color: #fff !important;
    border-color: var(--accent) !important;
}

/* Kill Orphaned Content in Dark Mode */
[data-theme="dark"] .center-content > :not(.tab-panel) {
    display: none !important;
}

/* Header Cleanup */
.header-logo-svg {
    width: 32px !important;
    height: 32px !important;
}

/* Footer & Legal */
.footer-btn {
    background: var(--surface2) !important;
    color: var(--text-muted) !important;
    padding: 10px 18px !important;
    border-radius: 12px !important;
    border: 1px solid var(--border) !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    text-decoration: none !important;
}

.footer-btn:hover {
    background: var(--surface3) !important;
    color: var(--text) !important;
}


/* Mobile Visibility Helpers */
.mobile-only { display: none !important; }
.desktop-only { display: block; }
.header-nav-icons.desktop-only { display: flex; }

@media (max-width: 980px) {
    .mobile-only { display: flex !important; }
    .mobile-only.hidden { display: none !important; }
    .desktop-only { display: none !important; }

    .app-container {
        grid-template-columns: 1fr !important;
        grid-template-rows: 0px 1fr 0px !important;
        height: 100dvh !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    #panel-center {
        grid-row: 1 / -1 !important;
    }

    #panel-left, #panel-right {
        display: none;
        position: fixed;
        top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
        bottom: 56px;
        left: 0;
        width: 100%;
        z-index: 1500;
        background: var(--bg);
        overflow: hidden;
    }

    /* Weltenbaum (Left Panel) Mobile Open */
    body.weltenbaum-mobile-open #panel-left {
        display: flex;
        flex-direction: column;
        animation: slideInLeft 0.3s ease;
    }

    /* Mobile Chat Mode */
    body.mobile-chat-center #panel-center {
        display: none !important;
    }
    body.mobile-chat-center #panel-right {
        display: flex;
        flex-direction: column;
        animation: slideInRight 0.3s ease;
        z-index: 1600;
        background: var(--bg) !important;
    }

    header {
        padding: 0 12px !important;
        padding-top: env(safe-area-inset-top, 0px) !important;
        height: calc(var(--header-h) + env(safe-area-inset-top, 0px)) !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 10000 !important;
        background-color: var(--bg, #0a0a0f) !important;
        border-bottom: 1px solid var(--border, #1a1a2e);
        transition: transform 0.25s ease;
    }

    header.header-hidden {
        transform: translateY(-100%) !important;
    }

    /* Hamburger menu button hidden on mobile — replaced by MEHR tab */
    #mobile-header-menu-btn { display: none !important; }
    #mobile-header-menu { display: none !important; }

    /* Toggle buttons (Info/Chat/Community) hidden on mobile — bottom tabs handle this */
    .right-panel-tabs, .right-panel-toggle { display: none !important; }

    .center-tabs {
        display: none !important;
    }

    footer {
        display: none !important;
    }

    :root {
        --footer-h: 0px;
    }

    /* MEHR Panel — sits above content but below tab bar so tabs stay clickable */
    #mobile-more-panel {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 56px;
        background: var(--bg, #0a0a0f);
        z-index: 9998; /* below tab bar (9999) */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-top: env(safe-area-inset-top, 0);
    }
    #mobile-more-panel.hidden { display: none !important; }
    .mobile-more-content { padding: 0; }
    .mobile-more-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px 20px;
        border-bottom: 1px solid var(--border, #2a2a3a);
    }
    .mobile-more-item {
        display: block;
        width: 100%;
        background: none;
        border: none;
        color: var(--text, #eee);
        text-align: left;
        padding: 16px 20px;
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
    }
    .mobile-more-item:hover, .mobile-more-item:active {
        background: var(--surface2, #1a1a2e);
    }

    /* Bottom Tabs Styling — fixed flush to viewport bottom */
    #mobile-bottom-tabs {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        display: flex !important;
        justify-content: space-around;
        align-items: center;
        background: var(--bg, #0a0a0f) !important;
        border-top: 1px solid var(--border, #1a1a2e);
        padding: 0 !important;
        padding-bottom: 0 !important;
        height: 56px !important;
        min-height: 56px !important;
        z-index: 99999 !important;
        box-sizing: border-box !important;
        margin: 0 !important;
        transform: none !important;
        opacity: 1;
        pointer-events: auto;
        transition: transform 0.22s ease, opacity 0.18s ease;
        will-change: transform, opacity;
    }

    body.mobile-dock-hidden #mobile-bottom-tabs {
        transform: translateY(100%) !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    /* Content area padding for fixed header + fixed tab bar */
    .center-content {
        padding-top: calc(var(--header-h, 64px) + env(safe-area-inset-top, 0px)) !important;
        padding-bottom: 56px !important;
        -webkit-overflow-scrolling: touch;
        min-height: 100dvh;
    }

    #placeMasterMount {
        padding: 0 8px !important;
    }

    .tab-panel > * {
        max-width: 100% !important;
    }

    .mobile-tab-btn {
        flex: 1;
        background: none;
        border: none;
        color: var(--text-muted);
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        padding: 8px 0;
        cursor: pointer;
        transition: color 0.2s;
    }

    .mobile-tab-btn.active {
        color: var(--accent);
    }

    .mobile-tab-btn.active::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 24px;
        height: 3px;
        border-radius: 3px;
        background: var(--accent, #3b82f6);
        transition: width 0.2s;
    }

    .mobile-tab-btn {
        position: relative;
    }

    .tab-icon {
        font-size: 1.4rem;
    }

    .tab-label {
        font-size: 0.65rem;
        font-weight: 700;
        text-transform: uppercase;
    }

    /* Mobile Header Menu */
    #mobile-header-menu {
        position: fixed;
        top: var(--header-h);
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0,0,0,0.5);
        z-index: 3000;
        display: flex;
        flex-direction: column;
    }

    .mobile-menu-content {
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        padding: 10px 0;
        display: flex;
        flex-direction: column;
        animation: slideDown 0.2s ease;
    }

    .mobile-menu-item {
        background: none;
        border: none;
        color: var(--text);
        text-align: left;
        padding: 14px 20px;
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
    }

    .mobile-menu-item:hover {
        background: var(--surface2);
    }

    .mobile-menu-divider {
        height: 1px;
        background: var(--border);
        margin: 8px 20px;
    }

    /* Create FAB */
    #mobile-create-fab {
        position: fixed;
        bottom: 80px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 28px;
        background: var(--accent);
        color: white;
        border: none;
        font-size: 2rem;
        font-weight: 300;
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
        z-index: 2100;
        display: none;
        align-items: center;
        justify-content: center;
    }

    #mobile-create-fab:not(.hidden) {
        display: flex !important;
    }

    #mobile-create-menu {
        position: fixed;
        bottom: 145px;
        right: 20px;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 8px;
        display: none;
        flex-direction: column;
        gap: 4px;
        box-shadow: 0 8px 24px rgba(0,0,0,0.4);
        z-index: 2100;
        min-width: 160px;
    }

    #mobile-create-menu:not(.hidden) {
        display: flex !important;
    }

    .mobile-create-item {
        background: none;
        border: none;
        color: var(--text);
        text-align: left;
        padding: 12px 16px;
        font-weight: 600;
        border-radius: 8px;
    }

    .mobile-create-item:hover {
        background: var(--surface2);
    }

    /* Utility Drawer */
    #mobile-utility-drawer {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 4000;
        display: none; /* hidden by default */
        align-items: flex-end;
    }

    #mobile-utility-drawer:not(.hidden) {
        display: flex !important;
    }

    .mobile-utility-content {
        background: var(--bg);
        width: 100%;
        max-height: 80vh;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
        padding: 20px;
        display: flex;
        flex-direction: column;
        animation: slideUp 0.3s ease;
    }

    .mobile-utility-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
    }

    #mobile-utility-list {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
        overflow-y: auto;
    }

    .mobile-utility-item {
        background: var(--surface2);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 15px 10px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        color: var(--text);
    }
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* Fix Center Content Overflows */
.center-content {
    -webkit-overflow-scrolling: touch;
}



/* Chat on Mobile — flex layout, input at bottom */
@media (max-width: 980px) {
    body.mobile-chat-center #panel-right {
        overflow: hidden !important;
        padding: 0 !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: auto !important;
        height: 100dvh !important;
    }
    body.mobile-chat-center #mobile-bottom-tabs {
        display: none !important;
    }
    body.mobile-chat-center #rightPanelChat .chat-input-container {
        flex: 0 0 auto !important;
        position: sticky !important;
        bottom: 0 !important;
        z-index: 10 !important;
        background: var(--bg, #0b0f19) !important;
        border-top: 1px solid rgba(255,255,255,0.06) !important;
        padding: 8px 12px !important;
    }
    body.mobile-chat-center header {
        display: none !important;
    }
    body.mobile-chat-center #rightPanelChat .chat-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
        background: var(--bg, #0b0f19) !important;
    }
    body.mobile-chat-center #chat-back-btn {
        display: block !important;
    }
    #chatInput[contenteditable]:empty::before {
        content: attr(data-placeholder);
        color: #666;
        pointer-events: none;
    }
    body.mobile-chat-center #rightPanelChat {
        display: flex !important;
        flex-direction: column !important;
        min-height: 0 !important;
        overflow: hidden !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
    }
    body.mobile-chat-center #rightPanelChat #chatMessages {
        flex: 1 1 0 !important;
        min-height: 0 !important;
        overflow-y: auto !important;
    }
    body.mobile-chat-center #rightPanelChat .chat-header {
        flex: 0 0 auto !important;
        margin-top: 0 !important;
        padding-top: env(safe-area-inset-top, 8px) !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 10 !important;
        background: var(--bg, #0b0f19) !important;
        border-bottom: 1px solid rgba(255,255,255,0.06) !important;
    }
    body.mobile-chat-center #rightPanelChat .chat-input-container {
        padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    }
    body.mobile-chat-center #rightPanelChat #chatMessages {
        flex: 1 1 0 !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }
    body.mobile-chat-center #rightPanelChat .chat-input-container {
        flex: 0 0 auto !important;
        position: sticky !important;
        bottom: 0 !important;
        z-index: 3 !important;
        background: var(--surface, #0b0f19) !important;
        border-top: 1px solid var(--border, #1a1a2e) !important;
        padding: 8px 12px !important;
    }
}

/* Chat Height Stabilization — desktop/tablet only */
@media (min-width: 981px) {
    #panel-right[data-right-panel-mode="chat"] #rightPanelChat {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 0 !important;
        min-height: 0 !important;
        height: auto !important;
        max-height: none !important;
        overflow: hidden !important;
        box-sizing: border-box;
    }

    #rightPanelChat #chatMessages {
        flex: 1 1 0 !important;
        min-height: 0 !important;
        overflow-y: auto !important;
    }

    #rightPanelChat .chat-header,
    #rightPanelChat .chat-input-container,
    #rightPanelChat #chat-view-switch,
    #rightPanelChat #chat-contacts-pane,
    #rightPanelChat #typing-indicator {
        flex: 0 0 auto;
    }
}


/* Bottom-Tabs Positioning (war Inline-Style, jetzt CSS-kontrolliert) */
#mobile-bottom-tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    z-index: 99999;
    transform: none;
}

/* Keyboard offen: Bottom-Tabs verstecken */
body.mobile-keyboard-open #mobile-bottom-tabs,
#mobile-bottom-tabs.keyboard-hidden {
    display: none !important;
}

/* Chat/Kontakte UI verbessern */
.chat-contacts-pane {
    padding: 12px;
}

.chat-contacts-head {
    margin-bottom: 12px;
}

.chat-contact-search {
    margin-bottom: 12px;
}

.chat-contact-search input {
    width: 100%;
    padding: 10px 14px;
    background: var(--surface2, #161b22);
    border: 1px solid var(--border, #1a1a2e);
    border-radius: 10px;
    color: var(--text, #e0e0e0);
    font-size: 14px;
    outline: none;
}

.chat-contact-search input:focus {
    border-color: var(--accent, #3b82f6);
}

.chat-contact-search button {
    margin-top: 6px;
    padding: 8px 16px;
    background: var(--accent, #3b82f6);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

#chat-contacts-list {
    font-size: 14px;
    color: var(--text, #e0e0e0);
    line-height: 1.6;
}

/* Login-Hinweis im Chat besser sichtbar */
.chat-contacts-pane .chat-contact-search + div {
    padding: 12px;
    border: 1px dashed var(--border, #1a1a2e);
    border-radius: 10px;
    text-align: center;
    color: var(--text-muted, #888);
    font-size: 13px;
}

/* Entdecken: Tabs sticky beim Keyboard */
#entdecken-overlay {
    display: flex;
    flex-direction: column;
}

#entdecken-overlay > div:first-child {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 10;
    background: #0b0f19;
}

/* Light Mode Feed Rescue */
html:not([data-theme="dark"]) .puls-news-card,
html:not([data-theme="dark"]) .puls-news-card.is-hero,
html:not([data-theme="dark"]) .puls-news-card.trend-bundle-card,
html:not([data-theme="dark"]) .puls-news-card.daily-vibe-inline,
html:not([data-theme="dark"]) .stream-card,
html:not([data-theme="dark"]) .news-card,
html:not([data-theme="dark"]) .hani-card {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow) !important;
}

html:not([data-theme="dark"]) .puls-news-card:hover,
html:not([data-theme="dark"]) .puls-news-card.is-hero:hover,
html:not([data-theme="dark"]) .puls-news-card.trend-bundle-card:hover,
html:not([data-theme="dark"]) .puls-news-card.daily-vibe-inline:hover,
html:not([data-theme="dark"]) .stream-card:hover,
html:not([data-theme="dark"]) .news-card:hover,
html:not([data-theme="dark"]) .hani-card:hover {
    background: #ffffff !important;
    border-color: var(--text-soft) !important;
}

html:not([data-theme="dark"]) .puls-news-card *,
html:not([data-theme="dark"]) .stream-card *,
html:not([data-theme="dark"]) .news-card *,
html:not([data-theme="dark"]) .hani-card * {
    border-color: var(--border);
}

html:not([data-theme="dark"]) .puls-news-title,
html:not([data-theme="dark"]) .puls-news-card .puls-news-title,
html:not([data-theme="dark"]) .puls-news-card .puls-news-head,
html:not([data-theme="dark"]) .puls-news-card .puls-news-proof,
html:not([data-theme="dark"]) .puls-news-card .puls-news-hook,
html:not([data-theme="dark"]) .puls-news-card .puls-news-meta,
html:not([data-theme="dark"]) .puls-news-card .puls-news-source,
html:not([data-theme="dark"]) .puls-news-card .puls-news-headline,
html:not([data-theme="dark"]) .puls-news-card .puls-news-headline a,
html:not([data-theme="dark"]) .puls-news-card a,
html:not([data-theme="dark"]) .stream-card a,
html:not([data-theme="dark"]) .news-card a,
html:not([data-theme="dark"]) .hani-card a {
    color: var(--text) !important;
}

html:not([data-theme="dark"]) .puls-news-card .puls-scope-label,
html:not([data-theme="dark"]) .puls-news-card .puls-type-pill,
html:not([data-theme="dark"]) .puls-news-card .puls-badge {
    box-shadow: none !important;
}

html:not([data-theme="dark"]) #tab-threads .pm-signal-card,
html:not([data-theme="dark"]) #tab-threads .pm-row,
html:not([data-theme="dark"]) #tab-threads .pm-vibe-card,
html:not([data-theme="dark"]) #tab-threads .pm-vibe-inner,
html:not([data-theme="dark"]) #tab-threads .pm-thread-card,
html:not([data-theme="dark"]) #tab-threads .pm-thread-mini,
html:not([data-theme="dark"]) #tab-threads .pm-contact-found-card {
    background: var(--surface) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow) !important;
}

html:not([data-theme="dark"]) #tab-threads .pm-signal-card:hover,
html:not([data-theme="dark"]) #tab-threads .pm-thread-card:hover {
    background: #ffffff !important;
    border-color: var(--text-soft) !important;
    box-shadow: var(--shadow-lg) !important;
}

html:not([data-theme="dark"]) #tab-threads .pm-sc-title,
html:not([data-theme="dark"]) #tab-threads .pm-title,
html:not([data-theme="dark"]) #tab-threads .pm-thread-title,
html:not([data-theme="dark"]) #tab-threads .pm-thread-author,
html:not([data-theme="dark"]) #tab-threads .pm-sc-body,
html:not([data-theme="dark"]) #tab-threads .pm-thread-body,
html:not([data-theme="dark"]) #tab-threads .pm-meta,
html:not([data-theme="dark"]) #tab-threads .pm-live,
html:not([data-theme="dark"]) #tab-threads .pm-contact-btn,
html:not([data-theme="dark"]) #tab-threads .pm-link {
    color: var(--text) !important;
}

html:not([data-theme="dark"]) #tab-threads .pm-sc-source,
html:not([data-theme="dark"]) #tab-threads .pm-vibe-label,
html:not([data-theme="dark"]) #tab-threads .pm-vibe-place,
html:not([data-theme="dark"]) #tab-threads .pm-thread-meta,
html:not([data-theme="dark"]) #tab-threads .pm-calm,
html:not([data-theme="dark"]) #tab-threads .pm-block h3 {
    color: var(--text-muted) !important;
}

/* Light mode: Lokal/World toggle contrast */
html:not([data-theme="dark"]) .puls-toggle-btn,
html:not([data-theme="dark"]) .xf-scope-btn,
html:not([data-theme="dark"]) .scope-pill {
    border: 1px solid #cbd5e1 !important;
    background: #f1f5f9 !important;
    color: var(--text) !important;
}
html:not([data-theme="dark"]) .puls-toggle-btn.is-active,
html:not([data-theme="dark"]) .xf-scope-btn.is-active,
html:not([data-theme="dark"]) .scope-pill.active {
    border-color: var(--accent) !important;
    background: var(--accent) !important;
    color: #fff !important;
}

/* Light mode: Smart input visibility */
html:not([data-theme="dark"]) #smart-input,
html:not([data-theme="dark"]) .xf-input,
html:not([data-theme="dark"]) .search-input {
    border: 1px solid #ddd !important;
    background: #f5f5f5 !important;
    color: var(--text) !important;
}
html:not([data-theme="dark"]) #smart-input::placeholder,
html:not([data-theme="dark"]) .xf-input::placeholder,
html:not([data-theme="dark"]) .search-input::placeholder {
    color: #888 !important;
}

.place-context-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.right-panel-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
}

.right-panel-toggle-btn {
    min-width: 84px;
    height: 38px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--text2);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.right-panel-toggle-btn:hover {
    color: var(--text);
    background: rgba(255,255,255,0.04);
}

.right-panel-toggle-btn.is-active {
    color: #fff;
    background: var(--accent);
    border-color: var(--accent);
}

.sidebar-item-card {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    box-shadow: var(--shadow);
}

.sidebar-item-card:hover {
    border-color: var(--accent-soft, var(--border)) !important;
    background: var(--surface2) !important;
}

#PlaceTrendsCard .sidebar-item-title {
    color: var(--text);
}

#PlaceTrendsCard .sidebar-item-meta {
    color: var(--text-soft);
}

#rightPanelContext section {
    padding: 14px;
}

#rightPanelContext .section-title {
    margin-bottom: 10px;
}

#streamList .stream-card {
    border-radius: 16px !important;
}

/* Light v1.8 — schärfere Kontraste */
html:not([data-theme="dark"]) .puls-toggle-btn:not(.is-active),
html:not([data-theme="dark"]) .xf-scope-btn:not(.xf-scope-active) {
    border: 1.5px solid #94a3b8 !important;
    background: #fff !important;
    color: #1e293b !important;
}
html:not([data-theme="dark"]) textarea,
html:not([data-theme="dark"]) input[type="text"] {
    border: 1.5px solid #94a3b8 !important;
    background: #fff !important;
    color: #1e293b !important;
}

/* Light v1.8 — xf-chip Kontrast */
html:not([data-theme="dark"]) .xf-chip:not(.xf-chip-active) {
    border: 1.5px solid #94a3b8 !important;
    background: #ffffff !important;
    color: #1e293b !important;
}
html:not([data-theme="dark"]) .xf-chip.xf-chip-active {
    border: 1.5px solid #0f172a !important;
    background: #0f172a !important;
    color: #ffffff !important;
}

/* PULSE BLOCK */
#PlacePulseCard{padding:12px 16px 4px;}
.sprow{display:flex;align-items:center;gap:8px;margin-bottom:4px;}
.slb{font-size:.6rem;font-weight:900;letter-spacing:2px;color:#ff4500 !important;background:rgba(255,69,0,.15) !important;padding:2px 7px;border-radius:20px;}
.sdots{display:flex;gap:3px;}.pd{width:8px;height:8px;border-radius:50%;background:rgba(255,255,255,0.2);}.pd-on{background:#ff4500 !important;}
.slv{font-size:.75rem;font-weight:700;color:var(--text-muted,#888);text-transform:uppercase;letter-spacing:1px;}
.spst{font-size:.75rem;color:var(--text-muted,#888);padding-bottom:4px;}
#PlaceHotCard{padding:4px 16px 8px;}
.sidebar-hot-title{font-size:.7rem;font-weight:800;text-transform:uppercase;color:var(--text-muted,#888);margin-bottom:6px;}
.shc{display:block;background:var(--surface,#1e1e2e);border:1px solid var(--border,#2a2a3a);border-radius:10px;padding:10px 12px;margin-bottom:6px;text-decoration:none;color:inherit;}
.sht{display:inline-block;font-size:.6rem;font-weight:800;padding:2px 6px;border-radius:20px;margin-bottom:4px;}
.sht-s{background:rgba(255,69,0,.15);color:#ff4500;}
.sht-n{background:rgba(59,130,246,.15);color:#3b82f6;}
.shct{display:block;font-size:.82rem;font-weight:600;line-height:1.3;color:var(--text,#fff);}
.shcs{display:block;font-size:.7rem;color:var(--text-muted,#888);margin-top:2px;}
.she{font-size:.8rem;color:var(--text-muted,#888);padding:8px 0;}
/* EVENT CARDS MIT BILD */
.sev{display:flex;gap:10px;background:var(--surface,#1e1e2e);border:1px solid var(--border,#2a2a3a);border-radius:10px;padding:10px;margin-bottom:8px;text-decoration:none;color:inherit;overflow:hidden;}
.si{width:64px;min-width:64px;height:64px;border-radius:8px;background-size:cover;background-position:center;background-color:var(--border,#333);}
.sb{display:flex;flex-direction:column;gap:3px;overflow:hidden;}
.st{display:block;font-size:.82rem;font-weight:700;line-height:1.3;color:var(--text,#fff);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.sm{font-size:.72rem;color:var(--text-muted,#888);}
.ss{font-size:.68rem;color:var(--text-muted,#aaa);}
/* Community sidebar wrap */
.community-sidebar-wrap { padding: 0 16px 16px; }
/* HOT CARD fix: links-buendig, quelle rechts unten */
.shc { text-align:left; }
.shct { text-align:left; }
.shcs { text-align:right; display:block; font-size:.65rem; color:var(--text-muted,#888); margin-top:4px; }
.shc { display:flex !important; flex-direction:column; align-items:flex-start; }
.shcs { align-self:flex-end; margin-top:5px; }
/* PlaceHeader — consolidated */
.place-context-header { padding: 12px 16px 10px; border-bottom: 1px solid var(--border,#2a2a3a); margin-bottom: 0; }
.place-context-header-top { display:flex; justify-content:flex-start; margin-bottom:6px; overflow:visible; padding-top:4px; }
.place-name-heading { font-size:1.4rem !important; font-weight:800 !important; margin:0 0 2px !important; line-height:1.2 !important; color:var(--text,#fff) !important; }
.sidebar-place-meta-text { font-size:0.78rem; color:var(--text-muted,#888); margin:0; }
#PlacePulseCard { margin-top: 8px; }
#rightPanelContext section { margin-bottom: 4px; }
#panel-right[data-right-panel-mode="community"] .sidebar-scroll-area > section { display:none !important; }
#panel-right[data-right-panel-mode="community"] #sidebar-community-mount { display:flex !important; }
.sidebar-scroll-area { overflow-y:auto; flex:1; }
.right-panel-toggle { display:flex; gap:4px; flex-wrap:nowrap; overflow:visible; }
.right-panel-toggle-btn { font-size:10px !important; padding:3px 6px !important; white-space:nowrap; }
#panel-right { min-width: 260px; overflow: visible; }
/* context mode: show sections, hide community mount */
#panel-right[data-right-panel-mode="context"] .sidebar-scroll-area > section { display:block !important; }
#panel-right[data-right-panel-mode="context"] #sidebar-community-mount { display:none !important; }
/* force dot colors */
.pd.pd-on { background-color: #ff4500 !important; background: #ff4500 !important; }
.pd:not(.pd-on) { background-color: rgba(255,255,255,0.25) !important; background: rgba(255,255,255,0.25) !important; }
.slb { color: #ff4500 !important; background: rgba(255,69,0,0.15) !important; }
/* Ortsname unter Buttons ausblenden - steht im Header */
.place-name-heading { display:none !important; }
.sidebar-place-meta-text { display:none !important; }

/* PWA Standalone Mode — iOS PWA viewport fix */
@media all and (display-mode: standalone) {
    header {
        padding-top: env(safe-area-inset-top, 0px) !important;
        height: calc(var(--header-h) + env(safe-area-inset-top, 0px)) !important;
    }
    nav#mobile-bottom-tabs {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 99999 !important;
        padding-bottom: 0 !important;
        height: 56px !important;
        min-height: 56px !important;
    }
    .center-content {
        padding-top: calc(var(--header-h, 64px) + env(safe-area-inset-top, 0px)) !important;
        padding-bottom: 56px !important;
    }
}
