/* weydix — стили. Все цвета берутся из токенов: светлая тема в :root, тёмная в [data-theme="dark"]. */
:root {
  --bg: #FFFFFF; --rail: #FAFAFB; --canvas: #FCFCFD; --card: #FFFFFF; --raised: #FFFFFF;
  --surface: #F3F3F5; --field: #FAFAFB; --sunken: #F6F6F8;
  --text: #0E0E10; --text2: #6B6B73; --text3: #3A3A40;
  --border: #EDEDF0; --field-border: #E3E3E8; --bubble: #EFEFF3;
  --chip-bg: #0E0E10; --chip-fg: #FFFFFF; --chip-border: #E6E6EA;
  --danger: #C2410C; --online: #15803D; --hover: #F3F3F5; --off: #C9C9CF;
  --shadow: 0 16px 40px rgba(14,14,16,.18), 0 0 0 1px rgba(14,14,16,.06);
  --accent: #4C3DF5; --accent-text: #4C3DF5; --accent-soft: #EAE8FE; --unread-bg: #F6F5FF;
  --msg-size: 15px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0E0E10; --rail: #0B0B0D; --canvas: #121215; --card: #18181C; --raised: #1C1C21;
  --surface: #1A1A1E; --field: #151518; --sunken: #0E0E10;
  --text: #F2F2F5; --text2: #9A9AA3; --text3: #C9C9CF;
  --border: #222227; --field-border: #2A2A30; --bubble: #1E1E22;
  --chip-bg: #F2F2F5; --chip-fg: #0E0E10; --chip-border: #2A2A30;
  --danger: #FF8A5C; --online: #4ADE80; --hover: #1A1A1E; --off: #3A3A40;
  --shadow: 0 16px 40px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.08);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: Manrope, system-ui, -apple-system, "Segoe UI", sans-serif; }
body { overflow: hidden; overscroll-behavior: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-text); }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot { height: 100dvh; display: flex; align-items: center; justify-content: center; color: var(--text2); font-weight: 600; }
.muted { color: var(--text2); }
.themed, .pane-list, .pane-main, .pane-info, .rail, .tabbar { transition: background-color .3s ease, border-color .3s ease, color .3s ease; }

/* ---------- Каркас ---------- */
.app { display: flex; height: 100dvh; overflow: hidden; }
.rail { flex: 0 0 76px; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 0; background: var(--rail); border-right: 1px solid var(--border); }
.logo { width: 44px; height: 44px; border-radius: 14px; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 16px; flex: none; }
.rail-btn { position: relative; width: 48px; height: 48px; border: 0; border-radius: 14px; background: transparent; color: var(--text2); display: flex; align-items: center; justify-content: center; }
.rail-btn:hover { background: var(--hover); }
.rail-btn[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.rail-spacer { flex: 1; }
.pane-list { flex: 0 0 360px; min-width: 0; display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--bg); }
.pane-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: var(--canvas); position: relative; }
.pane-info { flex: 0 0 320px; border-left: 1px solid var(--border); overflow-y: auto; padding: 32px 24px; display: flex; flex-direction: column; gap: 22px; background: var(--bg); }
.app.no-list .pane-list, .app.no-info .pane-info { display: none; }
.tabbar { display: none; }
.pane-scroll { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 22px 20px 12px; }
.pane-head h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.03em; }
@media (max-width: 1199px) { .pane-info { display: none; } }

@media (max-width: 899px) {
  /* Фиксируем оболочку к видимой области, чтобы при вводе и всплывающих уведомлениях
     страница не «съезжала»: прокручиваются только внутренние области (чаты, списки). */
  html, body { position: fixed; inset: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
  .rail { display: none; }
  .app { flex-direction: column; height: 100dvh; }
  .pane-list { flex: 1 1 auto; border-right: 0; min-height: 0; }
  .pane-main { flex: 1 1 auto; min-height: 0; background: var(--bg); }
  .app:not(.m-detail):not(.m-main) .pane-main { display: none; }
  .app.m-main .pane-list, .app.m-detail .pane-list, .app.m-detail .tabbar { display: none; }
  .app.no-list.m-main .pane-main { display: flex; }
  .tabbar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 8px 12px calc(10px + var(--safe-b)); border-top: 1px solid var(--border); background: var(--bg); flex: none; }
  .pane-head { padding-top: calc(22px + var(--safe-t)); }
  .pane-head h1 { font-size: 30px; }
}
.tab { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; border: 0; background: transparent; color: var(--text2); font-size: 11px; font-weight: 600; min-height: 48px; }
.tab[aria-current="page"] { color: var(--accent-text); font-weight: 700; }
.tab .badge { position: absolute; top: 0; left: 50%; margin-left: 6px; }

