body.has-social-rails {
    padding-inline: 72px;
}

.has-social-rails .site-header {
    margin-inline: -72px;
}

.has-social-rails .app-shell {
    grid-template-columns: minmax(0,1fr);
    max-width: 1440px;
    margin-inline: auto;
}

.has-social-rails .app-shell>.sidebar {
    display: none;
}

.social-rail {
    position: fixed;
    z-index: 25;
    top: var(--header-height);
    bottom: 0;
    width: 72px;
    background: #fffaf2;
    color: #655e54;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 9px;
    padding: 16px 8px;
    overflow-y: auto;
    scrollbar-width: none;
}

.social-rail--left {
    left: 0;
    border-right: 1px solid #e5ddd1;
}

.social-rail--right {
    right: 0;
    border-left: 1px solid #e5ddd1;
}

.social-rail>a, .social-rail>button, .rail-avatars>a {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border: 0;
    border-radius: 12px;
    background: none;
    color: inherit;
    font-size: 21px;
}

.social-rail>a:hover, .social-rail>button:hover {
    background: #e9ecdf;
    color: #315b44;
}

.social-rail>.rail-toggle {
    margin-bottom: 8px;
    background: #e9ecdf;
    color: #315b44;
}

.rail-avatars {
    display: grid;
    gap: 14px;
}

.rail-avatars .avatar {
    width: 40px;
    height: 40px;
    border: 2px solid #e3ddcd;
}

.rail-unread {
    display: grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 10px;
    color: #fff;
    background: #a6533e;
    font: 600 10px/1 sans-serif;
}

.rail-avatars .rail-unread {
    position: absolute;
    right: -2px;
    top: 0;
}

.rail-panel {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    margin: 0;
    padding: 20px;
    width: 350px;
    max-width: calc(100vw - 20px);
    max-height: none;
    height: calc(100dvh - var(--header-height));
    background: #fffaf2;
    color: #302d29;
    border: 1px solid #e5ddd1;
    box-shadow: 0 8px 35px #302d2920;
    overscroll-behavior: contain;
}

.rail-panel--left {
    left: 72px;
    right: auto;
    border-radius: 0 16px 0 0;
}

.rail-panel--right {
    right: 72px;
    left: auto;
    border-radius: 16px 0 0 0;
}

.rail-panel::backdrop {
    background: #31271920;
}

.rail-close {
    display: grid;
    place-items: center;
    margin-left: auto;
    width: 36px;
    height: 36px;
    background: none;
    color: #655e54;
    border: 0;
    font-size: 20px;
}

.rail-panel-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: space-between;
    margin: 10px 0 20px;
}

.rail-panel-heading h2 {
    font-size: 1.4rem;
    margin: 0;
}

.rail-shortcuts {
    display: grid;
    gap: 4px;
}

.rail-shortcuts>a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 12px;
    border-radius: 8px;
    font: 500 14px/1.3 'Avenir Next', sans-serif;
}

.rail-shortcuts>a:hover {
    background: #e9ecdf;
}

.rail-shortcuts i {
    font-size: 20px;
    width: 25px;
    text-align: center;
    color: #647754;
}

.rail-plus {
    display: grid;
    grid-template-columns: 25px 1fr;
    gap: 5px 12px;
    margin-top: 20px;
    padding: 18px 12px;
    background: #f6eedb;
    border-radius: 8px;
}

.rail-plus>span {
    grid-column: 2;
    font-size: .85rem;
    color: #756953;
}

.rail-plus>i {
    color: #986e22;
}

.rail-search {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.rail-search input {
    min-width: 0;
    width: 100%;
}

.rail-conversations>a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border-bottom: 1px solid #e5ddd1;
}

.rail-conversations .avatar {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
}

.rail-conversations>a>span:not(.rail-unread) {
    flex: 1;
    min-width: 0;
}

.rail-conversations strong, .rail-conversations small, .rail-conversations time {
    display: block;
}

.rail-conversations strong {
    font-size: .95rem;
}

.rail-conversations small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #756953;
    margin-top: 4px;
}

.rail-conversations time {
    font-size: .7rem;
    color: #756953;
    margin-top: 4px;
}

.rail-all-messages {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    font-size: .95rem;
    color: #315b44;
}

.rail-conversation .message-history {
    min-height: 160px;
    height: min(40dvh,400px);
    padding: 10px 0;
    overflow-y: auto;
}

.rail-conversation .message {
    gap: 8px;
}

.rail-conversation .message .avatar {
    width: 28px;
    height: 28px;
}

.rail-conversation .message-compose {
    padding: 14px 0;
}

