/* ============================================================
   VEIL v2 — светлая/тёмная тема через data-theme, поиск,
   звонки, файлы, новая регистрация
   ============================================================ */

:root {
  --bg: #f4f6fb;
  --bg2: #ffffff;
  --bg3: #eef1f8;
  --bg-input: #ffffff;
  --fg: #1a2233;
  --fg-dim: #5b6478;
  --fg-faint: #98a1b5;
  --border: #dde3f0;
  --border-strong: #c4cde0;
  --accent: #6247e6;
  --accent2: #3d7bff;
  --accent-soft: rgba(98, 71, 230, .09);
  --bubble-me: linear-gradient(135deg, #6a4fe6, #4470e0);
  --bubble-me-fg: #ffffff;
  --bubble-them: #ffffff;
  --bubble-them-fg: #22293a;
  --danger: #e5484d;
  --ok: #218838;
  --shadow: 0 18px 50px rgba(30, 41, 80, .12);
  --shadow-btn: 0 8px 22px rgba(98, 71, 230, .28);
  --scroll: #c9d2e5;
  --glow1: rgba(98, 71, 230, .16);
  --glow2: rgba(61, 123, 255, .14);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #05060a;
  --bg2: #0d101b;
  --bg3: #131828;
  --bg-input: #0a0e1a;
  --fg: #e9edf7;
  --fg-dim: #8b93a8;
  --fg-faint: #566076;
  --border: #222b40;
  --border-strong: #323d5c;
  --accent: #7c5cff;
  --accent2: #4c8dff;
  --accent-soft: rgba(124, 92, 255, .12);
  --bubble-me: linear-gradient(135deg, #6a4fe6, #4470e0);
  --bubble-me-fg: #ffffff;
  --bubble-them: #131828;
  --bubble-them-fg: #d7dcea;
  --danger: #ff7a7a;
  --ok: #6bd68b;
  --shadow: 0 24px 80px rgba(0, 0, 0, .55);
  --shadow-btn: 0 10px 30px rgba(102, 108, 255, .35);
  --scroll: #1d2742;
  --glow1: rgba(91, 59, 214, .32);
  --glow2: rgba(31, 79, 214, .30);
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--fg);
  font-family: "Segoe UI Variable Display", "Segoe UI", system-ui, sans-serif;
  font-size: 15px; overflow: hidden; -webkit-font-smoothing: antialiased;
  transition: background .25s, color .25s;
}
::selection { background: rgba(98, 71, 230, .35); }

body::before, body::after {
  content: ''; position: fixed; z-index: 0; pointer-events: none;
  border-radius: 50%; filter: blur(110px);
}
body::before {
  width: 55vw; height: 55vw; left: -18vw; top: -22vw; opacity: .6;
  background: radial-gradient(circle, var(--glow1) 0%, transparent 70%);
  animation: drift1 26s ease-in-out infinite alternate;
}
body::after {
  width: 48vw; height: 48vw; right: -16vw; bottom: -20vw; opacity: .6;
  background: radial-gradient(circle, var(--glow2) 0%, transparent 70%);
  animation: drift2 32s ease-in-out infinite alternate;
}
@keyframes drift1 { to { transform: translate(9vw, 7vw) scale(1.15); } }
@keyframes drift2 { to { transform: translate(-8vw, -6vw) scale(1.1); } }

main { position: relative; z-index: 1; height: 100vh; width: 100%; overflow-y: auto; }
.screen { display: none; min-height: 100%; }
.screen.active { display: block; }

/* ---------- auth ---------- */
.authwrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 32px 20px; position: relative;
}
.card {
  width: 100%; max-width: 470px;
  background: color-mix(in srgb, var(--bg2) 88%, transparent);
  border: 1px solid var(--border); border-radius: 24px; padding: 28px;
  backdrop-filter: blur(18px); box-shadow: var(--shadow);
  animation: card-in .45s cubic-bezier(.2, .9, .3, 1);
}
@keyframes card-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

