/* Кяшник — оформление в стиле WhatsApp (светлая и тёмная тема) */
:root, [data-theme=light] {
  --accent: #00a884; --accent-dark: #008069; --accent-soft: #d9fdd3;
  --bg: #fff; --bg-2: #f0f2f5; --bg-3: #e9edef; --rail: #f0f2f5; --hover: #f5f6f6; --active: #f0f2f5;
  --chat-bg: #efeae2; --pattern-op: .06;
  --in: #fff; --out: #d9fdd3; --text: #111b21; --text-2: #667781; --text-3: #8696a0; --line: #e9edef;
  --tick: #8696a0; --read: #53bdeb; --danger: #ea0038; --sys: #ffffffe6; --sys-text: #54656f; --enc: #ffeecd; --enc-text: #54656f;
  --shadow: 0 2px 5px rgba(11,20,26,.26), 0 2px 10px rgba(11,20,26,.16); --badge: #25d366; --quote: rgba(11,20,26,.05);
  --bubble-shadow: 0 1px .5px rgba(11,20,26,.13); --input: #fff; --chip: #f0f2f5; --chip-active: #d9fdd3; --chip-active-text: #008069;
}
[data-theme=dark] {
  --accent: #00a884; --accent-dark: #00a884; --accent-soft: #005c4b;
  --bg: #111b21; --bg-2: #202c33; --bg-3: #2a3942; --rail: #202c33; --hover: #202c33; --active: #2a3942;
  --chat-bg: #0b141a; --pattern-op: .05;
  --in: #202c33; --out: #005c4b; --text: #e9edef; --text-2: #8696a0; --text-3: #8696a0; --line: #222d34;
  --tick: #ffffff99; --read: #53bdeb; --danger: #f15c6d; --sys: #182229; --sys-text: #8696a0; --enc: #182229; --enc-text: #ffd279;
  --shadow: 0 2px 5px rgba(0,0,0,.5); --badge: #00a884; --quote: rgba(0,0,0,.18);
  --bubble-shadow: 0 1px .5px rgba(0,0,0,.25); --input: #2a3942; --chip: #202c33; --chip-active: #0a332c; --chip-active-text: #00a884;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font: 14.2px/1.4 "Segoe UI", "Helvetica Neue", Helvetica, "Lucida Grande", Arial, Ubuntu, Cantarell, "Fira Sans", sans-serif; color: var(--text); background: var(--bg-2); -webkit-font-smoothing: antialiased; }
#app { height: 100%; height: 100dvh; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea { font: inherit; color: var(--text); }
a { color: #027eb5; } [data-theme=dark] a { color: #53bdeb; }
[hidden] { display: none !important; }
.ic { width: 24px; height: 24px; flex: none; display: inline-block; vertical-align: middle; }
.ic.sm { width: 18px; height: 18px; } .ic.xs { width: 15px; height: 15px; }
.scroll { overflow-y: auto; flex: 1; min-height: 0; }
.scroll::-webkit-scrollbar, .messages::-webkit-scrollbar, .chat-list::-webkit-scrollbar { width: 6px; }
.scroll::-webkit-scrollbar-thumb, .messages::-webkit-scrollbar-thumb, .chat-list::-webkit-scrollbar-thumb { background: #0003; }
.slogan { font-family: "Segoe Script", "Brush Script MT", "Comic Sans MS", cursive; color: var(--accent); font-size: 17px; letter-spacing: .3px; }

/* заставка */
.splash { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: var(--bg); }
.splash img { width: 96px; animation: pop .6s ease; } .splash-name { font-size: 26px; font-weight: 600; color: var(--text); }
.splash-foot { position: absolute; bottom: 40px; color: var(--text-2); font-size: 13px; }
@keyframes pop { from { transform: scale(.6); opacity: 0 } to { transform: none; opacity: 1 } }

/* регистрация */
.welcome-body { background: var(--bg-2); }
.welcome { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; overflow: auto; height: 100%;
  background: linear-gradient(var(--accent-dark) 0 220px, transparent 220px); }
[data-theme=dark] .welcome { background: linear-gradient(#103529 0 220px, transparent 220px); }
.welcome-card { background: var(--bg); border-radius: 6px; box-shadow: var(--shadow); padding: 36px 40px; width: 100%; max-width: 440px; text-align: center; }
.welcome-logo { width: 110px; } .welcome h1 { margin: 6px 0 0; font-weight: 400; font-size: 30px; }
.welcome-sub { color: var(--text-2); margin: 10px 0 22px; }
#reg { text-align: left; display: flex; flex-direction: column; gap: 14px; }
#reg label { color: var(--accent-dark); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
#reg input, details input { border: 0; border-bottom: 2px solid var(--line); background: none; padding: 8px 2px; outline: none; font-size: 16px; width: 100%; }
#reg input:focus { border-color: var(--accent); }
.at-input { display: flex; align-items: center; } .at-input span { color: var(--text-2); font-size: 16px; }
details summary { color: var(--text-2); cursor: pointer; font-size: 13px; }
.err { color: var(--danger); min-height: 1em; font-size: 13px; }
.btn-primary { background: var(--accent); color: #fff; border-radius: 24px; padding: 11px 26px; font-weight: 500; font-size: 15px; }
.btn-primary:hover { background: var(--accent-dark); } .btn-primary:disabled { opacity: .6; }
.btn-link { color: var(--accent-dark); margin-top: 18px; font-size: 14px; } [data-theme=dark] .btn-link { color: var(--accent); }
.welcome-legal { color: var(--text-3); font-size: 12px; margin-top: 20px; }

/* каркас */
.shell { display: flex; height: 100%; max-width: 1700px; margin: 0 auto; background: var(--bg); position: relative; overflow: hidden; }
@media (min-width: 1440px) { .shell { height: calc(100% - 38px); margin-top: 19px; box-shadow: var(--shadow); } body { background: linear-gradient(var(--bg-3), var(--bg-3)) top / 100% 127px no-repeat, var(--bg-2); } }
.rail { width: 64px; flex: none; background: var(--rail); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 8px; }
.rail-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); position: relative; }
.rail-btn:hover { background: var(--bg-3); } .rail-btn.active { background: var(--bg-3); color: var(--text); }
.rail-spacer { flex: 1; }
.rail-badge { position: absolute; top: 0; right: -2px; background: var(--badge); color: #fff; font-size: 11px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; font-weight: 600; }
.side { width: 30%; min-width: 340px; max-width: 500px; flex: none; border-right: 1px solid var(--line); position: relative; overflow: hidden; display: flex; flex-direction: column; background: var(--bg); }
.side-inner { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; background: var(--chat-bg); }
.info { width: 0; flex: none; overflow: hidden; background: var(--bg-2); border-left: 1px solid var(--line); display: flex; flex-direction: column; transition: width .2s; }
.info.open { width: 30%; min-width: 340px; max-width: 460px; }
.tabbar { display: none; }

.side-head { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px 0 20px; flex: none; }
.side-head h2 { margin: 0; font-size: 22px; font-weight: 700; color: var(--text); }
[data-theme=light] .side-head h2 { color: #111b21; }
.head-btns { display: flex; gap: 6px; align-items: center; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); flex: none; }
.icon-btn:hover { background: var(--bg-3); } .icon-btn.green-ic { color: var(--accent); }
.net-banner { background: #ffd279; color: #3b4a54; padding: 10px 16px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.search { padding: 2px 12px 8px; flex: none; }
.search-box { display: flex; align-items: center; gap: 14px; background: var(--bg-2); border-radius: 8px; padding: 0 14px; height: 36px; color: var(--text-2); }
.search-box input { flex: 1; border: 0; background: none; outline: none; height: 100%; }
.filters { display: flex; gap: 8px; padding: 0 12px 8px; flex: none; }
.chip { background: var(--chip); color: var(--text-2); border-radius: 16px; padding: 5px 12px; font-size: 14px; }
.chip.active { background: var(--chip-active); color: var(--chip-active-text); }
.chat-list { overflow-y: auto; flex: 1; }
.chat-row { display: flex; align-items: center; height: 72px; padding: 0 0 0 13px; cursor: pointer; }
.chat-row:hover { background: var(--hover); } .chat-row.active { background: var(--active); }
.chat-row .av { margin-right: 13px; }
.chat-row-body { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: center; border-bottom: 1px solid var(--line); padding-right: 15px; }
.chat-row-top, .chat-row-bot { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.chat-name { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-time { font-size: 12px; color: var(--text-2); flex: none; } .chat-time.unread { color: var(--badge); }
.chat-preview { color: var(--text-2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.chat-flags { display: flex; gap: 4px; align-items: center; flex: none; font-size: 12px; }
.badge { background: var(--badge); color: #fff; border-radius: 11px; min-width: 20px; height: 20px; font-size: 12px; font-weight: 600; display: grid; place-items: center; padding: 0 6px; }
[data-theme=dark] .badge { color: #111b21; }
.typing { color: var(--badge); }
.tick { color: var(--tick); margin-right: 2px; display: inline-flex; vertical-align: -3px; } .tick.read { color: var(--read); } .tick.fail { color: var(--danger); cursor: pointer; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 10px 16px; cursor: pointer; min-height: 60px; color: var(--text); }
.list-row:hover { background: var(--hover); }
.list-row > .ic { color: var(--text-2); margin: 0 6px; }
.list-row.danger, .list-row.danger .ic { color: var(--danger); }
.row-text { flex: 1; min-width: 0; } .row-title { font-size: 16px; } .row-title.big { font-size: 19px; } .row-title.red { color: var(--danger); }
.row-sub { color: var(--text-2); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.archive-row { min-height: 48px; color: var(--accent-dark); } .archive-row .count { margin-left: auto; color: var(--accent); font-size: 12px; }
.section-title { color: var(--accent-dark); padding: 22px 20px 12px; font-size: 15px; } [data-theme=dark] .section-title { color: var(--accent); }
.empty-list { text-align: center; color: var(--text-2); padding: 40px 30px; } .empty-logo { width: 90px; opacity: .9; }
.hint { color: var(--text-2); font-size: 13.5px; padding: 0 20px; line-height: 1.5; }
.av { border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 500; flex: none; overflow: hidden; background: #dfe5e7; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av-empty { background: #dfe5e7; color: #fff; } [data-theme=dark] .av-empty { background: #6a7175; }
.av-empty .ic { width: 60%; height: 60%; }
.av-green { background: var(--accent); color: #fff; }
.call-arrow { display: inline-flex; vertical-align: -3px; margin-right: 4px; } .call-arrow.red { color: var(--danger); } .call-arrow.green { color: var(--badge); }
.switch { appearance: none; width: 34px; height: 14px; background: #8696a080; border-radius: 7px; position: relative; cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; top: -3px; left: -2px; background: #fff; box-shadow: 0 1px 3px #0005; transition: .2s; }
.switch:checked { background: #00a88480; } .switch:checked::after { left: 16px; background: var(--accent); }
.me-row { padding: 18px 16px; }
.about-app { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 30px; color: var(--text-2); }
.about-app img { width: 56px; margin-bottom: 6px; } .about-app b { color: var(--text); font-size: 16px; }

/* выдвижные панели */
.drawer { position: absolute; inset: 0; background: var(--bg); transform: translateX(-100%); transition: transform .25s ease; z-index: 5; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-head { height: 108px; background: var(--accent-dark); color: #fff; display: flex; align-items: flex-end; gap: 20px; padding: 0 20px 18px; flex: none; }
[data-theme=dark] .drawer-head { background: var(--bg-2); color: var(--text); }
.drawer-head h2 { margin: 0; font-size: 19px; font-weight: 500; } .drawer-head .icon-btn { color: inherit; width: 30px; height: 30px; }
.info .drawer-head { height: 60px; align-items: center; background: var(--bg-2); color: var(--text); padding-bottom: 0; }
.drawer .search { padding-top: 10px; }
.user-results { padding-bottom: 80px; }
.list-row.action .row-title, .list-row.action span { font-size: 16px; }
.sel-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 20px 0; }
.chip-user { background: var(--bg-2); border-radius: 14px; padding: 4px 12px; font-size: 14px; }
.fab { position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); width: 50px; height: 50px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: var(--shadow); }
.fab.inline { position: static; transform: none; flex: none; }
.pad { padding: 28px 30px; }
.group-av { display: flex; justify-content: center; margin-bottom: 24px; } .group-av .av { width: 140px !important; height: 140px !important; } .group-av .ic { width: 60px; height: 60px; }
.line-input { width: 100%; border: 0; border-bottom: 2px solid var(--accent); background: none; padding: 8px 2px; font-size: 16px; outline: none; margin-bottom: 16px; }
.profile-photo { position: relative; width: 200px; height: 200px; margin: 28px auto; border-radius: 50%; overflow: hidden; cursor: pointer; }
.photo-hover { position: absolute; inset: 0; background: #0006; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; opacity: 0; transition: .2s; font-size: 13px; text-transform: uppercase; }
.profile-photo:hover .photo-hover { opacity: 1; }
.field { padding: 14px 30px; cursor: pointer; } .field label { color: var(--accent-dark); font-size: 14px; } [data-theme=dark] .field label { color: var(--accent); }
.field-val { display: flex; justify-content: space-between; align-items: center; font-size: 17px; padding-top: 12px; } .field-val .ic { color: var(--text-2); }

/* окно чата */
.intro { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; background: var(--bg-2); border-bottom: 6px solid var(--accent); color: var(--text-2); }
.intro img { width: 200px; } .intro h1 { color: var(--text); font-weight: 300; font-size: 32px; margin: 18px 0 2px; }
.intro p { max-width: 460px; font-size: 14px; } .intro-foot { position: absolute; bottom: 40px; font-size: 13px; display: flex; gap: 6px; align-items: center; color: var(--text-3); }
.chat-head { height: 60px; background: var(--bg-2); display: flex; align-items: center; padding: 0 12px 0 16px; gap: 10px; flex: none; z-index: 2; border-left: 1px solid var(--line); }
.back-btn { display: none; }
.chat-head-info { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; cursor: pointer; }
.chat-head-text { min-width: 0; } .chat-head-name { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.verified { color: var(--accent); font-size: 13px; }
.msg-search { background: var(--bg-2); padding: 6px 16px; display: flex; gap: 8px; border-top: 1px solid var(--line); }
.msg-search input { flex: 1; border: 0; border-radius: 8px; padding: 8px 12px; background: var(--input); outline: none; }
.messages { flex: 1; overflow-y: auto; position: relative; padding: 12px 0 8px; overscroll-behavior: contain; }
.main::before { content: ""; position: absolute; inset: 0; opacity: var(--pattern-op); pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='%23000'%3E%3Cellipse cx='24' cy='30' rx='7' ry='6'/%3E%3Ccircle cx='15' cy='20' r='3.2'/%3E%3Ccircle cx='21' cy='15' r='3.2'/%3E%3Ccircle cx='28' cy='15' r='3.2'/%3E%3Ccircle cx='34' cy='20' r='3.2'/%3E%3Cellipse cx='84' cy='86' rx='7' ry='6' transform='rotate(25 84 86)'/%3E%3Ccircle cx='77' cy='74' r='3.2'/%3E%3Ccircle cx='84' cy='71' r='3.2'/%3E%3Ccircle cx='91' cy='73' r='3.2'/%3E%3Ccircle cx='95' cy='80' r='3.2'/%3E%3Cpath d='M70 26h14a4 4 0 0 1 0 8H70a4 4 0 0 1 0-8zm-6-2a5 5 0 1 0 0 6zm26 0a5 5 0 1 1 0 6zM20 90l6 6 10-12' stroke='%23000' stroke-width='0'/%3E%3Cpath d='M26 92c-6-6-12 2-6 8l6 6 6-6c6-6 0-14-6-8z'/%3E%3C/g%3E%3C/svg%3E"); }
[data-theme=dark] .main::before { filter: invert(1); }
.msgs-inner { display: flex; flex-direction: column; padding: 0 min(7%, 63px); position: relative; }
.e2e-note { align-self: center; background: var(--enc); color: var(--enc-text); font-size: 12.5px; text-align: center; padding: 6px 12px; border-radius: 7.5px; max-width: 520px; margin: 4px 0 12px; cursor: pointer; box-shadow: var(--bubble-shadow); }
.day { align-self: center; margin: 10px 0; } .day span { background: var(--sys); color: var(--sys-text); font-size: 12.5px; padding: 5px 12px; border-radius: 7.5px; box-shadow: var(--bubble-shadow); text-transform: uppercase; }
.sys { align-self: center; margin: 6px 0; text-align: center; max-width: 80%; } .sys span { background: var(--sys); color: var(--sys-text); font-size: 12.5px; padding: 5px 12px; border-radius: 7.5px; display: inline-block; box-shadow: var(--bubble-shadow); }
.sys.keychange { cursor: pointer; } .sys.keychange span { background: var(--enc); color: var(--enc-text); }
.msg { display: flex; margin-top: 12px; position: relative; align-items: center; gap: 6px; }
.msg.cont { margin-top: 2px; }
.msg.out { flex-direction: row-reverse; }
.bubble { position: relative; max-width: min(65%, 560px); padding: 6px 7px 8px 9px; border-radius: 7.5px; background: var(--in); box-shadow: var(--bubble-shadow); word-wrap: break-word; overflow-wrap: anywhere; }
.msg.out .bubble { background: var(--out); }
.msg:not(.cont).in .bubble { border-top-left-radius: 0; } .msg:not(.cont).out .bubble { border-top-right-radius: 0; }
.msg:not(.cont).in .bubble::before, .msg:not(.cont).out .bubble::before { content: ""; position: absolute; top: 0; width: 8px; height: 13px; }
.msg:not(.cont).in .bubble::before { left: -8px; background: var(--in); clip-path: polygon(100% 0, 0 0, 100% 100%); }
.msg:not(.cont).out .bubble::before { right: -8px; background: var(--out); clip-path: polygon(0 0, 100% 0, 0 100%); }
.text { white-space: pre-wrap; font-size: 14.2px; } .text code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.text::after { content: ""; display: inline-block; width: 70px; }
.msg.out .text::after { width: 88px; }
.text.deleted { font-style: italic; color: var(--text-2); }
.big-emoji { font-size: 40px; line-height: 1.2; }
.meta { float: right; margin: 10px 0 -5px 8px; font-size: 11px; color: var(--text-2); display: inline-flex; align-items: center; gap: 3px; position: relative; bottom: 0; white-space: nowrap; }
.text + .meta { margin-left: -84px; } .msg.in .text + .meta { margin-left: -66px; }
.msg.out .meta { color: var(--tick); } [data-theme=light] .msg.out .meta { color: #667781; }
.sender { font-size: 12.8px; font-weight: 500; margin-bottom: 2px; }
.fwd { font-size: 12px; color: var(--text-2); font-style: italic; margin-bottom: 2px; }
.msg-menu { position: absolute; top: 2px; right: 2px; width: 26px; height: 24px; display: grid; place-items: center; color: var(--text-3); opacity: 0; border-radius: 0 7px 0 12px; background: linear-gradient(to left, var(--in) 70%, transparent); }
.msg.out .msg-menu { background: linear-gradient(to left, var(--out) 70%, transparent); }
.media-only .msg-menu { background: radial-gradient(#0006, transparent 70%); color: #fff; }
.bubble:hover .msg-menu { opacity: 1; }
.react-btn { width: 28px; height: 28px; border-radius: 50%; background: var(--sys); color: var(--text-2); display: grid; place-items: center; opacity: 0; box-shadow: var(--bubble-shadow); flex: none; }
.msg:hover .react-btn { opacity: 1; }
.reacts { position: absolute; bottom: -18px; left: 8px; background: var(--in); border-radius: 12px; padding: 2px 6px; font-size: 14px; box-shadow: var(--bubble-shadow); display: flex; gap: 2px; align-items: center; z-index: 1; }
.msg.out .reacts { left: auto; right: 8px; } .reacts small { font-size: 11px; color: var(--text-2); }
.msg.has-react { margin-bottom: 16px; }
.quote { border-left: 4px solid var(--qc, var(--accent)); background: var(--quote); border-radius: 5px; padding: 5px 8px; margin-bottom: 4px; display: flex; flex-direction: column; font-size: 13px; cursor: pointer; min-width: 120px; }
.quote b { color: var(--qc, var(--accent)); font-weight: 500; } .quote span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.msg.flash .bubble { animation: flash 1.5s; } @keyframes flash { 30% { filter: brightness(.8); } }
.msg.dim { opacity: .35; } .msg.hit .bubble { outline: 2px solid #ffd279; }
.media { position: relative; width: 330px; max-width: 100%; aspect-ratio: 1 / var(--r, .75); border-radius: 6px; overflow: hidden; background: #0002; margin-bottom: 4px; cursor: pointer; display: grid; place-items: center; }
.media img, .media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-only { padding: 3px 3px 3px 3px; } .media-only .media { margin: 0; }
.media-only .meta { position: absolute; right: 10px; bottom: 8px; color: #fff !important; margin: 0; text-shadow: 0 1px 2px #0008; } .media-only .tick { color: #fff; } .media-only .tick.read { color: var(--read); }
.dl-btn { position: absolute; background: #0008; color: #fff; border-radius: 22px; padding: 8px 14px; display: flex; gap: 6px; align-items: center; font-size: 13px; }
.progress-wrap { height: 4px; background: #0002; border-radius: 2px; overflow: hidden; margin: 4px 0; width: 100%; } .media .progress-wrap { position: absolute; bottom: 10px; left: 10px; right: 10px; width: auto; }
.progress { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.dl-err { color: var(--danger); font-size: 12px; padding: 4px; }
.doc { display: flex; align-items: center; gap: 10px; background: var(--quote); border-radius: 6px; padding: 10px; min-width: 260px; cursor: pointer; margin-bottom: 4px; }
.doc-ic { position: relative; color: #ff5b5b; display: grid; place-items: center; } .doc-ic .ic { width: 34px; height: 40px; }
.doc-ic b { position: absolute; bottom: 6px; font-size: 7px; color: #fff; }
.doc-info { flex: 1; min-width: 0; } .doc-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .doc-sub { font-size: 12px; color: var(--text-2); }
.doc.big { flex-direction: column; background: none; font-size: 16px; text-align: center; } .doc.big .ic { width: 90px; height: 90px; color: var(--text-3); }
.voice { display: flex; align-items: center; gap: 10px; min-width: 260px; padding: 4px 0 6px; }
.vplay { color: var(--text-2); width: 34px; height: 34px; display: grid; place-items: center; } .vplay .ic { width: 30px; height: 30px; }
.vtrack { flex: 1; position: relative; } .vrange { width: 100%; accent-color: var(--accent); height: 4px; margin: 10px 0 2px; }
.vtime { font-size: 11px; color: var(--text-2); position: absolute; left: 0; top: 22px; }
.call-bubble { display: flex; align-items: center; gap: 10px; padding: 10px 12px; } .call-ic { background: var(--quote); border-radius: 50%; width: 34px; height: 34px; display: grid; place-items: center; color: var(--accent); } .call-ic.red { color: var(--danger); }
.call-bubble .meta { margin: 0 0 0 8px; align-self: flex-end; }
.scroll-down { position: absolute; right: 18px; bottom: 80px; width: 42px; height: 42px; border-radius: 50%; background: var(--bg); color: var(--text-2); box-shadow: var(--shadow); display: grid; place-items: center; z-index: 3; }
.drop-zone { display: none; position: absolute; inset: 60px 0 0; background: #00a884cc; color: #fff; font-size: 22px; align-items: center; justify-content: center; z-index: 10; pointer-events: none; }
.main.dragging .drop-zone { display: flex; }

/* поле ввода */
.composer { background: var(--bg-2); flex: none; position: relative; z-index: 2; padding-bottom: env(safe-area-inset-bottom); }
.composer-row, .rec-bar { display: flex; align-items: flex-end; gap: 4px; padding: 5px 10px; min-height: 62px; }
.composer-row .icon-btn { margin-bottom: 6px; }
.input-wrap { flex: 1; background: var(--input); border-radius: 8px; padding: 9px 12px; margin: 5px 4px; display: flex; }
#composer-input { flex: 1; border: 0; outline: none; resize: none; background: none; max-height: 140px; font-size: 15px; line-height: 20px; height: 20px; }
.send-btn { color: var(--text-2); } .send-btn.has-text, #rec-send { color: var(--accent); }
.rec-bar { align-items: center; justify-content: flex-end; gap: 14px; padding-right: 16px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: blink 1s infinite; } @keyframes blink { 50% { opacity: .2 } }
.rec-time { font-size: 18px; min-width: 50px; } .rec-label { color: var(--text-2); flex: 1; }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px 0 70px; } .reply-bar .quote { flex: 1; cursor: default; background: var(--input); }
.emoji-panel { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); height: 240px; overflow-y: auto; padding: 10px; background: var(--bg); border-top: 1px solid var(--line); }
.emoji-panel button { font-size: 26px; height: 42px; border-radius: 6px; } .emoji-panel button:hover { background: var(--bg-2); }
.left-note { padding: 20px; text-align: center; color: var(--text-2); }

/* правая панель */
.info .scroll { background: var(--bg-2); }
.info-top { background: var(--bg); padding: 28px 20px 18px; display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 10px; }
.info-top h2 { margin: 14px 0 2px; font-weight: 400; font-size: 24px; }
.info-actions { display: flex; gap: 12px; margin-top: 16px; } .info-actions button { border: 1px solid var(--line); border-radius: 10px; width: 92px; padding: 10px 0; display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--accent); font-size: 13px; }
.info-actions button span { color: var(--text); }
.info-sec { background: var(--bg); padding: 16px 26px; margin-bottom: 10px; } .info-sec > label { color: var(--text-2); font-size: 14px; display: flex; justify-content: space-between; margin-bottom: 10px; }
.info-sec.rows { padding: 8px 0; } .info-sec.rows > label { padding: 8px 26px 0; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mg-item { aspect-ratio: 1; background: var(--bg-2); border-radius: 6px; overflow: hidden; display: grid; place-items: center; cursor: pointer; color: var(--text-3); } .mg-item img { width: 100%; height: 100%; object-fit: cover; }
.admin-tag { font-size: 11px; color: var(--accent-dark); background: var(--accent-soft); padding: 2px 6px; border-radius: 4px; } [data-theme=dark] .admin-tag { color: #fff; }

/* меню, модальные окна, уведомления */
.ctx { position: fixed; z-index: 1000; background: var(--bg); box-shadow: var(--shadow); border-radius: 12px; padding: 8px 0; min-width: 200px; animation: fade .12s; }
[data-theme=dark] .ctx { background: #233138; }
.ctx-item { padding: 10px 24px; cursor: pointer; font-size: 14.5px; } .ctx-item:hover { background: var(--hover); } [data-theme=dark] .ctx-item:hover { background: #182229; }
.ctx-item.danger { color: var(--danger); }
.quick-reacts { display: flex; gap: 2px; padding: 2px 10px 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; } .quick-reacts button { font-size: 24px; width: 38px; height: 38px; border-radius: 50%; } .quick-reacts button:hover { background: var(--bg-2); transform: scale(1.15); }
@keyframes fade { from { opacity: 0; transform: scale(.96) } }
.modal-bg { position: fixed; inset: 0; background: #0b141ab3; z-index: 900; display: grid; place-items: center; padding: 20px; animation: fade .15s; } [data-theme=light] .modal-bg { background: #ffffffd9; }
.modal { background: var(--bg); border-radius: 3px; box-shadow: 0 17px 50px 0 rgba(11,20,26,.19), 0 12px 15px 0 rgba(11,20,26,.24); padding: 22px 24px 20px; width: 100%; max-width: 480px; max-height: 90vh; display: flex; flex-direction: column; }
[data-theme=dark] .modal { background: #3b4a54; }
.modal.wide { max-width: 520px; } .modal h3 { margin: 0 0 16px; font-weight: 400; font-size: 20px; }
.modal-text { color: var(--text-2); margin: 0 0 20px; font-size: 15px; line-height: 1.5; }
.modal-input { border: 0; border-bottom: 2px solid var(--accent); background: none; padding: 8px 2px; font-size: 16px; outline: none; margin-bottom: 20px; }
.modal-btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; } .modal-btns.col { flex-direction: column; align-items: flex-end; }
.btn-flat { color: var(--accent-dark); border: 1px solid var(--line); padding: 9px 22px; border-radius: 24px; font-weight: 500; } [data-theme=dark] .btn-flat { color: var(--accent); border-color: #ffffff22; }
.btn-flat:hover { background: var(--hover); } .btn-flat.danger { background: var(--danger); color: #fff; border-color: transparent; }
.fwd-list { max-height: 50vh; margin: 0 -24px; }
.info-rows p { margin: 6px 0; color: var(--text-2); }
.safety-pair { display: flex; align-items: center; justify-content: center; gap: 14px; color: var(--accent); margin-bottom: 16px; }
.safety { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 14px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 20px; text-align: center; padding: 14px; background: var(--bg-2); border-radius: 8px; margin-bottom: 14px; letter-spacing: 1px; }
.safety-pair + .safety + .hint { padding: 0; }
.toast { position: fixed; left: 50%; bottom: 30px; transform: translate(-50%, 30px); background: #323739; color: #fff; padding: 12px 22px; border-radius: 8px; opacity: 0; transition: .25s; z-index: 2000; font-size: 14px; box-shadow: var(--shadow); max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.fatal { position: fixed; top: 0; left: 0; right: 0; background: var(--danger); color: #fff; padding: 12px; z-index: 3000; text-align: center; } .fatal button { text-decoration: underline; margin-left: 8px; }
.preview-modal { max-width: 720px; padding: 0; overflow: hidden; height: min(640px, 90vh); }
.preview { display: flex; flex-direction: column; height: 100%; background: var(--bg-2); }
.preview header { display: flex; align-items: center; gap: 12px; padding: 10px 14px; } .preview-body { flex: 1; display: grid; place-items: center; min-height: 0; padding: 10px; }
.preview-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.preview-foot { display: flex; gap: 14px; padding: 14px 20px; align-items: center; } .caption { flex: 1; border: 0; border-radius: 8px; padding: 12px 14px; background: var(--input); outline: none; font-size: 15px; }
.lightbox { position: fixed; inset: 0; background: var(--bg); z-index: 950; display: flex; flex-direction: column; } [data-theme=dark] .lightbox { background: #0b141af2; }
.lightbox header { display: flex; justify-content: space-between; padding: 10px 16px; align-items: center; } .lightbox header > div { display: flex; align-items: center; gap: 12px; }
.lightbox header span { display: flex; flex-direction: column; } .lightbox small { color: var(--text-2); }
.lightbox img { flex: 1; min-height: 0; object-fit: contain; width: 100%; padding: 10px 40px; } .lightbox p { text-align: center; padding: 10px 20px 30px; margin: 0; }

/* звонок */
.call { position: fixed; inset: 0; z-index: 800; background: #0b141a; color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 40px 20px calc(40px + env(safe-area-inset-bottom)); overflow: hidden; }
.call::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 50% 30%, #1f3a33, #0b141a 70%); }
.call > * { position: relative; }
.call .remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; background: #000; }
.call.has-remote .remote { display: block; } .call.has-remote::before { display: none; }
.call.has-remote .call-center .av { display: none; } .call.has-remote .call-center { margin-top: 0; text-shadow: 0 1px 4px #000; }
.call .local { position: absolute; right: 16px; top: 70px; width: 120px; aspect-ratio: 3/4; object-fit: cover; border-radius: 12px; background: #222; box-shadow: 0 4px 16px #0008; transform: scaleX(-1); z-index: 2; display: none; }
.call.is-video .local { display: block; } .call.cam-off .local { opacity: .2; }
.call-top { font-size: 13px; color: #ffffffb3; display: flex; gap: 6px; align-items: center; z-index: 2; }
.call-center { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: -40px; z-index: 2; }
.call-name { font-size: 26px; font-weight: 400; margin-top: 10px; } .call-status { color: #ffffffcc; font-size: 15px; }
.call-btns { display: flex; gap: 22px; z-index: 2; background: #0006; padding: 12px 22px; border-radius: 40px; backdrop-filter: blur(10px); }
.cbtn { width: 58px; height: 58px; border-radius: 50%; background: #ffffff26; color: #fff; display: grid; place-items: center; } .cbtn:hover { background: #ffffff40; }
.cbtn.off { background: #fff; color: #111b21; }
.cbtn.red { background: #f15c6d; } .cbtn.green { background: #25d366; animation: pulse 1.4s infinite; }
.cbtn.red .ic, .cbtn.green .ic { width: 28px; height: 28px; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #25d36699 } 70% { box-shadow: 0 0 0 18px #25d36600 } 100% { box-shadow: 0 0 0 0 #25d36600 } }

/* мобильная раскладка (как WhatsApp на телефоне) */
@media (max-width: 799px) {
  .rail { display: none; }
  .shell { flex-direction: column; }
  .side { width: 100%; min-width: 0; max-width: none; flex: 1; border: 0; min-height: 0; padding-top: env(safe-area-inset-top); }
  .main { position: absolute; inset: 0; transform: translateX(100%); transition: transform .22s ease; z-index: 20; padding-top: env(safe-area-inset-top); }
  body.in-chat .main { transform: none; }
  .info.open { position: absolute; inset: 0; width: 100%; max-width: none; min-width: 0; z-index: 30; padding-top: env(safe-area-inset-top); }
  .back-btn { display: grid; margin-left: -8px; } .chat-head { padding-left: 8px; gap: 4px; }
  .tabbar { display: flex; flex: none; border-top: 1px solid var(--line); background: var(--bg); padding-bottom: env(safe-area-inset-bottom); }
  .tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; font-size: 12px; color: var(--text-2); position: relative; }
  .tab .ic { padding: 3px 18px; width: 60px; height: 30px; border-radius: 15px; box-sizing: border-box; }
  .tab.active { color: var(--text); font-weight: 600; } .tab.active .ic { background: var(--chip-active); color: var(--chip-active-text); }
  .tab-badge { position: absolute; top: 4px; left: 54%; background: var(--badge); color: #fff; font-size: 11px; font-style: normal; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }
  .side-head h2 { font-size: 24px; color: var(--accent-dark); } [data-theme=dark] .side-head h2 { color: var(--text); }
  .msgs-inner { padding: 0 10px; } .bubble { max-width: 82%; } .media { width: 260px; }
  .msg-menu { display: none; } .react-btn { display: none; }
  .reply-bar { padding-left: 14px; }
  .composer-row { padding: 5px 6px; min-height: 56px; }
  .welcome-card { padding: 28px 22px; }
  .drawer-head { height: calc(64px + env(safe-area-inset-top)); padding-bottom: 14px; }
  .call .local { width: 100px; top: calc(60px + env(safe-area-inset-top)); }
  .modal { max-width: 100%; }
}
