:root {
  --honey: #FFC531;
  --honey-2: #FFB300;
  --honey-soft: #FFF4D1;
  --ink: #141210;
  --bg: #F6F4EF;
  --panel: #FFFFFF;
  --panel-2: #FAF8F3;
  --line: #ECE7DC;
  --text: #1B1916;
  --muted: #8A847A;
  --bubble-in: #FFFFFF;
  --bubble-out: #FFC531;
  --bubble-out-text: #141210;
  --hover: #F3EFE6;
  --active: #FFF1C2;
  --danger: #E5484D;
  --online: #21B573;
  --shadow: 0 1px 2px rgba(20, 18, 16, .06), 0 8px 24px rgba(20, 18, 16, .06);
  --radius: 16px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0F0E0C;
  --panel: #181614;
  --panel-2: #1E1C19;
  --line: #2A2723;
  --text: #F3EFE7;
  --muted: #8F887D;
  --bubble-in: #24211E;
  --hover: #221F1C;
  --active: #2E2817;
  --honey-soft: #2E2817;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input, textarea { font: inherit; color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 26px; letter-spacing: .04em; }
.brand img { width: 38px; height: 38px; }
.brand.small { font-size: 18px; min-width: 0; letter-spacing: .01em; }
.brand.small span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-head { gap: 10px; }
.brand.small img { width: 30px; height: 30px; }

.btn { height: 48px; padding: 0 22px; border-radius: 12px; font-weight: 700; transition: transform .1s, background .2s, opacity .2s; }
.btn.primary { background: var(--honey); color: var(--ink); width: 100%; }
.btn.primary:hover { background: var(--honey-2); }
.btn.primary:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: var(--hover); }
.btn.danger { background: transparent; color: var(--danger); }
.link { color: var(--muted); font-weight: 600; font-size: 14px; margin-top: 14px; }
.link:not(:disabled):hover { color: var(--text); }
.link:disabled { cursor: default; opacity: .7; }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; height: 50px; padding: 0 16px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--panel-2); outline: none; font-size: 16px; transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--honey); box-shadow: 0 0 0 4px rgba(255, 197, 49, .2); }

