/* =====================================================================
   Orbita — классический мессенджер-дизайн
   ===================================================================== */
:root {
  --accent: #3a8ef2;
  --on-accent: #ffffff;
  --bg: #ffffff;
  --bg-2: #f4f4f5;
  --bg-3: #e9e9ec;
  --hover: #f4f4f5;
  --text: #0f0f0f;
  --muted: #707579;
  --border: #e6e6e9;
  --chat-grad: linear-gradient(160deg, #d0e4ae 0%, #aed4a8 35%, #c9e1b2 65%, #e2e6b3 100%);
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%232b4a1f' stroke-opacity='.16' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 14l3 7 7 .5-5.5 4.5 2 7-6.5-4-6.5 4 2-7-5.5-4.5 7-.5z'/%3E%3Ccircle cx='82' cy='28' r='7'/%3E%3Cellipse cx='82' cy='28' rx='14' ry='4.5' transform='rotate(-20 82 28)'/%3E%3Cpath d='M135 50c-7-5-11-8-11-12a5 5 0 0 1 11-2 5 5 0 0 1 11 2c0 4-4 7-11 12z'/%3E%3Cpath d='M28 86h24a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4H38l-7 6v-6h-3a4 4 0 0 1-4-4V90a4 4 0 0 1 4-4z'/%3E%3Ccircle cx='112' cy='108' r='10'/%3E%3Cpath d='M107 111a6 6 0 0 0 10 0M108 104h.01M116 104h.01'/%3E%3Cpath d='M140 126l-8 12h6l-4 10 10-14h-6l4-8z'/%3E%3Cpath d='M70 136v-13l10-2v11'/%3E%3Ccircle cx='67' cy='136' r='3'/%3E%3Ccircle cx='77' cy='132' r='3'/%3E%3Ccircle cx='58' cy='60' r='2'/%3E%3Ccircle cx='150' cy='88' r='2.5'/%3E%3Ccircle cx='10' cy='62' r='1.6'/%3E%3Ccircle cx='100' cy='70' r='1.6'/%3E%3Cpath d='M8 118l4 4M12 118l-4 4'/%3E%3C/g%3E%3C/svg%3E");
  --bubble-in: #ffffff;
  --bubble-out: #e4fbd2;
  --out-meta: #4fae4e;
  --pill: rgba(60, 90, 40, .38);
  --danger: #e53935;
  --online: #3ec44a;
  --shadow: 0 6px 24px rgba(0, 0, 0, .16);
  --radius: 16px;
  --font-size: 15px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #1c242f;
  --bg-2: #242f3d;
  --bg-3: #2e3a49;
  --hover: #26313e;
  --text: #f1f3f5;
  --muted: #8b98a6;
  --border: #111820;
  --chat-grad: linear-gradient(160deg, #0f1a24 0%, #132231 50%, #0e1822 100%);
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.06' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 14l3 7 7 .5-5.5 4.5 2 7-6.5-4-6.5 4 2-7-5.5-4.5 7-.5z'/%3E%3Ccircle cx='82' cy='28' r='7'/%3E%3Cellipse cx='82' cy='28' rx='14' ry='4.5' transform='rotate(-20 82 28)'/%3E%3Cpath d='M135 50c-7-5-11-8-11-12a5 5 0 0 1 11-2 5 5 0 0 1 11 2c0 4-4 7-11 12z'/%3E%3Cpath d='M28 86h24a4 4 0 0 1 4 4v12a4 4 0 0 1-4 4H38l-7 6v-6h-3a4 4 0 0 1-4-4V90a4 4 0 0 1 4-4z'/%3E%3Ccircle cx='112' cy='108' r='10'/%3E%3Cpath d='M107 111a6 6 0 0 0 10 0M108 104h.01M116 104h.01'/%3E%3Cpath d='M140 126l-8 12h6l-4 10 10-14h-6l4-8z'/%3E%3Cpath d='M70 136v-13l10-2v11'/%3E%3Ccircle cx='67' cy='136' r='3'/%3E%3Ccircle cx='77' cy='132' r='3'/%3E%3Ccircle cx='58' cy='60' r='2'/%3E%3Ccircle cx='150' cy='88' r='2.5'/%3E%3Ccircle cx='10' cy='62' r='1.6'/%3E%3Ccircle cx='100' cy='70' r='1.6'/%3E%3Cpath d='M8 118l4 4M12 118l-4 4'/%3E%3C/g%3E%3C/svg%3E");
  --bubble-in: #222e3b;
  --bubble-out: #2b5b8a;
  --out-meta: #8fc3f5;
  --pill: rgba(0, 0, 0, .35);
  --shadow: 0 6px 24px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; }
body {
  font-family: "Roboto", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: var(--font-size); color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); }
a { color: var(--accent); }
.hidden { display: none !important; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--muted) 40%, transparent); border-radius: 6px; }
code { background: var(--bg-2); padding: 1px 6px; border-radius: 6px; font-size: 13px; }

