@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --Sela-primary: #1a6b4a;
    --Sela-primary-dark: #0f4d35;
    --Sela-accent: #e8a838;
    --Sela-bg: #f0f4f1;
    --Sela-card: #ffffff;
    --Sela-text: #1a2e24;
    --Sela-muted: #5a7268;
    --Sela-border: #d4e0da;
    --Sela-radius: 12px;
    --Sela-shadow: 0 8px 32px rgba(26, 107, 74, 0.12);
    --app-height: 100dvh;
}

* { box-sizing: border-box; }

html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

:focus:not(:focus-visible) {
    outline: none;
}

body {
    margin: 0;
    font-family: 'IBM Plex Sans Arabic', 'Inter', system-ui, sans-serif;
    background: var(--Sela-bg);
    color: var(--Sela-text);
}

.wasm-loading {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    background: var(--Sela-bg);
    color: var(--Sela-text);
    transition: opacity 0.25s ease;
}

.wasm-loading-hidden {
    opacity: 0;
    pointer-events: none;
}

.wasm-loading-icon-wrap {
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
}

.wasm-loading-icon {
    display: block;
    width: 64px;
    height: 64px;
}

.wasm-loading p {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
    line-height: 1.5;
    min-height: 1.65rem;
}

/* Landing Page */
.landing-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: clip;
}

