:root {
    --bg: #eef2f6;
    --surface: #ffffff;
    --surface-soft: #f6f8fb;
    --line: #d9e1ea;
    --text: #111827;
    --muted: #667085;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #15803d;
    --danger: #dc2626;
    --shadow: 0 16px 40px rgba(17, 24, 39, 0.12);
}

[data-theme="dark"] {
    --bg: #111418;
    --surface: #181d23;
    --surface-soft: #20262e;
    --line: #333b46;
    --text: #f4f7fb;
    --muted: #a9b4c0;
    --primary: #5b8cff;
    --primary-dark: #b8ccff;
    --success: #5fd28d;
    --danger: #ff6b6b;
    --shadow: 0 16px 42px rgba(0, 0, 0, 0.35);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--text);
    background: var(--bg);
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    padding: 0 12px;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
}

button svg,
.icon-button svg,
.send-button svg {
    width: 19px;
    height: 19px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    cursor: wait;
    opacity: 0.62;
    transform: none;
}

input,
textarea,
select {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    padding: 12px;
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

textarea {
    resize: vertical;
}

.hidden,
.auth-form:not(.active),
.hidden-admin {
    display: none !important;
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
    background:
        linear-gradient(150deg, rgba(37, 99, 235, 0.14), transparent 42%),
        linear-gradient(330deg, rgba(21, 128, 61, 0.12), transparent 38%),
        var(--bg);
}

.login-shell {
    width: min(100%, 380px);
    display: grid;
    gap: 14px;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.brand-mark {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 24px;
    font-weight: 800;
}

.login-shell h1,
.login-note {
    margin: 0;
}

.login-note,
.form-error,
.empty-state,
.chat-row small,
.person-main span,
.person-main small,
.header-user span,
.chat-title span,
.msg time,
.news-meta {
    color: var(--muted);
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.auth-tab,
.ghost-button,
.nav-button,
.msg-actions button,
.news-actions button,
.icon-button,
.back-button {
    background: var(--surface-soft);
    color: var(--text);
}

.icon-only {
    width: 42px;
    min-height: 42px;
    padding: 0;
    display: grid;
    place-items: center;
}

.auth-tab.active,
.nav-button.active {
    background: #dbeafe;
    color: var(--primary-dark);
    font-weight: 700;
}

.auth-form {
    display: grid;
    gap: 10px;
}

.form-error {
    min-height: 22px;
    color: var(--danger);
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes sheetIn {
    from {
        opacity: 0;
        transform: translate(-50%, 18px);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes rowIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: no-preference) {
    .view.active,
    .modal-scrim {
        animation: fadeIn 0.16s ease-out;
    }

    .group-panel {
        animation: sheetIn 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .action-sheet,
    .forward-panel {
        animation: sheetIn 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .msg {
        animation: messageIn 0.18s ease-out;
    }

    .chat-row,
    .person-row,
    .news-card {
        animation: rowIn 0.16s ease-out both;
    }

    button,
    .nav-button,
    .icon-button,
    .send-button {
        transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease, opacity 0.16s ease;
    }
}

.app-body {
    min-height: 100vh;
}

.app-shell {
    width: min(100%, 520px);
    height: 100vh;
    margin: 0 auto;
    display: grid;
    grid-template-rows: auto 1fr auto;
    overflow: hidden;
    background: var(--surface);
}

.app-header {
    min-height: 68px;
    display: grid;
    grid-template-columns: 44px 1fr 42px auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}

.header-user,
.chat-row-main,
.person-main,
.chat-title > div {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.header-user strong,
.header-user span,
.chat-row-main strong,
.chat-row-main small,
.person-main strong,
.person-main span,
.person-main small,
.chat-title strong,
.chat-title span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-row-main small {
    display: flex;
    gap: 5px;
    align-items: center;
}

.presence-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--muted);
    opacity: 0.45;
}

.presence-dot.online {
    background: var(--success);
    opacity: 1;
}

.app-main {
    min-height: 0;
    overflow: hidden;
}

.view {
    display: none;
    height: 100%;
    min-height: 0;
}

.view.active {
    display: flex;
    flex-direction: column;
}

#viewFeed {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

#viewFeed .feed-list {
    flex: none;
    min-height: auto;
    overflow: visible;
}

.bottom-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
    gap: 6px;
    padding: 8px 8px 10px;
    border-top: 1px solid var(--line);
}

.nav-button {
    min-height: 42px;
    padding: 0 6px;
    font-size: 13px;
}

.avatar-button,
.profile-avatar {
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 8px;
    background: #dbeafe;
    color: var(--primary-dark);
    font-weight: 800;
}

.avatar-button {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
}

.avatar-button.small {
    width: 38px;
    height: 38px;
    min-height: 38px;
}

.avatar-button img,
.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.clickable {
    cursor: pointer;
}

.profile-avatar:has(img) {
    cursor: zoom-in;
}

.chat-layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-rows: 1fr;
}

.chat-list-panel,
.chat-panel {
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.chat-list-panel {
    border-bottom: 1px solid var(--line);
    background: #fbfcfe;
}

.chat-layout.chat-open .chat-list-panel,
.chat-layout:not(.chat-open) .chat-panel {
    display: none;
}

.chat-layout.chat-open .chat-panel {
    display: flex;
}

.toolbar,
.search-box,
.message-form,
.dual-actions,
.form-grid {
    display: grid;
    gap: 8px;
}

.toolbar,
.search-box {
    grid-template-columns: 1fr auto;
    padding: 10px;
    border-bottom: 1px solid var(--line);
}

.admin-card {
    display: grid;
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.modal-scrim {
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(15, 23, 42, 0.44);
}

.group-panel {
    position: fixed;
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 31;
    width: min(calc(100% - 24px), 480px);
    max-height: min(78vh, 620px);
    overflow: auto;
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    transform: translateX(-50%);
}

.group-panel-head {
    display: grid;
    grid-template-columns: 1fr 42px;
    gap: 10px;
    align-items: start;
}

.group-panel-head > div {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.group-panel-head strong {
    font-size: 18px;
}

.group-panel-head span,
.group-members-label {
    color: var(--muted);
    font-size: 13px;
}

.group-members-label {
    font-weight: 700;
}

.group-panel .checkbox-list {
    max-height: min(34vh, 260px);
}

.group-panel .form-error {
    margin: 0;
}

.action-sheet,
.forward-panel {
    position: fixed;
    left: 50%;
    bottom: max(12px, env(safe-area-inset-bottom));
    z-index: 33;
    width: min(calc(100% - 24px), 480px);
    max-height: min(74vh, 580px);
    overflow: auto;
    display: grid;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
    transform: translateX(-50%);
}

.image-viewer {
    position: fixed;
    inset: 0;
    z-index: 34;
    display: grid;
    place-items: center;
    padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}

.image-viewer img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.image-viewer .icon-button {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    right: 12px;
    z-index: 35;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
}

.action-sheet-title {
    padding: 4px 4px 8px;
    color: var(--muted);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.action-sheet button {
    width: 100%;
    justify-content: start;
    text-align: left;
}

.forward-targets {
    display: grid;
    gap: 6px;
}

.forward-target {
    display: grid;
    grid-template-columns: 38px 1fr;
    gap: 10px;
    align-items: center;
    min-height: 54px;
    background: var(--surface-soft);
    color: var(--text);
    text-align: left;
}

.forward-target span:last-child {
    min-width: 0;
    display: grid;
    gap: 2px;
}

.forward-target small {
    color: var(--muted);
}

.chat-list,
.people-list,
.feed-list,
.admin-stack,
.profile-panel {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.chat-list {
    display: grid;
    align-content: start;
}

.chat-row,
.person-row {
    width: 100%;
    display: grid;
    grid-template-columns: 38px 1fr auto;
    gap: 10px;
    align-items: center;
    min-height: 62px;
    padding: 10px 12px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
    transition: background-color 0.16s ease, transform 0.16s ease;
}

.chat-row.active {
    background: #edf4ff;
}

.unread-badge {
    min-width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 12px;
    font-weight: 800;
}

@media (hover: hover) {
    .chat-row:hover,
    .person-row:hover {
        background: #f1f5f9;
        transform: translateY(-1px);
    }
}

.person-row {
    background: var(--surface);
}

.person-row.is-banned {
    outline: 1px solid rgba(220, 38, 38, 0.24);
}

.person-actions {
    display: grid;
    gap: 6px;
}

.ban-note {
    color: var(--danger);
}

.person-row button {
    min-height: 34px;
    font-size: 13px;
}

.empty-chat,
.empty-state {
    min-height: 120px;
    display: grid;
    place-items: center;
    padding: 18px;
    text-align: center;
}

.empty-state.compact {
    min-height: 48px;
}

.chat-room {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-rows: auto auto 1fr auto auto auto;
}

.chat-title {
    min-height: 58px;
    display: grid;
    grid-template-columns: 36px 38px 1fr;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
}

.back-button,
.icon-button,
.send-button {
    width: 42px;
    min-height: 42px;
    padding: 0;
    display: grid;
    place-items: center;
}

.back-button {
    width: 36px;
    min-height: 36px;
    font-size: 28px;
}

.messages {
    min-height: 0;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    background: var(--surface-soft);
}

.msg {
    width: fit-content;
    max-width: min(88%, 380px);
    position: relative;
    display: grid;
    gap: 5px;
    padding: 8px 10px 6px;
    border-radius: 14px;
    overflow-wrap: anywhere;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.msg.me {
    align-self: flex-end;
    background: var(--primary);
    color: #fff;
}

.msg.him {
    align-self: flex-start;
    background: #e5e7eb;
}

.msg-sticker,
.msg-circle {
    background: transparent !important;
    box-shadow: none;
    padding: 2px;
}

.msg-sticker .msg-meta,
.msg-circle .msg-meta {
    padding: 3px 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.46);
    color: #fff;
}

.msg-sender {
    font-size: 13px;
}

.muted {
    opacity: 0.76;
}

.msg-meta {
    justify-self: end;
    display: inline-flex;
    gap: 4px;
    align-items: center;
}

.msg time {
    font-size: 10px;
    line-height: 1;
    opacity: 0.72;
}

.read-status {
    width: 15px;
    height: 12px;
    display: inline-grid;
    place-items: center;
    opacity: 0.72;
}

.read-status svg {
    width: 14px;
    height: 14px;
}

.read-status.read {
    color: #9be7ff;
    opacity: 1;
}

.msg.me time {
    color: rgba(255, 255, 255, 0.74);
}

.msg.him time {
    color: #6b7280;
}

.msg-text {
    line-height: 1.34;
}

.reply-quote {
    width: 100%;
    min-height: 0;
    display: grid;
    gap: 2px;
    padding: 6px 8px;
    border-left: 3px solid rgba(37, 99, 235, 0.75);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.58);
    color: var(--text);
    text-align: left;
}

.msg.me .reply-quote {
    border-left-color: rgba(255, 255, 255, 0.86);
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.reply-quote strong,
.reply-quote span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reply-quote strong {
    font-size: 12px;
}

.reply-quote span {
    font-size: 12px;
    opacity: 0.82;
}

.msg-highlight {
    outline: 2px solid rgba(37, 99, 235, 0.35);
    outline-offset: 2px;
}

.msg.swipe-ready {
    outline: 2px solid rgba(37, 99, 235, 0.28);
    outline-offset: 2px;
}

.msg-actions,
.news-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.heart-button {
    min-height: 36px;
    display: inline-grid;
    grid-auto-flow: column;
    gap: 6px;
    align-items: center;
    padding: 0 10px;
}

.heart-button svg {
    width: 18px;
    height: 18px;
}

.heart-button.active {
    color: #e11d48;
}

.heart-button.active svg {
    fill: currentColor;
}

.msg-actions button {
    min-height: 28px;
    padding: 0 8px;
    font-size: 12px;
}

.attachment {
    display: grid;
    gap: 6px;
    color: inherit;
    text-decoration: none;
}

button.attachment {
    min-height: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
}

.attachment img,
.attachment video {
    width: 100%;
    max-width: min(320px, 100%);
    height: auto;
    border-radius: 8px;
    object-fit: contain;
    background: #111827;
}

.attachment.image img {
    display: block;
    background: transparent;
}

.sticker-message {
    width: min(190px, 54vw);
    max-width: 100%;
    justify-items: start;
}

.sticker-message img {
    width: 100%;
    max-height: 190px;
    object-fit: contain;
    border-radius: 0;
    background: transparent;
}

.attachment audio {
    width: 100%;
}

.attachment-tools {
    display: grid;
    grid-template-columns: 1fr 34px;
    gap: 8px;
    align-items: center;
}

.attachment-tools.only-cache {
    grid-template-columns: 34px;
    justify-content: end;
}

.cache-button {
    width: 34px;
    min-height: 34px;
    padding: 0;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.48);
    color: inherit;
}

.cache-button.is-loading {
    opacity: 0.55;
}

.cache-button.is-cached {
    color: var(--success);
}

.media-attachment {
    width: min(320px, 100%);
}

.circle-attachment {
    width: 184px;
    position: relative;
}

.circle-player,
.circle-video {
    width: 184px;
    height: 184px;
    border-radius: 50%;
    overflow: hidden;
}

.circle-video {
    display: block;
    object-fit: cover;
    background: #111827;
}

.cache-button.mini {
    position: absolute;
    right: 4px;
    bottom: 4px;
    background: rgba(15, 23, 42, 0.62);
    color: #fff;
}

.media-player {
    width: 100%;
    border-radius: 8px;
}

.audio-player {
    display: block;
    padding: 6px;
    border: 1px solid rgba(17, 24, 39, 0.12);
    background: rgba(255, 255, 255, 0.46);
}

.msg.me .audio-player {
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.14);
}

.media-native {
    display: block;
    width: 100%;
}

.video-player video {
    width: 100%;
    max-width: 100%;
    display: block;
}

.attachment span,
.attachment a {
    color: inherit;
    overflow-wrap: anywhere;
    font-size: 13px;
    text-decoration: underline;
}

.attachment-preview {
    display: grid;
    grid-template-columns: 1fr 34px;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px solid var(--line);
    background: var(--surface);
}

.reply-preview {
    display: grid;
    grid-template-columns: 1fr 34px;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    border-top: 1px solid var(--line);
    background: #eaf2ff;
    color: var(--primary-dark);
}

.reply-preview span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 700;
}

.reply-preview button {
    width: 34px;
    min-height: 34px;
    padding: 0;
    background: #dbeafe;
    color: var(--primary-dark);
}

.attachment-preview span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
}

.attachment-preview button {
    width: 34px;
    min-height: 34px;
    padding: 0;
    background: var(--surface-soft);
    color: var(--text);
}

.message-form {
    grid-template-columns: 42px 42px minmax(0, 1fr) auto auto auto;
    align-items: center;
    padding: 10px 12px;
    border-top: 1px solid var(--line);
}

.message-form .send-button.hidden,
.message-form #voiceButton.hidden,
.message-form #circleButton.hidden {
    display: none;
}

.recording {
    background: var(--danger);
    color: #fff;
}

.feed-list,
.people-list,
.admin-stack,
.profile-panel {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 12px;
    background: var(--surface-soft);
}

.news-card {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.news-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    background: transparent;
}

.news-body {
    display: grid;
    gap: 10px;
    padding: 12px;
}

.news-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
}

.news-body p {
    margin: 0;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.comment-form {
    display: grid;
    grid-template-columns: 1fr 42px;
    gap: 8px;
}

.comment-form button {
    width: 42px;
    padding: 0;
}

.comments {
    display: grid;
    gap: 8px;
}

.comment {
    display: grid;
    gap: 2px;
    padding: 8px;
    border-radius: 8px;
    background: #f1f5f9;
    margin-left: calc(var(--comment-depth, 0) * 14px);
}

.comment strong {
    font-size: 13px;
}

.comment span {
    font-size: 14px;
}

.comment-reply {
    justify-self: start;
    min-height: 26px;
    padding: 0;
    background: transparent;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
}

.section-title {
    font-weight: 800;
}

.dual-actions {
    grid-template-columns: 1fr 1fr;
}

.form-grid {
    grid-template-columns: 1fr 1fr;
}

.form-grid select {
    grid-column: 1 / -1;
}

.audience-grid {
    display: grid;
    gap: 10px;
}

.checkbox-list {
    max-height: 180px;
    overflow: auto;
    display: grid;
    gap: 6px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.check-row {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 8px;
    align-items: center;
    min-height: 30px;
}

.check-row input {
    width: 18px;
    height: 18px;
    padding: 0;
}

.check-row span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.check-row small {
    color: var(--muted);
}

.invite-list {
    display: grid;
    gap: 8px;
}

.invite-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 9px;
    border-radius: 8px;
    background: var(--surface-soft);
}

.profile-hero {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    text-align: center;
}

.profile-avatar {
    width: 96px;
    height: 96px;
    font-size: 42px;
}

.profile-hero h2,
.profile-hero p {
    margin: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.profile-bio {
    color: var(--text);
    line-height: 1.45;
}

.role-badge {
    min-height: 28px;
    display: inline-grid;
    place-items: center;
    padding: 0 10px;
    border-radius: 8px;
    background: #dcfce7;
    color: #166534;
    font-size: 13px;
    font-weight: 700;
}

.profile-form {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.profile-posts {
    display: grid;
    gap: 10px;
}

.profile-post {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
}

.profile-post-image {
    min-height: 0;
    padding: 0;
    background: transparent;
    color: inherit;
}

.profile-post img,
.profile-post-image img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    object-fit: contain;
    background: transparent;
}

.profile-post p {
    margin: 0;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.sticker-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.sticker-item {
    aspect-ratio: 1;
    min-height: 0;
    padding: 6px;
    display: grid;
    place-items: center;
    background: var(--surface-soft);
    color: var(--text);
}

.sticker-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.role-select {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 13px;
}

[data-theme="dark"] .chat-list-panel,
[data-theme="dark"] .messages,
[data-theme="dark"] .feed-list,
[data-theme="dark"] .people-list,
[data-theme="dark"] .admin-stack,
[data-theme="dark"] .profile-panel {
    background: var(--surface-soft);
}

[data-theme="dark"] .msg.him,
[data-theme="dark"] .comment,
[data-theme="dark"] .person-row {
    background: #252c35;
}

[data-theme="dark"] .reply-preview {
    background: #1d2b44;
    color: var(--primary-dark);
}

[data-theme="dark"] .audio-player,
[data-theme="dark"] .cache-button {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select,
[data-theme="dark"] .checkbox-list {
    background: #14191f;
    color: var(--text);
}

@media (min-width: 840px) {
    .app-body {
        padding: 18px;
    }

    .app-shell {
        height: calc(100vh - 36px);
        border-radius: 8px;
        box-shadow: var(--shadow);
    }

    .chat-layout {
        grid-template-columns: 220px 1fr;
        grid-template-rows: 1fr;
    }

    .chat-list-panel {
        border-right: 1px solid var(--line);
        border-bottom: 0;
    }

    .chat-layout.chat-open .chat-list-panel,
    .chat-layout:not(.chat-open) .chat-panel {
        display: flex;
    }
}