/* ---------- Общие элементы ---------- */
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--bg); }
.rail-btn .badge { position: absolute; top: 4px; right: 4px; border-color: var(--rail); }
.avatar { flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; position: relative; }
.avatar .dot { position: absolute; right: 0; bottom: 0; width: 28%; height: 28%; min-width: 11px; min-height: 11px; border-radius: 50%; background: #22C55E; border: 3px solid var(--bg); }
.icon-btn { width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: var(--text); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.icon-btn:hover { background: var(--hover); }
.icon-btn.filled { background: var(--surface); }
@media (max-width: 899px) { .icon-btn { width: 44px; height: 44px; } }
.btn { height: 44px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--field-border); background: transparent; color: var(--text); font-size: 15px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--hover); }
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--danger); }
.btn-sm { height: 36px; padding: 0 14px; border-radius: 12px; font-size: 13px; }
.btn-block { width: 100%; height: 52px; border-radius: 16px; }
.btn:disabled { opacity: .5; cursor: default; }
.link-btn { border: 0; background: transparent; color: var(--accent-text); font-weight: 700; font-size: 14px; padding: 8px 4px; }
.search { height: 42px; border-radius: 12px; background: var(--surface); display: flex; align-items: center; gap: 10px; padding: 0 12px; color: var(--text2); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 15px; color: var(--text); }
.search input::placeholder, .field input::placeholder, .field textarea::placeholder, .composer textarea::placeholder { color: var(--text2); }
.chip { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--chip-border); background: transparent; color: var(--text); font-size: 14px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--chip-bg); color: var(--chip-fg); border-color: transparent; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); font-size: 11px; font-weight: 800; vertical-align: 2px; margin-left: 6px; }
.tag.warn { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.tag.ok { background: color-mix(in srgb, var(--online) 16%, transparent); color: var(--online); }
.empty { padding: 40px 28px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty b { font-size: 17px; }
.empty p { margin: 0; color: var(--text2); font-size: 14px; line-height: 1.5; max-width: 340px; }
.section-label { padding: 14px 20px 6px; font-size: 13px; font-weight: 700; color: var(--text2); }

/* Поля ввода */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .field .label { font-size: 14px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; }
.field input, .field textarea, .field select { height: 48px; border-radius: 14px; border: 1px solid var(--field-border); background: var(--field); padding: 0 14px; font-size: 16px; color: var(--text); outline: none; width: 100%; }
.field textarea { height: auto; padding: 12px 14px; line-height: 1.4; resize: vertical; min-height: 48px; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent-text); }
.field .hint { font-size: 13px; color: var(--text2); line-height: 1.4; }
.field .hint.err { color: var(--danger); }
.field .hint.ok { color: var(--online); }
.prefix-input { display: flex; align-items: center; height: 48px; border-radius: 14px; border: 1px solid var(--field-border); background: var(--field); padding-left: 14px; }
.prefix-input span { color: var(--text2); font-weight: 600; }
.prefix-input input { border: 0 !important; background: transparent !important; height: 46px !important; padding-left: 2px !important; }
.form-error { color: var(--danger); font-size: 14px; font-weight: 600; }

/* Сегментированный выбор, цвета, переключатели */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; background: var(--surface); border-radius: 14px; padding: 4px; }
.segmented button { height: 40px; border: 0; border-radius: 10px; background: transparent; font-size: 14px; font-weight: 700; color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--bg); box-shadow: 0 1px 3px rgba(0,0,0,.18); }
.swatches { display: flex; gap: 12px; flex-wrap: wrap; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 0; padding: 0; background: transparent; display: flex; align-items: center; justify-content: center; }
.swatch span { width: 34px; height: 34px; border-radius: 50%; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--sw); }
.track { width: 50px; height: 30px; border-radius: 999px; background: var(--off); padding: 3px; flex: none; transition: background .2s ease; }
.knob { display: block; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .22s cubic-bezier(.3,.7,.3,1.2); }
[aria-pressed="true"] > .track { background: var(--accent); }
[aria-pressed="true"] > .track .knob { transform: translateX(20px); }