.landing-scroll-area {
    flex: 1;
    width: 100%;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.pull-refresh-indicator {
    position: sticky;
    top: 0;
    z-index: 5;
    margin: -0.5rem 0 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: var(--Sela-card);
    border: 1px solid var(--Sela-border);
    color: var(--Sela-muted);
    font-size: 0.8rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(26, 107, 74, 0.08);
}

.pull-refresh-indicator[data-state='ready'] {
    color: var(--Sela-primary);
    border-color: var(--Sela-primary);
}

.landing-header {
    flex-shrink: 0;
    background: var(--Sela-card);
    border-bottom: 1px solid var(--Sela-border);
    padding: 1rem max(1rem, env(safe-area-inset-right)) 1rem max(1rem, env(safe-area-inset-left));
}

.landing-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.landing-header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.header-auth-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.header-auth-links a {
    color: var(--Sela-muted);
    text-decoration: none;
    font-weight: 500;
}

.header-auth-links a:hover { color: var(--Sela-primary); }

.header-signup-link {
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    background: var(--Sela-primary);
    color: white !important;
}

.header-signup-link:hover { background: var(--Sela-primary-dark); }

.landing-body { flex: 1; width: 100%; }

.brand { text-decoration: none; display: flex; align-items: center; gap: 0.5rem; }
.brand-logo {
    border-radius: 10px;
    flex-shrink: 0;
    object-fit: contain;
}
.hero-logo {
    max-width: min(100%, 420px);
    width: 100%;
    height: auto;
    margin-bottom: 1.25rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(26, 107, 74, 0.12);
}
.brand-ar { font-size: 2rem; font-weight: 700; color: var(--Sela-primary); }
.brand-en { font-size: 1.25rem; font-weight: 600; color: var(--Sela-muted); }

.lang-switch {
    display: inline-flex;
    padding: 3px;
    background: var(--Sela-bg);
    border: 1px solid var(--Sela-border);
    border-radius: 10px;
    gap: 2px;
}

.lang-switch-full {
    width: 100%;
}

.lang-btn {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.65rem;
    border: none;
    background: transparent;
    border-radius: 7px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--Sela-muted);
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.lang-btn:hover:not(.active) {
    color: var(--Sela-text);
}

.lang-btn.active {
    background: var(--Sela-card);
    color: var(--Sela-primary);
    box-shadow: 0 1px 4px rgba(26, 107, 74, 0.14);
}

.lang-btn[lang="ar"] {
    font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
}

.lang-btn[lang="en"] {
    font-family: 'Inter', system-ui, sans-serif;
}

.lang-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

.landing-main {
    max-width: 1080px;
    margin: 0 auto;
    padding: 2.5rem max(1rem, env(safe-area-inset-right)) 3rem max(1rem, env(safe-area-inset-left));
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: center;
    gap: 2rem 2.5rem;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.hero-panel {
    flex: 1 1 340px;
    max-width: 500px;
    min-width: 0;
}

.hero-panel--full {
    max-width: 520px;
}

.hero-panel--compact {
    max-width: 420px;
}

.auth-section {
    flex: 0 1 400px;
    width: 100%;
    max-width: 420px;
    min-width: 0;
}

.hero-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 1.5rem;
    max-width: 100%;
    min-width: 0;
}

.hero-panel--compact .hero-visual {
    padding-top: 1rem;
}

.hero-subtitle-compact {
    margin-bottom: 1.25rem;
    font-size: 1rem;
}

.hero-logo-compact {
    max-width: min(100%, 300px);
    margin-bottom: 0;
}

@media (min-width: 901px) {
    .hero-panel--full {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 1.5rem;
        align-content: start;
    }

    .hero-panel--full .hero-visual {
        padding-top: 0.5rem;
    }
}

@media (max-width: 900px) {
    .landing-main {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
        padding-top: 1.5rem;
    }

    .hero-panel,
    .auth-section {
        flex: 1 1 auto;
        max-width: none;
        width: 100%;
    }

    .auth-section {
        order: -1;
    }
}

.tagline {
    color: var(--Sela-primary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.hero h1,
.hero-subtitle,
.tagline,
.features li {
    unicode-bidi: plaintext;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 1rem;
    color: var(--Sela-primary-dark);
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--Sela-muted);
    line-height: 1.7;
    margin-bottom: 2rem;
}

.features { list-style: none; padding: 0; margin: 0; }
.features li {
    padding: 0.5rem 0;
    font-size: 1rem;
    color: var(--Sela-text);
}

.hero-card {
    background: linear-gradient(145deg, var(--Sela-primary) 0%, var(--Sela-primary-dark) 100%);
    border-radius: 20px;
    padding: 1.5rem;
    width: 280px;
    box-shadow: var(--Sela-shadow);
    color: white;
}

.hero-card-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.5rem; }
.avatar-group { display: flex; }
.avatar {
    width: 32px; height: 32px; border-radius: 50%;
    border: 2px solid white; margin-inline-start: -8px;
}
.avatar:first-child { margin-inline-start: 0; }
.a1 { background: #e8a838; }
.a2 { background: #6bc4a0; }
.a3 { background: #c4e8d4; }

.hero-card-title { font-weight: 700; font-size: 1.25rem; }

.post-preview { background: rgba(255,255,255,0.15); border-radius: 8px; padding: 1rem; }
.post-line { height: 8px; background: rgba(255,255,255,0.3); border-radius: 4px; margin-bottom: 0.5rem; }
.w80 { width: 80%; } .w60 { width: 60%; } .w40 { width: 40%; }

.connection-ring {
    width: 60px; height: 60px;
    border: 3px solid var(--Sela-accent);
    border-radius: 50%;
    margin: 1rem auto 0;
    opacity: 0.8;
}

.auth-card {
    background: var(--Sela-card);
    border-radius: var(--Sela-radius);
    padding: 2rem;
    box-shadow: var(--Sela-shadow);
    border: 1px solid var(--Sela-border);
}

.auth-card h2 { margin: 0 0 1.5rem; font-size: 1.5rem; color: var(--Sela-primary-dark); }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 0.35rem; color: var(--Sela-muted); }
.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--Sela-border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}
.form-group input:focus { outline: 2px solid var(--Sela-primary); outline-offset: 0; border-color: var(--Sela-primary); }

.btn-primary {
    width: 100%;
    padding: 0.875rem;
    background: var(--Sela-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.0625rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    margin-top: 0.5rem;
}
.btn-primary:hover { background: var(--Sela-primary-dark); }

.auth-footer { text-align: center; margin-top: 1rem; font-size: 0.9375rem; }
.auth-footer a { color: var(--Sela-primary); font-weight: 500; }

.landing-footer {
    flex-shrink: 0;
    background: var(--Sela-card);
    border-top: 1px solid var(--Sela-border);
    padding: 2rem;
    text-align: center;
}

.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.5rem; margin-bottom: 1rem; }
.footer-links a { color: var(--Sela-muted); text-decoration: none; font-size: 0.875rem; }
.footer-links a:hover { color: var(--Sela-primary); }
.copyright { font-size: 0.8125rem; color: var(--Sela-muted); margin: 0; }

.legal-page {
    max-width: 720px;
    margin: 3rem auto;
    padding: 2rem;
    background: var(--Sela-card);
    border-radius: var(--Sela-radius);
    box-shadow: var(--Sela-shadow);
}
.legal-draft { color: var(--Sela-accent); font-weight: 500; }
.legal-page a { color: var(--Sela-primary); }

/* App Shell */
.app-shell {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    grid-template-rows: 1fr;
    grid-template-areas: "sidebar main";
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    width: 100%;
    max-width: 100vw;
}

.app-mobile-header {
    display: none;
}

.app-sidebar {
    grid-area: sidebar;
}

.app-main {
    grid-area: main;
}

.app-sidebar {
    background: var(--Sela-card);
    border-inline-end: 1px solid var(--Sela-border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100vh;
    overflow: visible;
    position: sticky;
    top: 0;
}

.app-brand {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.5rem;
}

.app-brand-icon {
    border-radius: 10px;
    flex-shrink: 0;
    object-fit: contain;
}

.brand-ar,
.brand-en {
    align-self: baseline;
}

.app-brand .brand-ar,
.app-brand .brand-en {
    display: inline;
}

.app-brand-names {
    display: flex;
    align-items: baseline;
    gap: 0.35rem;
}

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    min-height: 0;
    overflow: visible;
    padding-inline: 4px;
}

.app-nav-link {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    column-gap: 0.65rem;
    align-items: center;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    color: var(--Sela-text);
    text-decoration: none;
    font-weight: 500;
}

.app-nav-icon-wrap {
    position: relative;
    width: 32px;
    height: 32px;
    line-height: 0;
    flex-shrink: 0;
}

.app-nav-svg {
    display: block;
    width: 24px;
    height: 24px;
    margin: 4px auto;
    flex: none;
    overflow: visible;
    shape-rendering: geometricPrecision;
}

.app-nav-badge {
    position: absolute;
    top: 0;
    inset-inline-end: 0;
    inset-inline-start: auto;
    transform: translate(30%, -30%);
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: #c0392b;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    pointer-events: none;
}

.app-nav-link.active .app-nav-badge {
    background: white;
    color: #c0392b;
}

.app-nav-badge-dot {
    min-width: 10px;
    width: 10px;
    height: 10px;
    padding: 0;
    transform: translate(20%, -20%);
}

.app-nav-label {
    line-height: 1.2;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-nav-link:hover { background: var(--Sela-bg); color: var(--Sela-primary); }
.app-nav-link.active { background: var(--Sela-primary); color: white; }

.app-nav-profile-fallback {
    display: block;
}

.app-nav-profile-avatar {
    display: none;
}

.app-nav-profile-avatar--placeholder {
    background: var(--Sela-primary);
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
    align-items: center;
    justify-content: center;
}
.app-nav-admin { color: var(--Sela-accent); }

.app-sidebar-footer {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--Sela-border);
}

.app-sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.75rem;
    margin-top: 0.75rem;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    background: var(--Sela-bg);
    border: 1px solid var(--Sela-border);
}

.app-sidebar-user:hover {
    border-color: var(--Sela-primary);
    color: var(--Sela-primary);
}

.app-sidebar-user-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.app-sidebar-user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.app-sidebar-user-name {
    font-weight: 600;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sidebar-user-handle {
    font-size: 0.78rem;
    color: var(--Sela-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-logout {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: transparent;
    border: 1px solid var(--Sela-border);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    color: var(--Sela-muted);
}

.btn-logout:hover { border-color: var(--Sela-primary); color: var(--Sela-primary); }

.app-main {
    display: grid;
    grid-template-columns: min(900px, 100%) minmax(280px, 1fr);
    gap: 2rem;
    align-content: start;
    padding: 1.5rem 2rem;
    min-width: 0;
    width: 100%;
    height: 100vh;
    overflow-y: auto;
}

.app-main:has(.chat-layout),
.app-main:has(.profile-layout) {
    grid-template-columns: minmax(0, 1fr);
}

.app-main:has(.chat-layout) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    height: 100%;
    max-height: 100vh;
    align-content: unset;
}

.app-main:has(.chat-layout) .pull-refresh-indicator {
    flex: 0 0 auto;
}

.app-main:has(.chat-layout) .app-content {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.app-main:has(.chat-layout) .chat-layout {
    flex: 1 1 0;
    min-height: 0;
}

.app-main:has(.chat-layout) .app-rail,
.app-main:has(.profile-layout) .app-rail {
    display: none;
}

.app-content {
    min-width: 0;
}

.app-rail {
    min-width: 0;
    align-self: start;
    position: sticky;
    top: 1.5rem;
}

@media (max-width: 768px) {
    body:has(.landing-page) {
        overflow: hidden;
        height: 100%;
        height: 100dvh;
    }

    .landing-page {
        position: fixed;
        inset: 0;
        width: 100%;
        max-width: 100vw;
        max-height: 100dvh;
        overflow-y: hidden;
    }

    .landing-scroll-area {
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    body:has(.app-shell) {
        overflow: hidden;
        height: var(--app-height, 100dvh);
    }

    .app-shell {
        display: flex;
        flex-direction: column;
        position: fixed;
        inset: 0;
        width: 100%;
        max-width: 100vw;
        height: var(--app-height, 100dvh);
        max-height: var(--app-height, 100dvh);
        overflow: hidden;
    }

    .app-mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.65rem 1rem;
        padding-top: max(0.65rem, env(safe-area-inset-top));
        background: var(--Sela-card);
        border-bottom: 1px solid var(--Sela-border);
        position: sticky;
        top: 0;
        z-index: 30;
        flex-shrink: 0;
    }

    .app-mobile-brand {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        text-decoration: none;
        color: var(--Sela-primary-dark);
        font-weight: 700;
        font-size: 1.05rem;
        min-width: 0;
    }

    .app-mobile-brand img {
        border-radius: 8px;
        flex-shrink: 0;
        object-fit: contain;
    }

    .app-mobile-header-actions {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex-shrink: 0;
    }

    .app-mobile-notifications {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.25rem;
        height: 2.25rem;
        border-radius: 8px;
        color: var(--Sela-text);
        text-decoration: none;
        flex-shrink: 0;
    }

    .app-mobile-notifications-icon {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.25rem;
        height: 2.25rem;
    }

    .app-mobile-notifications .app-nav-badge {
        top: 0;
        inset-inline-end: 0;
        transform: translate(35%, -35%);
        min-width: 16px;
        height: 16px;
        padding: 0 3px;
        font-size: 0.6rem;
        line-height: 16px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .app-mobile-notifications .app-nav-svg {
        width: 22px;
        height: 22px;
        margin: 0;
    }

    .app-nav-notifications-link--sidebar {
        display: none !important;
    }

    .lang-switch-compact .lang-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.72rem;
    }

    .btn-logout-icon {
        width: 2.25rem;
        height: 2.25rem;
        margin-top: 0;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .btn-logout-icon .app-nav-svg {
        width: 20px;
        height: 20px;
    }

    .app-sidebar {
        position: fixed;
        left: 0;
        right: 0;
        inset-inline: 0;
        bottom: 0;
        top: auto;
        z-index: 40;
        width: 100%;
        height: auto;
        max-height: none;
        padding: 0.35rem 0.5rem;
        padding-bottom: max(0.35rem, env(safe-area-inset-bottom));
        border-inline-end: none;
        border-top: 1px solid var(--Sela-border);
        box-shadow: 0 -4px 16px rgba(26, 107, 74, 0.08);
        overflow: visible;
    }

    .app-brand,
    .app-sidebar-user,
    .app-sidebar-footer {
        display: none !important;
    }

    .app-nav {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: space-between;
        gap: 0.15rem;
        width: 100%;
        overflow: visible;
    }

    .app-nav::-webkit-scrollbar {
        display: none;
    }

    .app-nav-link {
        flex: 1 1 0;
        min-width: 0;
        max-width: none;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.2rem;
        padding: 0.35rem 0.15rem;
        font-size: 0.625rem;
        border-radius: 10px;
    }

    .app-nav-label {
        font-size: 0.625rem;
        line-height: 1.15;
        text-align: center;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .app-nav-icon-wrap {
        width: 32px;
        height: 32px;
    }

    .app-nav-svg {
        width: 24px;
        height: 24px;
        margin: 4px auto;
    }

    .app-nav-profile-fallback {
        display: none;
    }

    .app-nav-profile-avatar {
        display: none;
    }

    .app-nav-profile-link--has-avatar .app-nav-profile-fallback {
        display: none;
    }

    .app-nav-profile-link--has-avatar .app-nav-profile-avatar {
        display: block;
        width: 28px;
        height: 28px;
        border-radius: 50%;
        object-fit: cover;
        margin: 2px auto;
    }

    .app-nav-profile-link:not(.app-nav-profile-link--has-avatar) .app-nav-profile-fallback {
        display: block;
    }

    .app-nav-profile-link--has-avatar .app-nav-profile-avatar--placeholder {
        display: flex;
    }

    .app-nav-profile-link.active {
        background: transparent;
        color: var(--Sela-primary-dark);
    }

    .app-nav-profile-link.active .app-nav-profile-avatar {
        box-shadow: 0 0 0 2px var(--Sela-card), 0 0 0 3.5px var(--Sela-primary);
    }

    .app-nav-profile-link.active:not(.app-nav-profile-link--has-avatar) {
        background: var(--Sela-primary);
        color: white;
    }

    .app-main {
        flex: 1;
        display: block;
        grid-template-columns: 1fr;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: 0.75rem 1rem calc(7.5rem + env(safe-area-inset-bottom));
    }

    .app-main:has(.chat-layout) {
        display: flex;
        flex-direction: column;
        overflow: hidden;
        padding-bottom: calc(5rem + env(safe-area-inset-bottom));
        min-height: 0;
    }

    .app-main:has(.chat-layout) .app-content {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .app-content {
        width: 100%;
        max-width: 100%;
    }

    .app-rail {
        display: none;
    }

    .page-header {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h1 { margin: 0; color: var(--Sela-primary-dark); }

.card {
    background: var(--Sela-card);
    border: 1px solid var(--Sela-border);
    border-radius: var(--Sela-radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(26, 107, 74, 0.06);
}

.muted { color: var(--Sela-muted); font-size: 0.875rem; }
.date-ltr {
    unicode-bidi: isolate;
    display: inline-block;
}
.bidi-ltr {
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
}

.feed-meta {
    unicode-bidi: isolate;
    display: inline-block;
}

.chat-header-last-seen {
    unicode-bidi: plaintext;
}

.btn-sm { width: auto; padding: 0.5rem 1rem; font-size: 0.875rem; }

.btn-secondary {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--Sela-border);
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    color: var(--Sela-text);
}

.btn-secondary:hover { border-color: var(--Sela-primary); color: var(--Sela-primary); }

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    color: var(--Sela-muted);
    text-decoration: none;
    font-size: 0.9375rem;
}

.btn-icon.liked { color: #c0392b; }
.btn-icon.react-angry { color: #d35400; }
.btn-icon.react-disbelief { color: #8e44ad; }
.reaction-picker .btn-icon.liked,
.reaction-picker .btn-icon.react-angry,
.reaction-picker .btn-icon.react-disbelief {
    color: inherit;
    background: color-mix(in srgb, var(--Sela-primary) 14%, transparent);
    border-radius: 0.35rem;
    padding: 0.1rem 0.35rem;
}
.reaction-picker { display: inline-flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.reaction-picker-compact { gap: 0.2rem; }
.profile-photo-dialog .profile-photo-preview {
    width: 100%;
    max-height: 240px;
    object-fit: contain;
    border-radius: 8px;
    margin: 0.75rem 0;
    background: var(--Sela-surface-muted, #f4f4f4);
}

.profile-photo-preview-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    padding: 1rem;
    text-align: center;
    font-size: 0.9rem;
}
.profile-photo-post-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0.5rem 0 0.75rem;
    cursor: pointer;
}
.profile-photo-post-toggle input { width: auto; }

.alert-error {
    background: #fde8e8;
    color: #9b1c1c;
    border: 1px solid #f5c2c2;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.auth-debug-panel {
    margin: 0 0 1rem;
    padding: 0.65rem 0.75rem;
    border: 1px dashed #c9d4cf;
    border-radius: 8px;
    background: #f7faf8;
    font-size: 0.75rem;
    color: #355446;
}

.auth-debug-panel summary {
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.auth-debug-pre {
    margin: 0.35rem 0 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.7rem;
    line-height: 1.35;
    color: #1f3d31;
}

.register-errors ul {
    margin: 0;
    padding-inline-start: 1.25rem;
}

.register-errors li + li {
    margin-top: 0.35rem;
}

.form-hint {
    margin: 0.35rem 0 0;
    line-height: 1.4;
}

.phone-field-row {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.phone-country-picker {
    position: relative;
    flex: 0 0 auto;
}

.phone-country-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 100%;
    min-height: 2.75rem;
    padding: 0 0.75rem;
    border: 1px solid var(--Sela-border);
    border-radius: 8px;
    background: #fff;
    color: var(--Sela-primary-dark);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
}

.phone-country-trigger:hover {
    border-color: var(--Sela-primary);
}

.phone-country-trigger:focus-visible {
    outline: 2px solid var(--Sela-primary);
    outline-offset: 0;
}

.phone-country-chevron {
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--Sela-muted);
}

.phone-country-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
}

.phone-country-menu {
    position: absolute;
    top: calc(100% + 0.35rem);
    inset-inline-start: 0;
    z-index: 50;
    width: min(22rem, calc(100vw - 2rem));
    max-height: min(18rem, 50vh);
    overflow-y: auto;
    border: 1px solid var(--Sela-border);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--Sela-shadow);
    padding: 0.35rem 0;
}

.phone-country-section + .phone-country-section {
    border-top: 1px solid var(--Sela-border);
    margin-top: 0.25rem;
    padding-top: 0.25rem;
}

.phone-country-section-title {
    padding: 0.4rem 0.85rem 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--Sela-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.phone-country-option {
    display: block;
    width: 100%;
    padding: 0.55rem 0.85rem;
    border: none;
    background: transparent;
    color: var(--Sela-text);
    font-size: 0.9rem;
    font-family: inherit;
    text-align: start;
    cursor: pointer;
}

.phone-country-option:hover,
.phone-country-option.selected {
    background: #eef6f1;
    color: var(--Sela-primary-dark);
}

.phone-national-input {
    flex: 1 1 auto;
    min-width: 0;
}

@media (max-width: 480px) {
    .phone-field-row {
        flex-direction: row;
    }

    .phone-country-menu {
        width: min(20rem, calc(100vw - 2rem));
    }
}

.alert-success {
    background: #e8f5ee;
    color: var(--Sela-primary-dark);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.empty-state { text-align: center; padding: 2rem; color: var(--Sela-muted); }

/* Auth pages in app */
.auth-page {
    display: flex;
    justify-content: center;
    padding: 2rem 1.5rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
}

.auth-page .auth-card { max-width: 420px; width: 100%; }
.auth-page h1 { margin: 0 0 1.5rem; font-size: 1.5rem; color: var(--Sela-primary-dark); }

/* Feed */
.feed-compose textarea {
    width: 100%;
    border: 1px solid var(--Sela-border);
    border-radius: 8px;
    padding: 0.75rem;
    font-family: inherit;
    resize: vertical;
}

.feed-compose-actions { display: flex; justify-content: flex-end; margin-top: 0.75rem; }

/* Post composer */
.post-composer { margin-bottom: 1rem; }
.post-composer-inner { display: flex; gap: 0.75rem; align-items: flex-start; }
.post-composer-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    background: linear-gradient(135deg, var(--Sela-primary), var(--Sela-accent));
    color: white; display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.post-composer-main { flex: 1; min-width: 0; }
.post-composer-input {
    width: 100%; border: 1px solid var(--Sela-border); border-radius: var(--Sela-radius);
    padding: 0.85rem 1rem; font-family: inherit; font-size: 1rem;
    resize: vertical; min-height: 72px; background: #fafcfb;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.post-composer-input:focus {
    outline: none; border-color: var(--Sela-primary);
    box-shadow: 0 0 0 3px rgba(26, 107, 74, 0.12);
}
.post-composer-toolbar {
    display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
    margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--Sela-border);
}
.post-composer-attach {
    position: relative;
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.45rem 0.85rem; border-radius: 8px;
    border: 1px dashed var(--Sela-border); background: #f8fbf9;
    color: var(--Sela-primary-dark); font-weight: 500; font-size: 0.9rem;
    cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.post-composer-attach:hover { background: #eef5f1; border-color: var(--Sela-primary); }
.post-composer-attach-icon { font-size: 1rem; }
.post-composer-file-input {
    position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden;
}
.post-composer-hint { font-size: 0.8rem; flex: 1; }
.post-composer-submit { margin-inline-start: auto; }
.post-composer-error { margin-top: 0.5rem; }
.post-composer-previews {
    display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem;
}
.post-composer-preview {
    position: relative; width: 88px; height: 88px; border-radius: 8px; overflow: hidden;
    border: 1px solid var(--Sela-border);
}
.post-composer-preview img { width: 100%; height: 100%; object-fit: cover; }
.post-composer-remove {
    position: absolute; top: 4px; inset-inline-end: 4px;
    width: 22px; height: 22px; border: none; border-radius: 50%;
    background: rgba(0,0,0,0.65); color: white; cursor: pointer; line-height: 1;
}

.feed-empty { text-align: center; padding: 2rem; }
.feed-empty .btn-primary { margin-top: 1rem; }
.discover-section { margin-top: 1.5rem; }
.discover-section h2 { font-size: 1.1rem; margin-bottom: 1rem; }
.feed-group-tag { color: var(--Sela-primary); font-weight: 500; }

.feed-group-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(26, 107, 74, 0.1);
    border: 1px solid rgba(26, 107, 74, 0.2);
    color: var(--Sela-primary-dark);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    max-width: 100%;
}

.feed-group-badge:hover {
    background: rgba(26, 107, 74, 0.16);
}

.feed-group-badge-icon {
    flex-shrink: 0;
    font-size: 0.9rem;
    line-height: 1;
}

.feed-group-badge-label {
    flex-shrink: 0;
    opacity: 0.85;
}

.feed-group-badge-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.feed-card-header-compact { display: flex; justify-content: space-between; align-items: center; }

.feed-card-header { margin-bottom: 0.75rem; display: flex; justify-content: space-between; align-items: flex-start; gap: 0.75rem; }
.feed-author-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; justify-content: flex-end; }
.feed-edit-actions, .comment-edit-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; }
.feed-edit-input { width: 100%; margin: 0.5rem 0; padding: 0.5rem; border: 1px solid var(--Sela-border); border-radius: 0.375rem; font-family: inherit; resize: vertical; }
.btn-link.danger { color: #c0392b; }
.edited-label, .confirm-label { font-size: 0.85rem; }

.feed-author { display: flex; gap: 0.75rem; align-items: center; }

.author-link {
    color: inherit;
    text-decoration: none;
}

.author-link:hover {
    color: var(--Sela-primary);
}

.author-name {
    display: block;
    font-weight: 600;
}

.feed-new-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--Sela-primary);
    color: white;
    border-radius: var(--Sela-radius);
    box-shadow: var(--Sela-shadow);
}

.feed-new-banner .btn-primary {
    background: white;
    color: var(--Sela-primary-dark);
    border: none;
}

.feed-new-banner .btn-primary:hover:not(:disabled) {
    background: #f4f4f4;
}

.feed-toast {
    margin-bottom: 1rem;
}

.avatar-placeholder {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--Sela-primary);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; flex-shrink: 0;
}

.feed-content { line-height: 1.6; margin: 0 0 0.75rem; white-space: pre-wrap; }

.feed-images {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.feed-images img { max-width: 100%; border-radius: 8px; }

.feed-image-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0;
    margin: 0;
    border: 0;
    background: var(--Sela-bg);
    border-radius: 8px;
    cursor: zoom-in;
    overflow: hidden;
    max-height: min(360px, 50vh);
}

.feed-image-trigger img {
    display: block;
    width: 100%;
    height: auto;
    max-height: min(360px, 50vh);
    margin-top: 0;
    object-fit: contain;
    object-position: center;
}

.feed-image-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    border-radius: 8px;
    background: var(--Sela-bg);
    max-height: min(360px, 50vh);
    cursor: grab;
    user-select: none;
}

.feed-image-carousel.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
}

.feed-image-carousel-wrap {
    position: relative;
}

.carousel-nav {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--Sela-primary-dark);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    align-items: center;
    justify-content: center;
}

.carousel-nav-prev { inset-inline-start: 0.5rem; }
.carousel-nav-next { inset-inline-end: 0.5rem; }

.carousel-nav-lightbox {
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
}

@media (hover: hover) and (pointer: fine) {
    .carousel-nav {
        display: inline-flex;
    }

    .feed-image-carousel-wrap:hover .carousel-nav {
        display: inline-flex;
    }
}

.feed-image-carousel::-webkit-scrollbar {
    display: none;
}

@media (hover: hover) and (pointer: fine) {
    .feed-image-carousel {
        scrollbar-width: thin;
        scrollbar-color: var(--Sela-border) transparent;
    }

    .feed-image-carousel::-webkit-scrollbar {
        display: block;
        height: 6px;
    }

    .feed-image-carousel::-webkit-scrollbar-thumb {
        background: var(--Sela-border);
        border-radius: 999px;
    }
}

.feed-image-slide {
    flex: 0 0 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    min-width: 100%;
    max-height: min(360px, 50vh);
}

.feed-image-carousel-meta,
.post-image-lightbox-meta {
    text-align: center;
    font-size: 0.8rem;
    margin-top: 0.35rem;
}

.feed-image-carousel-full,
.feed-images-full .feed-image-trigger {
    max-height: none;
}

.feed-image-carousel-full .feed-image-slide,
.feed-images-full .feed-image-trigger img,
.feed-images-full .feed-image-full {
    max-height: none;
}

.post-image-lightbox-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    width: min(96vw, 1200px);
    max-width: 100%;
    cursor: grab;
    user-select: none;
}

.post-image-lightbox-carousel.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
}

.feed-image-carousel-wrap-lightbox {
    width: min(96vw, 1200px);
    max-width: 100%;
}

.post-image-lightbox-carousel::-webkit-scrollbar {
    display: none;
}

.post-image-lightbox-slide {
    flex: 0 0 100%;
    scroll-snap-align: center;
    min-width: 100%;
}

.feed-image-item {
    margin: 0;
}

.feed-image-item .feed-image-full {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin-top: 0;
    border-radius: 8px;
}

.feed-card-footer { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; padding-top: 0.75rem; padding-bottom: 0.35rem; border-top: 1px solid var(--Sela-border); }

.feed-card { margin-bottom: 0.75rem; }

.feed-list { padding-bottom: 1.5rem; }

@media (max-width: 768px) {
    .feed-list { padding-bottom: 2.75rem; }
    .feed-card-footer { padding-bottom: 0.85rem; margin-bottom: 0.25rem; }
}

.feed-image-open-link {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.85rem;
    color: var(--Sela-primary);
    text-decoration: none;
}

.feed-image-open-link:hover { text-decoration: underline; }

.post-image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.85);
}