h1.title {
  font-size: 34px; font-weight: 800; text-align: center;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sub { font-size: 13px; color: var(--fg-dim); line-height: 1.55; text-align: center; margin-top: 8px; }

.logo { width: 72px; height: 72px; margin: 0 auto 18px; position: relative; display: flex; align-items: center; justify-content: center; }
.logo .ring {
  position: absolute; inset: -6px; border-radius: 26px;
  background: conic-gradient(var(--accent), var(--accent2), #3ad3d0, var(--accent));
  animation: spinring 6s linear infinite; filter: blur(6px); opacity: .55;
}
.logo .core {
  position: relative; width: 72px; height: 72px; border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 900; color: #fff;
  box-shadow: 0 12px 40px var(--shadow-btn);
}
@keyframes spinring { to { transform: rotate(360deg); } }

.cardhead { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.cardhead .mark {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; color: #fff;
}
.cardhead .t1 { font-size: 17px; font-weight: 700; letter-spacing: .18em; }
.cardhead .t2 { font-family: Consolas, monospace; font-size: 10.5px; color: var(--fg-faint); margin-top: 2px; }

h3.sect { font-size: 16.5px; font-weight: 650; margin-bottom: 4px; }
.hint { font-size: 13px; color: var(--fg-dim); line-height: 1.55; margin: 6px 0 14px; }
.hint b { color: var(--accent); font-weight: 600; }
label.f { display: block; font-size: 12px; color: var(--fg-dim); margin: 16px 0 6px; letter-spacing: .04em; }

input[type="text"], input[type="tel"], textarea {
  width: 100%; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 14px; color: var(--fg); padding: 13px 15px;
  font-size: 15px; font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input[type="text"]:focus, input[type="tel"]:focus, textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
::placeholder { color: var(--fg-faint); }

input[type="file"] {
  width: 100%; color: var(--fg-dim); font-size: 13px; font-family: Consolas, monospace;
  background: var(--bg-input); border: 1px dashed var(--border-strong); border-radius: 14px;
  padding: 13px 15px; cursor: pointer; transition: border-color .15s;
}
input[type="file"]:hover { border-color: var(--accent); }
input[type="file"]::file-selector-button {
  background: var(--accent-soft); border: 1px solid var(--border-strong); color: var(--accent);
  border-radius: 9px; padding: 6px 12px; font: inherit; margin-right: 12px; cursor: pointer;
}

/* телефонный ввод */
.phone-input { position: relative; }
.phone-input .flag {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  font-size: 17px; pointer-events: none;
}
.phone-input input { padding-left: 44px; letter-spacing: .06em; font-size: 17px; }

/* ---------- OTP (постепенное заполнение цифр номера) ---------- */
.otp { display: flex; gap: 7px; flex-wrap: wrap; }
.otp .d {
  width: 40px; height: 46px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 12px;
  color: var(--fg); font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 20px; text-align: center; outline: none; caret-color: var(--accent);
  transition: border-color .12s, box-shadow .12s, background .12s, transform .12s;
}
.otp .d:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); transform: translateY(-1px); }
.otp .d.filled { border-color: var(--border-strong); background: var(--bg3); }
.otp .d[data-ch="0"] { width: 34px; } /* первая «8» чуть уже */
.otp.done .d { border-color: rgba(33, 136, 56, .5); }

/* ---------- кнопки ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: 0; border-radius: 14px; color: #fff; padding: 14px 16px;
  font-size: 15px; font-weight: 650; width: 100%; margin-top: 16px; cursor: pointer;
  font-family: inherit; box-shadow: var(--shadow-btn);
  transition: transform .12s, filter .12s, box-shadow .12s;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.07); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; }
.btn.ghost {
  background: color-mix(in srgb, var(--fg) 4%, transparent);
  border: 1px solid var(--border-strong); color: var(--fg-dim); font-weight: 550; box-shadow: none;
}
.btn.ghost:hover { border-color: var(--fg-faint); filter: none; background: color-mix(in srgb, var(--fg) 7%, transparent); }

.seg { display: flex; gap: 8px; margin-top: 8px; }
.seg .btn { margin-top: 0; padding: 10px 12px; font-size: 13.5px; }
.seg .btn.ghost.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.msg { font-size: 12.5px; margin-top: 10px; min-height: 16px; color: var(--fg-dim); line-height: 1.4; }
.msg.err { color: var(--danger); }
.msg.ok { color: var(--ok); }

.duress {
  margin-top: 16px; border: 1px dashed var(--border-strong); border-radius: 14px;
  padding: 12px 14px; font-size: 12px; color: var(--fg-dim); line-height: 1.55;
}
.duress b { color: var(--accent); font-weight: 600; }

.chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 22px; }
.chip {
  font-family: Consolas, monospace; font-size: 10.5px; color: var(--fg-faint);
  border: 1px solid var(--border); border-radius: 99px; padding: 5px 11px; letter-spacing: .05em;
}

.filegrid {
  font-family: Consolas, monospace; font-size: 12px; line-height: 1.7;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; max-height: 200px; overflow: auto; white-space: pre; user-select: all;
  color: var(--fg-dim);
}
.filegrid .cur { color: var(--accent); font-weight: 600; }
.filegrid .mark { background: var(--accent-soft); color: var(--accent); border-radius: 4px; padding: 0 4px; }

.fp {
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border);
  font-family: Consolas, monospace; font-size: 10.5px; color: var(--fg-faint);
  text-align: center; letter-spacing: .08em;
}

/* маскировка: карточки-варианты */
.maskgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.maskopt {
  border: 1px solid var(--border); border-radius: 16px; padding: 16px 14px;
  cursor: pointer; background: var(--bg2); text-align: left; font-family: inherit;
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.maskopt:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.maskopt.sel { border-color: var(--accent); background: var(--accent-soft); }
.maskopt .ic { font-size: 22px; }
.maskopt .tt { font-weight: 650; font-size: 13.5px; margin-top: 8px; }
.maskopt .dd { font-size: 11.5px; color: var(--fg-dim); margin-top: 4px; line-height: 1.45; }

/* превью vCard/события */
.preview {
  margin-top: 12px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 14px; padding: 13px 15px; font-family: Consolas, monospace;
  font-size: 11.5px; color: var(--fg-dim); white-space: pre-wrap; word-break: break-all;
  max-height: 150px; overflow: auto; line-height: 1.6;
}

.stepper { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; }
.stepper .st { font-size: 11px; font-family: Consolas, monospace; color: var(--fg-faint); display: flex; align-items: center; gap: 6px; }
.stepper .st.on { color: var(--accent); }
.stepper .st .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); }
.stepper .st.on .dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.stepper .bar { flex: 1; height: 1px; background: var(--border); }

/* ============================================================
   ЧАТ (полноэкранный, список диалогов + переписка)
   ============================================================ */
#screen-chat.active { position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; }

.appbar {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; flex: none;
  background: color-mix(in srgb, var(--bg2) 85%, transparent);
  border-bottom: 1px solid var(--border); backdrop-filter: blur(16px);
}
.appbar .searchwrap { flex: 1; max-width: 560px; position: relative; }
.appbar input.search {
  width: 100%; padding: 11px 14px 11px 42px; border-radius: 13px;
  background: var(--bg-input); border: 1px solid var(--border); color: var(--fg);
  font-size: 14px; outline: none; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.appbar input.search:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.appbar .searchwrap .sic {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--fg-faint); pointer-events: none; width: 17px; height: 17px;
}
.appbar .right { display: flex; gap: 8px; margin-left: auto; }

.iconbtn {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  border: 1px solid var(--border-strong); color: var(--fg-dim);
  background: color-mix(in srgb, var(--fg) 3%, transparent);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: border-color .15s, color .15s, transform .12s;
}
.iconbtn:hover { border-color: var(--fg-faint); color: var(--fg); transform: translateY(-1px); }
.iconbtn svg { width: 19px; height: 19px; }
.iconbtn.theme svg { transition: transform .4s; }
.iconbtn.theme:hover svg { transform: rotate(60deg); }

/* список диалогов + область переписки */
.chatbody { flex: 1; display: flex; min-height: 0; max-width: 1080px; width: 100%; margin: 0 auto; }

.convlist {
  width: 340px; flex: none; border-right: 1px solid var(--border);
  overflow-y: auto; background: color-mix(in srgb, var(--bg2) 60%, transparent);
}
.convlist .myhead {
  padding: 16px 16px 10px; display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; background: color-mix(in srgb, var(--bg2) 92%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); z-index: 2;
}
.pfp {
  width: 44px; height: 44px; border-radius: 15px; flex: none;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 17px; position: relative;
}
.pfp .dot {
  position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px;
  border-radius: 50%; background: #2bd665; border: 2.5px solid var(--bg2); display: none;
}
.pfp.online .dot { display: block; animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(43, 214, 101, .5); } 70% { box-shadow: 0 0 0 7px rgba(43, 214, 101, 0); } 100% { box-shadow: 0 0 0 0 rgba(43, 214, 101, 0); } }
.pfp.g0 { background: linear-gradient(135deg, #7c5cff, #4c8dff); }
.pfp.g1 { background: linear-gradient(135deg, #3ad3d0, #4c8dff); }
.pfp.g2 { background: linear-gradient(135deg, #ff5c87, #b05cff); }
.pfp.g3 { background: linear-gradient(135deg, #ffb84c, #ff6a5c); }
.pfp.g4 { background: linear-gradient(135deg, #5cff9d, #3ad3d0); }
.pfp.g5 { background: linear-gradient(135deg, #b05cff, #6ea8ff); }
.pfp.g6 { background: linear-gradient(135deg, #ff8a4c, #ff5c87); }
.pfp.g7 { background: linear-gradient(135deg, #4c8dff, #3ad3d0); }

.convlist .myhead .nick { font-weight: 650; font-size: 15.5px; }
.convlist .myhead .fp { border: 0; padding: 0; margin: 0; font-family: Consolas, monospace; font-size: 10.5px; color: var(--fg-faint); text-align: left; }

.conv {
  display: flex; gap: 12px; padding: 12px 14px; cursor: pointer; align-items: center;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  transition: background .12s;
}
.conv:hover { background: var(--accent-soft); }
.conv.sel { background: var(--accent-soft); }
.conv .mid { flex: 1; min-width: 0; }
.conv .nm { font-weight: 600; font-size: 14.5px; display: flex; justify-content: space-between; }
.conv .nm .tm { font-size: 10.5px; color: var(--fg-faint); font-family: Consolas, monospace; font-weight: 400; }
.conv .ls { font-size: 12.5px; color: var(--fg-dim); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .ls b { color: var(--fg); font-weight: 600; }
.conv .unread { background: var(--accent); color: #fff; border-radius: 99px; font-size: 10.5px; padding: 2px 8px; font-weight: 700; }

/* область переписки */
.thread { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.thread .thead {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg2) 85%, transparent); backdrop-filter: blur(10px);
}
.thread .thead .who { flex: 1; min-width: 0; }
.thread .thead .pname { font-weight: 650; font-size: 15.5px; }
.thread .thead .pstatus { font-family: Consolas, monospace; font-size: 10.5px; color: var(--fg-faint); margin-top: 1px; }
.thread .thead .pstatus.ok { color: var(--ok); }

.log { flex: 1; overflow-y: auto; padding: 18px 16px 8px; display: flex; flex-direction: column; gap: 3px; }
.log .col { max-width: 780px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 3px; }

.m {
  max-width: 68%; padding: 10px 15px; font-size: 14.5px; line-height: 1.5;
  word-break: break-word; white-space: pre-wrap;
  animation: msg-in .28s cubic-bezier(.2, .9, .3, 1);
}
@keyframes msg-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
.m .tm { display: block; font-size: 9.5px; opacity: .6; margin-top: 3px; font-family: Consolas, monospace; text-align: right; }
.m.me {
  align-self: flex-end; color: var(--bubble-me-fg);
  background: var(--bubble-me); border-radius: 18px 18px 5px 18px;
  box-shadow: 0 6px 22px rgba(84, 100, 255, .18);
}
.m.them {
  align-self: flex-start; color: var(--bubble-them-fg);
  background: var(--bubble-them); border: 1px solid var(--border);
  border-radius: 18px 18px 18px 5px; box-shadow: 0 2px 10px rgba(30, 41, 80, .06);
}
.m.them.cont, .m.me.cont { margin-top: 2px; }
.m.sys {
  align-self: center; font-size: 11px; color: var(--fg-faint);
  font-family: Consolas, monospace; padding: 6px 4px; margin: 8px 0; animation: none; text-align: center;
}
.m .call {
  display: flex; align-items: center; gap: 9px; padding: 2px 0;
}
.m .call .cic { width: 30px; height: 30px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.22); }
.m.them .call .cic { background: var(--accent-soft); }
.m .call .cic svg { width: 15px; height: 15px; }
.m .call .cdur { font-family: Consolas, monospace; font-size: 12px; opacity: .85; }

/* вложения */
.m .att {
  display: flex; align-items: center; gap: 10px; margin-top: 6px;
  background: rgba(255,255,255,.14); border-radius: 12px; padding: 9px 12px;
  text-decoration: none; color: inherit; cursor: pointer;
}
.m.them .att { background: var(--bg3); border: 1px solid var(--border); }
.m .att .fic { font-size: 21px; flex: none; }
.m .att .fmeta { min-width: 0; }
.m .att .fname { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.m .att .fsize { font-size: 10px; opacity: .7; font-family: Consolas, monospace; margin-top: 1px; }
.m .att:hover { filter: brightness(1.05); }
.m img.attimg { max-width: 280px; max-height: 220px; border-radius: 12px; display: block; margin-top: 6px; cursor: zoom-in; }

.empty {
  align-self: center; margin: auto; max-width: 440px; text-align: center;
  padding: 34px 26px; border: 1px dashed var(--border-strong); border-radius: 20px;
  color: var(--fg-dim); font-size: 13.5px; line-height: 1.6;
}
.empty .big { font-size: 15px; color: var(--fg); font-weight: 600; margin-bottom: 6px; }

/* композер */
.composer {
  flex: none; padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg2) 88%, transparent);
  border-top: 1px solid var(--border); backdrop-filter: blur(16px);
  display: flex; gap: 10px; align-items: flex-end; max-width: 820px; width: 100%; margin: 0 auto;
}
.composer .inp {
  flex: 1; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 22px; color: var(--fg); padding: 12px 18px; font-size: 14.5px;
  font-family: inherit; outline: none; resize: none; max-height: 130px; line-height: 1.45;
  transition: border-color .15s, box-shadow .15s;
}
.composer .inp:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer .inp.hasfile {
  border-top-left-radius: 14px; border-top-right-radius: 14px; margin-bottom: 46px;
}
.filechip {
  position: absolute; left: 4px; bottom: 58px; display: flex; gap: 9px; align-items: center;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 12px;
  padding: 7px 12px; font-size: 12px; max-width: 78%;
}
.filechip .fname { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filechip .fsize { color: var(--fg-faint); font-family: Consolas, monospace; font-size: 10px; }
.filechip .x { cursor: pointer; color: var(--danger); font-weight: 700; margin-left: 4px; }
.composerwrap { position: relative; flex: 1; display: flex; gap: 10px; align-items: flex-end; }

.toolbtn {
  width: 46px; height: 46px; border-radius: 50%; flex: none; border: 1px solid var(--border-strong);
  color: var(--fg-dim); background: color-mix(in srgb, var(--fg) 3%, transparent);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: border-color .15s, color .15s, transform .12s;
}
.toolbtn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.toolbtn svg { width: 20px; height: 20px; }
.sendbtn {
  width: 46px; height: 46px; border-radius: 50%; flex: none; border: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: var(--shadow-btn); transition: transform .12s, filter .12s;
}
.sendbtn:hover { transform: translateY(-2px) scale(1.04); filter: brightness(1.08); }
.sendbtn svg { width: 20px; height: 20px; margin-right: -2px; }

.strip {
  flex: none; text-align: center; font-family: Consolas, monospace;
  font-size: 10px; color: var(--fg-faint); padding: 0 0 10px; letter-spacing: .08em;
}

/* ---------- поиск: подсветка ---------- */
.log mark { background: rgba(255, 200, 0, .5); color: inherit; border-radius: 3px; padding: 0 1px; }
[data-theme="dark"] .log mark { background: rgba(255, 200, 0, .35); }

/* ---------- звонок ---------- */
#callOverlay {
  position: fixed; inset: 0; z-index: 70; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: color-mix(in srgb, var(--bg) 84%, transparent); backdrop-filter: blur(14px);
}
#callOverlay.on { display: flex; animation: card-in .3s; }
#callOverlay .callring {
  width: 120px; height: 120px; border-radius: 50%; position: relative;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 42px; font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 20px 70px var(--shadow-btn);
}
#callOverlay .callring::before {
  content: ''; position: absolute; inset: -14px; border-radius: 50%;
  border: 2px solid var(--accent); opacity: 0; animation: ringpulse 1.6s ease-out infinite;
}
@keyframes ringpulse { 0% { transform: scale(.9); opacity: .7; } 100% { transform: scale(1.35); opacity: 0; } }
#callOverlay .cname { font-size: 22px; font-weight: 700; }
#callOverlay .cstate { font-family: Consolas, monospace; font-size: 13px; color: var(--fg-dim); letter-spacing: .06em; }
#callOverlay .cbtns { display: flex; gap: 22px; margin-top: 14px; }
.cbtn {
  width: 62px; height: 62px; border-radius: 50%; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #fff;
  box-shadow: 0 12px 34px rgba(0,0,0,.25); transition: transform .12s, filter .12s;
}
.cbtn:hover { transform: scale(1.06); }
.cbtn svg { width: 24px; height: 24px; }
.cbtn.red { background: linear-gradient(135deg, #ff5c5c, #e5484d); }
.cbtn.grn { background: linear-gradient(135deg, #2bd665, #218838); }
.cbtn.grn { animation: ringshake 1.2s ease-in-out infinite; }
@keyframes ringshake { 0%,100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }

/* ---------- оверлей ожидания ---------- */
#waitOverlay {
  position: fixed; inset: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center; flex-direction: column; gap: 16px;
}
#waitOverlay .big { font-size: 18px; color: var(--accent); font-weight: 650; }
#waitOverlay .small { font-size: 12px; color: var(--fg-dim); }
.spin { width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* просмотр картинки */
#imgViewer {
  position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,.86); cursor: zoom-out;
}
#imgViewer.on { display: flex; }
#imgViewer img { max-width: 92vw; max-height: 92vh; border-radius: 12px; }

.hidden { display: none !important; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

@media (max-width: 860px) {
  .convlist { width: 100%; border-right: 0; }
  .convlist.hidden-mobile { display: none; }
  .thread.mobile-hidden { display: none; }
  .chatbody.showthread .convlist { display: none; }
  .chatbody:not(.showthread) .thread { display: none; }
}
@media (max-width: 720px) {
  .card { padding: 22px 18px; }
  .m { max-width: 84%; }
  .maskgrid { grid-template-columns: 1fr; }
  .appbar .searchwrap { max-width: none; }
}
