.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; }
.rail-panel { position: fixed; z-index: 60; inset: 0 0 0 auto; width: 380px; max-width: calc(100vw - 16px); height: 100dvh; max-height: none; margin: 0; padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); border: 0; border-radius: 0; background: var(--surface); color: var(--ink); box-shadow: 0 12px 40px var(--shadow-strong); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.rail-panel::backdrop { background: color-mix(in srgb, var(--ink) 30%, transparent); backdrop-filter: blur(3px); }
.rail-panel::-webkit-scrollbar, .rail-panel .message-history::-webkit-scrollbar { display: none; }
.rail-close { position: absolute; top: 12px; right: 12px; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: var(--text-card); cursor: pointer; }
.rail-close:hover { background: var(--sage); color: var(--green); }
.rail-panel--right > .rail-close + div { padding-top: 32px; }
.rail-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 20px; }
.rail-panel-heading h2 { margin: 0; font-size: var(--text-section); }
.rail-panel :focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.rail-unread {
    display: grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 10px;
    color:var(--primary-ink);
    background: var(--primary);
    font: 600 var(--text-small)/1 var(--font-ui);
}

.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 var(--line);
}

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

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

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

.rail-conversations strong {
    font-size: var(--text-base);
}

.rail-conversations small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--muted);
    margin-top: 4px;
}

.rail-conversations time {
    font-size: var(--text-small);
    color: var(--muted);
    margin-top: 4px;
}

.rail-all-messages {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    font-size: var(--text-base);
    color: var(--green);
}

.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: var(--text-small);
}

.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-conversations > a > i { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; border-radius: 50%; background: var(--sage); color: var(--green); }
.rail-conversation .message-history { scrollbar-width: none; }
@media (max-width: 760px) { .rail-panel { padding: max(20px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom)); } }
