:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f7f7f8;
  --surface-3: #eef0f2;
  --text: #17191c;
  --muted: #747981;
  --line: #e2e5e9;
  --line-strong: #cfd4da;
  --red: #e21d2f;
  --red-hover: #c91627;
  --red-soft: #fff1f3;
  --green: #169b62;
  --shadow: 0 18px 48px rgba(20, 24, 31, .12);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root[data-theme="dark"] { color-scheme: dark; --bg: #0b0e11; --surface: #12161b; --surface-2: #171c22; --surface-3: #20262e; --text: #f3f4f6; --muted: #9299a3; --line: #282f38; --line-strong: #39424d; --red-soft: #291419; --shadow: 0 20px 52px rgba(0, 0, 0, .38); }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--red) 24%, transparent); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(25px, 3vw, 31px); letter-spacing: -.6px; }
h2 { letter-spacing: -.35px; }
small { color: var(--muted); }
.brand { display: flex; align-items: center; gap: 9px; min-width: 0; font-size: 19px; font-weight: 800; letter-spacing: -.45px; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; flex: 0 0 auto; width: 31px; height: 31px; border-radius: 9px; background: var(--red); color: #fff; font-size: 21px; font-style: normal; line-height: 1; box-shadow: 0 7px 18px rgba(226, 29, 47, .24); }
.brand span { color: #111315; }
:root[data-theme="dark"] .brand span { color: #f7f7f8; }
.brand strong { color: var(--red); }
.brand-large { font-size: 30px; }
.brand-large .brand-mark { width: 45px; height: 45px; border-radius: 12px; font-size: 30px; }
.eyebrow { margin: 0 0 6px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; }
.primary, .secondary, .danger { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 42px; padding: 0 15px; border-radius: 10px; font-weight: 760; line-height: 1.15; white-space: nowrap; transition: background .16s, border-color .16s, transform .16s; }
.primary { border: 1px solid var(--red); background: var(--red); color: #fff; box-shadow: 0 7px 18px rgba(226, 29, 47, .18); }
.primary:hover { background: var(--red-hover); border-color: var(--red-hover); }
.secondary { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.secondary:hover { border-color: var(--line-strong); background: var(--surface-2); }
.danger { border: 1px solid color-mix(in srgb, var(--red) 18%, var(--line)); background: var(--red-soft); color: var(--red); }
.danger:hover { border-color: var(--red); }
.primary:active, .secondary:active, .danger:active { transform: translateY(1px); }
label { display: grid; gap: 7px; font-weight: 680; }
input, textarea, select { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: var(--surface); transition: border .18s, box-shadow .18s; }
input:focus, textarea:focus, select:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 9%, transparent); }
textarea { resize: vertical; }
.stack, .dialog-card { display: grid; gap: 16px; }
.form-error { min-height: 18px; margin: 0; color: var(--red); font-size: 13px; }
.muted { color: var(--muted); }
.warning { padding: 12px; border-radius: 10px; background: #fff7dd; color: #755a00; font-size: 12px; }
:root[data-theme="dark"] .warning { background: #332b12; color: #f2d876; }
.login-shell { min-height: 100dvh; display: grid; place-items: center; padding: 24px; overflow: auto; background: radial-gradient(circle at 78% 15%, rgba(226, 29, 47, .1), transparent 24%), radial-gradient(circle at 16% 82%, rgba(35, 39, 45, .09), transparent 28%), var(--bg); }
.login-card { width: min(430px, 100%); padding: 40px; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow); }
.login-card .eyebrow { margin-top: 28px; }
.login-card h1 { margin: 8px 0 22px; }
.security-note { margin: 22px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.app-shell { min-height: 100dvh; display: grid; grid-template-columns: 204px minmax(0, 1fr); transition: grid-template-columns .2s ease; }
.side-nav { position: sticky; top: 0; z-index: 12; height: 100dvh; display: flex; flex-direction: column; gap: 32px; padding: 23px 13px 16px; border-right: 1px solid var(--line); background: var(--surface); transition: padding .2s, opacity .18s; }
.side-nav > .brand { padding: 0 9px; }
.side-nav nav { display: grid; gap: 6px; }
.nav-item { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 8px 11px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--muted); text-align: left; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { border-color: color-mix(in srgb, var(--red) 14%, var(--line)); background: var(--red-soft); color: var(--red); font-weight: 780; }
.nav-item i { display: grid; place-items: center; width: 22px; height: 22px; }
.nav-item svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item b, #navUnread { display: grid; place-items: center; min-width: 21px; height: 21px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 10px; }
.side-footer { display: grid; gap: 8px; margin-top: auto; }
.theme-button, .account-card { width: 100%; border: 0; border-radius: 11px; background: transparent; text-align: left; }
.theme-button { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 8px 10px; color: var(--muted); font-size: 12px; }
.theme-button:hover { background: var(--surface-2); }
.account-card { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 9px; background: var(--surface-2); }
.account-card strong, .account-card small { display: block; max-width: 108px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar, .group-avatar, .mini-avatar, .message-avatar, .mention-avatar { display: grid; place-items: center; flex: 0 0 auto; overflow: hidden; background: #20242a; color: #fff; font-weight: 800; }
.avatar { width: 36px; height: 36px; border-radius: 50%; }
.group-avatar { width: 42px; height: 42px; border-radius: 12px; }
.mini-avatar { width: 42px; height: 42px; border-radius: 12px; background: var(--surface-3); color: var(--text); }
.message-avatar { width: 34px; height: 34px; border-radius: 50%; font-size: 10px; }
.mention-avatar { width: 31px; height: 31px; border-radius: 50%; font-size: 9px; }
.avatar img, .group-avatar img, .mini-avatar img, .message-avatar img, .mention-avatar img { width: 100%; height: 100%; display: block; object-fit: cover; border-radius: inherit; }
.avatar-button { padding: 0; border: 1px solid var(--line); }
.avatar-button:not(:disabled):hover { border-color: var(--red); }
.avatar-button:disabled { opacity: 1; cursor: default; }
.view { min-width: 0; min-height: 100dvh; }
.chat-view { display: grid; grid-template-columns: 350px minmax(0, 1fr); transition: grid-template-columns .2s ease; }
.chat-list-panel { min-width: 0; padding: 23px 16px; overflow: auto; border-right: 1px solid var(--line); background: var(--surface); transition: padding .2s, opacity .18s; }
.panel-header, .content-header, .conversation-header, .dialog-card header, .dialog-card footer, .security-title { display: flex; align-items: center; gap: 12px; }
.panel-header, .content-header { justify-content: space-between; }
.panel-header h2, .content-header h1 { margin: 0; }
.icon-button { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 11px; font-size: 22px; }
.icon-button.red { background: var(--red); color: #fff; box-shadow: 0 7px 18px rgba(226, 29, 47, .18); }
.search { position: relative; margin: 18px 0 12px; }
.search span { position: absolute; left: 12px; top: 8px; color: var(--muted); font-size: 21px; }
.search input { padding-left: 38px; background: var(--surface-2); }
.group-list { display: grid; gap: 3px; }
.group-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 1px solid transparent; border-radius: 12px; background: transparent; text-align: left; }
.group-row:hover { background: var(--surface-2); }
.group-row.active { border-color: var(--line); background: var(--surface-2); box-shadow: inset 3px 0 var(--red); }
.group-row strong, .group-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-row small { margin-top: 4px; }
.group-row time { color: var(--muted); font-size: 10px; }
.empty-list { padding: 28px 12px; color: var(--muted); text-align: center; }
.conversation-panel { position: relative; min-width: 0; min-height: 0; }
.empty-state { height: 100dvh; display: grid; place-content: center; padding: 24px; color: var(--muted); text-align: center; }
.empty-state h2 { color: var(--text); }
.empty-mark { width: 68px; height: 68px; display: grid; place-items: center; margin: 0 auto 17px; border-radius: 19px; background: var(--red); color: #fff; font-size: 35px; font-weight: 900; box-shadow: 0 14px 30px rgba(226, 29, 47, .2); }
.conversation { height: 100dvh; min-height: 0; display: grid; grid-template-areas: "header" "pinned" "messages" "reply" "upload" "composer"; grid-template-rows: auto auto minmax(0, 1fr) auto auto auto; background: var(--bg); }
.conversation-header { grid-area: header; min-width: 0; padding: 13px 18px; border-bottom: 1px solid var(--line); background: var(--surface); }
.conversation-header > div:not(.header-actions) { min-width: 0; }
.conversation-header h2, .conversation-header p { margin: 0; }
.conversation-header h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; }
.conversation-header p { margin-top: 3px; color: var(--muted); font-size: 11px; }
.mobile-back { display: none; padding: 0 3px; border: 0; background: transparent; font-size: 30px; line-height: 1; }
.header-actions { display: flex; align-items: center; gap: 7px; margin-left: auto; }
.header-actions .secondary, .header-actions .danger { min-height: 38px; padding-inline: 12px; font-size: 12px; }
.collapse-chat-button, .delete-group-button { white-space: nowrap; }
.pinned-bar { grid-area: pinned; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 45px; padding: 8px 18px; border: 0; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--text); text-align: left; }
.pinned-bar > span:first-child { color: var(--red); }
.pinned-bar strong, .pinned-bar small { display: block; }
.pinned-bar small { max-width: 66vw; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-list { grid-area: messages; min-width: 0; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 20px clamp(14px, 4vw, 54px); }
.message { position: relative; align-self: flex-start; display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: end; gap: 9px; width: fit-content; max-width: min(720px, 78%); }
.message.own { grid-template-columns: minmax(0, 1fr); align-self: flex-end; }
.bubble { position: relative; min-width: 150px; padding: 10px 12px 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 2px 8px rgba(20, 24, 31, .035); }
.own .bubble { background: var(--surface-2); border-color: var(--line); }
.message-head { display: flex; align-items: center; gap: 7px; min-height: 22px; margin-bottom: 4px; }
.message-head strong { color: var(--text); font-size: 12px; }
.message-head small { font-size: 9px; }
.message-head time { margin-left: auto; padding-left: 8px; color: var(--muted); font-size: 9px; }
.pin-mark { color: var(--red); font-size: 8px; }
.message-body { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.45; }
.message-body .mention { color: var(--red); font-weight: 800; }
.reply-quote { margin-bottom: 7px; padding: 6px 8px; border-left: 3px solid var(--red); border-radius: 5px; background: var(--surface-3); font-size: 11px; }
.attachment { display: block; margin-top: 8px; padding: 9px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: inherit; text-decoration: none; }
.attachment img { display: block; max-width: 100%; max-height: 330px; border-radius: 7px; }
.attachment small { display: block; margin-top: 6px; }
.file-card { display: flex; align-items: center; gap: 9px; }
.file-icon { display: grid; place-items: center; width: 36px; height: 40px; border-radius: 7px; background: #252a31; color: #fff; font-size: 9px; font-weight: 800; }
.audio-card audio { display: block; width: min(400px, 100%); max-width: 100%; }
.message-menu { position: relative; margin-left: 1px; }
.message-menu-toggle { display: grid; place-items: center; width: 28px; height: 25px; padding: 0 0 5px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 17px; letter-spacing: 1px; }
.message-menu-toggle:hover { background: var(--surface-3); color: var(--text); }
.message-menu-panel { position: absolute; z-index: 25; top: 28px; right: 0; width: 158px; padding: 5px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow); }
.message-menu-panel button { display: flex; width: 100%; min-height: 35px; align-items: center; padding: 7px 9px; border: 0; border-radius: 7px; background: transparent; text-align: left; }
.message-menu-panel button:hover { background: var(--surface-2); }
.message-menu-panel .danger-menu-item { color: var(--red); }
.reactions-row { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; min-height: 25px; margin-top: 6px; }
.reaction-chip, .reaction-add-button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 29px; height: 25px; padding: 0 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.reaction-chip b { font-size: 10px; }
.reaction-chip.reacted { border-color: color-mix(in srgb, var(--red) 38%, var(--line)); background: var(--red-soft); }
.reaction-add { position: relative; }
.reaction-add-button { padding: 0; color: var(--muted); }
.reaction-picker { position: absolute; z-index: 24; left: 0; bottom: 31px; display: flex; gap: 2px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.reaction-picker button { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: transparent; font-size: 19px; }
.reaction-picker button:hover { background: var(--surface-2); }
.reply-bar { grid-area: reply; }
.upload-preview { grid-area: upload; }
.reply-bar, .upload-preview { margin: 0 14px; padding: 8px 12px; border: 1px solid var(--line); border-bottom: 0; background: var(--surface); }
.reply-bar { display: flex; align-items: center; justify-content: space-between; }
.reply-bar small, .reply-bar b { display: block; }
.reply-bar button { border: 0; background: transparent; font-size: 20px; }
.upload-preview { color: var(--muted); cursor: pointer; }
.composer { grid-area: composer; position: relative; align-self: end; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: end; gap: 7px; width: auto; min-width: 0; min-height: 58px; margin: 0 14px 13px; padding: 7px; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); box-shadow: 0 6px 18px rgba(20, 24, 31, .05); }
.composer textarea { width: 100%; min-width: 0; min-height: 40px; max-height: 126px; padding: 9px 5px; border: 0; background: transparent; resize: none; box-shadow: none; }
.composer textarea:focus { box-shadow: none; }
.composer-tools { display: flex; align-items: center; gap: 3px; }
.composer-tool, .send-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 10px; }
.composer-tool { border: 0; background: var(--surface-2); font-size: 19px; font-weight: 800; }
.composer-tool:hover { background: var(--surface-3); }
.composer-tool input { display: none; }
.gif-tool { font-size: 10px; letter-spacing: .02em; }
.send-button { border: 0; background: var(--red); color: #fff; font-size: 18px; box-shadow: 0 6px 16px rgba(226, 29, 47, .18); }
.send-button:hover { background: var(--red-hover); }
.emoji-picker, .mention-picker { position: absolute; z-index: 22; left: 7px; bottom: 56px; padding: 7px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.emoji-picker { display: grid; grid-template-columns: repeat(5, 36px); gap: 3px; }
.emoji-picker button { width: 36px; height: 36px; padding: 0; border: 0; border-radius: 8px; background: transparent; font-size: 20px; }
.emoji-picker button:hover { background: var(--surface-2); }
.mention-picker { display: grid; width: min(320px, calc(100vw - 32px)); gap: 2px; }
.mention-picker button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 7px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.mention-picker button:hover { background: var(--surface-2); }
.mention-picker strong, .mention-picker small { display: block; }
.content-view { max-width: 1500px; margin: auto; padding: 32px; overflow: auto; }
.content-header { margin-bottom: 22px; }
.content-header h1 { margin: 0; }
.header-button-group { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.stat-card, .surface { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat-card { padding: 18px; }
.stat-card strong { display: block; margin-top: 6px; font-size: 26px; }
.colleagues-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; }
.people-list { overflow: auto; }
.person-row { display: grid; grid-template-columns: minmax(190px, 1.25fr) 112px minmax(150px, .7fr) minmax(150px, auto); align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.person-row:last-child { border-bottom: 0; }
.person-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person-main strong, .person-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-badge { width: fit-content; padding: 5px 8px; border-radius: 7px; background: var(--surface-2); font-size: 10px; }
.role-badge.admin { background: var(--red-soft); color: var(--red); }
.status-dot { font-size: 11px; }
.status-dot.online { color: var(--green); }
.status-dot.offline { color: var(--muted); }
.person-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.person-actions button { min-height: 31px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); font-size: 10px; }
.security-panel { align-self: start; padding: 18px; }
.security-title { align-items: flex-start; }
.security-title h3, .security-title p { margin: 0; }
.security-title p { margin-top: 3px; color: var(--muted); font-size: 10px; }
.shield { color: var(--red); font-size: 22px; }
.switch { position: relative; margin-left: auto; }
.switch input { position: absolute; opacity: 0; }
.switch span { display: block; width: 42px; height: 24px; border-radius: 99px; background: #b9bec6; transition: .2s; }
.switch span::after { content: ""; display: block; width: 18px; height: 18px; margin: 3px; border-radius: 50%; background: #fff; transition: .2s; }
.switch input:checked + span { background: var(--red); }
.switch input:checked + span::after { transform: translateX(18px); }
.inline-form { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 15px 0; }
.inline-form button { grid-column: 1 / -1; }
.ip-rules { display: grid; gap: 7px; }
.ip-rule { display: grid; grid-template-columns: 1fr auto; gap: 7px; padding: 9px; border-radius: 9px; background: var(--surface-2); }
.ip-rule button { border: 0; background: transparent; color: var(--red); }
code { padding: 3px 6px; border-radius: 6px; background: var(--surface-2); }
.notification-list { display: grid; }
.notification-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 14px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.notification-row.unread { background: var(--red-soft); }
.notification-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: #242930; color: #fff; }
.notification-row p { margin: 3px 0 0; color: var(--muted); }
dialog { width: min(560px, calc(100% - 28px)); max-height: calc(100dvh - 28px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(4, 7, 12, .62); backdrop-filter: blur(4px); }
.dialog-card { padding: 22px; }
.dialog-card header, .dialog-card footer { justify-content: space-between; }
.dialog-card header h2 { margin: 0; }
.dialog-close { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: var(--surface-2); font-size: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
fieldset { border: 1px solid var(--line); border-radius: 11px; }
legend { font-weight: 750; }
.choice-list { display: grid; gap: 3px; max-height: 240px; overflow: auto; }
.choice-item { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 8px; }
.choice-item:hover { background: var(--surface-2); }
.choice-item input { width: auto; }
.compact { gap: 9px; }
.dialog-section-title { margin: 0 0 8px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.current-member-list { display: grid; max-height: 230px; overflow: auto; border: 1px solid var(--line); border-radius: 11px; }
.current-member-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 9px; border-bottom: 1px solid var(--line); }
.current-member-row:last-child { border-bottom: 0; }
.current-member-row strong, .current-member-row small { display: block; }
.remove-member-button { min-height: 32px; padding: 5px 8px; border: 1px solid color-mix(in srgb, var(--red) 20%, var(--line)); border-radius: 7px; background: var(--red-soft); color: var(--red); font-size: 10px; }
.profile-avatar-action { display: flex; cursor: pointer; }
.toast { position: fixed; z-index: 50; right: 18px; bottom: 18px; max-width: min(420px, calc(100vw - 28px)); padding: 12px 15px; border: 1px solid #292e35; border-radius: 10px; background: #171a1f; color: #fff; box-shadow: var(--shadow); }
.app-shell.focus-chat { grid-template-columns: 0 minmax(0, 1fr); }
.app-shell.focus-chat > .side-nav { padding-inline: 0; overflow: hidden; border: 0; opacity: 0; pointer-events: none; }
.chat-view.chat-list-collapsed { grid-template-columns: 0 minmax(0, 1fr); }
.chat-view.chat-list-collapsed > .chat-list-panel { padding-inline: 0; overflow: hidden; border: 0; opacity: 0; pointer-events: none; }
@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 78px minmax(0, 1fr); }
  .side-nav { padding-inline: 9px; }
  .side-nav > .brand span { display: none; }
  .side-nav > .brand { justify-content: center; padding: 0; }
  .nav-item { grid-template-columns: 1fr; justify-items: center; padding: 7px 4px; }
  .nav-item > span { display: none; }
  .nav-item b { position: absolute; top: 3px; right: 4px; }
  .theme-button { justify-content: center; }
  .theme-button span:last-child, .account-card > span:last-child { display: none; }
  .account-card { justify-content: center; }
  .chat-view { grid-template-columns: 310px minmax(0, 1fr); }
  .colleagues-layout { grid-template-columns: 1fr; }
  .security-panel { order: -1; }
  .person-row { grid-template-columns: minmax(180px, 1fr) 105px minmax(130px, .8fr); }
  .person-actions { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 860px) {
  .chat-view { grid-template-columns: 280px minmax(0, 1fr); }
  .collapse-chat-button span { display: none; }
  .header-actions .secondary, .header-actions .danger { padding-inline: 10px; }
  .message { max-width: 88%; }
  .content-view { padding: 24px 18px; }
}
@media (max-width: 720px) {
  body { overflow: auto; }
  .app-shell { display: block; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .side-nav { position: fixed; inset: auto 0 0; z-index: 30; width: 100%; height: calc(64px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; padding: 5px 8px env(safe-area-inset-bottom); border: 0; border-top: 1px solid var(--line); }
  .side-nav > .brand, .account-card { display: none; }
  .side-nav nav { display: contents; }
  .nav-item { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 52px; padding: 4px; font-size: 9px; text-align: center; }
  .nav-item > span { display: block; }
  .nav-item i, .nav-item svg { width: 19px; height: 19px; }
  .nav-item b { top: 2px; right: 18%; }
  .side-footer { display: contents; }
  .theme-button { justify-content: center; min-height: 52px; margin: 0; padding: 4px; }
  .theme-button span:first-child { font-size: 19px; }
  .chat-view { grid-template-columns: 1fr; }
  .chat-list-panel { min-height: calc(100dvh - 64px - env(safe-area-inset-bottom)); border: 0; }
  .conversation-panel { position: fixed; z-index: 20; inset: 0 0 calc(64px + env(safe-area-inset-bottom)); min-height: 0; background: var(--bg); transform: translateX(100%); transition: transform .2s; }
  .conversation-panel.mobile-open { transform: none; }
  .conversation { height: 100%; }
  .conversation-header { gap: 7px; padding: 9px 8px; }
  .mobile-back { display: block; }
  .conversation-header h2 { max-width: 37vw; font-size: 15px; }
  .conversation-header p { font-size: 9px; }
  .group-avatar { width: 36px; height: 36px; }
  .collapse-chat-button { display: none; }
  .header-actions { gap: 4px; }
  .header-actions #addMembersButton { width: 36px; min-height: 36px; padding: 0; font-size: 0; }
  .header-actions #addMembersButton::after { content: "+"; font-size: 20px; }
  .delete-group-button { width: 36px; min-height: 36px !important; padding: 0 !important; font-size: 0 !important; }
  .delete-group-button::after { content: "×"; font-size: 21px; }
  .message-list { padding: 12px 8px; }
  .message { grid-template-columns: 30px minmax(0, 1fr); max-width: 94%; gap: 6px; }
  .message.own { grid-template-columns: minmax(0, 1fr); }
  .message-avatar { width: 30px; height: 30px; }
  .bubble { min-width: 120px; padding: 9px 10px 7px; }
  .message-menu-panel { position: fixed; top: auto; right: 8px; bottom: calc(72px + env(safe-area-inset-bottom)); width: min(230px, calc(100vw - 16px)); }
  .reaction-picker { left: auto; right: 0; }
  .reply-bar, .upload-preview { margin-inline: 7px; }
  .composer { grid-template-columns: minmax(0, 1fr) auto; min-height: 0; margin: 0 6px 6px; padding: 6px; gap: 5px; }
  .composer-tools { grid-column: 1 / -1; order: -1; }
  .composer-tool { width: 35px; height: 32px; }
  .composer textarea { min-height: 40px; max-height: 96px; padding: 8px 4px; }
  .send-button { width: 41px; height: 41px; }
  .emoji-picker, .mention-picker { left: 3px; bottom: 88px; }
  .content-view { min-height: calc(100dvh - 64px); padding: 19px 11px; }
  .content-header { align-items: flex-start; flex-wrap: wrap; }
  .content-header > div:first-child { min-width: 0; }
  .header-button-group { width: 100%; justify-content: flex-start; }
  .header-button-group .secondary { flex: 1 1 160px; min-height: 40px; padding-inline: 10px; font-size: 11px; white-space: normal; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .stat-card { padding: 11px; }
  .stat-card strong { font-size: 21px; }
  .person-row { grid-template-columns: minmax(0, 1fr) auto; gap: 7px; padding: 11px; }
  .person-row > :nth-child(2), .person-row > :nth-child(3) { display: none; }
  .person-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .person-actions button { min-height: 35px; }
  .form-grid, .inline-form { grid-template-columns: 1fr; }
  .login-card { padding: 26px; }
  .brand-large { font-size: 26px; }
  dialog { width: calc(100% - 18px); max-height: calc(100dvh - 18px); }
  .dialog-card { padding: 17px; }
  .dialog-card footer { flex-wrap: wrap; }
  .dialog-card footer .primary, .dialog-card footer .secondary { flex: 1; }
  .toast { right: 9px; bottom: calc(74px + env(safe-area-inset-bottom)); }
}
@media (max-width: 390px) {
  .conversation-header .group-avatar { display: none; }
  .conversation-header h2 { max-width: 40vw; }
  .stats { grid-template-columns: 1fr; }
  .emoji-picker { grid-template-columns: repeat(5, 33px); }
  .emoji-picker button { width: 33px; }
  .current-member-row { grid-template-columns: 32px minmax(0, 1fr); }
  .current-member-row .remove-member-button { grid-column: 1 / -1; }
}