/* ---------- Экран входа ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); overflow-y: auto; }
.auth-card { width: 100%; max-width: 360px; text-align: center; }
.auth-logo img { width: 150px; height: 150px; margin-bottom: 24px; filter: drop-shadow(0 8px 24px color-mix(in srgb, var(--accent) 35%, transparent)); }
.auth-card h2 { font-size: 30px; font-weight: 500; margin-bottom: 8px; }
.auth-card .sub { color: var(--muted); margin-bottom: 28px; line-height: 1.4; }
.seg { display: flex; background: var(--bg-2); border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.seg button { flex: 1; padding: 9px; border-radius: 9px; color: var(--muted); font-weight: 500; transition: all .15s; }
.seg button.active { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
:root[data-theme="dark"] .seg button.active { background: var(--bg-3); }
.form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.field, .form input {
  width: 100%; padding: 15px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); outline: none; transition: border-color .15s, box-shadow .15s;
}
:root[data-theme="dark"] .field, :root[data-theme="dark"] .form input { border-color: var(--bg-3); }
.field:focus, .form input:focus { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
textarea.field { resize: vertical; min-height: 70px; }
.label { font-size: 13px; color: var(--muted); font-weight: 500; margin: 4px 2px -6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 20px; border-radius: 12px; font-weight: 500; background: var(--accent); color: var(--on-accent); text-transform: uppercase; letter-spacing: .02em; font-size: 14px; transition: filter .15s; }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.btn.danger { background: transparent; color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn.block { width: 100%; padding: 15px; }
.error { color: var(--danger); font-size: 14px; min-height: 18px; }

/* ---------- Каркас ---------- */
.app { display: flex; height: 100vh; height: 100dvh; }
.sidebar { width: 380px; min-width: 300px; background: var(--bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: relative; }
.side-top { display: flex; align-items: center; gap: 10px; padding: 8px 14px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); flex-shrink: 0; position: relative; transition: background .15s; }
.icon-btn:hover { background: var(--hover); }
.search { flex: 1; display: flex; align-items: center; gap: 10px; background: var(--bg-2); border-radius: 22px; padding: 0 14px; height: 42px; border: 2px solid transparent; transition: all .15s; }
.search:focus-within { border-color: var(--accent); background: var(--bg); }
.search svg { width: 20px; height: 20px; color: var(--muted); }
.search:focus-within svg { color: var(--accent); }
.search input { flex: 1; border: 0; background: none; outline: none; min-width: 0; }
.folders { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
.folders button { position: relative; padding: 10px 12px 12px; color: var(--muted); font-weight: 500; font-size: 14.5px; display: flex; align-items: center; gap: 6px; white-space: nowrap; border-radius: 10px 10px 0 0; }
.folders button:hover { background: var(--hover); }
.folders button.active { color: var(--accent); }
.folders button.active::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.fbadge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--muted); color: #fff; font-size: 12px; font-weight: 500; display: grid; place-items: center; }
.folders button.active .fbadge { background: var(--accent); }
.chat-list { flex: 1; overflow-y: auto; padding: 6px 8px 90px; }
.section-title { color: var(--muted); font-size: 14px; font-weight: 500; padding: 12px 10px 6px; }
.empty { color: var(--muted); text-align: center; padding: 40px 20px; line-height: 1.5; }