.post-image-lightbox-inner {
    max-width: min(96vw, 1200px);
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.post-image-lightbox-img {
    max-width: 100%;
    max-height: calc(92vh - 3rem);
    object-fit: contain;
    border-radius: 8px;
}

.post-image-lightbox-actions {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0.65rem 1rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    backdrop-filter: blur(10px);
}

.lightbox-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem 1.15rem;
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.lightbox-btn-solid {
    background: #fff;
    border: 1px solid #fff;
    color: #1a2e24;
}

.lightbox-btn-solid:hover {
    background: #eef2ef;
    border-color: #eef2ef;
    color: #0f4d35;
}

.lightbox-btn-ghost {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.45);
    color: #fff;
}

.lightbox-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.65);
    color: #fff;
}

.load-more { text-align: center; margin: 1.5rem 0; }

/* Profile */
.profile-toast { margin-bottom: 1rem; }

.profile-hero { padding: 0; overflow: hidden; }

.profile-cover-large {
    height: 220px;
    background: linear-gradient(135deg, var(--Sela-primary), var(--Sela-primary-dark));
    background-size: cover;
    background-position: center;
    position: relative;
}

.profile-cover-btn {
    position: absolute;
    bottom: 1rem;
    inset-inline-end: 1rem;
}

.profile-hero-body {
    display: flex;
    gap: 1.25rem;
    align-items: flex-end;
    padding: 0 1.5rem 1.5rem;
    margin-top: -3rem;
    flex-wrap: wrap;
}

