: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: "Avenir Next", "Segoe UI Variable", "SF Pro Display", ui-sans-serif, system-ui, -apple-system, 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; transition: color .18s ease, background-color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
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: block; }
.main-menu-button { position: fixed; z-index: 45; top: 17px; left: 15px; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); color: var(--text); font-size: 21px; box-shadow: 0 5px 16px rgba(20, 24, 31, .08); transition: opacity .18s, transform .18s; }
.main-menu-button:hover { background: var(--surface-2); }
.app-shell.focus-chat .main-menu-button { opacity: 0; pointer-events: none; transform: translateX(-12px); }
.menu-backdrop { position: fixed; z-index: 50; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: rgba(7, 10, 15, .4); backdrop-filter: blur(2px); }
.side-nav { position: fixed; z-index: 55; inset: 0 auto 0 0; width: 252px; height: 100dvh; display: flex; flex-direction: column; gap: 28px; padding: 20px 13px 16px; border-right: 1px solid var(--line); background: var(--surface); box-shadow: 18px 0 45px rgba(16, 20, 27, .16); transform: translateX(-105%); transition: transform .2s ease; }
.app-shell.menu-open .side-nav { transform: none; }
.menu-brand-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 5px 0 8px; }
.menu-close-button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 9px; background: var(--surface-2); color: var(--muted); font-size: 21px; }
.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 .26s ease, opacity .2s ease; }
.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 { padding-left: 52px; }
.content-header { padding-left: 50px; }
.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; animation: fade-slide-in .22s ease both; }
.group-row:hover { background: var(--surface-2); transform: translateX(2px); }
.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; }
.group-row-meta { display: grid; justify-items: end; gap: 5px; }
.chat-pin { color: var(--red); font-size: 10px; line-height: 1; }
.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; overflow: hidden; display: grid; grid-template-areas: "header" "pinned" "messages" "reply" "upload" "composer"; grid-template-rows: auto auto minmax(0, 1fr) auto auto auto; background: linear-gradient(150deg, color-mix(in srgb, var(--bg) 94%, var(--red) 6%), var(--bg) 38%); }
.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 { white-space: nowrap; }
.group-settings-menu { position: relative; }
.group-menu-button { display: grid; place-items: center; width: 40px; height: 38px; padding: 0 0 5px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 20px; letter-spacing: 1px; }
.group-menu-button:hover, .group-menu-button[aria-expanded="true"] { border-color: var(--line-strong); background: var(--surface-2); color: var(--text); }
.group-menu-panel { position: absolute; z-index: 28; top: 44px; right: 0; width: 228px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); animation: menu-in .16s ease both; }
.group-menu-panel button { display: flex; align-items: center; width: 100%; min-height: 38px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; text-align: left; }
.group-menu-panel button:hover { background: var(--surface-2); }
.group-menu-panel .danger-menu-item { color: var(--red); }
.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%); animation: message-in .22s cubic-bezier(.2,.7,.2,1) both; }
.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 color-mix(in srgb, var(--line) 85%, transparent); border-radius: 16px; background: var(--surface); box-shadow: 0 3px 12px rgba(20, 24, 31, .045); transition: transform .18s ease, box-shadow .18s ease; }
.bubble:hover { box-shadow: 0 7px 20px rgba(20, 24, 31, .075); }
.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[open] { animation: dialog-in .2s cubic-bezier(.2,.75,.25,1) both; }
dialog::backdrop { background: rgba(4, 7, 12, .62); backdrop-filter: blur(5px); animation: backdrop-in .2s ease both; }
.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; }
.dialog-card footer .dialog-close { display: inline-flex; width: auto; height: auto; min-height: 42px; padding: 0 15px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
#editMessageDialog { width: min(510px, calc(100% - 28px)); }
.edit-message-card { gap: 14px; padding: 24px; }
.edit-message-card header { padding-bottom: 2px; }
.edit-message-field { gap: 8px; }
.edit-message-field textarea { min-height: 118px; max-height: 46dvh; padding: 13px 14px; border-color: var(--line-strong); line-height: 1.45; resize: vertical; }
.edit-message-card .form-error:empty { display: none; }
.edit-message-card footer { padding-top: 5px; }
.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); }
.folder-bar { display: flex; gap: 6px; margin: 0 -2px 12px; padding: 2px; overflow-x: auto; scrollbar-width: none; }
.folder-bar::-webkit-scrollbar { display: none; }
.folder-chip { flex: 0 0 auto; min-height: 31px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 10px; font-weight: 750; }
.folder-chip:hover { border-color: var(--line-strong); color: var(--text); }
.folder-chip.active { border-color: color-mix(in srgb, var(--red) 28%, var(--line)); background: var(--red-soft); color: var(--red); }
.folder-add { width: 31px; padding: 0; font-size: 17px; }
.unread-badge { display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--red); color: #fff; font-size: 9px; }
.muted-chat { color: var(--muted); font-size: 11px; font-style: normal; }
.draft-preview b { color: var(--red); }
.global-search-results { display: grid; gap: 3px; padding-bottom: 10px; }
.global-search-results h3 { margin: 13px 8px 5px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.search-result { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; align-items: center; gap: 10px; width: 100%; padding: 9px; border: 0; border-radius: 11px; background: transparent; text-align: left; }
.search-result:hover { background: var(--surface-2); }
.search-result strong, .search-result small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-result small { margin-top: 3px; }
.search-result time { color: var(--muted); font-size: 9px; }
.message-result { grid-template-columns: 34px minmax(0,1fr) auto; }
.result-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: var(--surface-3); color: var(--red); }
.new-messages-divider { align-self: stretch; display: flex; align-items: center; gap: 10px; margin: 5px 0; color: var(--red); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.new-messages-divider::before, .new-messages-divider::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--red) 35%, var(--line)); }
.new-messages-divider span { padding: 5px 9px; border-radius: 999px; background: var(--red-soft); }
.forwarded-label { margin-bottom: 7px; color: var(--muted); font-size: 10px; }
.forwarded-label strong { color: var(--red); }
.delivery-status { margin-top: 5px; color: var(--muted); font-size: 9px; text-align: right; }
.delivery-status.read { color: var(--red); }
.people-search { max-width: 620px; margin: -6px 0 15px; }
.write-person-button { border-color: color-mix(in srgb, var(--red) 24%, var(--line)) !important; background: var(--red-soft) !important; color: var(--red); font-weight: 750; }
.folder-choices, .forward-choices { display: grid; gap: 5px; max-height: min(420px, 52dvh); overflow: auto; }
.folder-choice-row { display: grid; grid-template-columns: minmax(0,1fr) 38px; gap: 6px; }
.folder-choice, .forward-choice { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); text-align: left; }
.folder-choice { justify-content: space-between; }
.folder-choice span, .forward-choice small { color: var(--muted); font-size: 10px; }
.folder-choice.selected { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); background: var(--red-soft); color: var(--red); }
.folder-delete { border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--muted); }
.folder-create-form { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px; margin-top: 7px; }
.forward-choice:hover, .folder-choice:hover { border-color: var(--line-strong); background: var(--surface-2); }
.forward-choice span:last-child { min-width: 0; }
.forward-choice strong, .forward-choice small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wide-dialog { width: min(820px, calc(100% - 28px)); }
.media-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 65dvh; overflow: auto; }
.media-tile { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: inherit; text-decoration: none; transition: transform .18s ease, border-color .18s ease; }
.media-tile:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.media-tile.image img { display: block; width: 100%; aspect-ratio: 1.2; object-fit: cover; }
.media-tile.image span { display: block; padding: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.media-tile.file { display: flex; align-items: center; gap: 9px; min-height: 76px; padding: 10px; }
.media-tile.file span:last-child { min-width: 0; }
.media-tile.file strong, .media-tile.file small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes fade-slide-in { from { opacity: 0; transform: translateY(4px); } }
@keyframes message-in { from { opacity: 0; transform: translateY(6px) scale(.985); } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-5px) scale(.98); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
@keyframes backdrop-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.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) {
  .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 { padding-bottom: 0; }
  .main-menu-button { top: 11px; left: 9px; width: 39px; height: 39px; }
  body.chat-mobile-open .main-menu-button { display: none; }
  .side-nav { width: min(286px, calc(100vw - 44px)); padding-top: 17px; }
  .chat-view { grid-template-columns: 1fr; }
  .chat-list-panel { min-height: 100dvh; border: 0; }
  .panel-header { padding-left: 44px; }
  .conversation-panel { position: fixed; z-index: 20; inset: 0; 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; }
  .group-menu-button { width: 37px; height: 36px; }
  .group-menu-panel { position: fixed; top: 55px; right: 8px; width: min(230px, calc(100vw - 16px)); }
  .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: auto minmax(0, 1fr) auto; min-height: 0; margin: 0 6px calc(6px + env(safe-area-inset-bottom)); padding: 5px; gap: 4px; }
  .composer-tools { grid-column: auto; order: initial; gap: 1px; }
  .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: 55px; }
  .content-view { min-height: 100dvh; padding: 19px 11px; }
  .content-header { align-items: flex-start; flex-wrap: wrap; }
  .content-header { padding-left: 44px; }
  .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(9px + env(safe-area-inset-bottom)); }
  .folder-bar { margin-bottom: 8px; }
  .folder-chip { min-height: 30px; }
  .media-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
}
@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; }
  .composer-tool { width: 31px; }
  .composer textarea { font-size: 13px; }
  .folder-create-form { grid-template-columns: 1fr; }
}