.chat-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; cursor: pointer; }
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--accent); color: #fff; }
.chat-item.active .ci-text, .chat-item.active .ci-time, .chat-item.active .ci-title svg, .chat-item.active .ci-time svg, .chat-item.active .ci-text b, .chat-item.active .ci-text .typing { color: #fff !important; }
.chat-item.active .badge { background: #fff; color: var(--accent); }
.chat-item.active .avatar.online::after { border-color: var(--accent); }
.ci-body { flex: 1; min-width: 0; }
.ci-row { display: flex; align-items: center; gap: 6px; }
.ci-title { font-weight: 500; font-size: 16px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.ci-title svg { width: 16px; height: 16px; color: var(--text); }
.ci-time { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 2px; }
.ci-time svg { width: 18px; height: 18px; color: var(--out-meta); }
.ci-text { color: var(--muted); font-size: 15px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; }
.ci-text b { color: var(--text); font-weight: 400; }
.ci-text .typing { color: var(--accent); }
.badge { background: var(--out-meta); color: #fff; border-radius: 12px; min-width: 24px; height: 24px; padding: 0 7px; font-size: 13px; font-weight: 500; display: grid; place-items: center; margin-top: 3px; }
.badge.muted { background: #c4c9cc; }
:root[data-theme="dark"] .badge { background: var(--accent); }
:root[data-theme="dark"] .badge.muted { background: #4a5663; }

.avatar { width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 500; font-size: 19px; flex-shrink: 0; position: relative; background-size: cover; background-position: center; }
.avatar.xs { width: 34px; height: 34px; font-size: 13px; }
.avatar.sm { width: 42px; height: 42px; font-size: 16px; }
.avatar.lg { width: 120px; height: 120px; font-size: 44px; margin: 0 auto; }
.avatar.online::after { content: ''; position: absolute; right: 1px; bottom: 1px; width: 13px; height: 13px; border-radius: 50%; background: var(--online); border: 2.5px solid var(--bg); }
.avatar.xs.online::after, .avatar.sm.online::after { width: 11px; height: 11px; border-width: 2px; right: 0; bottom: 0; }
.avatar.saved { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent)); }
.avatar.saved svg { color: #fff; }

.fab { position: absolute; right: 20px; bottom: 20px; width: 56px; height: 56px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 45%, transparent); transition: transform .15s; z-index: 2; }
.fab:hover { transform: scale(1.05); }
.fab svg { width: 24px; height: 24px; }

/* ---------- Чат ---------- */
.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; position: relative; background: var(--chat-grad); }
.chat.pattern::before { content: ''; position: absolute; inset: 0; background-image: var(--pattern); background-size: 180px 180px; pointer-events: none; }
.chat > * { position: relative; }
.chat-empty { margin: auto; }
.pill { background: var(--pill); color: #fff; padding: 5px 12px; border-radius: 16px; font-size: 14.5px; font-weight: 500; }
.chat-inner { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 20px; background: var(--bg); border-bottom: 1px solid var(--border); min-height: 58px; z-index: 3; }
.chat-head .back { display: none; }
.chat-head-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; }
.chat-head-info .avatar { width: 42px; height: 42px; font-size: 16px; }
.chat-title { font-weight: 500; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-status { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-status.on { color: var(--accent); }
.head-actions { display: flex; gap: 2px; }

.pinned-bar { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 20px; background: var(--bg); border-bottom: 1px solid var(--border); cursor: pointer; z-index: 2; }
.pinned-bar .pb-line { width: 2px; align-self: stretch; border-radius: 2px; background: var(--accent); }
.pinned-bar .pb-body { flex: 1; min-width: 0; }
.pinned-bar .pb-title { color: var(--accent); font-weight: 500; font-size: 14px; }
.pinned-bar .pb-text { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.search-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg); border-bottom: 1px solid var(--border); z-index: 2; }
.search-bar input { flex: 1; padding: 10px 14px; }
.search-results { max-height: 45%; overflow-y: auto; background: var(--bg); border-bottom: 1px solid var(--border); z-index: 2; }
.sr-item { padding: 8px 16px; cursor: pointer; display: flex; gap: 10px; align-items: center; }
.sr-item:hover { background: var(--hover); }
.sr-item .grow { flex: 1; min-width: 0; }
.sr-item .t { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.messages { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 10px max(16px, calc((100% - 760px) / 2)) 6px; display: flex; flex-direction: column; }
.day { align-self: center; background: var(--pill); color: #fff; font-size: 14px; font-weight: 500; padding: 4px 11px; border-radius: 14px; margin: 10px 0 6px; position: sticky; top: 6px; z-index: 2; }
.service { align-self: center; background: var(--pill); color: #fff; font-size: 14px; padding: 4px 11px; border-radius: 14px; margin: 5px 0; text-align: center; max-width: 90%; }
.service b { font-weight: 500; }
.unread-sep { align-self: stretch; text-align: center; font-size: 14px; font-weight: 500; color: var(--muted); background: color-mix(in srgb, var(--bg) 80%, transparent); padding: 4px; margin: 8px calc(-1 * max(16px, calc((100% - 760px) / 2))); }

.row { display: flex; align-items: flex-end; gap: 8px; margin-top: 2px; }
.row.first { margin-top: 8px; }
.row.out { flex-direction: row-reverse; }
.row.appear { animation: msgIn .2s ease-out; }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
.row .avatar { width: 34px; height: 34px; font-size: 13px; position: sticky; bottom: 2px; }
.row .av-space { width: 34px; flex-shrink: 0; }

.bubble { max-width: min(480px, 75%); background: var(--bubble-in); border-radius: var(--radius); padding: 6px 10px 6px 11px; position: relative; box-shadow: 0 1px 1px rgba(0,0,0,.13); overflow-wrap: anywhere; line-height: 1.35; min-width: 60px; }
.row.out .bubble { background: var(--bubble-out); }
.row.in.last .bubble { border-bottom-left-radius: 0; }
.row.out.last .bubble { border-bottom-right-radius: 0; }
.row.last .bubble:not(.clear):not(.only-media)::before {
  content: ''; position: absolute; bottom: 0; width: 9px; height: 17px; background: inherit;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 17'%3E%3Cpath d='M9 0v17H0c3.5-.6 6.5-2.8 8-6.2C8.8 8.8 9 5 9 0z'/%3E%3C/svg%3E") no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 9 17'%3E%3Cpath d='M9 0v17H0c3.5-.6 6.5-2.8 8-6.2C8.8 8.8 9 5 9 0z'/%3E%3C/svg%3E") no-repeat;
}
.row.in.last .bubble::before { left: -8.5px; }
.row.out.last .bubble::before { right: -8.5px; transform: scaleX(-1); }
.bubble .author { font-weight: 500; font-size: 14px; margin-bottom: 1px; cursor: pointer; }
.bubble .fwd { font-size: 14px; color: var(--accent); margin-bottom: 2px; display: flex; gap: 4px; align-items: center; }
.row.out .bubble .fwd { color: var(--out-meta); }
.bubble .fwd svg { width: 14px; height: 14px; }
.bubble .text { white-space: pre-wrap; }
.bubble .text.jumbo { font-size: 46px; line-height: 1.15; }
.bubble.clear { background: none !important; box-shadow: none; padding: 0; }
.bubble.clear .meta { background: var(--pill); color: #fff !important; padding: 2px 7px; border-radius: 10px; }
.bubble.clear .meta svg { color: #fff; }
.bubble.deleted .text { font-style: italic; color: var(--muted); }
.bubble .reply { border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); border-radius: 5px; padding: 2px 8px; margin: 3px 0 5px; font-size: 14px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.row.out .bubble .reply { border-color: var(--out-meta); background: color-mix(in srgb, var(--out-meta) 12%, transparent); }
.bubble .reply .rthumb { width: 34px; height: 34px; border-radius: 4px; object-fit: cover; }
.bubble .reply b { display: block; color: var(--accent); font-size: 14px; font-weight: 500; }
.row.out .bubble .reply b { color: var(--out-meta); }
.bubble .reply span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
.meta { float: right; display: inline-flex; align-items: center; gap: 2px; margin: 8px -4px -4px 12px; font-size: 12px; color: var(--muted); user-select: none; position: relative; }
.row.out .meta { color: var(--out-meta); }
.meta svg { width: 18px; height: 18px; stroke-width: 2; }
.bubble.flash { animation: flash 1.4s ease; }
@keyframes flash { 30% { filter: brightness(.85); } }

.media { margin: -2px -6px 4px -7px; border-radius: 12px; overflow: hidden; display: block; max-width: 380px; cursor: zoom-in; background: var(--bg-3); }
.media img, .media video { display: block; width: 100%; height: auto; max-height: 440px; object-fit: cover; }
.bubble.only-media { padding: 0; background: none !important; box-shadow: none; }
.bubble.only-media .media { margin: 0; border-radius: var(--radius); }
.bubble.only-media .meta { position: absolute; right: 8px; bottom: 8px; margin: 0; background: rgba(0,0,0,.4); color: #fff; padding: 2px 7px; border-radius: 10px; }
.bubble.only-media .meta svg { color: #fff; }
video.media { cursor: default; }

.file { display: flex; align-items: center; gap: 12px; min-width: 220px; padding: 3px 0; text-decoration: none !important; color: inherit !important; }
.file .ext { width: 54px; height: 54px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 500; text-transform: uppercase; flex-shrink: 0; }
.row.out .file .ext { background: var(--out-meta); }
.file .fname { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px; }
.file .fsize { font-size: 13px; color: var(--muted); }
.row.out .file .fsize { color: var(--out-meta); }

.voice { display: flex; align-items: center; gap: 10px; width: 280px; max-width: 100%; padding: 2px 0; }
.voice .play { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex-shrink: 0; }
.row.out .voice .play { background: var(--out-meta); }
.voice .play svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.voice .wave { display: flex; align-items: center; gap: 2px; height: 26px; flex: 1; min-width: 0; overflow: hidden; cursor: pointer; }
.voice .wave i { flex: 0 1 3px; width: 3px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 35%, transparent); min-height: 3px; }
.voice .wave i.on { background: var(--accent); }
.row.out .voice .wave i { background: color-mix(in srgb, var(--out-meta) 40%, transparent); }
.row.out .voice .wave i.on { background: var(--out-meta); }
.voice .vdur { font-size: 12.5px; color: var(--muted); min-width: 34px; }
.row.out .voice .vdur { color: var(--out-meta); }

.call-msg { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 2px 0; }
.call-msg .ci { width: 42px; height: 42px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); display: grid; place-items: center; }
.row.out .call-msg .ci { background: color-mix(in srgb, var(--out-meta) 18%, transparent); color: var(--out-meta); }
.call-msg .ci.missed { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.call-msg b { display: block; font-weight: 500; }
.call-msg span { font-size: 13px; color: var(--muted); }

.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; clear: both; }
.react { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border-radius: 14px; font-size: 15px; background: color-mix(in srgb, var(--accent) 12%, transparent); }
.row.out .react { background: color-mix(in srgb, var(--out-meta) 16%, transparent); }
.react.mine { background: var(--accent); }
.row.out .react.mine { background: var(--out-meta); }
.react small { font-size: 13px; font-weight: 500; color: var(--accent); }
.row.out .react small { color: var(--out-meta); }
.react.mine small { color: #fff !important; }

.scroll-down { position: absolute; right: 20px; bottom: 84px; width: 48px; height: 48px; border-radius: 50%; background: var(--bg); color: var(--muted); box-shadow: var(--shadow); display: grid; place-items: center; z-index: 3; }
.scroll-down .badge { position: absolute; top: -8px; right: -4px; margin: 0; background: var(--accent); }

/* ---------- Поле ввода ---------- */
.composer-wrap { padding: 4px max(16px, calc((100% - 760px) / 2)) 16px; position: relative; }
.compose-extra { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 16px 16px 0 0; padding: 8px 8px 2px 14px; margin-right: 62px; }
.compose-extra .ce-ico { color: var(--accent); }
.compose-extra .ce-body { flex: 1; min-width: 0; border-left: 2px solid var(--accent); padding-left: 10px; }
.compose-extra .ce-title { color: var(--accent); font-weight: 500; font-size: 14px; }
.compose-extra .ce-text { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer { display: flex; align-items: flex-end; gap: 8px; }
.input-box { flex: 1; min-width: 0; display: flex; align-items: flex-end; background: var(--bg); border-radius: 16px; padding: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.12); min-height: 54px; }
.compose-extra:not(.hidden) + .composer .input-box { border-top-left-radius: 0; border-top-right-radius: 0; }
.input-box .icon-btn { width: 46px; height: 46px; }
.composer textarea { flex: 1; border: 0; outline: none; resize: none; background: none; padding: 13px 4px; max-height: 200px; line-height: 1.35; min-width: 0; }
.send { width: 54px; height: 54px; border-radius: 50%; background: var(--bg); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; box-shadow: 0 1px 2px rgba(0,0,0,.12); transition: background .15s, color .15s, transform .1s; }
.send:hover { background: var(--accent); color: #fff; }
.send:active { transform: scale(.94); }
.send svg { width: 24px; height: 24px; }
.recording { display: flex; align-items: center; gap: 12px; flex: 1; padding: 0 8px; min-height: 46px; }
.recording .rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.recording .rec-time { font-variant-numeric: tabular-nums; }
.recording .rec-wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 26px; overflow: hidden; justify-content: flex-end; }
.recording .rec-wave i { width: 3px; border-radius: 2px; background: var(--accent); min-height: 3px; flex-shrink: 0; }
#recSend { background: var(--accent); color: #fff; }
.readonly-bar { display: flex; justify-content: center; }
.readonly-bar .btn { min-width: 280px; background: var(--bg); color: var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

.emoji-panel { position: absolute; bottom: 78px; left: max(16px, calc((100% - 760px) / 2)); width: 340px; height: 370px; background: var(--bg); border-radius: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; z-index: 20; overflow: hidden; animation: pop .15s ease-out; transform-origin: bottom left; }
.emoji-tabs { display: flex; border-bottom: 1px solid var(--border); padding: 4px; gap: 2px; }
.emoji-tabs button { flex: 1; padding: 6px 0; border-radius: 8px; font-size: 19px; opacity: .5; }
.emoji-tabs button.active { opacity: 1; background: var(--bg-2); }
.emoji-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(8, 1fr); padding: 6px; align-content: start; }
.emoji-grid button { font-size: 25px; padding: 4px 0; border-radius: 8px; }
.emoji-grid button:hover { background: var(--bg-2); }

.drop-zone { position: absolute; inset: 12px; border: 2px dashed var(--accent); border-radius: 18px; background: color-mix(in srgb, var(--bg) 90%, transparent); display: grid; place-items: center; font-size: 20px; font-weight: 500; color: var(--accent); z-index: 30; pointer-events: none; }

/* ---------- Панель информации ---------- */
.info { width: 380px; background: var(--bg); border-left: 1px solid var(--border); display: flex; flex-direction: column; overflow-y: auto; flex-shrink: 0; }
.info-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 1; min-height: 58px; }
.info-head b { flex: 1; font-size: 18px; font-weight: 500; }
.info-top { text-align: center; padding: 24px 16px 12px; }
.info-top h2 { font-size: 21px; font-weight: 500; margin-top: 14px; }
.info-top .muted { margin-top: 2px; }
.info-actions { display: flex; justify-content: center; gap: 8px; padding: 4px 16px 12px; }
.info-actions button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 12px; border-radius: 12px; font-size: 13px; min-width: 82px; color: var(--accent); }
.info-actions button:hover { background: var(--hover); }
.info-actions button span { color: var(--accent); }
.info-list { padding: 4px 8px; }
.info-row { display: flex; gap: 22px; align-items: center; padding: 10px 14px; border-radius: 12px; }
.info-row.click { cursor: pointer; }
.info-row.click:hover { background: var(--hover); }
.info-row svg { color: var(--muted); }
.info-row .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.info-row small { display: block; color: var(--muted); font-size: 13.5px; }
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--border); padding: 0 8px; margin-top: 8px; position: sticky; top: 58px; background: var(--bg); z-index: 1; }
.tabs button { flex-shrink: 0; padding: 12px 12px; font-weight: 500; color: var(--muted); border-bottom: 3px solid transparent; font-size: 14.5px; }
.tabs button.active { color: var(--accent); border-color: var(--accent); }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; }
.media-grid > * { aspect-ratio: 1; overflow: hidden; background: var(--bg-3); cursor: pointer; position: relative; }
.media-grid img, .media-grid video { width: 100%; height: 100%; object-fit: cover; }
.media-grid .play-badge { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; }
.member { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; cursor: pointer; }
.member:hover { background: var(--hover); }
.member .grow { flex: 1; min-width: 0; }
.member .grow b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.role-tag { font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); font-size: 14px; }
.switch { position: relative; width: 36px; height: 16px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--bg-3); border-radius: 8px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 20px; height: 20px; left: -2px; top: -2px; background: var(--bg); border: 2px solid var(--muted); border-radius: 50%; transition: .2s; box-sizing: border-box; }
.switch input:checked + span { background: color-mix(in srgb, var(--accent) 45%, var(--bg)); }
.switch input:checked + span::before { transform: translateX(20px); border-color: var(--accent); background: var(--accent); }

/* ---------- Меню, модалки, тосты ---------- */
.pop { position: fixed; z-index: 60; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(12px); border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.2); padding: 6px 0; min-width: 220px; animation: pop .15s ease-out; }
@keyframes pop { from { opacity: 0; transform: scale(.95); } }
.pop button { display: flex; align-items: center; gap: 18px; width: calc(100% - 8px); margin: 0 4px; text-align: left; padding: 8px 14px; border-radius: 8px; font-size: 14.5px; font-weight: 500; }
.pop button:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.pop button svg { width: 20px; height: 20px; color: var(--muted); }
.pop .danger, .pop .danger svg { color: var(--danger); }
.pop .quick { display: flex; gap: 2px; padding: 0 6px 6px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.pop .quick button { width: 38px; height: 38px; padding: 0; margin: 0; justify-content: center; font-size: 22px; border-radius: 50%; transition: transform .12s; }
.pop .quick button:hover { transform: scale(1.2); background: none; }

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal-card { width: 100%; max-width: 440px; max-height: 88vh; overflow-y: auto; background: var(--bg); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); animation: modalIn .18s ease-out; }
@keyframes modalIn { from { opacity: 0; transform: scale(.96); } }
.modal-card h2 { font-size: 20px; font-weight: 500; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.modal-card h2 > .icon-btn:last-child { margin-left: auto; }
.modal-card h2 > svg { color: var(--accent); }
.modal-card .form { gap: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 16px; }
.modal-actions .btn:not(.ghost):not(.danger) { background: transparent; color: var(--accent); }
.modal-actions .btn:not(.ghost):not(.danger):hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.pick { display: flex; align-items: center; gap: 12px; padding: 7px 8px; border-radius: 10px; cursor: pointer; }
.pick:hover { background: var(--hover); }
.pick .grow { flex: 1; min-width: 0; }
.pick .grow b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.pick input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
.pick-list { max-height: 340px; overflow-y: auto; margin: 6px -8px 0; padding: 0 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); border-radius: 14px; padding: 4px 12px; font-size: 14px; }
.avatar-edit { position: relative; width: 120px; margin: 0 auto 10px; cursor: pointer; }
.avatar-edit .cam { position: absolute; inset: 0; border-radius: 50%; background: rgba(0,0,0,.35); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .15s; }
.avatar-edit:hover .cam { opacity: 1; }
.avatar-edit .cam svg { width: 34px; height: 34px; }
.settings-sec { border-top: 8px solid var(--bg-2); padding-top: 14px; margin: 16px -20px 0; padding-left: 20px; padding-right: 20px; }
.settings-sec h3 { font-size: 15px; font-weight: 500; color: var(--accent); margin-bottom: 8px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; }
.set-row > span:first-child { flex-shrink: 0; }
.swatches { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--bg); box-shadow: 0 0 0 2px transparent; }
.swatch.active { box-shadow: 0 0 0 2px var(--text); }
.upload-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; margin-bottom: 12px; }
.upload-list .up { aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--bg-2); display: grid; place-items: center; text-align: center; font-size: 12px; padding: 6px; overflow-wrap: anywhere; }
.upload-list .up img, .upload-list .up video { width: 100%; height: 100%; object-fit: cover; }
.progress { height: 4px; background: var(--bg-3); border-radius: 2px; overflow: hidden; margin-top: 10px; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

.toast-wrap { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: rgba(0, 0, 0, .78); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14.5px; animation: fade .2s; }

.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .9); z-index: 70; display: flex; flex-direction: column; animation: fade .15s; }
.lightbox .lb-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; color: #fff; }
.lightbox .lb-top .grow { flex: 1; min-width: 0; }
.lightbox .lb-top .icon-btn { color: #fff; }
.lightbox .lb-top .icon-btn:hover { background: rgba(255,255,255,.12); }
.lightbox .lb-body { flex: 1; display: grid; place-items: center; min-height: 0; padding: 0 16px 16px; }
.lightbox img, .lightbox video { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---------- Звонки ---------- */
.call { position: fixed; inset: 0; z-index: 80; color: #fff; display: flex; flex-direction: column; align-items: center; background: linear-gradient(180deg, #2b5f9e, #203e66 60%, #172c47); }
.call video.remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; }
.call video.local { position: absolute; right: 20px; top: 20px; width: 180px; max-width: 32vw; aspect-ratio: 3/4; object-fit: cover; border-radius: 14px; box-shadow: var(--shadow); z-index: 2; transform: scaleX(-1); background: #111; }
.call .call-info { position: relative; z-index: 2; margin-top: 14vh; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; text-shadow: 0 1px 6px rgba(0,0,0,.4); }
.call .call-info .avatar { width: 150px; height: 150px; font-size: 54px; }
.call .call-info .avatar.pulse { animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.35); } 100% { box-shadow: 0 0 0 40px rgba(255,255,255,0); } }
.call .call-info h2 { font-size: 28px; font-weight: 500; }
.call .call-info .cs { opacity: .8; }
.call.has-video .call-info { margin-top: 24px; }
.call.has-video .call-info .avatar { display: none; }
.call .call-controls { position: absolute; bottom: 52px; left: 0; right: 0; display: flex; justify-content: center; gap: 22px; z-index: 2; flex-wrap: wrap; }
.call .cbtn { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; }
.call .cbtn i { width: 62px; height: 62px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; transition: background .15s; }
.call .cbtn:hover i { background: rgba(255,255,255,.28); }
.call .cbtn.off i { background: #fff; color: #203e66; }
.call .cbtn.red i { background: #ff4d4d; }
.call .cbtn.green i { background: #3ec44a; }
.call .cbtn svg { width: 28px; height: 28px; }

/* ---------- Админ-панель ---------- */
.modal-card.wide { max-width: 840px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.stat { background: var(--bg-2); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.stat span { color: var(--muted); font-size: 13.5px; }
.stat b { font-size: 30px; font-weight: 500; color: var(--accent); }
.stat small { color: var(--muted); font-size: 12.5px; }
.adm-list { margin-top: 10px; max-height: 56vh; overflow-y: auto; }
.adm-row { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; cursor: pointer; }
.adm-row:hover { background: var(--hover); }
.adm-row .grow { flex: 1; min-width: 0; }
.adm-row .grow b { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 500; }
.adm-row .grow b svg { width: 16px; height: 16px; color: var(--muted); }
.adm-row .muted { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-row.banned { opacity: .55; }
.tag { font-size: 11.5px; font-weight: 500; padding: 1px 7px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent); }
.tag.red { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
#admTabs { overflow-x: auto; }
#admTabs button { white-space: nowrap; }


/* ---------- Опросы ---------- */
.bubble.poll-bubble { min-width: min(320px, 75vw); }
.poll { padding: 2px 0 4px; }
.poll-q { font-weight: 500; font-size: 15.5px; margin-bottom: 2px; }
.poll-kind { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.row.out .poll-kind, .row.out .poll-foot { color: var(--out-meta); }
.poll-opt { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 7px 4px; border-radius: 8px; }
.poll-opt:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.po-mark { width: 20px; height: 20px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--muted) 70%, transparent); flex-shrink: 0; }
.po-mark.sq { border-radius: 6px; }
.poll-opt.selected .po-mark { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--bubble-in); }
.row.out .poll-opt.selected .po-mark { box-shadow: inset 0 0 0 3px var(--bubble-out); }
.poll-res { padding: 5px 0; }
.pr-top { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.pr-top b { min-width: 38px; font-weight: 500; }
.pr-top span { flex: 1; }
.pr-top svg { width: 18px; height: 18px; color: var(--accent); }
.pr-bar { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--accent) 12%, transparent); margin: 4px 0 0 46px; overflow: hidden; }
.pr-bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width .4s; }
.row.out .pr-bar i, .row.out .pr-top svg { background: var(--out-meta); color: var(--out-meta); }
.row.out .pr-top svg { background: none; }
.poll-res.mine .pr-top span { font-weight: 500; }
.poll-submit { margin-top: 6px; }
.poll-foot { font-size: 13px; color: var(--muted); margin-top: 6px; }
.poll-foot a { color: var(--accent); text-decoration: none; }

/* ---------- Кружочки ---------- */
.round { width: 240px; height: 240px; border-radius: 50%; overflow: hidden; position: relative; cursor: pointer; background: #000; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.round video { width: 100%; height: 100%; object-fit: cover; }
.round-dur { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: rgba(0,0,0,.45); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 10px; }
.round-sound { position: absolute; right: 18%; bottom: 10px; background: rgba(0,0,0,.45); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.round-sound svg { width: 13px; height: 13px; }
.round.playing .round-sound { display: none; }
.round.playing { box-shadow: 0 0 0 3px var(--accent); }
.round-rec { position: fixed; inset: 0; z-index: 85; background: rgba(0,0,0,.75); backdrop-filter: blur(6px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; color: #fff; }
.rr-circle { position: relative; width: min(320px, 80vw); aspect-ratio: 1; }
.rr-circle video { position: absolute; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); border-radius: 50%; object-fit: cover; transform: scaleX(-1); background: #111; }
.rr-ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.rr-ring circle { fill: none; stroke: var(--accent); stroke-width: 3; stroke-dasharray: 301.6; stroke-dashoffset: 301.6; stroke-linecap: round; transition: stroke-dashoffset .1s linear; }
.rr-time { display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.rr-time .rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff4d4d; animation: blink 1s infinite; }
.rr-actions { display: flex; gap: 40px; }
.round-rec .cbtn, .gcall .cbtn { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; color: #fff; }
.round-rec .cbtn i, .gcall .cbtn i { width: 62px; height: 62px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; }
.round-rec .cbtn.red i, .gcall .cbtn.red i { background: #ff4d4d; }
.round-rec .cbtn.green i { background: var(--accent); }
.gcall .cbtn.off i { background: #fff; color: #203e66; }
.round-rec .cbtn svg, .gcall .cbtn svg { width: 26px; height: 26px; }

/* ---------- Стикеры и GIF ---------- */
.sticker { width: 180px; height: 180px; display: grid; place-items: center; }
.sticker img, .sticker video { max-width: 100%; max-height: 100%; object-fit: contain; }
.media.gif { position: relative; cursor: default; }
.media.gif video, .media.gif img { width: 100%; }
.gif-badge { position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.45); color: #fff; font-size: 11px; font-weight: 500; padding: 1px 6px; border-radius: 6px; }
.mp-tabs { display: flex; gap: 2px; padding: 6px 6px 0; }
.mp-tabs button { flex: 1; padding: 7px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--muted); }
.mp-tabs button.active { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.sticker-grid { flex: 1; overflow-y: auto; padding: 4px 8px 8px; }
.sg-title { font-size: 13px; font-weight: 500; color: var(--muted); padding: 8px 2px 4px; }
.sg-items { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.sg-items.gif { grid-template-columns: repeat(2, 1fr); }
.sg-items button { aspect-ratio: 1; border-radius: 10px; padding: 4px; display: grid; place-items: center; overflow: hidden; }
.sg-items.gif button { aspect-ratio: 16/10; padding: 0; }
.sg-items button:hover { background: var(--bg-2); }
.sg-items img, .sg-items video { max-width: 100%; max-height: 100%; object-fit: contain; }
.sg-items.gif img, .sg-items.gif video { width: 100%; height: 100%; object-fit: cover; }
.sg-items.admin { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); margin-top: 6px; }
.sg-admin { position: relative; aspect-ratio: 1; background: var(--bg-2); border-radius: 10px; display: grid; place-items: center; overflow: hidden; }
.sg-admin img, .sg-admin video { max-width: 90%; max-height: 90%; object-fit: contain; }
.sg-del { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: grid; place-items: center; }
.sg-del svg { width: 13px; height: 13px; }

/* ---------- Каналы: просмотры и комментарии ---------- */
.views { display: inline-flex; align-items: center; gap: 2px; margin-right: 6px; }
.views svg { width: 15px !important; height: 15px !important; }
.silent-ico { width: 13px !important; height: 13px !important; margin-right: 2px; }
.comments-btn { display: flex; align-items: center; gap: 10px; width: calc(100% + 21px); margin: 8px -10px -6px -11px; padding: 9px 12px; border-top: 1px solid color-mix(in srgb, var(--muted) 20%, transparent); color: var(--accent); font-size: 14.5px; font-weight: 500; clear: both; border-radius: 0 0 var(--radius) var(--radius); }
.comments-btn:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.comments-btn span { flex: 1; text-align: left; }
.comments-btn svg { width: 20px; height: 20px; }
.row.last.in .comments-btn { border-bottom-left-radius: 0; }
svg.rot { transform: rotate(180deg); width: 18px; height: 18px; }
.comments-panel { position: absolute; inset: 0; z-index: 15; display: flex; flex-direction: column; background: var(--chat-grad); }
.comments-panel::before { content: ''; position: absolute; inset: 0; background-image: var(--pattern); background-size: 180px 180px; pointer-events: none; }
.comments-panel > * { position: relative; }
.cm-post { padding-bottom: 6px; }

/* ---------- Групповые звонки ---------- */
.gcall-bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 20px; background: var(--bg); border-bottom: 1px solid var(--border); z-index: 2; }
.gcall-bar .grow { flex: 1; display: flex; flex-direction: column; }
.gcall-bar b { font-weight: 500; color: var(--accent); }
.gcall-bar span { font-size: 13px; color: var(--muted); }
.gcall-bar .btn { padding: 8px 14px; font-size: 13px; }
.gc-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--online); animation: blink 1.4s infinite; }
.gcall { position: fixed; inset: 0; z-index: 80; background: #0f1722; color: #fff; display: flex; flex-direction: column; }
.gc-head { padding: 14px 20px; }
.gc-head b { font-size: 18px; font-weight: 500; }
.gc-sub { font-size: 13.5px; opacity: .7; }
.gc-grid { flex: 1; min-height: 0; display: grid; gap: 8px; padding: 0 12px; grid-template-columns: repeat(auto-fit, minmax(min(280px, 45vw), 1fr)); grid-auto-rows: minmax(140px, 1fr); overflow-y: auto; }
.gc-grid[data-count="1"] { grid-template-columns: 1fr; }
.gc-grid[data-count="2"] { grid-template-columns: repeat(auto-fit, minmax(min(360px, 90vw), 1fr)); }
.gc-tile { position: relative; background: #1c2a3a; border-radius: 14px; overflow: hidden; display: grid; place-items: center; }
.gc-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.gc-tile[data-tile="me"] video { transform: scaleX(-1); }
.gc-tile.has-video video { opacity: 1; }
.gc-tile.has-video .gc-ava { display: none; }
.gc-ava .avatar.lg { width: 96px; height: 96px; font-size: 36px; }
.gc-tile.connecting .gc-ava { opacity: .5; }
.gc-name { position: absolute; left: 10px; bottom: 8px; background: rgba(0,0,0,.45); padding: 3px 10px; border-radius: 10px; font-size: 13.5px; display: flex; gap: 6px; align-items: center; }
.gc-mic svg { width: 15px; height: 15px; color: #ff6b6b; }
.gc-controls { display: flex; justify-content: center; gap: 22px; padding: 18px 12px calc(22px + env(safe-area-inset-bottom)); }

/* ---------- Разное ---------- */
.qr-box { display: grid; place-items: center; padding: 8px 0; }
.qr-box canvas { width: min(280px, 70vw); height: auto; border-radius: 12px; image-rendering: pixelated; }
.qr-link { text-align: center; color: var(--accent); word-break: break-all; font-size: 14px; }
.sched-item { display: flex; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.sched-item .grow { flex: 1; min-width: 0; }
.sched-item .muted svg { width: 14px; height: 14px; vertical-align: -2px; }
.sched-text { white-space: pre-wrap; overflow: hidden; text-overflow: ellipsis; max-height: 60px; }
.report { border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.rp-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.rp-body { display: flex; gap: 10px; }
.rp-body .grow { flex: 1; min-width: 0; }
.rp-text { background: var(--bg-2); border-radius: 10px; padding: 8px 10px; margin: 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.rp-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.rp-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
.rp-actions .btn { padding: 9px 12px; font-size: 13px; }
.radio-list input { width: 18px; height: 18px; accent-color: var(--accent); }
select.field.sel { width: auto; min-width: 150px; padding: 9px 12px; }
.pin-ico { color: var(--muted); display: flex; }
.pin-ico svg { width: 17px; height: 17px; transform: rotate(45deg); }
.chat-item.active .pin-ico { color: #fff; }
.set-row small { font-size: 12.5px; }

/* ---------- Адаптив ---------- */
@media (max-width: 1180px) {
  .info { position: fixed; right: 0; top: 0; bottom: 0; z-index: 40; box-shadow: var(--shadow); }
}
@media (max-width: 800px) {
  .sidebar { width: 100%; min-width: 0; border-right: 0; }
  .chat { position: fixed; inset: 0; z-index: 20; transform: translateX(100%); transition: transform .25s ease; }
  .app.chat-open .chat { transform: none; }
  .chat-head { padding: 4px 6px 4px 2px; }
  .chat-head .back { display: grid; }
  .messages { padding: 8px 10px 4px; }
  .unread-sep { margin: 8px -10px; }
  .composer-wrap { padding: 4px 8px calc(8px + env(safe-area-inset-bottom)); }
  .composer { gap: 6px; }
  .input-box { min-height: 48px; padding: 2px; }
  .input-box .icon-btn { width: 42px; height: 42px; }
  .composer textarea { padding: 11px 2px; }
  .send { width: 48px; height: 48px; }
  .compose-extra { margin-right: 54px; }
  .bubble { max-width: 85%; }
  .info { width: 100%; }
  .emoji-panel { left: 8px; right: 8px; width: auto; }
  .head-actions .hide-m { display: none; }
  .call video.local { width: 110px; top: 12px; right: 12px; }
  .round { width: 200px; height: 200px; }
  .gc-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .gc-grid[data-count="1"], .gc-grid[data-count="2"] { grid-template-columns: 1fr !important; }
  .fab { bottom: calc(20px + env(safe-area-inset-bottom)); }
  .modal { align-items: end; padding: 0; }
  .modal-card { border-radius: 16px 16px 0 0; max-height: 92vh; padding-bottom: calc(20px + env(safe-area-inset-bottom)); animation: sheetIn .25s ease-out; }
  @keyframes sheetIn { from { transform: translateY(100%); } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