.profile-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.profile-avatar {
    width: 128px; height: 128px;
    border-radius: 50%;
    background: var(--Sela-accent);
    color: white;
    display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem; font-weight: 700;
    border: 4px solid var(--Sela-card);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.profile-avatar-img {
    width: 128px; height: 128px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--Sela-card);
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    display: block;
}

.profile-avatar-btn {
    position: absolute;
    bottom: 0.25rem;
    inset-inline-end: 0.25rem;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-hero-meta { flex: 1; min-width: 200px; padding-top: 3.5rem; }
.profile-hero-meta h1 { margin: 0 0 0.25rem; font-size: 1.75rem; }
.profile-username { margin: 0 0 0.5rem; }
.profile-bio-preview { margin: 0 0 0.75rem; line-height: 1.5; }

.profile-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.profile-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1rem;
    margin-top: 1rem;
    align-items: start;
}

@media (max-width: 900px) {
    .profile-layout { grid-template-columns: 1fr; }
    .profile-hero-body { flex-direction: column; align-items: center; text-align: center; }
    .profile-hero-meta { padding-top: 0.5rem; }
    .profile-hero-actions { justify-content: center; }
}

.profile-about h2,
.profile-posts-title {
    margin: 0 0 1rem;
    font-size: 1.125rem;
    color: var(--Sela-primary-dark);
}