/* ===== Вход ===== */
.auth { display: grid; grid-template-columns: minmax(380px, 520px) 1fr; min-height: 100vh; }
.auth-panel { display: flex; flex-direction: column; padding: 36px 48px; background: var(--panel); }
.auth-card { margin: auto 0; width: 100%; max-width: 400px; padding: 24px 0; }
.auth-card h1 { font-size: 28px; line-height: 1.15; margin: 22px 0 8px; letter-spacing: -.02em; }
.auth-card p.muted { margin: 0 0 24px; line-height: 1.5; }
.foot { font-size: 12px; margin: 0; line-height: 1.7; }
.foot a { color: inherit; }
.foot a:hover { color: var(--text); }
.check-line { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; font-size: 13px; line-height: 1.45; color: var(--muted); cursor: pointer; }
.check-line input { appearance: none; flex-shrink: 0; width: 20px; height: 20px; margin: 0; border-radius: 6px; border: 1.5px solid var(--line); background: var(--panel-2); cursor: pointer; display: grid; place-items: center; transition: all .12s; }
.check-line input:checked { background: var(--honey); border-color: var(--honey); }
.check-line input:checked::after { content: ""; width: 10px; height: 6px; border: 2.5px solid var(--ink); border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.check-line input:focus-visible { box-shadow: 0 0 0 4px rgba(255, 197, 49, .25); }
.check-line a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--honey); }
#step-target .btn.primary { margin-top: 6px; }
.legal-links { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: center; font-size: 12px; margin-top: 16px; }
.legal-links a { color: var(--muted); }
.tabs { display: inline-flex; background: var(--hover); border-radius: 12px; padding: 4px; }
.tab { padding: 9px 16px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); transition: all .15s; }
.tab.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.back { color: var(--muted); font-weight: 600; font-size: 14px; margin-top: 20px; }
.back:hover { color: var(--text); }
.step { animation: rise .25s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.code-boxes { display: flex; gap: 8px; margin-bottom: 16px; }
.code-boxes input {
  width: 54px; height: 64px; text-align: center; font-size: 30px; font-weight: 800; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--panel-2); outline: none;
}
.code-boxes input:focus { border-color: var(--honey); box-shadow: 0 0 0 4px rgba(255, 197, 49, .2); }
.code-boxes.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.dev-hint { background: var(--honey-soft); border: 1px dashed var(--honey-2); padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.dev-hint b { letter-spacing: .2em; }
.error { margin-top: 14px; color: var(--danger); font-weight: 600; font-size: 14px; }

.demo-users { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.demo-user { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1.5px solid var(--line); border-radius: 12px; text-align: left; transition: all .15s; }
.demo-user:hover { border-color: var(--honey); background: var(--honey-soft); }
.demo-user b { display: block; font-size: 13px; }
.demo-user small { color: var(--muted); font-size: 12px; }

.auth-art { position: relative; overflow: hidden; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; }
.hexes {
  position: absolute; inset: -20%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='98' viewBox='0 0 56 98'%3E%3Cpath d='M28 66 0 50V17L28 1l28 16v33zm0 32L0 82' fill='none' stroke='%23FFC531' stroke-opacity='.14' stroke-width='1.5'/%3E%3C/svg%3E");
  transform: rotate(-8deg);
  mask-image: radial-gradient(circle at 70% 40%, #000 0%, transparent 70%);
}
.art-copy { position: relative; max-width: 460px; padding: 40px; }
.art-copy h2 { font-size: 52px; line-height: 1.02; letter-spacing: -.03em; margin: 0 0 18px; }
.art-copy p { color: #B9B2A6; font-size: 18px; line-height: 1.5; margin: 0 0 36px; }
.bubbles { display: flex; flex-direction: column; gap: 10px; }
.bubbles .b { padding: 12px 16px; border-radius: 18px; max-width: 70%; font-weight: 600; animation: rise .5s ease both; }
.bubbles .b.in { background: #24211E; border-bottom-left-radius: 6px; }
.bubbles .b.out { background: var(--honey); color: var(--ink); align-self: flex-end; border-bottom-right-radius: 6px; animation-delay: .25s; }
.bubbles .b:nth-child(3) { animation-delay: .5s; }

/* ===== Приложение ===== */
.app { display: grid; grid-template-columns: 340px 1fr; height: 100vh; height: 100dvh; }
.sidebar { display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); min-height: 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 12px; }
.side-actions { display: flex; gap: 6px; }
.icon-btn { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--muted); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.accent { background: var(--honey); color: var(--ink); }
.icon-btn.accent:hover { background: var(--honey-2); color: var(--ink); }

.search { margin: 0 14px 10px; position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.search input { width: 100%; height: 42px; border-radius: 12px; border: 0; background: var(--hover); padding: 0 14px 0 38px; outline: none; }
.search input:focus { box-shadow: 0 0 0 2px var(--honey); }

.chat-list { flex: 1; overflow-y: auto; padding: 4px 8px; }
.list-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 10px 6px; }
.chat-item { width: 100%; display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; text-align: left; transition: background .12s; }
.chat-item:hover { background: var(--hover); }
.chat-item.active { background: var(--active); }
.chat-item .meta { flex: 1; min-width: 0; }
.chat-item .row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.chat-item .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .time { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.chat-item .preview { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .preview.typing { color: var(--honey-2); font-weight: 600; }
.badge { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--honey); color: var(--ink); font-size: 12px; font-weight: 800; display: grid; place-items: center; flex-shrink: 0; }
.list-empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 14px; }

.avatar {
  position: relative; flex-shrink: 0; width: 46px; height: 46px; border-radius: 15px;
  display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 16px; letter-spacing: .02em;
}
.avatar.sm { width: 34px; height: 34px; border-radius: 11px; font-size: 13px; }
.avatar.lg { width: 72px; height: 72px; border-radius: 22px; font-size: 26px; }
.avatar.group { background: var(--ink) !important; color: var(--honey); }
:root[data-theme="dark"] .avatar.group { background: #2A2620 !important; }
.avatar.group svg { width: 22px; height: 22px; }
.avatar .dot { position: absolute; right: -2px; bottom: -2px; width: 14px; height: 14px; border-radius: 50%; background: var(--online); border: 3px solid var(--panel); }

.me-card { display: flex; gap: 12px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); text-align: left; }
.me-card:hover { background: var(--hover); }
.me-card b { display: block; }
.me-card small { color: var(--muted); }

/* Чат */
.chat { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.chat::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='98' viewBox='0 0 56 98'%3E%3Cpath d='M28 66 0 50V17L28 1l28 16v33zm0 32L0 82' fill='none' stroke='%23C9A23A' stroke-opacity='.12' stroke-width='1'/%3E%3C/svg%3E");
}
.empty { margin: auto; text-align: center; position: relative; }
.empty img { width: 80px; height: 80px; margin-bottom: 10px; }
.empty h3 { margin: 0 0 6px; font-size: 22px; }
.empty p { margin: 0 0 20px; }
.empty .btn { width: auto; }
.chat-view { position: relative; display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head { position: relative; z-index: 4; display: flex; align-items: center; gap: 6px; padding: 12px 18px; background: color-mix(in srgb, var(--panel) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.back-btn { display: none; }
.chat-title { display: flex; align-items: center; gap: 12px; text-align: left; padding: 4px 8px 4px 4px; border-radius: 12px; min-width: 0; }
.chat-title:hover { background: var(--hover); }
.chat-title b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-title small { color: var(--muted); font-size: 13px; }
.chat-title small.online { color: var(--online); }
.chat-title small.typing { color: var(--honey-2); font-weight: 600; }

.messages { flex: 1; overflow-y: auto; padding: 18px 6% 10px; display: flex; flex-direction: column; gap: 2px; }
.day { align-self: center; margin: 14px 0 10px; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--panel); padding: 5px 12px; border-radius: 20px; box-shadow: var(--shadow); }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: min(640px, 78%); }
.msg.first { margin-top: 8px; }
.msg .avatar { visibility: hidden; }
.msg.last .avatar { visibility: visible; }
.msg.out { align-self: flex-end; flex-direction: row-reverse; }
.bubble {
  position: relative; padding: 8px 12px 6px; border-radius: 18px; background: var(--bubble-in); box-shadow: 0 1px 1px rgba(20, 18, 16, .06);
  line-height: 1.42; white-space: pre-wrap; overflow-wrap: anywhere; animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.msg.in.last .bubble { border-bottom-left-radius: 6px; }
.msg.out .bubble { background: var(--bubble-out); color: var(--bubble-out-text); }
.msg.out.last .bubble { border-bottom-right-radius: 6px; }
.bubble .author { display: block; font-size: 13px; font-weight: 800; margin-bottom: 2px; }
.bubble .stamp { float: right; margin: 6px 0 -2px 10px; font-size: 11px; opacity: .55; display: inline-flex; gap: 3px; align-items: center; user-select: none; }
.bubble .stamp svg { width: 15px; height: 15px; stroke-width: 2.2; }
.bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.msg.in .bubble a { color: #C48A00; }
.no-msgs { margin: auto; text-align: center; color: var(--muted); }
.no-msgs .wave { font-size: 44px; display: block; margin-bottom: 8px; }

.composer { position: relative; display: flex; align-items: flex-end; gap: 10px; margin: 8px 6% 18px; padding: 8px 8px 8px 18px; background: var(--panel); border-radius: 20px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.composer:focus-within { border-color: var(--honey); }
.composer textarea { flex: 1; border: 0; outline: none; background: transparent; resize: none; max-height: 180px; padding: 9px 0; line-height: 1.4; }
.send { width: 42px; height: 42px; border-radius: 14px; background: var(--honey); color: var(--ink); display: grid; place-items: center; transition: transform .1s, opacity .15s; flex-shrink: 0; }
.send:active { transform: scale(.92); }
.send svg { width: 19px; height: 19px; fill: currentColor; }

/* Модалки */
.modal { border: 0; padding: 0; border-radius: 22px; background: var(--panel); color: var(--text); width: min(440px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.modal::backdrop { background: rgba(15, 14, 12, .45); backdrop-filter: blur(3px); }
.modal[open] { animation: rise .2s ease; }
.m-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 6px; }
.m-head h3 { margin: 0; font-size: 20px; }
.m-body { padding: 10px 22px 22px; }
.m-body .search { margin: 0 0 10px; }
.people { max-height: 340px; overflow-y: auto; margin: 0 -10px 14px; }
.person { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 12px; text-align: left; }
.person:hover { background: var(--hover); }
.person .meta { flex: 1; min-width: 0; }
.person b { display: block; font-size: 15px; }
.person small { color: var(--muted); }
.check { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--line); display: grid; place-items: center; transition: all .12s; }
.check svg { width: 14px; height: 14px; stroke-width: 3; opacity: 0; color: var(--ink); }
.person.on .check { background: var(--honey); border-color: var(--honey); }
.person.on .check svg { opacity: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { background: var(--honey-soft); padding: 5px 10px; border-radius: 20px; font-size: 13px; font-weight: 600; }
.profile-top { text-align: center; margin-bottom: 18px; }
.profile-top .avatar { margin: 0 auto 10px; }
.profile-top h4 { margin: 0; font-size: 20px; }
.profile-top p { margin: 4px 0 0; }
.row-btns { display: flex; gap: 10px; margin-top: 6px; }
.row-btns .btn { flex: 1; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); z-index: 10; animation: rise .2s ease; }

.invite-banner { display: flex; gap: 12px; align-items: center; background: var(--honey-soft); border: 1px solid var(--honey); border-radius: 14px; padding: 12px 14px; margin-bottom: 18px; font-size: 14px; line-height: 1.4; }
.invite-banner.bad { background: transparent; border-color: var(--danger); color: var(--danger); }
.invite-banner .ic { font-size: 22px; }

/* Шапка чата: звонки */
.head-actions { margin-left: auto; display: flex; gap: 4px; }
.call-banner { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 18px; background: var(--honey-soft); border-bottom: 1px solid var(--line); font-weight: 600; font-size: 14px; }
.call-banner .pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--online); box-shadow: 0 0 0 0 rgba(33, 181, 115, .6); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(33, 181, 115, 0); } 100% { box-shadow: 0 0 0 0 rgba(33, 181, 115, 0); } }
.call-banner .btn { height: 34px; padding: 0 14px; margin-left: auto; width: auto; font-size: 14px; border-radius: 10px; }
.btn.green { background: var(--online); color: #fff; }

/* Вложения */
.composer .attach { width: 40px; height: 40px; margin-left: -10px; flex-shrink: 0; }
.attach-preview { position: relative; display: flex; gap: 8px; flex-wrap: wrap; margin: 0 6% -2px; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-bottom: 0; border-radius: 16px 16px 0 0; }
.att { position: relative; display: flex; align-items: center; gap: 8px; background: var(--hover); border-radius: 12px; padding: 6px 10px 6px 6px; max-width: 240px; font-size: 13px; }
.att img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; }
.att .fi { width: 44px; height: 44px; border-radius: 8px; background: var(--honey); color: var(--ink); display: grid; place-items: center; font-weight: 800; font-size: 11px; flex-shrink: 0; }
.att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .rm { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; }
.att .rm svg { width: 12px; height: 12px; stroke-width: 3; }
.att .bar { position: absolute; left: 6px; right: 6px; bottom: 3px; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
.att .bar i { display: block; height: 100%; background: var(--honey-2); width: 0; transition: width .15s; }
.drop-zone { position: absolute; inset: 10px; z-index: 5; border: 2.5px dashed var(--honey); border-radius: 20px; background: color-mix(in srgb, var(--bg) 85%, transparent); display: grid; place-items: center; font-weight: 800; font-size: 18px; pointer-events: none; }

.bubble.media { padding: 4px; overflow: hidden; }
.bubble.media .author { padding: 4px 8px 2px; }
.bubble.media .caption { padding: 6px 8px 2px; }
.bubble .img { display: block; max-width: 100%; width: 360px; max-height: 420px; border-radius: 14px; object-fit: cover; cursor: zoom-in; background: var(--hover); }
.bubble.media .stamp.over { position: absolute; right: 12px; bottom: 10px; float: none; margin: 0; background: rgba(0, 0, 0, .5); color: #fff; opacity: 1; padding: 2px 7px; border-radius: 10px; }
.bubble.media.has-caption .stamp.over { position: static; float: right; background: none; color: inherit; opacity: .55; padding: 0; margin: 6px 4px -2px 10px; }
.filecard { display: flex; align-items: center; gap: 10px; padding: 4px 2px; color: inherit; text-decoration: none; min-width: 200px; }
.filecard .fi { width: 42px; height: 42px; border-radius: 12px; background: var(--ink); color: var(--honey); display: grid; place-items: center; font-weight: 800; font-size: 11px; flex-shrink: 0; text-transform: uppercase; }
.msg.out .filecard .fi { background: rgba(20, 18, 16, .85); }
.filecard b { display: block; font-size: 14px; overflow-wrap: anywhere; }
.filecard small { opacity: .65; font-size: 12px; }
.bubble video { display: block; max-width: 100%; width: 360px; border-radius: 14px; }

/* Сообщение о звонке */
.callmsg { align-self: center; display: flex; align-items: center; gap: 10px; margin: 10px 0; padding: 8px 14px 8px 8px; background: var(--panel); border-radius: 16px; box-shadow: var(--shadow); font-size: 14px; }
.callmsg .ci { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--hover); }
.callmsg .ci svg { width: 17px; height: 17px; }
.callmsg.active .ci { background: var(--online); color: #fff; }
.callmsg.missed .ci { background: rgba(229, 72, 77, .12); color: var(--danger); }
.callmsg small { display: block; color: var(--muted); font-size: 12px; }
.callmsg .btn { height: 32px; padding: 0 12px; font-size: 13px; margin-left: 6px; border-radius: 10px; }

/* Окно звонка */
.call { position: fixed; inset: 0; z-index: 20; background: #0D0C0B; color: #fff; display: flex; flex-direction: column; animation: rise .2s ease; }
.call-top { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; }
.call-top b { display: block; font-size: 17px; }
.call-top small { color: #A39C90; font-size: 13px; }
.icon-btn.light { color: #ccc; }
.icon-btn.light:hover { background: #222; color: #fff; }
.call-grid { flex: 1; display: grid; gap: 10px; padding: 0 16px; min-height: 0; grid-template-columns: repeat(var(--cols, 1), 1fr); grid-auto-rows: 1fr; }
.tile { position: relative; background: #1B1917; border-radius: 20px; overflow: hidden; display: grid; place-items: center; min-height: 0; transition: box-shadow .2s; }
.tile.speaking { box-shadow: 0 0 0 3px var(--honey); }
.tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tile video.contain { object-fit: contain; background: #000; }
.tile.local video.mirror { transform: scaleX(-1); }
.tile .avatar { width: 96px; height: 96px; border-radius: 30px; font-size: 34px; }
.tile .label { position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 6px; background: rgba(0, 0, 0, .55); padding: 5px 10px; border-radius: 10px; font-size: 13px; font-weight: 600; backdrop-filter: blur(6px); }
.tile .label svg { width: 14px; height: 14px; color: #FF6B6B; }
.call-grid .waiting { grid-column: 1 / -1; align-self: center; text-align: center; color: #A39C90; }
.call-controls { display: flex; justify-content: center; gap: 14px; padding: 20px; }
.cbtn { width: 56px; height: 56px; border-radius: 50%; background: #2A2724; color: #fff; display: grid; place-items: center; transition: background .15s, transform .1s; }
.cbtn:hover { background: #3A3631; }
.cbtn:active { transform: scale(.94); }
.cbtn svg { width: 22px; height: 22px; }
.cbtn.off { background: #fff; color: #141210; }
.cbtn.on { background: var(--honey); color: var(--ink); }
.cbtn.hang { background: var(--danger); }
.cbtn.hang:hover { background: #C93338; }
.call-pill { position: fixed; z-index: 15; right: 20px; bottom: 96px; display: flex; align-items: center; gap: 10px; background: var(--online); color: #fff; padding: 12px 18px; border-radius: 30px; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.call-pill svg { width: 18px; height: 18px; }

/* Входящий звонок */
.incoming { position: fixed; z-index: 25; top: 20px; right: 20px; width: 320px; background: var(--ink); color: #fff; border-radius: 22px; padding: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .4); animation: rise .25s ease; }
.incoming .who { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.incoming .who .avatar { animation: ring 1.2s infinite; }
@keyframes ring { 0%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(-8deg); } 20%, 40% { transform: rotate(8deg); } 50% { transform: rotate(0); } }
.incoming b { display: block; font-size: 16px; }
.incoming small { color: #A39C90; }
.incoming .acts { display: flex; gap: 8px; }
.incoming .acts .btn { flex: 1; height: 44px; padding: 0 10px; font-size: 14px; }
.btn.red { background: var(--danger); color: #fff; }

/* Просмотр картинки */
.lightbox { position: fixed; inset: 0; z-index: 30; background: rgba(10, 9, 8, .92); display: grid; place-items: center; padding: 30px; cursor: zoom-out; animation: rise .15s ease; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); }
.lightbox .lb-bar { position: absolute; top: 16px; right: 16px; display: flex; gap: 8px; }
.lightbox .lb-bar a, .lightbox .lb-bar button { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); color: #fff; }

/* Администрирование */
.modal.wide { width: min(720px, calc(100vw - 32px)); }
.modal .tabs { margin: 0 22px; }
.admin-pane { padding: 16px 22px 22px; min-height: 380px; max-height: 70vh; overflow-y: auto; }
.mrow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.mrow:last-child { border-bottom: 0; }
.mrow .meta { flex: 1; min-width: 0; }
.mrow b { display: block; }
.mrow small { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.mrow.disabled { opacity: .5; }
.pill { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: 3px 8px; border-radius: 8px; background: var(--hover); color: var(--muted); }
.pill.owner { background: var(--honey); color: var(--ink); }
.pill.admin { background: var(--honey-soft); color: var(--text); }
.pill.off { background: rgba(229, 72, 77, .12); color: var(--danger); }
.sel { height: 34px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--panel-2); padding: 0 8px; font: inherit; font-size: 13px; color: var(--text); }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; width: auto; }
.inv-form { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: end; margin-bottom: 16px; }
.inv-form .field { margin: 0; }
.inv-form .field input, .inv-form .sel { height: 42px; }
.inv-url { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.switch { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1.5px solid var(--line); border-radius: 14px; margin-bottom: 14px; cursor: pointer; }
.switch input { appearance: none; flex-shrink: 0; width: 42px; height: 24px; border-radius: 12px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--honey); }
.switch input:checked::after { transform: translateX(18px); }
.switch b { display: block; margin-bottom: 2px; }
.switch small { color: var(--muted); line-height: 1.4; }
.note { font-size: 13px; color: var(--muted); line-height: 1.5; background: var(--panel-2); border-radius: 12px; padding: 10px 12px; margin: 0 0 14px; }
.section-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.danger-link { color: var(--danger); font-weight: 600; font-size: 14px; }

/* Удаление участников */
.person.clickable { cursor: pointer; }
.kick { flex-shrink: 0; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--muted); opacity: .6; transition: all .12s; }
.kick svg { width: 17px; height: 17px; }
.person:hover .kick { opacity: 1; }
.kick:hover { background: rgba(229, 72, 77, .12); color: var(--danger); }
.icon-btn.danger-icon:hover { background: rgba(229, 72, 77, .12); color: var(--danger); }

/* Фото профиля */
.avatar.photo { background-size: cover; background-position: center; background-color: var(--hover); }
.avatar-edit { position: relative; display: block; margin: 0 auto 8px; border-radius: 22px; }
.avatar-edit .avatar { margin: 0; }
.avatar-edit .cam { position: absolute; right: -6px; bottom: -6px; width: 30px; height: 30px; border-radius: 50%; background: var(--honey); color: var(--ink); display: grid; place-items: center; border: 3px solid var(--panel); transition: transform .15s; }
.avatar-edit .cam svg { width: 15px; height: 15px; }
.avatar-edit:hover .cam { transform: scale(1.1); }
.avatar-edit:hover .avatar { filter: brightness(.9); }

/* Значок шифрования */
.secure { position: relative; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; color: var(--online); cursor: help; flex-shrink: 0; vertical-align: middle; }
.secure svg { width: 16px; height: 16px; stroke-width: 2.2; }
.secure:hover, .secure:focus-visible { background: rgba(33, 181, 115, .12); outline: none; }
.secure .tip { position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: 280px; padding: 10px 12px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 500; line-height: 1.45; letter-spacing: 0; text-align: left; box-shadow: 0 12px 30px rgba(0, 0, 0, .3); opacity: 0; visibility: hidden; transition: opacity .15s; z-index: 20; pointer-events: none; white-space: normal; }
.secure:hover .tip, .secure:focus-visible .tip { opacity: 1; visibility: visible; }
.call-top .secure { color: #4ADE80; }
.call-top b { display: flex; align-items: center; gap: 6px; }

/* Мобильная версия */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-panel { padding: 24px 20px; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .app .chat { display: none; }
  .app.show-chat .sidebar { display: none; }
  .app.show-chat .chat { display: flex; }
  .back-btn { display: grid; }
  .messages { padding: 12px 12px 8px; }
  .composer { margin: 6px 10px 12px; }
  .msg { max-width: 88%; }
  .code-boxes input { width: calc((100vw - 40px - 40px) / 6); height: 58px; font-size: 24px; }
}
@media (max-width: 760px) {
  .secure .tip { left: auto; right: -40px; transform: none; width: 240px; }
  .attach-preview { margin: 0 10px -2px; }
  .incoming { left: 12px; right: 12px; width: auto; top: 12px; }
  .call-grid { padding: 0 8px; }
  .inv-form { grid-template-columns: 1fr 1fr; }
  .inv-form .field { grid-column: 1 / -1; }
  .call-pill { bottom: 88px; right: 12px; }
}