/* ---------- Списки ---------- */
.list { padding: 0 8px 8px; }
.row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-radius: 14px; background: transparent; text-align: left; color: var(--text); text-decoration: none; }
.row:hover { background: var(--hover); }
.row[aria-current="true"] { background: var(--accent-soft); }
.row[aria-current="true"] .avatar .dot { border-color: var(--accent-soft); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-top, .row-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row-title { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { font-size: 13px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub.accent { color: var(--accent-text); font-weight: 700; }
.row-time { font-size: 12px; color: var(--text2); font-weight: 600; flex: none; }
.row-time.accent { color: var(--accent-text); }
.ticks-sm { color: var(--accent-text); flex: none; }
@media (max-width: 899px) {
  .list { padding: 0 0 8px; }
  .row { border-radius: 0; padding: 10px 20px; }
  .row .avatar.md { width: 52px !important; height: 52px !important; font-size: 17px !important; }
  .row-title { font-size: 16px; }
  .row-sub { font-size: 14px; }
}
.online-strip { display: flex; gap: 16px; padding: 8px 20px 16px; overflow-x: auto; }
.online-strip button { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 60px; flex: none; border: 0; background: transparent; color: var(--text); font-size: 12px; font-weight: 600; }
.online-strip span.name { max-width: 60px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Переписка ---------- */
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg); flex: none; }
.chat-head .who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; border: 0; background: transparent; text-align: left; padding: 0; color: var(--text); }
.chat-head .name { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .status { font-size: 13px; font-weight: 600; color: var(--text2); }
.chat-head .status.online { color: var(--online); }
.chat-head .status.typing { color: var(--accent-text); font-weight: 700; }
@media (max-width: 899px) { .chat-head { padding: calc(10px + var(--safe-t)) 8px 10px; } }
.messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; padding: 20px 20px 8px; -webkit-overflow-scrolling: touch; }
.messages-inner { margin-top: auto; width: 100%; max-width: 780px; align-self: center; display: flex; flex-direction: column; gap: 6px; }
.day-sep { align-self: center; font-size: 12px; font-weight: 600; color: var(--text2); background: var(--surface); padding: 5px 12px; border-radius: 999px; margin: 8px 0; }
.bubble { max-width: min(78%, 560px); padding: 9px 14px 7px; display: flex; flex-direction: column; gap: 2px; }
.bubble .text { font-size: var(--msg-size); line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
.bubble .meta { align-self: flex-end; display: flex; align-items: center; gap: 3px; font-size: 11px; }
.bubble.out { align-self: flex-end; background: var(--accent); color: #fff; border-radius: 20px 20px 6px 20px; }
.bubble.out .meta { color: rgba(255,255,255,.85); }
.bubble.in { align-self: flex-start; background: var(--bubble); color: var(--text); border-radius: 20px 20px 20px 6px; }
.bubble.in .meta { color: var(--text2); }
.bubble.cmd .text { font-weight: 700; }
.chat-banner { margin: 0 auto 8px; max-width: 520px; text-align: center; font-size: 13px; color: var(--text2); background: var(--surface); border-radius: 14px; padding: 10px 14px; line-height: 1.45; }
.chat-banner.warn { color: var(--danger); }
.composer-wrap { padding: 8px 16px calc(14px + var(--safe-b)); background: transparent; flex: none; }
.composer-inner { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 4px; }
.composer { display: flex; align-items: flex-end; gap: 6px; background: var(--bg); border: 1px solid var(--field-border); border-radius: 24px; padding: 4px; }
.composer textarea { flex: 1; min-width: 0; border: 0; background: transparent; resize: none; outline: none; font-size: 16px; line-height: 1.4; padding: 10px 6px; max-height: 160px; color: var(--text); }
.send-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; transition: transform .15s ease; }
.send-btn:active { transform: scale(.92); }
.counter { text-align: right; font-size: 12px; font-weight: 600; color: var(--text2); padding-right: 12px; }
.counter.warn { color: var(--danger); }
.cmd-menu { position: absolute; left: 16px; right: 16px; bottom: 90px; max-width: 420px; background: var(--raised); border-radius: 18px; box-shadow: var(--shadow); padding: 6px; z-index: 5; }
.cmd-menu button { width: 100%; display: flex; gap: 10px; align-items: baseline; border: 0; background: transparent; padding: 10px 12px; border-radius: 12px; text-align: left; color: var(--text); }
.cmd-menu button:hover { background: var(--hover); }
.cmd-menu b { color: var(--accent-text); }
.typing-bubble { align-self: flex-start; background: var(--bubble); padding: 13px 16px; border-radius: 20px 20px 20px 6px; display: flex; gap: 5px; }
.typing-bubble span { width: 8px; height: 8px; border-radius: 50%; background: var(--text2); }
.welcome { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 40px; text-align: center; color: var(--text2); }
.welcome .logo { width: 64px; height: 64px; border-radius: 20px; margin: 0 0 8px; }
.welcome b { color: var(--text); font-size: 20px; }

/* Анимации */
@keyframes msgIn { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
.msg-in { animation: msgIn .32s cubic-bezier(.2,.8,.2,1) both; }
@keyframes draw { from { stroke-dashoffset: 24; } to { stroke-dashoffset: 0; } }
.tick-anim { stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw .35s ease-out forwards; }
@keyframes spin { to { transform: rotate(360deg); } }
.spin { transform-origin: 12px 12px; animation: spin 1.2s linear infinite; }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-4px); opacity: 1; } }
.dot-anim { display: inline-block; animation: dot 1.2s infinite ease-in-out; }
.d2 { animation-delay: .15s; } .d3 { animation-delay: .3s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.fade { animation: fade .25s ease-out both; }
@keyframes paneIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.pane-in { animation: paneIn .22s ease-out both; }
@keyframes slideIn { from { opacity: .4; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@media (max-width: 899px) { .pane-in { animation: slideIn .22s ease-out both; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-120%); } to { opacity: 1; transform: none; } }
@keyframes toastInSide { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }

/* ---------- Профиль собеседника ---------- */
.profile-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.profile-hero .title { font-size: 20px; font-weight: 800; margin-top: 4px; }
.profile-hero .sub { font-size: 14px; color: var(--text2); font-weight: 600; }
.action-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.action-grid button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border: 1px solid var(--border); border-radius: 14px; background: transparent; color: var(--text); font-size: 12px; font-weight: 700; }
.action-grid button:hover { background: var(--hover); }
.action-grid button.danger { color: var(--danger); }
.info-block { display: flex; flex-direction: column; gap: 6px; }
.info-block .k { font-size: 13px; font-weight: 700; color: var(--text2); }
.info-block .v { font-size: 15px; line-height: 1.5; word-break: break-word; }
.contact-page { flex: 1; overflow-y: auto; display: flex; justify-content: center; padding: 64px 24px 32px; }
.contact-page .inner { width: 100%; max-width: 520px; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

/* ---------- Карточки, настройки ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 20px; }
.card-pad { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.page { flex: 1; overflow-y: auto; padding: 32px 40px 48px; }
.page-inner { max-width: 680px; display: flex; flex-direction: column; gap: 22px; }
.page-inner.wide { max-width: 980px; }
.page h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.page h3 { margin: 0; font-size: 13px; font-weight: 700; color: var(--text2); }
.page p.lead { margin: -10px 0 0; color: var(--text2); font-size: 14px; line-height: 1.5; }
.sub-head { display: none; }
@media (max-width: 899px) {
  .page { padding: 8px 16px calc(32px + var(--safe-b)); background: var(--sunken); }
  .page h2.desk { display: none; }
  .sub-head { display: flex; align-items: center; gap: 4px; padding: calc(8px + var(--safe-t)) 8px 8px; background: var(--sunken); border-bottom: 1px solid var(--border); flex: none; }
  .sub-head b { font-size: 17px; flex: 1; text-align: center; margin-right: 44px; }
  .card { border: 0; }
  .card-pad { padding: 18px; }
}
.srows { overflow: hidden; }
.srow { width: 100%; display: flex; align-items: center; gap: 14px; min-height: 58px; padding: 10px 16px; border: 0; border-top: 1px solid var(--border); background: transparent; text-align: left; color: var(--text); text-decoration: none; }
.srow:first-child { border-top: 0; }
.srow:hover { background: var(--hover); }
.srow .ico { width: 32px; height: 32px; border-radius: 10px; color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.srow .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.srow .lbl { font-size: 15px; font-weight: 700; }
.srow .sub { font-size: 13px; color: var(--text2); line-height: 1.35; }
.srow .val { display: flex; align-items: center; gap: 4px; color: var(--text2); font-size: 14px; font-weight: 600; flex: none; }
.srow.danger .lbl { color: var(--danger); }
.settings-mobile { padding: 4px 16px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 20px; }
.settings-mobile h2 { margin: 0; padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--text2); }
.settings-mobile section { display: flex; flex-direction: column; gap: 8px; }
.app.sec-settings .pane-list { background: var(--sunken); }
.me-card { display: flex; align-items: center; gap: 14px; padding: 14px; width: 100%; border: 0; border-radius: 20px; background: var(--card); text-align: left; color: var(--text); }
.version { text-align: center; font-size: 12px; color: var(--text2); border: 0; background: transparent; padding: 8px; user-select: none; }
.cat { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px 12px; border: 0; border-radius: 14px; background: transparent; text-align: left; font-size: 15px; font-weight: 700; color: var(--text); width: 100%; }
.cat:hover { background: var(--hover); }
.cat[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 599px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
.preview-chat { border-radius: 18px; background: var(--canvas); border: 1px solid var(--border); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.kv { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); }
.kv > div { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 14px; }
.kv > div:nth-child(-n+2) { border-top: 0; }
.kv > div:nth-child(odd) { color: var(--text2); font-weight: 600; }
.kv > div:nth-child(even) { font-weight: 600; word-break: break-word; }
@media (max-width: 599px) { .kv { grid-template-columns: minmax(0, 1fr); } .kv > div:nth-child(odd) { padding-bottom: 0; } .kv > div:nth-child(even) { border-top: 0; padding-top: 2px; } }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--surface); border-radius: 12px; padding: 12px 14px; white-space: pre-wrap; word-break: break-all; line-height: 1.5; margin: 0; }
.token-box { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.token-box .code { flex: 1; min-width: 200px; }
.cmd-edit { display: grid; grid-template-columns: 150px minmax(0, 1fr) 40px; gap: 8px; align-items: start; }
.cmd-edit textarea { grid-column: 1 / 3; }
@media (max-width: 599px) { .cmd-edit { grid-template-columns: minmax(0, 1fr) 44px; } .cmd-edit input:nth-child(2) { grid-column: 1 / 2; } .cmd-edit textarea { grid-column: 1 / 2; } }
.cmd-edit input, .cmd-edit textarea { height: 42px; border-radius: 12px; border: 1px solid var(--field-border); background: var(--field); padding: 0 12px; font-size: 14px; outline: none; color: var(--text); width: 100%; }
.cmd-edit textarea { height: 64px; padding: 10px 12px; resize: vertical; }
.cmd-list { display: flex; flex-direction: column; gap: 14px; }
.notice { border-radius: 14px; padding: 12px 14px; font-size: 14px; line-height: 1.45; background: var(--accent-soft); color: var(--text); }
.notice.warn { background: color-mix(in srgb, var(--danger) 14%, transparent); }

/* Админ-панель */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat { padding: 16px; border-radius: 18px; background: var(--card); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.stat b { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.stat span { font-size: 13px; color: var(--text2); font-weight: 600; }
.bar-row { display: grid; grid-template-columns: minmax(100px, 180px) minmax(0, 1fr) 40px; gap: 12px; align-items: center; padding: 8px 16px; font-size: 14px; font-weight: 600; }
.bar { height: 10px; border-radius: 999px; background: var(--surface); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.trow { width: 100%; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.2fr) 90px; gap: 12px; align-items: center; padding: 12px 16px; border: 0; border-top: 1px solid var(--border); background: transparent; text-align: left; color: var(--text); font-size: 14px; }
.trow:first-child { border-top: 0; }
button.trow:hover { background: var(--hover); }
.trow.head { font-size: 12px; font-weight: 700; color: var(--text2); }
.trow .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.trow .who div { min-width: 0; }
.trow .who b, .trow .who span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .who span { color: var(--text2); font-size: 12px; font-weight: 600; }
@media (max-width: 699px) { .trow { grid-template-columns: minmax(0, 1fr) auto; } .trow .hide-m { display: none; } }
.bot-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Тосты и модальные окна ---------- */
#toasts { position: fixed; z-index: 50; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 10px; width: 360px; max-width: calc(100vw - 24px); pointer-events: none; }
.toast { pointer-events: auto; background: var(--raised); color: var(--text); border-radius: 20px; box-shadow: var(--shadow); padding: 12px 10px 12px 12px; display: flex; gap: 12px; align-items: center; animation: toastInSide .4s cubic-bezier(.2,.9,.25,1.1) both; border: 0; text-align: left; width: 100%; }
.toast .t-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.toast .t-title { font-size: 14px; font-weight: 800; display: flex; justify-content: space-between; gap: 8px; }
.toast .t-title span { font-size: 12px; color: var(--text2); font-weight: 600; }
.toast .t-text { font-size: 14px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast.simple { padding: 12px 16px; font-size: 14px; font-weight: 600; }
@media (max-width: 899px) {
  #toasts { top: calc(10px + var(--safe-t)); bottom: auto; left: 12px; right: 12px; width: auto; max-width: none; }
  .toast { animation-name: toastIn; }
}
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(8,8,12,.45); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .2s ease-out both; }
.modal { width: 100%; max-width: 440px; background: var(--raised); color: var(--text); border-radius: 24px; box-shadow: var(--shadow); padding: 24px; display: flex; flex-direction: column; gap: 16px; animation: paneIn .25s ease-out both; }
.modal h3 { margin: 0; font-size: 20px; font-weight: 800; }
.modal p { margin: 0; color: var(--text2); line-height: 1.5; font-size: 14px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ---------- Вход ---------- */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b)); overflow-y: auto; height: 100dvh; }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.auth-brand .logo { margin: 0; }
.auth h1 { margin: 16px 0 0; font-size: 32px; line-height: 1.1; font-weight: 800; letter-spacing: -.03em; }
.auth p.lead { margin: -8px 0 6px; color: var(--text2); line-height: 1.5; }
.auth form { display: flex; flex-direction: column; gap: 16px; }
.auth .switch { text-align: center; color: var(--text2); font-size: 14px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .tick-anim { stroke-dashoffset: 0 !important; }
}

/* ===========================================================================
   Версия 0.3: вложения, голосовые, звонки, аватары, роли
   =========================================================================== */
.avatar { overflow: visible; }
.avatar .av-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar .av-clip { width: 100%; height: 100%; border-radius: 50%; overflow: hidden; display: block; }
.avatar .av-clip svg { display: block; }
.chips-row { display: flex; gap: 8px; padding: 0 16px 10px; overflow-x: auto; scrollbar-width: none; }
.chips-row::-webkit-scrollbar { display: none; }
.chips-row .chip { height: 32px; font-size: 13px; white-space: nowrap; flex: none; }
.btn-on { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.action-grid button.on { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.action-grid button.on svg { fill: currentColor; }
.btn-on svg { fill: currentColor; }

/* Меню «⋯» */
.pop-menu { position: absolute; top: 62px; right: 12px; z-index: 30; min-width: 220px; background: var(--raised); border-radius: 16px; box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; animation: paneIn .18s ease-out both; }
.pop-menu button { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; text-align: left; font-size: 14px; font-weight: 600; color: var(--text); }
.pop-menu button:hover { background: var(--hover); }
.pop-menu .danger { color: var(--danger); }

/* Форма «галочка» и поля в диалогах */
.check-row { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.4; color: var(--text); cursor: pointer; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.modal.wide { max-width: 520px; }
.modal { max-height: calc(100dvh - 32px); overflow-y: auto; }
.modal .field { display: flex; flex-direction: column; gap: 6px; }
.modal .field label, .modal .field .label { font-size: 13px; font-weight: 700; color: var(--text2); }
.modal input:not([type=checkbox]) { height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--field-border); background: var(--field); outline: none; font-size: 15px; width: 100%; }
.modal input:not([type=checkbox]):focus { border-color: var(--accent); }
.poll-opts { display: flex; flex-direction: column; gap: 8px; }
.form-error { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 0; }
.form-error:empty { display: none; }

/* Профиль: аватар */
.avatar-edit { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.ae-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ae-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.inline-copy { display: flex; align-items: center; gap: 8px; }
.copy-btn { width: 46px; height: 46px; border-radius: 14px; }
.av-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
.av-opt { border: 2px solid transparent; border-radius: 50%; background: transparent; padding: 2px; display: flex; justify-content: center; }
.av-opt:hover, .av-opt:focus-visible { border-color: var(--accent); }
.em-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; font-weight: 800; color: var(--text2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.em-title .link-btn { text-transform: none; letter-spacing: 0; font-size: 13px; }
.cam-box { position: relative; width: 100%; aspect-ratio: 1; border-radius: 20px; overflow: hidden; background: #000; }
.cam-box video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.cam-ring { position: absolute; inset: 8%; border-radius: 50%; border: 2px dashed rgba(255,255,255,.7); pointer-events: none; }

/* Панель вложений / эмодзи */
.panel { margin: 0 16px; max-width: 780px; align-self: center; width: calc(100% - 32px); background: var(--raised); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden; animation: paneIn .18s ease-out both; }
.attach-panel { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; padding: 10px; }
.attach-panel button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 4px; border: 0; border-radius: 14px; background: transparent; font-size: 13px; font-weight: 700; color: var(--text); }
.attach-panel button:hover { background: var(--hover); }
.ap-ico { width: 48px; height: 48px; border-radius: 16px; color: #fff; display: flex; align-items: center; justify-content: center; }
.panel-tabs { display: flex; gap: 8px; padding: 10px 12px 6px; }
.panel-tabs .chip { height: 32px; font-size: 13px; }
.panel-body { max-height: 260px; overflow-y: auto; padding: 6px 12px 12px; }
.em-group { margin-bottom: 10px; }
.em-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 2px; }
.em-grid button { height: 38px; border: 0; border-radius: 10px; background: transparent; font-size: 24px; line-height: 1; }
.em-grid button:hover { background: var(--hover); }
.st-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.st-grid.big { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.st { width: 100%; aspect-ratio: 1; border: 0; border-radius: 14px; background: transparent; padding: 4px; display: flex; align-items: center; justify-content: center; }
.st:hover { background: var(--hover); }
.st img { width: 100%; height: 100%; object-fit: contain; }
.st.em { font-size: 40px; line-height: 1; }
.st-wrap, .gif-wrap { position: relative; display: block; }
.st-x, .gif-save { position: absolute; top: 2px; right: 2px; width: 24px; height: 24px; border: 0; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; opacity: 0; }
.st-wrap:hover .st-x, .gif-wrap:hover .gif-save, .st-x:focus-visible, .gif-save:focus-visible { opacity: 1; }
@media (hover: none) { .st-x, .gif-save { opacity: .9; } }
.gif-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.gif-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.gif-item { width: 100%; aspect-ratio: 4/3; padding: 0; border: 0; border-radius: 12px; overflow: hidden; background: var(--surface); }
.gif-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Пузыри разных видов */
.bubble { position: relative; }
.bubble[data-act] { cursor: pointer; }
.bubble.k-sticker { background: transparent !important; padding: 2px 4px; }
.bubble.k-sticker .meta { color: var(--text2) !important; }
.sticker-emoji { font-size: 84px; line-height: 1.1; }
.sticker-img { width: 160px; max-width: 100%; height: auto; display: block; }
.bubble.media-only { padding: 4px; }
.bubble.media-only .meta { position: absolute; right: 10px; bottom: 8px; background: rgba(0,0,0,.5); color: #fff !important; padding: 2px 8px; border-radius: 999px; }
.bubble.media-only .meta svg { color: #fff; }
.b-media { position: relative; border-radius: 16px; overflow: hidden; background: var(--surface); display: block; line-height: 0; }
.b-img { max-width: min(320px, 100%); max-height: 360px; min-width: 120px; min-height: 80px; display: block; border-radius: 16px; object-fit: cover; cursor: zoom-in; }
.b-gif { border-radius: 16px; }
.gif-tag { position: absolute; left: 12px; top: 12px; background: rgba(0,0,0,.55); color: #fff; font-size: 10px; font-weight: 800; padding: 2px 6px; border-radius: 6px; }
.bubble.k-gif, .bubble.k-image, .bubble.k-video { gap: 6px; }
.b-video-box { cursor: pointer; width: min(320px, 70vw); aspect-ratio: 16/10; }
.b-video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.play-disc { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 54px; height: 54px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; line-height: 1; }
.play-disc svg { fill: currentColor; margin-left: 3px; }
.dur-tag { position: absolute; left: 10px; bottom: 8px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; line-height: 1.4; }
.prog { height: 4px; border-radius: 2px; background: rgba(127,127,127,.3); overflow: hidden; position: absolute; left: 0; right: 0; bottom: 0; }
.bubble > .prog { position: relative; margin-top: 4px; }
.prog-bar { height: 100%; background: var(--accent); transition: width .15s linear; }
.bubble.out .prog-bar { background: #fff; }
.b-file { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; min-width: 220px; }
.f-ico { width: 44px; height: 44px; border-radius: 14px; background: rgba(127,127,127,.18); display: flex; align-items: center; justify-content: center; flex: none; }
.f-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.f-main b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.f-main span { font-size: 12px; opacity: .75; }
.f-dl { opacity: .8; }
.bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.bubble .b-file, .bubble .b-loc { text-decoration: none; }
.bubble.out a:not(.b-file):not(.b-loc):not(.act-a) { color: #fff; }
/* карта */
.map { position: relative; overflow: hidden; border-radius: 14px; background: linear-gradient(135deg, #cfe8d4, #e3efe0); max-width: 100%; }
.map-tiles { position: absolute; width: 768px; height: 768px; }
.map-tiles img { position: absolute; width: 256px; height: 256px; }
.map-pin { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%); color: #E03131; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); display: flex; }
.map-pin svg { fill: #E03131; stroke: #fff; }
.b-loc { display: flex; flex-direction: column; gap: 8px; color: inherit; max-width: 100%; }
.loc-t { display: flex; flex-direction: column; font-size: 14px; }
.loc-t span { font-size: 12px; opacity: .75; }
.loc-view { min-height: 150px; border-radius: 16px; background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; overflow: hidden; }
.loc-view .map { width: 100% !important; }
.loc-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--text2); font-size: 14px; font-weight: 600; padding: 28px 0; }
.loc-coords { font-size: 12px; color: var(--text2); font-weight: 600; padding: 4px 0 8px; }
.spin-ring { width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--off); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* опрос */
.poll { display: flex; flex-direction: column; gap: 6px; min-width: min(280px, 70vw); }
.poll-q { display: flex; gap: 8px; align-items: flex-start; font-size: 15px; line-height: 1.35; }
.poll-q svg { margin-top: 2px; flex: none; }
.poll-sub { font-size: 12px; opacity: .75; margin-bottom: 4px; }
.poll-opt { position: relative; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 12px; border: 1px solid rgba(127,127,127,.35); border-radius: 12px; background: transparent; color: inherit; text-align: left; overflow: hidden; font-size: 14px; font-weight: 600; }
.poll-opt:disabled { opacity: .7; }
.po-bar { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(127,127,127,.22); transition: width .3s ease; }
.bubble.out .po-bar { background: rgba(255,255,255,.28); }
.po-mark { position: relative; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; opacity: .7; display: flex; align-items: center; justify-content: center; flex: none; }
.poll-opt.sel .po-mark { background: currentColor; opacity: 1; }
.poll-opt.sel .po-mark svg { color: var(--accent); }
.bubble.in .poll-opt.sel .po-mark svg { color: var(--bubble); }
.po-t { position: relative; flex: 1; min-width: 0; word-break: break-word; }
.po-n { position: relative; font-size: 12px; font-weight: 800; }
.poll-foot { font-size: 12px; opacity: .75; }
/* голосовое */
.voice { display: flex; align-items: center; gap: 10px; min-width: min(250px, 66vw); }
.vp-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.vp-btn svg { fill: currentColor; }
.bubble.out .vp-btn { background: #fff; color: var(--accent); }
.vp-wave { flex: 1; height: 34px; display: flex; align-items: center; gap: 2px; cursor: pointer; min-width: 0; }
.vp-wave i { flex: 1; min-width: 2px; border-radius: 2px; background: currentColor; opacity: .3; }
.vp-wave i.on { opacity: 1; }
.vp-time { font-size: 12px; font-weight: 700; min-width: 34px; text-align: right; font-variant-numeric: tabular-nums; }
/* действия над сообщением */
.b-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; padding-top: 8px; border-top: 1px solid rgba(127,127,127,.3); }
.b-actions button, .b-actions .act-a { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 999px; border: 0; background: rgba(127,127,127,.18); color: inherit; font-size: 12px; font-weight: 700; text-decoration: none !important; }
.b-actions button:hover, .b-actions .act-a:hover { background: rgba(127,127,127,.3); }
/* строка звонка */
.call-row { align-self: center; margin: 4px 0; }
.call-row button { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--surface); color: var(--text2); font-size: 13px; font-weight: 700; }
.call-row button.missed { color: var(--danger); }
.call-row button:hover { background: var(--hover); }
.call-row time { font-weight: 600; opacity: .8; }
/* запись голоса */
.composer.rec-mode { align-items: center; padding: 4px 4px 4px 8px; }
.rec-dot { width: 12px; height: 12px; border-radius: 50%; background: #E03131; animation: pulse 1s ease-in-out infinite; margin-left: 6px; }
@keyframes pulse { 50% { opacity: .25; } }
.rec-time { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 42px; }
.rec-hint { flex: 1; color: var(--text2); font-size: 14px; font-weight: 600; }
/* просмотр */
.lightbox { position: fixed; inset: 0; z-index: 90; background: rgba(5,5,8,.92); display: flex; flex-direction: column; animation: fade .2s ease-out both; }
.lb-bar { display: flex; justify-content: flex-end; gap: 8px; padding: calc(12px + var(--safe-t)) 12px 8px; }
.lb-btn { color: #fff; background: rgba(255,255,255,.12); }
.lb-btn:hover { background: rgba(255,255,255,.22); }
.lb-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 12px calc(16px + var(--safe-b)); }
.lb-body img, .lb-body video { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* Роли */
.tag.role-owner { background: #FDE7F0; color: #A61E4D; }
.tag.role-senior_admin { background: #EAE8FE; color: #3B2FD0; }
.tag.role-admin { background: #E0F0FF; color: #0B5FB0; }
.tag.role-moderator { background: #DDF5EC; color: #0B6B58; }
.tag.role-helper { background: #FFF1D6; color: #8A5A00; }
[data-theme="dark"] .tag.role-owner { background: #3A1226; color: #FF8FB9; }
[data-theme="dark"] .tag.role-senior_admin { background: #1F1B52; color: #B7B0FF; }
[data-theme="dark"] .tag.role-admin { background: #11304F; color: #8CC8FF; }
[data-theme="dark"] .tag.role-moderator { background: #0F3329; color: #7DE0C2; }
[data-theme="dark"] .tag.role-helper { background: #3A2B0A; color: #FFD58A; }
.role-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.log-row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr) minmax(0, 1fr) 110px; cursor: default; }
@media (max-width: 699px) { .log-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) 90px; } .hide-m { display: none !important; } }
.chart { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: end; height: 160px; }
.chart .col { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart .bars { display: flex; align-items: flex-end; gap: 4px; flex: 1; width: 100%; justify-content: center; }
.chart .bars i { width: 38%; max-width: 22px; border-radius: 6px 6px 2px 2px; display: block; }
.chart i.m, .legend i.m { background: var(--accent); }
.chart i.r, .legend i.r { background: var(--online); }
.chart b { font-size: 12px; } .chart span { font-size: 11px; color: var(--text2); font-weight: 600; }
.legend { display: flex; gap: 16px; margin-top: 14px; font-size: 12px; font-weight: 600; color: var(--text2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; } .legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.bar { height: 8px; border-radius: 4px; background: var(--surface); overflow: hidden; display: block; } .bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.flag { display: inline-flex; align-items: center; gap: 6px; }

/* ===== Звонок ===== */
#call-root:empty { display: none; }
.call { position: fixed; inset: 0; z-index: 80; background: radial-gradient(120% 90% at 50% 0%, #2B2560 0%, #111119 70%); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; animation: fade .2s ease-out both; }
.call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; display: none; }
.call.has-remote .call-remote { display: block; }
.call.remote-screen .call-remote { object-fit: contain; }
.call-center { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 0 24px; }
.call.has-remote .call-center { display: none; }
.call-center h2 { margin: 12px 0 0; font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.call-center p { margin: 0; font-size: 16px; opacity: .8; min-height: 22px; }
.call .avatar { box-shadow: 0 0 0 8px rgba(255,255,255,.08); }
.call-top { position: absolute; top: calc(18px + var(--safe-t)); left: 0; right: 0; display: none; justify-content: center; align-items: center; gap: 12px; font-weight: 700; font-size: 15px; text-shadow: 0 1px 6px rgba(0,0,0,.6); flex-wrap: wrap; padding: 0 16px; }
.call.is-active .call-top { display: flex; }
#call-timer { font-variant-numeric: tabular-nums; opacity: .9; }
#call-rflags { display: inline-flex; gap: 8px; flex-wrap: wrap; }
#call-rflags .flag { background: rgba(0,0,0,.45); padding: 4px 10px; border-radius: 999px; font-size: 12px; }
.call-local { position: absolute; right: 16px; bottom: calc(132px + var(--safe-b)); width: 150px; aspect-ratio: 4/3; object-fit: cover; border-radius: 16px; background: #000; box-shadow: 0 8px 24px rgba(0,0,0,.5); display: none; transform: scaleX(-1); border: 2px solid rgba(255,255,255,.25); }
.call.has-local .call-local { display: block; }
.call.local-screen .call-local { transform: none; object-fit: contain; }
.call-controls { position: absolute; left: 0; right: 0; bottom: calc(28px + var(--safe-b)); display: flex; justify-content: center; }
.cc-in, .cc-call { display: none; gap: 18px; align-items: flex-start; }
.call.mode-in .cc-in { display: flex; gap: 56px; }
.call.mode-call .cc-call { display: flex; }
.cc-btn { display: flex; flex-direction: column; align-items: center; gap: 8px; border: 0; background: transparent; color: #fff; }
.cc-btn span { width: 60px; height: 60px; border-radius: 50%; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; transition: background .15s ease, transform .1s; }
.cc-btn:hover span { background: rgba(255,255,255,.26); }
.cc-btn:active span { transform: scale(.94); }
.cc-btn.on span { background: #fff; color: #111; }
.cc-btn i { font-style: normal; font-size: 12px; font-weight: 600; opacity: .85; }
.cc-btn.hang span { background: #E03131; color: #fff; }
.cc-btn.hang svg { transform: rotate(135deg); }
.cc-btn.accept span { background: #2F9E44; color: #fff; }
@media (max-width: 480px) { .cc-call { gap: 10px; } .cc-btn span { width: 54px; height: 54px; } .call-local { width: 110px; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ===========================================================================
   Новое: шифрование, фон, спам/консоль, поддержка, удаление, жалобы
   =========================================================================== */
.tag.role-console { background: #111; color: #fff; }
[data-theme="dark"] .tag.role-console { background: #F2F2F5; color: #0E0E10; }
.enc-ic { display: inline-flex; vertical-align: -1px; opacity: .8; margin-right: 1px; }
.bubble.out .enc-ic { color: rgba(255,255,255,.85); }
.enc-locked { font-style: italic; opacity: .85; }
/* Фон: выбор */
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: 10px; }
.bg-sw { position: relative; height: 54px; border-radius: 14px; border: 2px solid var(--border); background-size: cover; background-position: center; color: var(--text2); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.bg-sw.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.bg-sw.none { background: var(--surface); }
.bg-color-in { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; border: 0; cursor: pointer; }
/* Поддержка (консоль) */
.support-thread { display: flex; flex-direction: column; gap: 6px; max-height: 48vh; overflow-y: auto; padding: 4px; background: var(--canvas); border-radius: 14px; }
.support-thread .bubble { max-width: 85%; }
/* Доказательства в жалобе */
.evidence { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; border-left: 3px solid var(--danger); padding: 6px 0 6px 10px; }
.ev-msg { font-size: 13px; line-height: 1.4; color: var(--text); background: var(--surface); border-radius: 8px; padding: 6px 10px; word-break: break-word; }
.ev-msg.ev-mine { background: var(--accent-soft); }
.ev-msg b { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--text2); margin-right: 6px; }
.enc-hint { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text2); }

/* Видеосообщения-«кружочки» (#4) */
.b-round { position: relative; width: 220px; height: 220px; max-width: 70vw; max-height: 70vw; border-radius: 50%; overflow: hidden; background: #000; cursor: pointer; }
.b-round .rv-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.b-round .play-disc { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 56px; height: 56px; border-radius: 50%; background: rgba(0,0,0,.45); color: #fff; display: flex; align-items: center; justify-content: center; }
.b-round.playing .play-disc { display: none; }
.b-round.uploading { opacity: .7; }
.round-dur { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: rgba(0,0,0,.55); color: #fff; font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.rec-cam-wrap { display: flex; justify-content: center; padding: 6px 0 10px; }
.rec-cam { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; background: #000; border: 2px solid var(--accent); }