.profile-posts-title { margin-top: 0; }

.profile-details { margin: 0; }

.profile-detail { margin-bottom: 1rem; }
.profile-detail dt { font-size: 0.8rem; font-weight: 600; color: var(--Sela-muted); margin-bottom: 0.25rem; }
.profile-detail dd { margin: 0; line-height: 1.5; }

.profile-main { display: flex; flex-direction: column; gap: 1rem; }

.profile-media-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    background: rgba(255,255,255,0.92);
    border: 1px solid var(--Sela-border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--Sela-text);
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.profile-media-btn:hover { background: white; }

.profile-file-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
}

.profile-edit textarea { width: 100%; font-family: inherit; border: 1px solid var(--Sela-border); border-radius: 8px; padding: 0.5rem; }

.profile-cover {
    height: 120px;
    background: linear-gradient(135deg, var(--Sela-primary), var(--Sela-primary-dark));
    border-radius: var(--Sela-radius) var(--Sela-radius) 0 0;
    margin: -1.25rem -1.25rem 0;
}

.profile-info { padding-top: 1rem; }

/* Friends & lists */
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }

.tab {
    padding: 0.5rem 1rem;
    border: 1px solid var(--Sela-border);
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
}

.tab.active { background: var(--Sela-primary); color: white; border-color: var(--Sela-primary); }

.user-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }

.user-list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.user-list-link {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    text-decoration: none;
    color: inherit;
}

.user-list-link:hover strong {
    color: var(--Sela-primary);
}

.user-list-info a,
.user-list-info strong {
    color: inherit;
}

.user-list-info a:hover {
    color: var(--Sela-primary);
}

.friend-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: var(--Sela-bg);
    color: var(--Sela-primary);
    font-size: 0.875rem;
    font-weight: 600;
}

.user-list-info { flex: 1; display: flex; flex-direction: column; }

.user-list-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.user-list-meta {
    font-size: 0.875rem;
}

.suggestion-reason {
    font-size: 0.8rem;
    color: var(--Sela-primary);
    margin-top: 0.15rem;
}

.discover-section h2 {
    margin: 0 0 0.5rem;
    font-size: 1.1rem;
}

.profile-preferences {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--Sela-border);
}

.profile-preferences h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-row input {
    width: 1rem;
    height: 1rem;
}

.search-bar { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.search-bar input { flex: 1; padding: 0.5rem 0.75rem; border: 1px solid var(--Sela-border); border-radius: 8px; font-family: inherit; }

/* Chat */
.chat-layout {
    display: grid;
    grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
    gap: 1rem;
    flex: 1;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.chat-layout > .card {
    margin-bottom: 0;
    min-height: 0;
}

.chat-sidebar {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.chat-sidebar .conversation-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .chat-layout { grid-template-columns: 1fr; min-height: 0; }

    .chat-layout:not(.chat-layout--conversation-open) .chat-panel {
        display: none;
    }

    .chat-layout--conversation-open .chat-sidebar {
        display: none;
    }

    .chat-layout--conversation-open .chat-panel {
        display: flex;
        flex-direction: column;
        flex: 1 1 0;
        min-height: 0;
        padding: 0;
        margin: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }

    .chat-layout--conversation-open .chat-panel .chat-header {
        background: var(--Sela-card);
        position: relative;
        z-index: 2;
        margin: 0;
        margin-bottom: 0;
        border-bottom: 1px solid var(--Sela-border);
        padding-top: max(0.65rem, env(safe-area-inset-top));
        padding-bottom: 0.65rem;
        padding-inline: max(0.75rem, env(safe-area-inset-left)) max(0.75rem, env(safe-area-inset-right));
    }

    .chat-layout--conversation-open .chat-messages {
        border-radius: 0;
        margin-inline: 0;
        padding-inline: max(0.75rem, env(safe-area-inset-left)) max(0.75rem, env(safe-area-inset-right));
    }

    .chat-sidebar {
        min-height: 0;
        overflow: auto;
    }

    .chat-back-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.25rem;
        height: 2.25rem;
        border: 1px solid var(--Sela-border);
        border-radius: 8px;
        background: var(--Sela-card);
        color: var(--Sela-text);
        flex-shrink: 0;
        cursor: pointer;
        font-size: 1.1rem;
        line-height: 1;
    }

    .chat-header {
        align-items: center;
    }

    .chat-header-actions {
        flex-wrap: wrap;
        gap: 0.35rem;
    }

    .chat-header-actions--desktop {
        display: none !important;
    }

    .chat-header-menu {
        display: block !important;
    }

    .chat-header-more-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.25rem;
        height: 2.25rem;
        border: 1px solid var(--Sela-border);
        border-radius: 8px;
        background: var(--Sela-card);
        color: var(--Sela-text);
        font-size: 1.25rem;
        line-height: 1;
        cursor: pointer;
        padding: 0;
    }

    .chat-header-actions .btn-sm {
        padding: 0.35rem 0.55rem;
        font-size: 0.75rem;
    }

    .chat-layout--conversation-open {
        display: flex;
        flex-direction: column;
        flex: 1 1 0;
        min-height: 0;
        overflow: hidden;
    }

    .app-shell:has(.chat-layout--conversation-open) .app-mobile-header {
        display: none;
    }

    body.chat-conversation-open .app-sidebar {
        display: none !important;
    }

    body.chat-conversation-open .app-main:has(.chat-layout) {
        flex: 1;
        min-height: 0;
        padding: 0;
        padding-bottom: 0;
        overflow: hidden;
    }

    body.chat-input-focused.chat-conversation-open .app-shell {
        top: var(--visual-offset-top, 0px);
        bottom: auto;
        height: var(--app-height, 100dvh);
        max-height: var(--app-height, 100dvh);
    }

    body.chat-input-focused.chat-conversation-open .chat-compose {
        position: sticky;
        bottom: 0;
        z-index: 5;
    }

    body.chat-conversation-open .app-main:has(.chat-layout) .pull-refresh-indicator {
        display: none !important;
    }

    body.chat-conversation-open .app-content {
        flex: 1;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    body.chat-conversation-open .app-content .pwa-banner {
        display: none;
    }

    .chat-layout--conversation-open .chat-compose {
        flex-shrink: 0;
        padding-inline: max(0.75rem, env(safe-area-inset-left)) max(0.75rem, env(safe-area-inset-right));
        padding-bottom: max(0.65rem, env(safe-area-inset-bottom));
    }

    body.chat-input-focused.chat-conversation-open .app-main:has(.chat-layout) {
        padding-bottom: 0;
    }

    .chat-compose {
        padding: 0.5rem 0.75rem;
        padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
        background: var(--Sela-card);
    }

    .chat-compose-row {
        gap: 0.45rem;
    }

    .chat-compose-input {
        font-size: 16px;
    }

    .chat-send-btn {
        min-width: 3.25rem;
        padding-inline: 0.85rem;
        touch-action: manipulation;
    }

    .chat-messages {
        padding-bottom: 0.5rem;
    }

    .chat-message-mine-actions {
        display: none;
        align-items: center;
        gap: 0.35rem;
        flex-wrap: wrap;
    }

    .chat-message.show-actions .chat-message-mine-actions {
        display: inline-flex;
    }

    .chat-message-more-btn {
        border: 0;
        background: transparent;
        color: inherit;
        opacity: 0.85;
        cursor: pointer;
        padding: 0 0.25rem;
        font-size: 1rem;
        line-height: 1;
    }
}

@media (min-width: 769px) {
    .chat-back-btn {
        display: none;
    }

    .chat-message-more-btn {
        display: none;
    }

    .chat-message-mine-actions {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        flex-wrap: wrap;
    }
}

.chat-sidebar h2 { margin: 0 0 1rem; font-size: 1.125rem; }

.conversation-list { list-style: none; padding: 0; margin: 0; }

.conversation-item {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem;
    border-radius: 8px;
    cursor: pointer;
}

.conversation-item:hover, .conversation-item.active { background: var(--Sela-bg); }

.conversation-item .truncate { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; }

.conversation-unread-badge {
    flex-shrink: 0;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    border-radius: 999px;
    background: var(--Sela-primary);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.chat-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--Sela-border);
    flex-shrink: 0;
}