.rail-conversation .message-compose textarea {
    min-height: 80px;
}

.rail-conversation-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: .8rem;
}

.social-mobile-tools {
    display: none;
}

@media(max-width:1100px) {
    body.has-social-rails {
        padding-inline: 0;
    }
    .has-social-rails .site-header {
        margin-inline: 0;
    }
    .social-rail {
        display: none;
    }
    .social-mobile-tools {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        padding: 7px 16px;
        background: #fffaf2;
        border-bottom: 1px solid #e5ddd1;
    }
    .social-mobile-tools button {
        display: flex;
        gap: 8px;
        align-items: center;
        background: none;
        border: 0;
        min-height: 34px;
        color: #315b44;
        font: 500 12px/1.4 'Avenir Next', sans-serif;
    }
    .rail-panel--left {
        left: 0;
    }
    .rail-panel--right {
        right: 0;
    }
}

.rail-conversations>a>i {
    width:42px;
    height:42px;
    flex-shrink:0;
    display:grid;
    place-items:center;
    background:#e9ecdf;
    color:#315b44;
    border-radius:50%
}

.rail-avatars>a>i {
    font-size:22px
}

/* Drawers unfold over the narrow rails; the feed keeps its place. */
.has-social-rails .site-header { z-index: 45; position: sticky; top: 0; }
html:has(body.has-social-rails) { scrollbar-gutter: stable; }
.header-brand-group { display: flex; align-items: center; flex-shrink: 0; gap: 14px; }
.header-grid-toggle { width: 32px; }
.four-squares { width: 19px; height: 19px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; transition: transform .25s ease; }
.four-squares span { border: 1.6px solid currentColor; border-radius: 2px; }
.header-grid-toggle[aria-expanded=true] { color: var(--green); background: var(--sage); }
.header-grid-toggle[aria-expanded=true] .four-squares { transform: rotate(90deg); }
.social-rail { transition: opacity .2s ease; }
.shortcuts-open .social-rail--left, .conversations-open .social-rail--right { opacity: 0; pointer-events: none; }
.rail-panel { z-index: 40; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; border: 0; box-shadow: 0 12px 40px var(--shadow-strong); padding: 24px; }
.rail-panel::-webkit-scrollbar, .social-rail::-webkit-scrollbar, .rail-panel .message-history::-webkit-scrollbar { display: none; }
.rail-panel--left { left: 0; width: 304px; border-radius: 0 0 20px 0; }
.rail-panel--right { right: 0; width: 380px; border-radius: 0 0 0 20px; }
.rail-panel::backdrop { background: color-mix(in srgb, var(--ink) 14%, transparent); }
.rail-close { position: absolute; top: 14px; right: 14px; border-radius: 50%; }
.rail-close:hover { background: var(--sage); color: var(--green); }
.rail-identity { display: flex; align-items: center; gap: 12px; padding: 6px 24px 24px 0; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.rail-identity .avatar { width: 44px; height: 44px; flex-shrink: 0; }
.rail-identity strong, .rail-identity small { display: block; }
.rail-identity small { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.rail-shortcuts>a { padding: 12px 10px; transition: background .18s ease, transform .18s ease; }
.rail-shortcuts>a:hover { transform: translateX(3px); }
.rail-panel--right>.rail-close+div { padding-top: 22px; }
.rail-conversations>a { border: 0; padding: 14px 10px; margin-inline: -10px; border-radius: 10px; transition: background .18s ease; }
.rail-conversations>a:hover { background: var(--sage); }
.rail-conversations strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-conversation .message-history { scrollbar-width: none; }
.rail-panel :focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
@media (max-width: 1350px) { .has-social-rails .site-header__inner { gap: 22px; } }
@media (max-width: 940px) and (min-width: 761px) { .has-social-rails .site-header__inner { gap: 14px; } .header-brand-group { gap: 6px; } }
@media (max-width: 760px) {
    .has-social-rails .site-header__inner { gap: 0 5px; padding-inline: 12px; }
    .header-brand-group { gap: 4px; }
    .has-social-rails .site-header .brand { font-size: 27px; gap: 5px; }
    .has-social-rails .site-header .brand img { width: 33px; }
    .header-grid-toggle { width: 30px; }
    .rail-panel { z-index: 60; max-width: calc(100vw - 18px); padding: 20px; }
    .rail-panel--right { width: 380px; }
}
@media (max-width: 350px) { .has-social-rails .site-header .brand img { display: none; } }
@media (prefers-reduced-motion: reduce) { .four-squares, .social-rail, .rail-shortcuts>a { transition: none; } }