.chat-header-main {
    display: flex;
    gap: 0.75rem;
    min-width: 0;
    flex: 1;
}

.chat-header-avatar {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
}

.chat-header-meta {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.chat-header-name {
    font-size: 1rem;
}

.chat-header-username {
    font-size: 0.82rem;
    color: var(--Sela-muted);
}

.chat-header-presence {
    font-size: 0.78rem;
}

.chat-header-presence.online {
    color: #0284c7;
}

.chat-header-presence-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.chat-header-presence.offline {
    color: var(--Sela-muted);
}

.chat-header-actions {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.chat-header-menu {
    display: none;
    position: relative;
    flex-shrink: 0;
}

.chat-header-menu-backdrop {
    display: none;
}

.chat-header-menu-panel {
    position: absolute;
    inset-inline-end: 0;
    top: calc(100% + 0.35rem);
    z-index: 50;
    min-width: 11rem;
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    box-shadow: var(--Sela-shadow);
}

.chat-header-menu-item {
    display: block;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--Sela-text);
    font-family: inherit;
    font-size: 0.9rem;
    text-align: start;
    text-decoration: none;
    cursor: pointer;
}

.chat-header-menu-item:hover {
    background: rgba(26, 107, 74, 0.08);
}

.chat-header-menu-item-danger {
    color: #b42318;
}

@media (min-width: 769px) {
    .chat-header-actions--desktop {
        display: flex;
    }

    .chat-header-menu {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .chat-header-menu-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1190;
        background: rgba(15, 23, 42, 0.35);
    }

    .chat-header-menu-panel {
        position: fixed;
        inset-inline: 0.75rem;
        top: auto;
        bottom: calc(4.75rem + env(safe-area-inset-bottom));
        z-index: 1200;
        min-width: 0;
        padding: 0.5rem;
        border-radius: 12px;
    }

    body.chat-input-focused.chat-conversation-open .chat-header-menu-panel {
        bottom: calc(0.75rem + env(safe-area-inset-bottom));
    }

    .chat-header-menu-item {
        padding: 0.75rem 0.85rem;
        font-size: 0.95rem;
    }
}

.chat-header-toast {
    margin-bottom: 0.5rem;
}

.avatar-presence-wrap {
    position: relative;
    flex-shrink: 0;
}

.conversation-avatar-wrap {
    width: 2.25rem;
    height: 2.25rem;
}

.chat-header-avatar-wrap {
    width: 2.75rem;
    height: 2.75rem;
}

.presence-dot {
    position: absolute;
    bottom: 0;
    inset-inline-end: 0;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: #38bdf8;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.conversation-item.active .presence-dot {
    border-color: var(--Sela-bg);
}

.conversation-avatar {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.conversation-avatar.avatar-placeholder {
    width: 2.25rem;
    height: 2.25rem;
    font-size: 0.95rem;
}

.chat-compose {
    flex-shrink: 0;
    border-top: 1px solid var(--Sela-border);
    padding: 0.5rem 0.75rem;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
    background: var(--Sela-card);
}

.chat-compose-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    width: 100%;
    min-width: 0;
}

.chat-compose-input {
    flex: 1;
    min-width: 0;
    min-height: 2.75rem;
    max-height: 7.5rem;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--Sela-border);
    border-radius: 1.25rem;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.35;
    resize: none;
    background: var(--Sela-bg);
    color: var(--Sela-text);
}

.chat-compose-input::placeholder {
    color: var(--Sela-muted);
    opacity: 1;
}

.chat-compose-input:focus {
    outline: 2px solid rgba(26, 107, 74, 0.35);
    outline-offset: 0;
    border-color: var(--Sela-primary);
}

.chat-attach-btn {
    flex-shrink: 0;
    width: 2.75rem;
    height: 2.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    opacity: 0.65;
    font-size: 1.15rem;
    padding: 0;
}

.chat-send-btn {
    flex-shrink: 0;
    width: auto;
    margin-top: 0;
    height: 2.75rem;
    min-width: 2.75rem;
    padding: 0 0.9rem;
    border-radius: 1.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    touch-action: manipulation;
}

.chat-send-btn:disabled {
    opacity: 0.45;
}

.chat-send-btn-label {
    display: inline-block;
}

.session-bootstrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    background: var(--Sela-bg);
}

.session-bootstrap-icon {
    border-radius: 12px;
    animation: session-bootstrap-pulse 1.2s ease-in-out infinite;
}

.app-shell--logging-out {
    pointer-events: none;
    user-select: none;
}

.logout-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(26, 46, 36, 0.42);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.logout-overlay-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.75rem 2rem;
    min-width: min(16rem, 90vw);
    text-align: center;
    box-shadow: var(--Sela-shadow);
}

.logout-overlay-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--Sela-border);
    border-top-color: var(--Sela-primary);
    border-radius: 50%;
    animation: logout-overlay-spin 0.75s linear infinite;
}

.logout-overlay-text {
    margin: 0;
    font-weight: 600;
    font-size: 1rem;
    color: var(--Sela-text);
}

@keyframes logout-overlay-spin {
    to { transform: rotate(360deg); }
}

@keyframes session-bootstrap-pulse {
    0%, 100% { opacity: 0.55; transform: scale(0.96); }
    50% { opacity: 1; transform: scale(1); }
}

.chat-blocked-notice {
    padding: 0.75rem 0;
    border-top: 1px solid var(--Sela-border);
    text-align: center;
}

.chat-attachment-image,
.chat-attachment-video {
    display: block;
    max-width: min(100%, 280px);
    border-radius: 10px;
    margin: 0.35rem 0;
}

.chat-attachment-file {
    display: inline-block;
    margin: 0.35rem 0;
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.chat-message.mine .chat-attachment-file {
    color: #fff;
}

.chat-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--Sela-muted); }

.chat-messages {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    direction: ltr;
    gap: 0.75rem;
    padding: 0.75rem;
    padding-bottom: 1rem;
    background: rgba(240, 244, 241, 0.65);
    border-radius: 10px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.chat-messages::before {
    content: '';
    flex: 1 1 auto;
    min-height: 0;
}

.chat-message {
    max-width: 75%;
    padding: 0.55rem 0.75rem;
    border-radius: 14px;
    line-height: 1.45;
}

.chat-message.theirs strong {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.82rem;
    color: var(--Sela-primary-dark);
}

.chat-message p { margin: 0; }

.chat-message-text {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.chat-message.mine {
    align-self: flex-end;
    background: var(--Sela-primary-dark);
    color: #fff;
    box-shadow: 0 2px 8px rgba(15, 77, 53, 0.22);
}

.chat-message.mine .muted,
.chat-message.mine .edited-label,
.chat-message.mine .confirm-label {
    color: rgba(255, 255, 255, 0.82);
}

.chat-message.theirs {
    align-self: flex-start;
    background: var(--Sela-card);
    border: 1px solid var(--Sela-border);
    box-shadow: 0 1px 3px rgba(26, 46, 36, 0.06);
}

.chat-message-link {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.chat-message.mine .chat-message-link {
    color: #fff;
    font-weight: 600;
}
.chat-message.theirs .chat-message-link {
    color: var(--Sela-primary);
}
.chat-link-preview {
    display: block;
    margin-top: 0.5rem;
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.92);
    max-width: 100%;
}
.chat-link-preview.mine {
    border-color: rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.14);
}
.chat-link-preview-image {
    display: block;
    width: 100%;
    max-height: 180px;
    object-fit: cover;
}
.chat-link-preview-body {
    padding: 0.6rem 0.75rem;
}
.chat-link-preview-title {
    display: block;
    font-size: 0.875rem;
    line-height: 1.3;
    margin-bottom: 0.25rem;
}
.chat-link-preview-desc {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.35;
    opacity: 0.85;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.chat-link-preview-host {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.72rem;
    opacity: 0.7;
    text-transform: lowercase;
}
.chat-link-preview.mine .chat-link-preview-title,
.chat-link-preview.mine .chat-link-preview-desc,
.chat-link-preview.mine .chat-link-preview-host {
    color: #fff;
}
.chat-message-meta {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
    font-size: 0.72rem;
    opacity: 0.85;
}

.chat-message.theirs .chat-message-meta {
    color: var(--Sela-muted);
}

.chat-message.mine .btn-link {
    color: #fff;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: 0.95;
}

.chat-message.mine .btn-link:hover {
    opacity: 1;
    color: #fff;
}

.chat-message.mine .btn-link.danger {
    color: #ffd0d0;
}

.chat-message.mine .btn-link.danger:hover {
    color: #fff;
}

.chat-message.mine .feed-edit-input {
    background: #fff;
    color: var(--Sela-text);
    border-color: rgba(255, 255, 255, 0.45);
}

.chat-message.mine .comment-edit-actions .btn-primary {
    background: #fff;
    color: var(--Sela-primary-dark);
}

.chat-message.mine .comment-edit-actions .btn-primary:hover:not(:disabled) {
    background: #f4f4f4;
}

.chat-message-status {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    opacity: 0.85;
}
.chat-message-status.read { opacity: 1; }
.chat-message.mine .chat-message-status.sent { color: rgba(255,255,255,0.8); }
.chat-message.mine .chat-message-status.read { color: rgba(255,255,255,0.95); }

.profile-blocked-banner { margin-bottom: 1rem; }

.chat-load-more {
    text-align: center;
    font-size: 0.8rem;
    padding: 0.25rem 0 0.5rem;
    flex-shrink: 0;
}

.chat-input { display: flex; gap: 0.5rem; align-items: flex-end; padding-top: 0; flex-shrink: 0; border-top: none; }
.chat-input input,
.chat-input textarea {
    flex: 1;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--Sela-border);
    border-radius: 10px;
    font-family: inherit;
    resize: vertical;
    min-height: 44px;
    background: var(--Sela-card);
    color: var(--Sela-text);
}

.chat-input textarea::placeholder {
    color: var(--Sela-muted);
    opacity: 1;
}
.conversation-meta { flex: 1; min-width: 0; }

.badge {
    background: var(--Sela-primary);
    color: white;
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.badge-success { background: #27ae60; }

/* Groups */
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }

.groups-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.groups-tab {
    padding: 0.5rem 1rem; border: 1px solid var(--Sela-border); border-radius: 8px;
    background: var(--Sela-card); cursor: pointer; font-family: inherit; font-weight: 500;
}
.groups-tab.active { background: var(--Sela-primary); color: white; border-color: var(--Sela-primary); }
.group-search { display: flex; gap: 0.75rem; margin-bottom: 1rem; padding: 1rem; }
.group-search input { flex: 1; }
.group-card-badges { margin-bottom: 0.5rem; }
.group-card--cover { padding: 0; overflow: hidden; }
.group-card-cover {
    display: block;
    height: 100px;
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid var(--Sela-border);
}
.group-card-body { padding: 1rem; }
.group-cover-manage-preview {
    height: 120px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    margin-bottom: 0.75rem;
    border: 1px solid var(--Sela-border);
}
.group-cover-manage-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.group-cover-upload-btn { position: relative; overflow: hidden; cursor: pointer; }
.group-card-actions { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.75rem; flex-wrap: wrap; }
.badge-muted { background: #e8ece9; color: var(--Sela-muted); }

.group-detail-top { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.group-badges { margin-bottom: 0.5rem; }
.group-description { line-height: 1.6; }
.group-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.group-action-toast { margin-top: 1rem; }
.join-request-list { list-style: none; padding: 0; margin: 0; }
.join-request-item {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem;
    padding: 0.75rem 0; border-bottom: 1px solid var(--Sela-border);
}
.join-request-actions { display: flex; gap: 0.5rem; }

.group-card h3 { margin: 0 0 0.5rem; }
.group-card h3 a { color: var(--Sela-primary-dark); text-decoration: none; }

.group-detail-header h1 { margin: 0 0 0.5rem; }
.group-actions { margin-top: 1rem; }

.group-detail-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.group-detail-header--cover {
    padding: 0;
    overflow: hidden;
}

.group-cover {
    height: 140px;
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid var(--Sela-border);
}

.group-detail-header--cover .group-detail-top {
    padding: 1rem 1.25rem;
}

.group-card-desc {
    margin: 0.35rem 0 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.group-member-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.group-member-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--Sela-border);
    flex-wrap: wrap;
}

.group-member-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.group-member-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.group-member-meta {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.group-member-name {
    font-weight: 600;
    color: var(--Sela-primary-dark);
    text-decoration: none;
}

.group-member-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.group-rule-list {
    margin: 0 0 1rem;
    padding-inline-start: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.group-rule-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
}

.group-rule-compose {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.group-rule-compose input {
    flex: 1;
    min-width: 12rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--Sela-border);
    border-radius: 8px;
    font-family: inherit;
}

.group-settings-panel .form-group input,
.group-settings-panel .form-group textarea,
.group-settings-panel .form-group select {
    width: 100%;
    font-family: inherit;
}

.group-members-panel,
.group-rules-panel,
.group-settings-panel {
    margin-bottom: 1rem;
}

/* Notifications */
.notification-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }

.notification-item { cursor: pointer; }
.notification-item.unread { border-inline-start: 3px solid var(--Sela-primary); }
.notification-item p { margin: 0.25rem 0; }

/* Admin */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 2rem; }

.stat-card { text-align: center; }
.stat-value { display: block; font-size: 2rem; font-weight: 700; color: var(--Sela-primary); }
.stat-label { font-size: 0.875rem; color: var(--Sela-muted); }

.report-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.75rem; }

.report-item { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }

.report-actions { display: flex; gap: 0.5rem; }

/* Comments */
.comments-section h2 { margin: 0 0 1rem; font-size: 1.125rem; }

.comment-compose { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.comment-compose textarea { width: 100%; font-family: inherit; border: 1px solid var(--Sela-border); border-radius: 8px; padding: 0.5rem; }

.comment-list { list-style: none; padding: 0; margin: 0; }
.comment-item { padding: 0.75rem 0; border-bottom: 1px solid var(--Sela-border); }
.comment-item p { margin: 0.25rem 0 0; }
.comment-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.comment-item.comment-highlight,
.comment-highlight {
    animation: comment-highlight-pulse 2.2s ease-out;
    border-radius: 8px;
}

@keyframes comment-highlight-pulse {
    0%, 15% { background: rgba(45, 122, 79, 0.18); }
    100% { background: transparent; }
}

.feed-author .author-link {
    display: inline-flex;
    flex-shrink: 0;
}

.shared-post-avatar .user-list-avatar {
    width: 32px;
    height: 32px;
}

.comment-body { white-space: pre-wrap; }
.comment-actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 0.35rem; }
.comment-reply-to {
    background: var(--Sela-bg);
    border-inline-start: 3px solid var(--Sela-primary);
    padding: 0.35rem 0.6rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
}
.comment-reply-to .mention { font-weight: 600; margin-inline-end: 0.35rem; }
.comment-snippet { color: var(--Sela-muted); }
.comment-reply-compose {
    margin-top: 0.65rem;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    background: var(--Sela-bg);
    border-inline-start: 3px solid var(--Sela-primary);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.comment-reply-compose textarea {
    width: 100%;
    font-family: inherit;
    border: 1px solid var(--Sela-border);
    border-radius: 8px;
    padding: 0.5rem;
}

.comment-reply-compose-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.comment-reply-compose-label {
    font-size: 0.9rem;
}

.comment-reply-preview {
    background: var(--Sela-bg);
    border: 1px solid var(--Sela-border);
    border-radius: 8px;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.75rem;
}
.comment-reply-preview .comment-snippet { margin: 0.25rem 0 0.5rem; font-size: 0.9rem; }

.reactions-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}
.reactions-modal {
    width: min(420px, 100%);
    max-height: 70vh;
    overflow: auto;
}
.reactions-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.reactions-modal-header h3 { margin: 0; font-size: 1.1rem; }
.reactions-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}
.reactions-filter-tab {
    border: 1px solid var(--Sela-border);
    background: var(--Sela-surface, #fff);
    color: inherit;
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    font-size: 0.82rem;
    cursor: pointer;
    font-family: inherit;
}
.reactions-filter-tab.active {
    border-color: var(--Sela-primary);
    background: color-mix(in srgb, var(--Sela-primary) 12%, transparent);
}
.reactions-user-list { list-style: none; padding: 0; margin: 0; }
.reactions-user-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--Sela-border);
}
.reactions-user-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
}
.reaction-type-icon { margin-inline-start: auto; }
.reaction-type-badge {
    margin-inline-start: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.85rem;
    white-space: nowrap;
}
.reaction-type-badge.liked { color: #c0392b; }
.reaction-type-badge.react-angry { color: #d35400; }
.reaction-type-badge.react-disbelief { color: #8e44ad; }
.reaction-type-label { font-size: 0.8rem; }
.btn-link { background: none; border: none; color: var(--Sela-primary); cursor: pointer; font-family: inherit; padding: 0; }
.btn-link:hover { text-decoration: underline; }
.feed-card-footer .btn-link { font-size: 0.85rem; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-card {
    width: min(480px, 100%);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-card h3 {
    margin: 0;
    color: var(--Sela-primary-dark);
}

.modal-card textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--Sela-border);
    border-radius: 8px;
    font-family: inherit;
    resize: vertical;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.shared-post-embed {
    display: block;
    margin-top: 0.75rem;
    padding: 0.875rem;
    border: 1px solid var(--Sela-border);
    border-radius: 10px;
    background: var(--Sela-bg);
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.shared-post-embed:hover {
    border-color: var(--Sela-primary);
    box-shadow: 0 2px 8px rgba(26, 107, 74, 0.08);
}

.shared-post-embed-header {
    display: flex;
    gap: 0.65rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.shared-post-avatar {
    width: 2rem;
    height: 2rem;
    font-size: 0.85rem;
}

.shared-post-author {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
}

.shared-post-username {
    display: block;
    font-size: 0.8rem;
}

.shared-post-content {
    margin: 0;
    line-height: 1.5;
    white-space: pre-wrap;
}

.shared-post-images img {
    width: 100%;
    max-height: min(280px, 40vh);
    object-fit: contain;
    object-position: center;
    border-radius: 8px;
    margin-top: 0.5rem;
    background: var(--Sela-bg);
}

.share-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.share-menu-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}

.share-menu-icon {
    font-size: 0.95rem;
    line-height: 1;
}

.share-menu-label {
    font-size: 0.85rem;
    font-weight: 500;
}

.share-menu-panel {
    position: absolute;
    inset-inline-end: 0;
    bottom: calc(100% + 0.35rem);
    z-index: 50;
    min-width: 11rem;
    padding: 0.35rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    box-shadow: var(--Sela-shadow);
}

.share-menu-backdrop {
    display: none;
}

@media (max-width: 768px) {
    .share-menu-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1190;
        background: rgba(15, 23, 42, 0.35);
    }

    .share-menu-panel {
        position: fixed;
        inset-inline: 0.75rem;
        bottom: calc(4.75rem + env(safe-area-inset-bottom));
        top: auto;
        z-index: 1200;
        min-width: 0;
        max-height: min(70vh, 24rem);
        overflow: auto;
        padding: 0.5rem;
        border-radius: 12px;
    }

    .share-menu-item {
        padding: 0.75rem 0.85rem;
        font-size: 0.95rem;
    }
}

.share-menu-item {
    display: block;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--Sela-text);
    font-family: inherit;
    font-size: 0.875rem;
    text-align: start;
    text-decoration: none;
    cursor: pointer;
}

.share-menu-item:hover {
    background: var(--Sela-bg);
    color: var(--Sela-primary);
}

.share-menu-item-internal {
    border-top: 1px solid var(--Sela-border);
    margin-top: 0.15rem;
    padding-top: 0.65rem;
    color: var(--Sela-primary);
    font-weight: 500;
}

.share-menu-toast {
    position: fixed;
    left: 50%;
    inset-inline: auto;
    transform: translateX(-50%);
    bottom: calc(5.25rem + env(safe-area-inset-bottom));
    white-space: nowrap;
    background: var(--Sela-primary-dark);
    color: #fff;
    font-size: 0.8rem;
    padding: 0.45rem 0.75rem;
    border-radius: 8px;
    pointer-events: none;
    z-index: 1300;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.shares-user-link {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    flex: 1;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.shares-user-link:hover strong {
    color: var(--Sela-primary);
}

.shares-user-item {
    align-items: flex-start;
}

.share-comment {
    margin: 0.25rem 0 0;
    font-size: 0.875rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

.share-time {
    display: block;
    font-size: 0.75rem;
    margin-top: 0.15rem;
}

.app-nav-notifications { position: relative; display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.notification-bell { position: relative; display: inline-flex; text-decoration: none; color: inherit; padding: 0.15rem 0.35rem; }
.notification-bell-icon { font-size: 1rem; line-height: 1; }
.notification-bell-badge {
    position: absolute; top: -6px; inset-inline-end: -4px;
    min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
    background: #c0392b; color: white; font-size: 0.65rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}

.pwa-banner {
    display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: 0.85rem 1rem; margin-bottom: 1rem; border-radius: var(--Sela-radius);
    background: linear-gradient(135deg, #e8f5ef, #fff);
    border: 1px solid var(--Sela-border);
}
.pwa-banner-text p { margin: 0.25rem 0 0; font-size: 0.9rem; }
.pwa-banner-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.notification-splash {
    position: fixed;
    top: max(1rem, env(safe-area-inset-top));
    inset-inline: 1rem;
    z-index: 10000;
    display: flex;
    justify-content: center;
    pointer-events: none;
    animation: notification-splash-in 0.28s ease-out;
}

@media (max-width: 768px) {
    .notification-splash {
        top: calc(3.75rem + env(safe-area-inset-top));
        inset-inline: 0.75rem;
    }
}

.notification-splash-inner {
    pointer-events: auto;
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    width: min(100%, 28rem);
    padding: 0;
    overflow: hidden;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
    border: 1px solid var(--Sela-border);
}

.notification-splash-body {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 0.5rem 0.85rem 1rem;
    background: transparent;
    border: 0;
    text-align: start;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.notification-splash-body:hover {
    background: var(--Sela-bg);
}

.notification-splash-icon {
    font-size: 1.15rem;
    line-height: 1;
    flex-shrink: 0;
}

.notification-splash-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.notification-splash-text strong {
    font-size: 0.95rem;
}

.notification-splash-text span {
    font-size: 0.875rem;
    color: var(--Sela-muted);
    line-height: 1.4;
}

.notification-splash-close {
    flex-shrink: 0;
    width: 2.5rem;
    border: 0;
    border-inline-start: 1px solid var(--Sela-border);
    background: transparent;
    color: var(--Sela-muted);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.notification-splash-close:hover {
    background: var(--Sela-bg);
    color: var(--Sela-text);
}

@keyframes notification-splash-in {
    from {
        opacity: 0;
        transform: translateY(-0.75rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
