/* ═══════════════════════ ЗАСЛОН — стили (tactical neon) ═══════════════════════ */

:root {
  --radius: 4px;
  --radius-sm: 3px;
  --cut: 16px;
  --cut-sm: 8px;
  --rail-w: 80px;
  --side-w: 350px;
  --gap: 12px;
  --font: 'Exo 2', system-ui, sans-serif;
  --font-head: 'Unbounded', 'Exo 2', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --blur: 22px;
  --hud: #c6ff00;
}

/* ── Тёмная: ядовитый лайм на чёрном */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #060708;
  --accent: #c6ff00;
  --accent-ink: #090b04;
  --accent2: #ff5a1f;
  --amber: #ffb800;
  --danger: #ff3b3b;
  --ok: #3dff8a;
  --glass: rgba(14, 16, 13, .58);
  --glass-strong: rgba(10, 11, 9, .9);
  --glass-hover: rgba(198, 255, 0, .07);
  --glass-border: rgba(198, 255, 0, .14);
  --glass-hi: rgba(255, 255, 255, .04);
  --input: rgba(0, 0, 0, .45);
  --text: #eef2e8;
  --text-dim: #8d947e;
  --text-faint: #555b4b;
  --bubble-me: rgba(198, 255, 0, .12);
  --bubble-them: rgba(24, 27, 22, .72);
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, .9);
  --grid: rgba(198, 255, 0, .05);
  --slash: rgba(198, 255, 0, .035);
  --scan: rgba(0, 0, 0, .22);
  --mark: rgba(198, 255, 0, .045);
  --noise-op: .08;
  --blob-a: rgba(198, 255, 0, .22);
  --blob-b: rgba(255, 90, 31, .18);
  --blob-c: rgba(31, 255, 176, .10);
  --vignette: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, .75));
}

/* ── Светлая: сигнальный оранжевый на белом */
[data-theme="light"] {
  color-scheme: light;
  --bg: #ebeae5;
  --accent: #ff4d00;
  --accent-ink: #ffffff;
  --accent2: #111111;
  --amber: #c27a00;
  --danger: #e0201b;
  --ok: #109a4a;
  --glass: rgba(255, 255, 255, .55);
  --glass-strong: rgba(250, 250, 247, .92);
  --glass-hover: rgba(255, 77, 0, .07);
  --glass-border: rgba(15, 15, 15, .14);
  --glass-hi: rgba(255, 255, 255, .7);
  --input: rgba(255, 255, 255, .75);
  --text: #0c0d0b;
  --text-dim: #55574f;
  --text-faint: #9a9b93;
  --bubble-me: rgba(255, 77, 0, .11);
  --bubble-them: rgba(255, 255, 255, .78);
  --shadow: 0 24px 50px -26px rgba(0, 0, 0, .35);
  --grid: rgba(0, 0, 0, .05);
  --slash: rgba(0, 0, 0, .04);
  --scan: rgba(0, 0, 0, .03);
  --mark: rgba(0, 0, 0, .04);
  --noise-op: .1;
  --blob-a: rgba(255, 77, 0, .22);
  --blob-b: rgba(184, 230, 0, .22);
  --blob-c: rgba(0, 0, 0, .06);
  --vignette: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .12));
}

/* уголки-скобки на неразрезанных углах + срез */
:root {
  --brk:
    linear-gradient(var(--accent), var(--accent)) right top / 18px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) right top / 2px 18px no-repeat,
    linear-gradient(var(--accent), var(--accent)) left bottom / 18px 2px no-repeat,
    linear-gradient(var(--accent), var(--accent)) left bottom / 2px 18px no-repeat;
  --chamfer: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  --chamfer-sm: polygon(var(--cut-sm) 0, 100% 0, 100% calc(100% - var(--cut-sm)), calc(100% - var(--cut-sm)) 100%, 0 100%, 0 var(--cut-sm));
  --hazard: repeating-linear-gradient(-45deg, var(--accent) 0 8px, transparent 8px 16px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden;
  background: var(--bg); color: var(--text);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  transition: background-color .5s;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-head); font-weight: 800; letter-spacing: .02em; margin: 0; text-transform: uppercase; }
.hidden { display: none !important; }
.mono { font-family: var(--font-mono); font-size: .86em; letter-spacing: .02em; }
.dim { color: var(--text-dim); }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

::selection { background: var(--accent); color: var(--accent-ink); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--accent) 35%, transparent); }
::-webkit-scrollbar-track { background: transparent; }

/* ═══════════ Фон ═══════════ */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--bg); transition: background-color .5s; }
.blob { position: absolute; border-radius: 50%; filter: blur(90px); will-change: transform; }
.b1 { width: 55vmax; height: 55vmax; left: -15vmax; top: -20vmax; background: radial-gradient(circle, var(--blob-a), transparent 65%); animation: float1 26s ease-in-out infinite alternate; }
.b2 { width: 50vmax; height: 50vmax; right: -18vmax; bottom: -22vmax; background: radial-gradient(circle, var(--blob-b), transparent 65%); animation: float2 32s ease-in-out infinite alternate; }
.b3 { width: 35vmax; height: 35vmax; left: 40%; top: 35%; background: radial-gradient(circle, var(--blob-c), transparent 65%); animation: float3 40s ease-in-out infinite alternate; }
@keyframes float1 { to { transform: translate(18vw, 22vh) scale(1.15); } }
@keyframes float2 { to { transform: translate(-22vw, -18vh) scale(1.2); } }
@keyframes float3 { to { transform: translate(-30vw, 10vh) scale(.8); } }
.bg-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 80%);
  animation: gridMove 30s linear infinite;
}
@keyframes gridMove { to { background-position: 56px 56px; } }
.bg-slash { position: absolute; inset: 0; background: repeating-linear-gradient(-45deg, transparent 0 26px, var(--slash) 26px 28px); mask-image: linear-gradient(225deg, #000, transparent 45%); }
.bg-mark {
  position: absolute; right: -2vw; bottom: -4vw; font: 900 22vw/1 var(--font-head); letter-spacing: -.03em;
  color: transparent; -webkit-text-stroke: 2px var(--mark); user-select: none; white-space: nowrap;
}
.bg-scan { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, var(--scan) 0 1px, transparent 1px 4px); opacity: .5; }
.bg-noise {
  position: absolute; inset: 0; opacity: var(--noise-op); mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.bg-vignette { position: absolute; inset: 0; background: var(--vignette); }

/* ═══════════ Стекло ═══════════ */
.glass, .glass-strong {
  background: var(--glass);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow), inset 0 1px 0 var(--glass-hi);
  transition: background-color .5s, border-color .5s;
}
.glass-strong { background: var(--glass-strong); }

/* срезанные углы и скобки на крупных блоках */
.rail, .side, .chat-head, .composer, .modal, .login-card, .drone-card, .stat, .table-wrap, .map-wrap, .panel, .logs, .drones-empty, .toast, .ctx {
  clip-path: var(--chamfer);
}
.side, .login-card, .modal, .stat, .panel, .drones-empty, .chat-head { background: var(--brk), var(--glass); }
.modal, .login-card { background: var(--brk), var(--glass-strong); }

/* ── Глитч */
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after {
  content: attr(data-text); position: absolute; inset: 0; pointer-events: none; padding: inherit;
}
.glitch::before { color: var(--accent2); transform: translate(-3px, 0); clip-path: inset(0 0 60% 0); animation: glitchA 3.2s infinite steps(1); mix-blend-mode: screen; opacity: .85; }
.glitch::after { color: var(--accent); transform: translate(3px, 0); clip-path: inset(55% 0 0 0); animation: glitchB 2.7s infinite steps(1); opacity: .85; }
[data-theme="light"] .glitch::before { mix-blend-mode: multiply; }
@keyframes glitchA { 0%, 86%, 100% { transform: translate(0); opacity: 0; } 87% { transform: translate(-5px, -1px); clip-path: inset(10% 0 55% 0); opacity: .9; } 90% { transform: translate(4px, 1px); clip-path: inset(60% 0 10% 0); } 93% { transform: translate(-2px, 0); clip-path: inset(30% 0 40% 0); } }
@keyframes glitchB { 0%, 80%, 100% { transform: translate(0); opacity: 0; } 81% { transform: translate(5px, 1px); clip-path: inset(70% 0 5% 0); opacity: .9; } 84% { transform: translate(-4px, -1px); clip-path: inset(20% 0 65% 0); } 87% { transform: translate(2px, 0); clip-path: inset(45% 0 30% 0); } }

/* ═══════════ Загрузчик ═══════════ */
#loader {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: var(--bg);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  transition: clip-path .9s cubic-bezier(.7, 0, .2, 1);
}
#loader::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, var(--scan) 0 1px, transparent 1px 3px); pointer-events: none; }
#loader::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--hazard); opacity: .8; animation: hazardMove 1s linear infinite; }
#loader.out { clip-path: polygon(0 0, 100% 0, 100% 0, 0 0); pointer-events: none; }
@keyframes hazardMove { to { background-position: 32px 0; } }
.radar {
  width: 200px; height: 200px; border-radius: 50%; position: relative; overflow: hidden;
  border: 2px solid var(--accent);
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%);
  box-shadow: 0 0 80px color-mix(in srgb, var(--accent) 30%, transparent), inset 0 0 50px color-mix(in srgb, var(--accent) 16%, transparent);
  animation: radarIn .9s var(--spring) both;
}
.radar::before, .radar::after { content: ''; position: absolute; background: color-mix(in srgb, var(--accent) 35%, transparent); }
.radar::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.radar::after { top: 50%; left: 0; right: 0; height: 1px; }
.radar-ring { position: absolute; border-radius: 50%; border: 1px dashed color-mix(in srgb, var(--accent) 35%, transparent); }
.radar-sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0deg 270deg, color-mix(in srgb, var(--accent) 75%, transparent) 360deg);
  animation: spin 1.8s linear infinite;
}
.blip { position: absolute; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: var(--accent2); box-shadow: 0 0 16px var(--accent2); opacity: 0; animation: blip 1.8s infinite; }
.loader-title {
  font-family: var(--font-head); font-weight: 900; font-size: clamp(40px, 8vw, 72px); letter-spacing: .08em; line-height: 1;
  text-shadow: 0 0 30px color-mix(in srgb, var(--accent) 40%, transparent);
  animation: titleIn 1s .15s var(--ease) both;
}
.loader-sub { font: 700 11px var(--font-mono); letter-spacing: .6em; padding: 6px 12px; background: var(--accent); color: var(--accent-ink); clip-path: var(--chamfer-sm); animation: fadeUp .6s .5s both; }
.loader-log { width: min(380px, 86vw); min-height: 116px; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); margin-top: 6px; }
.loader-log div { display: flex; gap: 8px; opacity: 0; transform: translateX(-10px); transition: .25s var(--ease); white-space: nowrap; }
.loader-log div.show { opacity: 1; transform: none; }
.loader-log .pfx { color: var(--accent); }
.loader-log .dots { flex: 1; overflow: hidden; color: var(--text-faint); }
.loader-log .dots::after { content: '////////////////////////////////////////////////'; }
.loader-log b { color: var(--accent); font-weight: 700; opacity: 0; transition: .2s; }
.loader-log div.done b { opacity: 1; }
.loader-bar { width: min(380px, 86vw); height: 10px; border: 1px solid var(--accent); padding: 2px; clip-path: var(--chamfer-sm); }
.loader-bar i { display: block; height: 100%; width: 0; background: var(--hazard); background-color: color-mix(in srgb, var(--accent) 35%, transparent); animation: hazardMove .6s linear infinite; transition: width .4s var(--ease); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes blip { 0%, 100% { opacity: 0; transform: scale(.4); } 15% { opacity: 1; transform: scale(1.3); } 60% { opacity: .2; } }
@keyframes radarIn { from { transform: scale(.3) rotate(-90deg); opacity: 0; } }
@keyframes titleIn { from { letter-spacing: .6em; opacity: 0; filter: blur(10px); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(8px); } }
@keyframes shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 100% { box-shadow: 0 0 0 18px transparent; } }

/* ═══════════ Общие элементы ═══════════ */
.screen { position: fixed; inset: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 13px;
  background: var(--glass); border: 1px solid var(--glass-border); clip-path: var(--chamfer-sm);
  transition: transform .2s var(--ease), background-color .2s, color .2s, filter .2s, opacity .2s;
  white-space: nowrap; position: relative; overflow: hidden;
}
.btn::after { content: ''; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%; background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent); transform: skewX(-20deg); transition: left .5s var(--ease); pointer-events: none; }
.btn:hover::after { left: 130%; }
.btn:hover { transform: translateY(-1px); background: var(--glass-hover); border-color: var(--accent); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 50%, transparent); }
.btn.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 7px 12px; font-size: 11px; }
.btn.wide { width: 100%; padding: 15px; font-size: 14px; }
.btn .ic { width: 17px; height: 17px; }

.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center; flex: none; clip-path: var(--chamfer-sm);
  color: var(--text-dim); transition: background-color .2s, color .2s, transform .2s var(--spring);
}
.icon-btn:hover { background: var(--glass-hover); color: var(--accent); }
.icon-btn:active { transform: scale(.88); }
.icon-btn.accent { background: var(--accent); color: var(--accent-ink); width: 46px; height: 46px; }
.icon-btn.accent:hover { filter: brightness(1.1); color: var(--accent-ink); box-shadow: 0 0 24px var(--accent); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .ic { width: 16px; height: 16px; }
.icon-btn.danger:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }

.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 6px; font: 700 10.5px var(--font-mono); color: var(--text-dim); text-transform: uppercase; letter-spacing: .14em; }
.form label.check { flex-direction: row; align-items: center; gap: 10px; text-transform: none; letter-spacing: 0; font: 500 14px var(--font); cursor: pointer; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea, select {
  width: 100%; padding: 12px 14px; border-radius: 0;
  background: var(--input); border: 1px solid var(--glass-border); border-left: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline: none;
  font: 500 15px var(--font); text-transform: none; letter-spacing: normal;
  transition: border-color .2s, box-shadow .2s, background-color .2s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 24px -6px var(--accent); }
select option { background: var(--bg); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.input-icon, .input-prefix { position: relative; display: flex; align-items: center; }
.input-icon .ic { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--accent); pointer-events: none; }
.input-icon input { padding-left: 44px !important; }
.input-prefix span { position: absolute; left: 15px; color: var(--accent); font-weight: 800; }
.input-prefix input { padding-left: 32px !important; }
.input-action { position: relative; }
.input-action input { padding-right: 84px !important; }
.input-action .acts { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: flex; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; font-weight: 700; }

.badge {
  position: absolute; top: 3px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--accent2); color: #fff; font: 700 10.5px/18px var(--font-mono); text-align: center;
  clip-path: polygon(4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%, 0 4px);
  transform: scale(0); transition: transform .3s var(--spring);
}
.badge.show { transform: scale(1); }
.badge.live { background: var(--danger); }
.badge.live.show { animation: blink 1.2s infinite; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; font: 700 10px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; background: var(--glass-hover); color: var(--text-dim); border: 1px solid var(--glass-border); clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px); }
.pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.pill.bad { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.pill.warn { color: var(--amber); background: color-mix(in srgb, var(--amber) 12%, transparent); border-color: color-mix(in srgb, var(--amber) 35%, transparent); }
.pill.acc { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }

.spinner { width: 34px; height: 34px; border: 3px solid color-mix(in srgb, var(--accent) 18%, transparent); border-top-color: var(--accent); border-right-color: var(--accent); animation: spin .7s linear infinite; }

/* ── Аватары (шестигранник) */
.ava {
  --s: 44px; width: var(--s); height: var(--s); flex: none; position: relative;
  display: grid; place-items: center;
  color: #fff; font: 800 calc(var(--s) * .32) var(--font-head);
}
.ava::before {
  content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, var(--ava-bg, #3d4d0a), color-mix(in srgb, var(--ava-bg, #3d4d0a) 45%, #000));
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
}
.ava > span { position: relative; }
.ava img { position: relative; width: 100%; height: 100%; object-fit: cover; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.ava .dot { position: absolute; right: 2%; bottom: 2%; width: calc(var(--s) * .26); height: calc(var(--s) * .26); min-width: 10px; min-height: 10px; background: var(--ok); border: 2px solid var(--bg); transform: rotate(45deg); box-shadow: 0 0 10px var(--ok); animation: pop .3s var(--spring); }

/* ═══════════ Вход ═══════════ */
#login { display: grid; place-items: center; padding: 20px; }
#login.leaving .login-card { animation: loginOut .45s var(--ease) forwards; }
@keyframes loginOut { to { opacity: 0; transform: scale(1.05); filter: blur(10px); } }
.login-card {
  width: min(430px, 100%); padding: 40px 34px 30px; text-align: center; position: relative;
  animation: loginIn .8s var(--ease) both;
}
.login-card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--hazard); opacity: .9; animation: hazardMove 1.4s linear infinite; }
.login-card.shake { animation: shake .5s; }
@keyframes loginIn { from { opacity: 0; transform: translateY(40px) scale(.95); filter: blur(12px); } }
.login-card h1 { font-size: 40px; font-weight: 900; letter-spacing: .06em; margin-top: 16px; }
.login-sub { margin: 10px 0 28px; letter-spacing: .4em; font-size: 10.5px; color: var(--accent) !important; }
.login-card .form { text-align: left; }
.login-card .hint { font: 11px var(--font-mono); color: var(--text-faint); margin: 20px 0 0; letter-spacing: .05em; }
.login-emblem { width: 100px; height: 100px; margin: 0 auto; position: relative; display: grid; place-items: center; color: var(--accent); }
.login-emblem > .ic { width: 48px; height: 48px; filter: drop-shadow(0 0 18px var(--accent)); }
.emblem-ring { position: absolute; inset: 0; width: 100%; height: 100%; animation: spin 10s linear infinite; }
.emblem-ring circle { fill: none; stroke: var(--accent); stroke-width: 3; stroke-dasharray: 20 14 4 14; }
.theme-float { position: fixed; top: 18px; right: 18px; background: var(--glass); border: 1px solid var(--glass-border); backdrop-filter: blur(12px); }

/* ═══════════ Каркас приложения ═══════════ */
#app {
  display: grid; grid-template-columns: var(--rail-w) var(--side-w) minmax(0, 1fr);
  gap: var(--gap); padding: var(--gap); height: 100dvh;
}
#app.no-side { grid-template-columns: var(--rail-w) minmax(0, 1fr); }
#app.no-side .side { display: none; }
#app.enter .rail { animation: slideRight .6s var(--ease) both; }
#app.enter .side { animation: slideRight .6s .08s var(--ease) both; }
#app.enter .main { animation: fadeUp .7s .16s var(--ease) both; }
@keyframes slideRight { from { opacity: 0; transform: translateX(-40px); clip-path: inset(0 100% 0 0); } }
#app.offline::after {
  content: '// НЕТ СВЯЗИ С СЕРВЕРОМ — ПЕРЕПОДКЛЮЧЕНИЕ'; position: fixed; top: 0; left: 50%; transform: translateX(-50%);
  padding: 7px 18px; background: var(--danger); color: #fff; font: 700 11px var(--font-mono); letter-spacing: .12em; z-index: 50;
  clip-path: polygon(0 0, 100% 0, calc(100% - 10px) 100%, 10px 100%); animation: blink 1.2s infinite;
}

/* Плашка «Доступна новая версия» */
.update-bar { position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 3700; display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; font: 700 12px var(--font-mono); clip-path: var(--chamfer-sm); animation: pop .3s var(--spring); white-space: nowrap; }
.update-bar .ic { width: 16px; height: 16px; color: var(--accent); }

/* ── Рейка навигации */
.rail { display: flex; flex-direction: column; align-items: center; padding: 16px 0; gap: 6px; position: relative; }
.rail::before { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 40px; background: repeating-linear-gradient(-45deg, var(--slash) 0 4px, transparent 4px 8px); pointer-events: none; }
.rail-logo { width: 48px; height: 48px; display: grid; place-items: center; color: var(--accent-ink); background: var(--accent); margin-bottom: 14px; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.rail-logo .ic { width: 24px; height: 24px; stroke-width: 2.4; }
.rail-btn {
  width: 54px; height: 54px; position: relative; display: grid; place-items: center; clip-path: var(--chamfer-sm);
  color: var(--text-dim); transition: color .25s, background-color .25s, transform .25s var(--spring);
}
.rail-btn em { display: none; }
.rail-btn:hover { color: var(--accent); background: var(--glass-hover); }
.rail-btn:active { transform: scale(.88); }
.rail-btn .ic { width: 23px; height: 23px; }
.rail-btn.active { color: var(--accent-ink); background: var(--accent); box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 45%, transparent); }
.rail-btn.active .ic { filter: none; }
.rail-btn.active::before { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.4) 50%, transparent 70%); background-size: 250% 100%; animation: shine 2.4s infinite; }
@keyframes shine { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.rail-spacer { flex: 1; }
.rail-me { margin-top: 8px; transition: transform .25s var(--spring); }
.rail-me:hover { transform: scale(1.1) rotate(-6deg); }

/* ── Боковая панель */
.side { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 16px 10px 22px; }
.side-head h2 { font-size: 20px; font-weight: 900; }
.side-head h2::after { content: ''; display: block; width: 36px; height: 3px; background: var(--accent); margin-top: 6px; box-shadow: 0 0 12px var(--accent); }
.search { margin: 4px 14px 10px; position: relative; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--accent); }
.search input { padding-left: 42px !important; }
.list { flex: 1; overflow-y: auto; padding: 4px 8px 12px; }
.li {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; position: relative;
  border-left: 3px solid transparent;
  transition: background-color .2s, border-color .2s, transform .2s var(--ease);
  animation: liIn .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 28ms);
}
@keyframes liIn { from { opacity: 0; transform: translateX(-18px); } }
.li:hover { background: var(--glass-hover); border-left-color: color-mix(in srgb, var(--accent) 50%, transparent); transform: translateX(2px); }
.li.active { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 18%, transparent), transparent); border-left-color: var(--accent); }
.li-main { flex: 1; min-width: 0; }
.li-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.li-row b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-row time { font: 10.5px var(--font-mono); color: var(--text-faint); flex: none; }
.li-sub { font-size: 13.5px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-sub.on, .li-sub.typing { color: var(--accent); }
.li-sub.typing { font-style: italic; }
.cnt { flex: none; min-width: 22px; height: 20px; padding: 0 6px; background: var(--accent); color: var(--accent-ink); font: 800 11px/20px var(--font-mono); text-align: center; font-style: normal; clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px); animation: pop .3s var(--spring); }
.li-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .2s; }
.li:hover .li-actions { opacity: 1; }
.list-empty { text-align: center; padding: 50px 20px; color: var(--text-dim); animation: fadeUp .5s both; }
.list-empty .ic { width: 42px; height: 42px; color: var(--accent); opacity: .6; margin-bottom: 10px; }
.list-empty b { display: block; color: var(--text); margin-bottom: 4px; font-family: var(--font-head); text-transform: uppercase; font-size: 13px; }

/* ── Основная область */
.main { min-width: 0; min-height: 0; position: relative; }
.view { height: 100%; min-height: 0; display: flex; flex-direction: column; }
.view.view-in { animation: viewIn .5s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(16px); filter: blur(6px); } }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 8px 6px 18px; }
.view-head h2 { font-size: 26px; font-weight: 900; display: flex; align-items: center; gap: 12px; }
.view-head h2 .ic { width: 30px; height: 30px; color: var(--accent); filter: drop-shadow(0 0 10px var(--accent)); }
.view-head p { margin: 6px 0 0; letter-spacing: .12em; }

.empty-state { margin: auto; text-align: center; padding: 30px; animation: fadeUp .6s both; }
.empty-state h3 { font-size: 20px; margin-top: 24px; font-weight: 900; }
.empty-state p { margin: 8px 0 0; }
.mini-radar { width: 130px; height: 130px; margin: 0 auto; border-radius: 50%; position: relative; overflow: hidden; border: 2px solid var(--accent); box-shadow: 0 0 50px color-mix(in srgb, var(--accent) 25%, transparent); background: repeating-radial-gradient(circle, transparent 0 20px, color-mix(in srgb, var(--accent) 25%, transparent) 20px 21px); }
.mini-radar i { position: absolute; inset: 0; background: conic-gradient(transparent 0 270deg, color-mix(in srgb, var(--accent) 65%, transparent) 360deg); animation: spin 2.4s linear infinite; }

/* ═══════════ Чат ═══════════ */
.chat { height: 100%; display: flex; flex-direction: column; gap: 10px; position: relative; min-height: 0; }
.chat.chat-in { animation: viewIn .4s var(--ease) both; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 18px; }
.chat-peer { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.chat-peer b { display: block; font: 800 15px var(--font-head); text-transform: uppercase; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-peer small { color: var(--text-dim); font: 11.5px var(--font-mono); }
.chat-peer small.on { color: var(--accent); }
.chat-actions { display: flex; gap: 2px; }
.mobile-only { display: none; }

.messages { flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.msgs-loading { margin: auto; }
.chat-intro { margin: auto; text-align: center; color: var(--text-dim); animation: fadeUp .5s both; }
.chat-intro .ic { width: 56px; height: 56px; color: var(--accent); filter: drop-shadow(0 0 16px var(--accent)); }
.day { align-self: center; margin: 12px 0 8px; position: sticky; top: 0; z-index: 2; }
.day span { display: inline-block; padding: 5px 14px; font: 700 10px var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); background: var(--glass-strong); backdrop-filter: blur(10px); border: 1px solid var(--glass-border); clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%); }

.msg { display: flex; }
.msg.me { justify-content: flex-end; }
.msg.pop .bubble, .msg.pop > span { animation: msgIn .38s var(--spring) both; }
.msg.me.pop .bubble { transform-origin: bottom right; }
.msg.them.pop .bubble { transform-origin: bottom left; }
@keyframes msgIn { from { opacity: 0; transform: scale(.85) translateY(14px); } }
.msg.removing { animation: msgOut .3s var(--ease) forwards; }
@keyframes msgOut { to { opacity: 0; transform: scale(.9) translateX(30px); height: 0; margin: 0; } }
.bubble {
  max-width: min(560px, 78%); padding: 9px 13px 7px; position: relative;
  background: var(--bubble-them); border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  clip-path: polygon(10px 0, 100% 0, 100% 100%, 0 100%, 0 10px);
  word-wrap: break-word; overflow-wrap: anywhere;
}
.msg.me .bubble {
  background: var(--bubble-me); border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
  box-shadow: inset 3px 0 0 var(--accent);
}
.m-text { white-space: pre-wrap; }
.m-text a { word-break: break-all; }
.meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 2px; font: 10px var(--font-mono); color: var(--text-faint); float: right; margin-left: 12px; position: relative; top: 5px; }
.bubble::after { content: ''; display: block; clear: both; }
.ticks .ic { width: 15px; height: 15px; }
.ticks.read { color: var(--accent); }
.m-img { display: block; max-width: 100%; max-height: 360px; cursor: zoom-in; margin: 2px 0 4px; background: rgba(0,0,0,.2); transition: filter .2s; }
.m-img:hover { filter: brightness(1.1) contrast(1.05); }
.t-image .bubble, .t-video .bubble { padding: 4px 4px 4px; }
.t-image .meta, .t-video .meta { padding-right: 6px; }
.m-video { display: block; max-width: 100%; max-height: 380px; background: #000; }
.m-file { display: flex; align-items: center; gap: 12px; padding: 6px 2px; text-decoration: none; color: inherit; min-width: 220px; }
.m-file-ic { width: 44px; height: 44px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); flex: none; clip-path: var(--chamfer-sm); }
.m-file span:nth-child(2) { flex: 1; min-width: 0; }
.m-file b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-file small { color: var(--text-dim); font: 11px var(--font-mono); }
.m-file .dl { color: var(--text-dim); transition: transform .2s; }
.m-file:hover .dl { color: var(--accent); transform: translateY(3px); }
.msg.sys { justify-content: center; margin: 6px 0; }
.msg.sys > span { display: inline-flex; align-items: center; gap: 8px; padding: 6px 16px; font: 11.5px var(--font-mono); color: var(--text-dim); background: var(--glass); border: 1px solid var(--glass-border); backdrop-filter: blur(10px); clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 50%, calc(100% - 8px) 100%, 8px 100%, 0 50%); }
.msg.sys .ic { width: 15px; height: 15px; color: var(--accent); }
.upload-progress { height: 6px; background: color-mix(in srgb, var(--accent) 15%, transparent); overflow: hidden; margin: 8px 0 4px; }
.upload-progress i { display: block; height: 100%; width: 0; background: var(--hazard); background-color: var(--accent); transition: width .2s; animation: hazardMove .6s linear infinite; }

/* ── Голосовые */
.voice { display: flex; align-items: center; gap: 10px; min-width: 230px; padding: 2px 0; }
.voice-play { width: 40px; height: 40px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); transition: transform .2s var(--spring); }
.voice-play:hover { transform: scale(1.1); }
.voice-play .ic { width: 15px; height: 15px; }
.wave { flex: 1; display: flex; align-items: center; gap: 2px; height: 30px; cursor: pointer; }
.wave i { flex: 1; min-width: 2px; background: color-mix(in srgb, var(--text-dim) 40%, transparent); transition: background-color .15s; }
.wave i.on { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.voice-time { font: 11px var(--font-mono); color: var(--text-dim); min-width: 34px; }

/* ── Поле ввода */
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 8px; position: relative; }
.composer:focus-within { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.composer textarea {
  flex: 1; resize: none; max-height: 160px; min-height: 46px; border: 0 !important; background: transparent !important; box-shadow: none !important;
  padding: 12px 6px; line-height: 1.4;
}
.composer #micBtn, .composer #sendBtn { animation: pop .25s var(--spring); }
.rec-bar { display: none; flex: 1; align-items: center; gap: 12px; height: 46px; padding: 0 8px; }
.composer.recording textarea, .composer.recording #attachBtn { display: none; }
.composer.recording .rec-bar { display: flex; animation: fadeIn .2s; }
.composer.recording #micBtn { background: var(--danger); color: #fff; animation: pulse 1.4s infinite; }
.rec-dot { width: 10px; height: 10px; background: var(--danger); transform: rotate(45deg); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.rec-wave { flex: 1; display: flex; align-items: center; gap: 3px; height: 30px; overflow: hidden; }
.rec-wave i { flex: 1; min-width: 2px; background: var(--danger); height: 10%; transition: height .08s; }

.drop-zone { position: absolute; inset: 0; z-index: 10; display: none; place-items: center; border: 2px dashed var(--accent); background: color-mix(in srgb, var(--bg) 65%, transparent); backdrop-filter: blur(10px); }
.drop-zone.show { display: grid; animation: fadeIn .2s; }
.drop-zone div { text-align: center; color: var(--accent); font-family: var(--font-head); text-transform: uppercase; }
.drop-zone .ic { width: 52px; height: 52px; display: block; margin: 0 auto 12px; }

/* ── Контекстное меню */
.ctx { position: fixed; z-index: 3900; min-width: 180px; padding: 6px; animation: pop .18s var(--ease); }
.ctx button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; text-align: left; font-size: 14px; font-weight: 600; }
.ctx button:hover { background: var(--glass-hover); color: var(--accent); }
.ctx button.danger { color: var(--danger); }
.ctx .ic { width: 17px; height: 17px; }

/* ── Просмотр изображения */
.lightbox { position: fixed; inset: 0; z-index: 4000; background: rgba(0,0,0,.88); backdrop-filter: blur(14px); display: grid; place-items: center; animation: fadeIn .25s; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 90vh; box-shadow: 0 0 0 1px var(--accent), 0 30px 80px rgba(0,0,0,.6); animation: pop .35s var(--spring); }
.lightbox.out { animation: fadeIn .2s reverse forwards; }

/* ═══════════ Модальные окна ═══════════ */
.modal-back { position: fixed; inset: 0; z-index: 3800; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); animation: fadeIn .25s; overflow-y: auto; }
.modal-back.out { animation: fadeIn .22s reverse forwards; }
.modal { width: min(480px, 100%); padding: 22px 24px 24px; animation: modalIn .45s var(--spring); max-height: calc(100dvh - 32px); overflow-y: auto; position: relative; }
.modal::before { content: ''; position: absolute; left: var(--cut); right: 0; top: 0; height: 3px; background: var(--accent); box-shadow: 0 0 16px var(--accent); }
.modal.wide { width: min(660px, 100%); }
.modal-back.out .modal { animation: modalOut .22s var(--ease) forwards; }
@keyframes modalIn { from { opacity: 0; transform: translateY(30px) scale(.94); clip-path: polygon(0 0, 100% 0, 100% 0, 0 0); } }
@keyframes modalOut { to { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.modal-head h3 { font-size: 17px; font-weight: 900; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.modal-actions.split { justify-content: space-between; }
.confirm-text { margin: 0; color: var(--text-dim); }

.profile-top { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.profile-name { font: 900 19px var(--font-head); text-transform: uppercase; }
.ava-edit { position: relative; cursor: pointer; }
.ava-edit-ov { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.55); color: var(--hud); opacity: 0; transition: opacity .2s; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.ava-edit:hover .ava-edit-ov, .ava-edit.loading .ava-edit-ov { opacity: 1; }
.pw-section { margin-top: 20px; border-top: 1px dashed var(--glass-border); padding-top: 16px; }
.pw-section summary { cursor: pointer; display: flex; align-items: center; gap: 8px; font: 700 11px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-dim); list-style: none; }
.pw-section summary::-webkit-details-marker { display: none; }
.pw-section[open] summary { margin-bottom: 14px; color: var(--accent); }
.pw-section summary .ic { width: 16px; height: 16px; }

.search-results { margin-top: 14px; max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.search-results .li { cursor: default; }

.kv { display: grid; grid-template-columns: auto 1fr auto; gap: 10px 12px; align-items: center; margin: 4px 0 6px; }
.kv dt { font: 700 10.5px var(--font-mono); color: var(--text-dim); text-transform: uppercase; letter-spacing: .14em; }
.kv dd { margin: 0; font-family: var(--font-mono); font-size: 13px; padding: 10px 12px; background: var(--input); border: 1px solid var(--glass-border); border-left: 3px solid var(--accent); overflow-wrap: anywhere; }
.steps { margin: 16px 0 0; padding-left: 20px; color: var(--text-dim); font-size: 13.5px; }
.steps li { margin: 5px 0; }
.steps li::marker { color: var(--accent); font-weight: 800; }
.steps b { color: var(--text); }
.note { padding: 12px 14px; font-size: 13px; color: var(--text-dim); background: color-mix(in srgb, var(--accent) 7%, transparent); border-left: 3px solid var(--accent); }
.note.warn { background: color-mix(in srgb, var(--amber) 9%, transparent); border-left-color: var(--amber); }

/* ═══════════ Тосты ═══════════ */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 5000; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 390px; padding: 13px 18px 13px 16px;
  background: var(--glass-strong); border: 1px solid var(--glass-border); backdrop-filter: blur(18px);
  animation: toastIn .45s var(--spring); box-shadow: inset 4px 0 0 var(--accent); font-weight: 600;
}
.toast.error { box-shadow: inset 4px 0 0 var(--danger); }
.toast.error > .ic { color: var(--danger); }
.toast.warn { box-shadow: inset 4px 0 0 var(--amber); }
.toast.warn > .ic { color: var(--amber); }
.toast > .ic { color: var(--accent); }
.toast .ava { --s: 38px; }
.toast small { display: block; color: var(--text-dim); font-size: 12.5px; font-weight: 500; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast.out { animation: toastOut .3s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(60px) skewX(-10deg); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(60px); } }

/* ═══════════ Звонки ═══════════ */
.call { position: fixed; inset: 0; z-index: 3500; background: #0b0c0e; background-image: radial-gradient(ellipse at 50% 28%, rgba(255, 255, 255, .06), transparent 62%); color: #eef2e8; animation: callIn .5s var(--ease); overflow: hidden; }
.call.out { animation: callIn .35s var(--ease) reverse forwards; }
@keyframes callIn { from { opacity: 0; transform: scale(1.05); } }
#remoteVideo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; opacity: 0; transition: opacity .6s; }
.call.has-video #remoteVideo { opacity: 1; }
/* Экран собеседника из приложения на телефоне (FLV) — поверх видео звонка, звук идёт через звонок */
#appScreen { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.call.mini #appScreen { position: relative; inset: auto; height: 168px; flex: none; border-radius: 16px 16px 0 0; }
.call.mini.app-screen #remoteVideo { display: none; }
.flv-note { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; max-width: 80%; padding: 12px 16px; text-align: center; font: 600 13px/1.4 var(--font-body, system-ui); color: #fff; background: rgba(0, 0, 0, .7); border-radius: 10px; pointer-events: none; }
.call.mini .flv-note { display: none; }
.call-scan { display: none; }
#localVideo { position: absolute; right: 22px; top: 22px; width: min(220px, 30vw); aspect-ratio: 3 / 4; object-fit: cover; background: #111; border: 2px solid rgba(255, 255, 255, .22); box-shadow: 0 12px 30px rgba(0, 0, 0, .5); transform: scaleX(-1); display: none; z-index: 2; animation: pop .5s var(--spring); border-radius: 14px; }
.call-min { position: absolute; left: 18px; top: 18px; z-index: 4; width: 44px; height: 44px; display: grid; place-items: center; color: #fff; background: rgba(255, 255, 255, .12); border-radius: 12px; backdrop-filter: blur(10px); transition: background-color .2s, transform .2s var(--spring); }
.call-min:hover { background: rgba(255, 255, 255, .22); transform: scale(1.06); }
.call.ringing .call-min { display: none; }
.call:not(.mini) .call-min { top: max(18px, calc(env(safe-area-inset-top) + 8px)); left: max(18px, env(safe-area-inset-left)); }
.call:not(.mini) .call-controls { bottom: calc(52px + env(safe-area-inset-bottom)); }
.call-net { display: inline-flex; align-items: center; gap: 7px; margin-top: 6px; padding: 4px 10px; border-radius: 999px; font: 600 11.5px/1.2 var(--mono, monospace); color: rgba(255, 255, 255, .82); background: rgba(255, 255, 255, .08); backdrop-filter: blur(8px); }
.call-net:empty { display: none; }
.call-net i { width: 8px; height: 8px; border-radius: 50%; background: #9aa0a6; }
.call-net.good i { background: #4cd964; }
.call-net.ok i { background: #ffcc00; }
.call-net.bad i { background: #ff453a; }
.call.mini .call-net { display: none; }
.call.reconnecting .call-center p { color: var(--amber); animation: blink 1s infinite; }

/* ── Свёрнутый звонок (мини-окно, перетаскивается к любому углу) */
.call.mini, .gcall.mini { inset: auto; width: 300px; height: auto; min-height: 0; border-radius: 16px; padding: 0; border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 18px 50px rgba(0, 0, 0, .6); cursor: grab; touch-action: none; animation: miniIn .35s var(--spring); z-index: 3600; }
.call.mini.dragging, .gcall.mini.dragging { cursor: grabbing; transition: none; opacity: .92; }
.call.mini[data-corner="br"], .gcall.mini[data-corner="br"] { right: 16px; bottom: 16px; }
.call.mini[data-corner="bl"], .gcall.mini[data-corner="bl"] { left: 16px; bottom: 16px; }
.call.mini[data-corner="tr"], .gcall.mini[data-corner="tr"] { right: 16px; top: 16px; }
.call.mini[data-corner="tl"], .gcall.mini[data-corner="tl"] { left: 16px; top: 16px; }
@keyframes miniIn { from { opacity: 0; transform: scale(.85); } }
.call.mini { display: flex; flex-direction: column; overflow: hidden; }
.call.mini .call-min, .gcall.mini .call-min, .call.mini #localVideo { display: none !important; }
.call.mini #remoteVideo { position: relative; inset: auto; height: 0; border-radius: 16px 16px 0 0; }
.call.mini.has-video #remoteVideo { height: 168px; }
.call.mini .call-center { position: static; transform: none; display: flex; align-items: center; gap: 10px; padding: 10px 12px 0; text-align: left; }
.call.mini.has-video .call-center { transform: none; }
.call.mini .call-ava { width: 40px; height: 40px; margin: 0; flex: none; }
.call.mini .call-ava .ava { --s: 40px !important; }
.call.mini .call-ava::before, .call.mini .call-ava::after { display: none; }
.call.mini.has-video .call-ava { display: grid; }
.call.mini .call-center h2 { font-size: 14px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call.mini .call-center p { margin: 0; font-size: 12px; letter-spacing: .06em; }
.call.mini .call-controls, .gcall.mini .call-controls { position: static; gap: 10px; padding: 10px; }
.call.mini .call-controls::after, .gcall.mini .call-controls::after { display: none; }
.call.mini .call-btn, .gcall.mini .call-btn { width: 44px; height: 44px; }
.call.mini .call-btn .ic, .gcall.mini .call-btn .ic { width: 20px; height: 20px; }
.call.mini.sharing::after { display: none; }
.gcall.mini { background: #0b0c0e; gap: 0; }
.gcall.mini .gcall-head { padding: 12px 14px 0; font-size: 13px; gap: 10px; }
.gcall.mini .gcall-grid { display: none; }
.call.local-video #localVideo { display: block; }
.call-center { position: absolute; left: 0; right: 0; top: 16%; text-align: center; transition: top .5s var(--ease), transform .5s var(--ease); z-index: 1; }
.call.has-video .call-center { top: 24px; transform: scale(.65); transform-origin: top center; }
.call.has-video .call-ava { display: none; }
.call-ava { width: 160px; height: 160px; margin: 0 auto 26px; position: relative; display: grid; place-items: center; }
.call-ava .ava { --s: 150px !important; z-index: 1; }
.call-ava::before, .call-ava::after { content: ''; position: absolute; inset: 0; border: 2px solid var(--hud); opacity: 0; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); background: rgba(198,255,0,.08); }
.call.ringing .call-ava::before, .call.outgoing .call-ava::before { animation: ring 2s infinite; }
.call.ringing .call-ava::after, .call.outgoing .call-ava::after { animation: ring 2s 1s infinite; }
@keyframes ring { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(1.8); } }
.call-center h2 { font-size: 32px; font-weight: 900; text-shadow: 0 2px 24px rgba(0,0,0,.6); }
.call-center p { margin: 12px 0 0; color: var(--hud); letter-spacing: .3em; text-transform: uppercase; font-size: 12px; }
.call-controls { position: absolute; left: 0; right: 0; bottom: 52px; display: flex; justify-content: center; gap: 24px; z-index: 2; }
.call-btn { width: 66px; height: 66px; display: grid; place-items: center; background: rgba(255,255,255,.12); color: #fff; backdrop-filter: blur(10px); clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); transition: transform .2s var(--spring), background-color .2s; animation: pop .45s var(--spring) both; position: relative; }
.call-btn:nth-child(2) { animation-delay: .06s; }
.call-btn:nth-child(3) { animation-delay: .12s; }
.call-btn:hover { transform: scale(1.1); background: rgba(255,255,255,.22); }
.call-btn .ic { width: 26px; height: 26px; }
.call-btn.off { background: #fff; color: #111; }
.call-btn.red { background: #ff3b3b; }
.call-btn.green { background: var(--hud); color: #0a0c05; animation: pop .45s var(--spring) both, greenPulse 1.2s .5s infinite; }
@keyframes greenPulse { 50% { transform: scale(1.1); filter: brightness(1.2); } }
.call-btn small { display: none; }
.call-controls::after { content: ''; position: absolute; left: 50%; bottom: -26px; width: 140px; height: 3px; transform: translateX(-50%); background: repeating-linear-gradient(-45deg, var(--hud) 0 6px, transparent 6px 12px); opacity: .6; }

/* ═══════════ Дроны ═══════════ */
#view-drones, #view-admin { overflow-y: auto; padding-right: 4px; }
.drones-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(390px, 100%), 1fr)); gap: 16px; padding: 0 2px 16px; }
.drone-card { overflow: hidden; animation: pop .55s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); display: flex; flex-direction: column; transition: transform .3s var(--ease), border-color .3s; }
.drone-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.feed { position: relative; aspect-ratio: 16 / 9; background: #040504; overflow: hidden; }
.feed > video, .feed > img, .feed > iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; z-index: 1; opacity: 0; transition: opacity .4s; }
.feed.ok > video, .feed.ok > img, .feed > iframe { opacity: 1; }
.feed:fullscreen > video, .feed:fullscreen > img { object-fit: contain; }
.nosignal {
  position: absolute; inset: 0; z-index: 0; display: grid; place-items: center;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  animation: static .25s steps(4) infinite;
}
@keyframes static { 0% { background-position: 0 0; } 25% { background-position: -40px 30px; } 50% { background-position: 50px -20px; } 75% { background-position: -20px -50px; } }
.nosignal span { font: 700 12px var(--font-mono); letter-spacing: .35em; color: var(--hud); background: rgba(0,0,0,.75); padding: 9px 16px; text-align: center; border: 1px solid rgba(198,255,0,.4); }
.nosignal small { display: block; letter-spacing: .05em; font-weight: 400; margin-top: 4px; opacity: .8; max-width: 300px; color: #ddd; }
.feed.ok .nosignal { display: none; }
.hud { position: absolute; inset: 0; z-index: 2; pointer-events: none; color: var(--hud); font: 700 11px var(--font-mono); letter-spacing: .1em; text-shadow: 0 0 6px rgba(0,0,0,.9); }
.hud .c { position: absolute; width: 24px; height: 24px; border: 2px solid var(--hud); filter: drop-shadow(0 0 4px rgba(198,255,0,.6)); }
.hud .tl { top: 10px; left: 10px; border-right: 0; border-bottom: 0; }
.hud .tr { top: 10px; right: 10px; border-left: 0; border-bottom: 0; }
.hud .bl { bottom: 10px; left: 10px; border-right: 0; border-top: 0; }
.hud .br { bottom: 10px; right: 10px; border-left: 0; border-top: 0; }
.hud .cross { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px; opacity: .7; border: 1px solid rgba(198,255,0,.35); border-radius: 50%; }
.hud .cross::before, .hud .cross::after { content: ''; position: absolute; }
.hud .cross::before { left: 50%; top: -10px; bottom: -10px; width: 1px; background: linear-gradient(var(--hud) 0 35%, transparent 35% 65%, var(--hud) 65%); }
.hud .cross::after { top: 50%; left: -10px; right: -10px; height: 1px; background: linear-gradient(90deg, var(--hud) 0 35%, transparent 35% 65%, var(--hud) 65%); }
.hud-tl, .hud-tr, .hud-bl, .hud-br { position: absolute; display: flex; align-items: center; gap: 6px; }
.hud-tl { top: 16px; left: 42px; }
.hud-tr { top: 16px; right: 42px; }
.hud-bl { bottom: 16px; left: 42px; }
.hud-br { bottom: 14px; right: 42px; gap: 2px; align-items: flex-end; }
.rec { width: 8px; height: 8px; background: #777; transform: rotate(45deg); }
.live .rec { background: #ff3b3b; box-shadow: 0 0 10px #ff3b3b; animation: blink 1s infinite; }
.hud-br i { width: 4px; background: rgba(198,255,0,.25); }
.hud-br i:nth-child(1) { height: 5px; } .hud-br i:nth-child(2) { height: 8px; } .hud-br i:nth-child(3) { height: 11px; } .hud-br i:nth-child(4) { height: 14px; }
.feed.ok .hud-br i { background: var(--hud); }
.feed::after { content: ''; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px); }
.drone-info { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 12px 13px 18px; border-top: 1px solid var(--glass-border); }
.drone-info h3 { font-size: 15px; font-weight: 900; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.drone-info p { margin: 4px 0 0; font-size: 11px; }
.drone-actions { display: flex; gap: 2px; flex: none; }
.drones-empty { grid-column: 1 / -1; text-align: center; padding: 70px 20px; }
.drones-empty .ic { width: 72px; height: 72px; color: var(--accent); filter: drop-shadow(0 0 20px var(--accent)); animation: hover 3s ease-in-out infinite; }
@keyframes hover { 50% { transform: translateY(-10px) rotate(6deg); } }
.drones-empty h3 { margin: 18px 0 8px; font-weight: 900; }
.drones-empty .btn { margin-top: 18px; }
.type-hint { font-size: 13px; color: var(--text-dim); line-height: 1.5; }

/* ═══════════ Карта ═══════════ */
.map-wrap { flex: 1; overflow: hidden; position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--bg); }
[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) grayscale(1) brightness(.72) contrast(1.25); }
[data-theme="dark"] #map::after { content: ''; position: absolute; inset: 0; z-index: 250; pointer-events: none; background: rgba(198,255,0,.06); mix-blend-mode: color; }
[data-theme="light"] .leaflet-tile-pane { filter: grayscale(.85) contrast(1.08) brightness(1.03); }
.leaflet-container { font-family: var(--font); }
.leaflet-bar, .leaflet-control-scale-line, .leaflet-control-attribution {
  background: var(--glass-strong) !important; backdrop-filter: blur(12px); border: 1px solid var(--glass-border) !important; color: var(--text) !important; box-shadow: none !important;
}
.leaflet-control-attribution { font-size: 10px; }
.leaflet-control-attribution a { color: var(--accent) !important; }
.leaflet-bar { border-radius: 0 !important; overflow: hidden; }
.leaflet-bar a { background: transparent !important; color: var(--text) !important; border-color: var(--glass-border) !important; width: 38px !important; height: 38px !important; line-height: 38px !important; border-radius: 0 !important; }
.leaflet-bar a:hover { background: var(--accent) !important; color: var(--accent-ink) !important; }
.leaflet-control-scale-line { font: 10px var(--font-mono); }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--glass-strong); color: var(--text); backdrop-filter: blur(16px); border: 1px solid var(--glass-border); box-shadow: var(--shadow); }
.leaflet-popup-content-wrapper { border-radius: 0; border-left: 3px solid var(--accent); }
.leaflet-popup-content { margin: 12px 14px; font-size: 14px; min-width: 200px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-dim); }
.leaflet-tooltip { background: var(--glass-strong); color: var(--text); border: 1px solid var(--glass-border); border-radius: 0; font: 600 12px var(--font); box-shadow: none; }
.leaflet-container.adding { cursor: crosshair; }
.pop h4 { margin: 0 0 4px; font: 900 13px var(--font-head); text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.pop h4 .ic { width: 16px; height: 16px; color: var(--accent); }
.pop p { margin: 2px 0; font-size: 12.5px; color: var(--text-dim); }
.pop .btn { margin-top: 10px; }
.map-tools { position: absolute; top: 14px; right: 14px; z-index: 500; display: flex; flex-direction: column; gap: 4px; padding: 6px; clip-path: var(--chamfer-sm); }
.map-tool { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 60px; padding: 9px 0 7px; color: var(--text-dim); font: 700 9.5px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; transition: .2s; clip-path: var(--chamfer-sm); }
.map-tool:hover { background: var(--glass-hover); color: var(--accent); }
.map-tool.on { background: var(--accent); color: var(--accent-ink); }
.map-tool.on.sharing { animation: pulse 1.6s infinite; }
.map-coords { position: absolute; left: 14px; top: 14px; z-index: 500; padding: 9px 14px; font-size: 12px; font-weight: 700; color: var(--accent); clip-path: var(--chamfer-sm); }
.map-coords::before { content: '⌖ '; }
.map-hint { position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 500; padding: 10px 18px; font-size: 13.5px; font-weight: 600; animation: pop .3s var(--spring); white-space: nowrap; box-shadow: inset 0 -3px 0 var(--accent); }
.map-legend { position: absolute; left: 14px; bottom: 34px; z-index: 500; padding: 11px 14px; font: 600 11px var(--font-mono); display: flex; flex-direction: column; gap: 6px; clip-path: var(--chamfer-sm); }
.map-legend span { display: flex; align-items: center; gap: 9px; color: var(--text-dim); }
.map-legend i { width: 11px; height: 11px; transform: rotate(45deg); }
.mk-wrap { background: none; border: 0; }
.mk { width: 30px; height: 30px; position: relative; display: grid; place-items: center; animation: drop .55s var(--spring) both; }
.mk::before { content: ''; position: absolute; inset: 4px; transform: rotate(45deg); background: var(--c); border: 2px solid #fff; box-shadow: 0 4px 14px rgba(0,0,0,.5), 0 0 0 5px color-mix(in srgb, var(--c) 30%, transparent), 0 0 20px var(--c); }
.mk span { position: relative; color: #fff; font-weight: 900; font-size: 12px; }
@keyframes drop { from { transform: translateY(-50px) scale(.4); opacity: 0; } }
.dr-mk { width: 40px; height: 40px; display: grid; place-items: center; color: #0a0c05; background: var(--hud); clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); filter: drop-shadow(0 0 10px rgba(198,255,0,.8)); animation: drop .55s var(--spring) both; }
.dr-mk.live { background: #ff3b3b; color: #fff; animation: drop .55s var(--spring) both, blink 1.2s infinite; }
.dr-mk .ic { width: 22px; height: 22px; }
.pos-mk { position: relative; }
.pos-mk .ava { --s: 38px; }
.pos-mk::after { content: ''; position: absolute; inset: -6px; border: 2px solid var(--accent); clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); animation: ring 2s infinite; }
.me-mk { width: 18px; height: 18px; background: var(--accent); border: 3px solid #fff; transform: rotate(45deg); animation: pulse 1.6s infinite; }
.kind-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.kind-pick label { flex-direction: row !important; align-items: center; gap: 8px !important; padding: 10px; border: 1px solid var(--glass-border); cursor: pointer; text-transform: none !important; letter-spacing: 0 !important; font: 600 13px var(--font) !important; color: var(--text) !important; transition: .2s; }
.kind-pick input { display: none; }
.kind-pick label:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); box-shadow: inset 3px 0 0 var(--accent); }
.kind-pick i { width: 12px; height: 12px; transform: rotate(45deg); flex: none; }

/* ═══════════ Админ-панель ═══════════ */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--glass); border: 1px solid var(--glass-border); backdrop-filter: blur(14px); clip-path: var(--chamfer-sm); }
.tabs button { padding: 9px 18px; font: 800 11px var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--text-dim); transition: .25s var(--ease); clip-path: var(--chamfer-sm); }
.tabs button:hover { color: var(--accent); }
.tabs button.active { background: var(--accent); color: var(--accent-ink); }
.admin-content { animation: fadeUp .4s var(--ease) both; padding-bottom: 16px; }
.admin-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.admin-bar .search { margin: 0; flex: 1; min-width: 200px; }
.table-wrap { overflow: hidden; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font: 700 10px var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); padding: 14px; border-bottom: 1px solid var(--glass-border); background: color-mix(in srgb, var(--accent) 5%, transparent); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--glass-border); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background-color .2s; animation: liIn .4s var(--ease) both; animation-delay: calc(var(--i, 0) * 25ms); }
.tbl tbody tr:hover { background: var(--glass-hover); }
.tbl tr.blocked td:not(:last-child) { opacity: .45; }
.u-cell { display: flex; align-items: center; gap: 12px; }
.u-cell b { display: block; }
.u-cell small { color: var(--text-dim); font: 11.5px var(--font-mono); }
.row-actions { display: flex; gap: 2px; justify-content: flex-end; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.stat { padding: 20px; position: relative; overflow: hidden; animation: pop .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 45ms); transition: transform .3s var(--ease); }
.stat:hover { transform: translateY(-3px); }
.stat .ic { width: 22px; height: 22px; color: var(--accent); }
.stat b { display: block; font: 900 34px var(--font-head); margin: 14px 0 2px; color: var(--text); }
.stat span { color: var(--text-dim); font: 700 10.5px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; }
.stat small { display: block; color: var(--text-faint); font: 11px var(--font-mono); margin-top: 6px; }
.stat::after { content: ''; position: absolute; right: 0; top: 0; width: 60px; height: 60px; background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--accent) 22%, transparent) 0 3px, transparent 3px 7px); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.panel { padding: 20px 22px; margin-top: 16px; }
.panel h3 { font-size: 14px; font-weight: 900; margin-bottom: 14px; }
.panel ul { margin: 0; padding-left: 18px; color: var(--text-dim); }
.panel li { margin: 6px 0; }
.panel li::marker { color: var(--accent); }
.panel code { font-family: var(--font-mono); color: var(--accent); font-size: 13px; }
.logs { overflow: hidden; }
.log { display: grid; grid-template-columns: 150px 170px 1fr; gap: 14px; padding: 10px 18px; border-bottom: 1px solid var(--glass-border); font-size: 13.5px; align-items: center; animation: liIn .35s var(--ease) both; animation-delay: calc(min(var(--i, 0), 30) * 15ms); }
.log:last-child { border-bottom: 0; }
.log:hover { background: var(--glass-hover); }
.log time { font: 11.5px var(--font-mono); color: var(--text-faint); }
.log b { font-weight: 700; font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.log span { color: var(--text-dim); }
.log .lvl-bad { color: var(--danger); }
.log .lvl-ok { color: var(--accent); }
.cred { font-family: var(--font-mono); white-space: pre; padding: 16px; background: var(--input); border: 1px solid var(--glass-border); border-left: 3px solid var(--accent); font-size: 13.5px; overflow-x: auto; }

/* ═══════════ Группы и каналы ═══════════ */
.ava-kind { position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); border: 2px solid var(--bg); clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.ava-kind .ic { width: 11px; height: 11px; stroke-width: 2.6; }
.li-kind { width: 14px; height: 14px; color: var(--accent); margin-right: 5px; vertical-align: -2px; }
#chatPeer { cursor: pointer; }
#chatPeer:hover b { color: var(--accent); }

.msg .m-ava { width: 34px; flex: none; margin-right: 8px; align-self: flex-end; }
.m-name { font: 800 12.5px var(--font); margin-bottom: 3px; letter-spacing: .01em; }
.msg.post .bubble { max-width: min(620px, 92%); clip-path: var(--chamfer-sm); box-shadow: inset 3px 0 0 var(--accent); }
.quote {
  display: block; margin: 2px 0 6px; padding: 5px 10px; cursor: pointer; max-width: 100%;
  border-left: 3px solid var(--qc, var(--accent)); background: color-mix(in srgb, var(--qc, var(--accent)) 10%, transparent);
  transition: background-color .2s;
}
.quote:hover { background: color-mix(in srgb, var(--qc, var(--accent)) 18%, transparent); }
.quote b { display: block; font-size: 12.5px; color: var(--qc, var(--accent)); }
.quote span { display: block; font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.flash .bubble { animation: flash 1.4s var(--ease); }
@keyframes flash { 0%, 40% { background: color-mix(in srgb, var(--accent) 35%, transparent); box-shadow: 0 0 30px color-mix(in srgb, var(--accent) 45%, transparent); } }

.reply-bar { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; margin-bottom: -4px; clip-path: var(--chamfer-sm); animation: fadeUp .25s var(--ease); box-shadow: inset 3px 0 0 var(--accent); }
.reply-bar > .ic { color: var(--accent); }
.reply-body { flex: 1; min-width: 0; }
.reply-body b { display: block; font-size: 13px; color: var(--accent); }
.reply-body span { display: block; font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-bar { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 10px; min-height: 62px; clip-path: var(--chamfer); }
.chat-bar .mono { display: flex; align-items: center; gap: 8px; letter-spacing: .1em; text-transform: uppercase; }
.chat-bar .mono .ic { color: var(--accent); width: 17px; height: 17px; }

.res-head { font: 700 10.5px var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin: 14px 4px 6px; }
.res-head:first-child { margin-top: 0; }
.room-new-top { display: flex; align-items: flex-end; gap: 14px; }
.room-new-ic { width: 64px; height: 64px; flex: none; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.room-new-ic .ic { width: 28px; height: 28px; }
.room-desc { margin: 8px 0 0; font-size: 14px; color: var(--text-dim); white-space: pre-wrap; }
.info-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 4px; }
.member-list { max-height: 360px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.member-list .li { cursor: default; }
.pick-count { color: var(--accent); min-height: 16px; margin: 0 2px 4px; font-size: 11px; letter-spacing: .1em; }
.pick { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--glass-border); padding: 4px; }
.pick-row { display: flex !important; flex-direction: row !important; align-items: center; gap: 12px !important; padding: 8px 10px; cursor: pointer; text-transform: none !important; letter-spacing: 0 !important; font: 500 14px var(--font) !important; color: var(--text) !important; transition: background-color .15s; }
.pick-row:hover { background: var(--glass-hover); }
.pick-row input { display: none; }
.pick-row > span { flex: 1; min-width: 0; }
.pick-row b { display: block; font-weight: 700; }
.pick-row small { color: var(--text-dim); font: 11.5px var(--font-mono); }
.pick-box { width: 22px; height: 22px; display: grid; place-items: center; border: 2px solid var(--glass-border); color: transparent; transition: .2s var(--spring); }
.pick-box .ic { width: 14px; height: 14px; stroke-width: 3; }
.pick-row:has(input:checked) { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.pick-row:has(input:checked) .pick-box { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); transform: scale(1.1); }

/* ═══════════ Эмодзи и стикеры ═══════════ */
#emojiBtn.on { color: var(--accent); background: var(--glass-hover); }
.emoji-panel {
  position: absolute; right: 8px; bottom: 74px; z-index: 20; width: min(390px, calc(100% - 16px)); height: min(400px, 60vh);
  display: flex; flex-direction: column; clip-path: var(--chamfer); animation: epIn .28s var(--spring);
}
@keyframes epIn { from { opacity: 0; transform: translateY(16px) scale(.96); } }
.ep-tabs { display: flex; gap: 4px; padding: 8px 8px 0; border-bottom: 1px solid var(--glass-border); }
.ep-tabs button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px; font: 700 11px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-dim); border-bottom: 3px solid transparent; transition: .2s; }
.ep-tabs button .ic { width: 16px; height: 16px; }
.ep-tabs button:hover { color: var(--text); }
.ep-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.ep-body { flex: 1; overflow-y: auto; padding: 6px 10px 12px; }
.ep-cat { font: 700 10px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); margin: 10px 2px 6px; position: sticky; top: -6px; background: var(--glass-strong); padding: 4px 0; z-index: 1; }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 2px; }
.ep-e { font-size: 24px; height: 40px; line-height: 1; display: grid; place-items: center; border-radius: 8px; transition: transform .15s var(--spring), background-color .15s; font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif; }
.ep-e:hover { background: var(--glass-hover); transform: scale(1.25); }
.ep-stickers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding-top: 8px; }
.ep-s { aspect-ratio: 1; padding: 6px; border-radius: 10px; transition: transform .2s var(--spring), background-color .2s; animation: pop .35s var(--ease) both; animation-delay: calc(var(--i) * 25ms); }
.ep-s:hover { background: var(--glass-hover); transform: scale(1.08) rotate(-3deg); }
.ep-s img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }

.msg.bare .bubble { background: none !important; border: 0; box-shadow: none !important; backdrop-filter: none; -webkit-backdrop-filter: none; clip-path: none; padding: 0; }
.msg.bare .meta { float: none; justify-content: flex-end; top: 0; margin: 2px 4px 0 0; background: var(--glass-strong); padding: 2px 8px; width: fit-content; margin-left: auto; }
.msg.them.bare .meta { margin-left: 0; }
.msg.bare .m-name, .msg.bare .quote { background: var(--glass-strong); padding: 4px 10px; }
.m-sticker { display: block; width: 180px; height: 180px; object-fit: contain; filter: drop-shadow(0 6px 14px rgba(0,0,0,.35)); user-select: none; }
.msg.pop.t-sticker .bubble { animation: stickerIn .55s var(--spring) both; }
@keyframes stickerIn { from { opacity: 0; transform: scale(.4) rotate(-12deg); } }
.m-text.jumbo { line-height: 1.15; font-family: 'Segoe UI Emoji', 'Apple Color Emoji', 'Noto Color Emoji', sans-serif; }
.m-text.jumbo.j1 { font-size: 64px; }
.m-text.jumbo.j2 { font-size: 52px; }
.m-text.jumbo.j3 { font-size: 42px; }
.msg.pop.bare:not(.t-sticker) .bubble { animation: stickerIn .5s var(--spring) both; }

/* ═══════════ Объявление ═══════════ */
.announce {
  position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1500; width: min(720px, calc(100% - 24px));
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; clip-path: var(--chamfer-sm);
  box-shadow: inset 4px 0 0 var(--accent2), var(--shadow); animation: annIn .5s var(--spring); font-weight: 600;
}
.announce > .ic { color: var(--accent2); flex: none; }
.announce span { flex: 1; min-width: 0; }
@keyframes annIn { from { opacity: 0; transform: translate(-50%, -30px); } }

/* ═══════════ Карта: слои и 3D ═══════════ */
#map.raw-tiles .leaflet-tile-pane { filter: none !important; }
#map.raw-tiles::after { display: none; }
#map3d { position: absolute; inset: 0; z-index: 1; background: #000; }
#map3d.adding canvas { cursor: crosshair; }
.ctx button.cur { color: var(--accent); background: var(--glass-hover); }
.mk3d { cursor: pointer; }
.maplibregl-popup-content { background: var(--glass-strong) !important; color: var(--text); backdrop-filter: blur(16px); border: 1px solid var(--glass-border); border-left: 3px solid var(--accent); border-radius: 0 !important; padding: 12px 14px !important; box-shadow: var(--shadow) !important; }
.maplibregl-popup-tip { border-top-color: var(--glass-strong) !important; border-bottom-color: var(--glass-strong) !important; }
.maplibregl-popup-close-button { color: var(--text-dim); font-size: 18px; }
.maplibregl-ctrl-group { background: var(--glass-strong) !important; border-radius: 0 !important; }
.maplibregl-ctrl-group button + button { border-top-color: var(--glass-border) !important; }
[data-theme="dark"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
.maplibregl-ctrl-attrib { background: var(--glass-strong) !important; color: var(--text-dim); font-size: 10px; }
.maplibregl-ctrl-attrib a { color: var(--accent) !important; }
.maplibregl-ctrl-scale { background: var(--glass-strong) !important; color: var(--text) !important; border-color: var(--accent) !important; font: 10px var(--font-mono); }
.map-tools, .map-coords, .map-hint, .map-legend { z-index: 600; }

/* ═══════════ Настройки (админ) ═══════════ */
.settings-form { gap: 0; }
.settings-form .panel { display: flex; flex-direction: column; gap: 14px; margin-top: 0; margin-bottom: 14px; }
.settings-form .panel h3 { display: flex; align-items: center; gap: 10px; margin: 0; }
.settings-form .panel h3 .ic { color: var(--accent); }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.color-field { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--input); border: 1px solid var(--glass-border); border-left: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.color-field input[type=color] { width: 44px; height: 32px; border: 0; padding: 0; background: none; cursor: pointer; }
.color-field span { color: var(--text); font-size: 13px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.settings-save { position: sticky; bottom: 0; padding: 10px 0 4px; display: flex; justify-content: flex-end; }
.settings-save .btn { box-shadow: 0 10px 30px -10px var(--accent); }

/* ═══════════ v1.3: SOS / тревога ═══════════ */
.rail-sos { width: 54px; height: 54px; margin: 6px 0; position: relative; display: grid; place-items: center; overflow: hidden; color: #fff; font: 900 13px var(--font-head); letter-spacing: .08em; background: #b3191b; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); transition: transform .2s var(--spring), filter .2s; user-select: none; touch-action: none; }
.rail-sos:hover { filter: brightness(1.2); transform: scale(1.05); }
.rail-sos i { position: absolute; left: 0; bottom: 0; width: 100%; height: 0; background: #ff3b3b; }
.rail-sos span { position: relative; }
.rail-sos.arming i { height: 100%; transition: height 1.5s linear; }
.rail-sos.arming { animation: shake .4s infinite; }
.rail-sos.fired { animation: blink .3s 5; background: #ff3b3b; }
.alarm { position: fixed; inset: 0; z-index: 6000; display: grid; place-items: center; padding: 16px; background: rgba(40, 0, 0, .78); backdrop-filter: blur(10px); animation: fadeIn .3s; }
.alarm.out { animation: fadeIn .3s reverse forwards; }
.alarm-stripes { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(-45deg, rgba(255, 59, 59, .18) 0 30px, transparent 30px 60px); animation: hazardMove 1s linear infinite; background-size: 85px 85px; }
.alarm::before { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 160px 40px rgba(255, 30, 30, .7); animation: blink 1s infinite; pointer-events: none; }
.alarm-box { position: relative; width: min(520px, 100%); padding: 30px 28px 24px; text-align: center; color: #fff; background: rgba(20, 4, 4, .92); border: 2px solid #ff3b3b; clip-path: var(--chamfer); animation: modalIn .5s var(--spring); }
.alarm-icon .ic { width: 64px; height: 64px; color: #ff3b3b; filter: drop-shadow(0 0 20px #ff3b3b); animation: blink .8s infinite; }
.alarm-box h1 { font-size: 46px; letter-spacing: .14em; color: #ff3b3b; text-shadow: 0 0 30px rgba(255, 59, 59, .7); margin: 6px 0 16px; }
.alarm-who { display: flex; align-items: center; justify-content: center; gap: 12px; text-align: left; }
.alarm-who b { display: block; font-size: 18px; }
.alarm-who small { color: #f2b8b8; }
.alarm-text { font-size: 18px; font-weight: 700; margin: 14px 0 6px; }
.alarm-coords { color: #ffd0d0; font-size: 12.5px; line-height: 1.6; }
.alarm-acks { color: #f2b8b8; font-size: 11.5px; }
.alarm-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.alarm-actions .btn.primary { background: #ff3b3b; color: #fff; font-size: 15px; padding: 14px 26px; }
.alarm-mk { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: #ff3b3b; color: #fff; font: 900 11px var(--font-head); border: 3px solid #fff; box-shadow: 0 0 0 0 rgba(255, 59, 59, .8); animation: sosPulse 1.2s infinite; }
@keyframes sosPulse { 0% { box-shadow: 0 0 0 0 rgba(255, 59, 59, .8); } 100% { box-shadow: 0 0 0 26px rgba(255, 59, 59, 0); } }

/* ═══════════ v1.3: чат ═══════════ */
.pin-bar { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 12px; margin-bottom: -4px; clip-path: var(--chamfer-sm); cursor: pointer; animation: fadeUp .25s var(--ease); }
.pin-lines { display: flex; flex-direction: column; gap: 2px; align-self: stretch; justify-content: center; }
.pin-lines i { width: 3px; flex: 1; max-height: 14px; background: color-mix(in srgb, var(--accent) 30%, transparent); }
.pin-lines i.on { background: var(--accent); }
.pin-body { flex: 1; min-width: 0; }
.pin-body b { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--accent); }
.pin-body b .ic { width: 14px; height: 14px; }
.pin-body span { display: block; font-size: 13px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-search { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 14px; margin-bottom: -4px; clip-path: var(--chamfer-sm); animation: fadeUp .2s var(--ease); }
.chat-search > .ic { color: var(--accent); width: 18px; }
.chat-search input { flex: 1; border: 0 !important; background: transparent !important; box-shadow: none !important; padding: 6px !important; }
.jump-down { position: absolute; right: 18px; bottom: 90px; z-index: 5; width: 44px; height: 44px; display: grid; place-items: center; background: var(--glass-strong); border: 1px solid var(--glass-border); color: var(--accent); clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); animation: pop .25s var(--spring); }
.jump-down:hover { background: var(--accent); color: var(--accent-ink); }
.gc-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 14px; margin-bottom: -4px; background: color-mix(in srgb, var(--ok) 16%, var(--glass-strong)); border: 1px solid color-mix(in srgb, var(--ok) 40%, transparent); clip-path: var(--chamfer-sm); animation: fadeUp .25s var(--ease); }
.gc-bar > .ic { color: var(--ok); }
.gc-bar b { flex: 1; font-size: 13.5px; }
.gc-avas { display: flex; }
.gc-avas .ava { margin-left: -6px; }
.li-muted { width: 13px; height: 13px; color: var(--text-faint); margin-left: 6px; vertical-align: -1px; }
.cnt.muted { background: var(--text-faint); color: var(--bg); }

.m-fwd { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--accent); margin-bottom: 4px; }
.m-fwd .ic { width: 14px; height: 14px; }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; clear: both; }
.react { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; font-size: 13px; background: color-mix(in srgb, var(--text) 8%, transparent); border: 1px solid transparent; clip-path: polygon(5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%, 0 5px); transition: transform .15s var(--spring), background-color .15s; animation: pop .25s var(--spring); }
.react b { font: 700 11px var(--font-mono); }
.react:hover { transform: scale(1.08); }
.react.mine { background: color-mix(in srgb, var(--accent) 22%, transparent); border-color: var(--accent); }
.msg.bare .reacts { background: var(--glass-strong); padding: 4px; width: fit-content; }
.ctx-react { display: flex; gap: 2px; padding: 4px; margin-bottom: 4px; border-bottom: 1px solid var(--glass-border); }
.ctx-react button { width: 34px !important; padding: 5px 0 !important; justify-content: center; font-size: 19px !important; transition: transform .15s var(--spring); }
.ctx-react button:hover { transform: scale(1.3); background: none !important; }
.ctx-sep { font: 700 9.5px var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-faint); padding: 8px 12px 4px; }

.poll { min-width: 260px; max-width: 420px; }
.poll-q { font-weight: 800; font-size: 15px; margin-bottom: 2px; }
.poll-kind { font-size: 9.5px; letter-spacing: .12em; color: var(--text-dim); margin-bottom: 10px; }
.poll-opt { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 10px; margin-bottom: 5px; text-align: left; overflow: hidden; border: 1px solid var(--glass-border); background: color-mix(in srgb, var(--text) 4%, transparent); transition: border-color .2s, transform .15s; }
.poll-opt:not(:disabled):hover { border-color: var(--accent); }
.poll-opt:active { transform: scale(.98); }
.poll-bar { position: absolute; left: 0; top: 0; bottom: 0; width: var(--p); background: color-mix(in srgb, var(--accent) 18%, transparent); transition: width .6s var(--ease); }
.poll-opt.mine .poll-bar { background: color-mix(in srgb, var(--accent) 34%, transparent); }
.poll-check { position: relative; width: 18px; height: 18px; flex: none; display: grid; place-items: center; border: 2px solid var(--text-faint); color: transparent; }
.poll-check .ic { width: 12px; height: 12px; stroke-width: 3; }
.poll-opt.mine .poll-check { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.poll-text { position: relative; flex: 1; font-size: 14px; }
.poll-who { position: relative; display: flex; }
.poll-who .ava { margin-left: -4px; }
.poll-pct { position: relative; font-size: 12px; font-weight: 700; }
.poll-foot { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.poll-edit { display: flex; flex-direction: column; gap: 6px; }
.poll-edit-row { display: flex; gap: 6px; align-items: center; }

.m-round { position: relative; width: 220px; height: 220px; cursor: pointer; }
.m-round video { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; background: #000; box-shadow: 0 8px 26px rgba(0, 0, 0, .45); }
.m-round svg { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); transform: rotate(-90deg); pointer-events: none; }
.m-round circle { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 302; stroke-dashoffset: 302; transition: stroke-dashoffset .25s linear; }
.m-round-ic { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; pointer-events: none; transition: opacity .2s; }
.m-round-ic .ic { width: 44px; height: 44px; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .6)); }
.m-round.playing .m-round-ic { opacity: 0; }
.m-round-dur { position: absolute; left: 14px; bottom: 14px; padding: 2px 8px; font-size: 11px; color: #fff; background: rgba(0, 0, 0, .55); border-radius: 10px; }
.round-rec { position: fixed; inset: 0; z-index: 3600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: rgba(0, 0, 0, .85); backdrop-filter: blur(16px); animation: fadeIn .3s; }
.round-wrap { position: relative; width: min(320px, 76vw); aspect-ratio: 1; }
.round-wrap video { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; background: #111; }
.round-ring { position: absolute; inset: -10px; width: calc(100% + 20px); height: calc(100% + 20px); transform: rotate(-90deg); }
.round-ring circle { fill: none; stroke: #ff3b3b; stroke-width: 2.5; transition: stroke-dashoffset .1s linear; }
.round-rec p { color: #fff; }
.round-rec .call-controls { position: static; }
.screen-rec { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 5500; display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; clip-path: var(--chamfer-sm); box-shadow: inset 4px 0 0 #ff3b3b; animation: annIn .4s var(--spring); }

/* ═══════════ v1.3: групповой звонок и рация ═══════════ */
.gcall { position: fixed; inset: 0; z-index: 3500; display: flex; flex-direction: column; padding: 18px; gap: 14px; background: rgba(3, 4, 2, .96); backdrop-filter: blur(24px); color: #eef2e8; animation: callIn .4s var(--ease); }
.gcall-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; font-family: var(--font-head); font-size: 16px; text-transform: uppercase; }
.gcall-head b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcall-head .call-min { position: static; flex: none; }
.gcall-head .mono { color: var(--hud); }
.gcall-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); grid-template-rows: repeat(var(--rows, 1), minmax(0, 1fr)); gap: 10px; }
.gcall:not(.mini) { padding: max(18px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
/* Номер версии не перекрывает кнопки звонка */
body:has(#callOverlay:not(.hidden):not(.mini)) .build-tag, body:has(#gcallOverlay:not(.hidden):not(.mini)) .build-tag { display: none; }
.gc-tile { position: relative; overflow: hidden; background: #0d100b; border: 1px solid rgba(198, 255, 0, .2); clip-path: var(--chamfer); animation: pop .4s var(--spring); }
.gc-tile video { width: 100%; height: 100%; object-fit: cover; }
.gc-tile.own video { transform: scaleX(-1); }
.gc-tile .gc-ava { position: absolute; inset: 0; display: none; place-items: center; }
.gc-tile.novideo video { opacity: 0; }
.gc-tile.novideo .gc-ava { display: grid; }
.gc-name { position: absolute; left: 10px; bottom: 10px; padding: 3px 10px; font-size: 13px; font-weight: 700; background: rgba(0, 0, 0, .6); }
.gcall .call-controls { position: static; }
.ptt { position: fixed; right: 18px; bottom: 90px; z-index: 1800; width: 260px; padding: 14px; display: flex; flex-direction: column; gap: 10px; align-items: stretch; clip-path: var(--chamfer); animation: modalIn .35s var(--spring); }
.ptt-head { display: flex; align-items: center; gap: 8px; }
.ptt-head > .ic { color: var(--accent); }
.ptt-head b { flex: 1; font-family: var(--font-head); font-size: 13px; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptt-status { text-align: center; font-size: 11px; letter-spacing: .12em; padding: 6px; background: var(--input); color: var(--text-dim); }
.ptt-status.busy { color: #fff; background: #b3191b; }
.ptt-status.mine { color: var(--accent-ink); background: var(--accent); }
.ptt-meter { height: 4px; background: var(--input); overflow: hidden; }
.ptt-meter i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .08s; }
.ptt-btn { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; background: color-mix(in srgb, var(--accent) 12%, var(--input)); border: 2px solid var(--accent); color: var(--accent); font: 800 12px var(--font-mono); letter-spacing: .14em; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; transition: transform .1s, background-color .15s; }
.ptt-btn .ic { width: 46px; height: 46px; }
.ptt-btn small { font-size: 9.5px; opacity: .7; letter-spacing: .06em; }
.ptt-btn.on { background: var(--accent); color: var(--accent-ink); transform: scale(.96); box-shadow: 0 0 40px var(--accent); animation: pulse 1s infinite; }

/* ── Просмотр аватарок */
.ava-view { display: inline-block; flex: none; line-height: 0; }
.ava-view:has(img) { cursor: zoom-in; }
.ava-view:has(img) .ava { transition: transform .2s var(--spring), filter .2s; }
.ava-view:has(img):hover .ava { transform: scale(1.05); filter: brightness(1.1); }
.ava-edit { position: relative; flex: none; }
.ava-cam { position: absolute; right: -4px; bottom: -4px; width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer; background: var(--accent); color: var(--accent-ink); border: 3px solid var(--bg); clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); transition: transform .2s var(--spring); }
.ava-cam:hover { transform: scale(1.12); }
.ava-cam .ic { width: 15px; height: 15px; }
.ava-edit.loading .ava-cam { animation: blink .8s infinite; }
.m-ava[data-user-card] { cursor: pointer; }
.m-ava[data-user-card]:hover .ava { filter: brightness(1.15); }
.lightbox .lb-bar { position: fixed; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 6px; padding: 12px 16px; background: linear-gradient(rgba(0, 0, 0, .7), transparent); color: #fff; animation: fadeIn .3s; }
.lightbox .lb-bar b { flex: 1; font: 800 15px var(--font-head); text-transform: uppercase; letter-spacing: .04em; }
.lightbox .lb-bar .icon-btn { color: #fff; margin-left: auto; }
.lightbox .lb-bar b + .icon-btn { margin-left: 0; }
.lightbox .lb-bar .icon-btn + .icon-btn { margin-left: 0; }
.lightbox.ava-lb img { width: min(560px, 86vw, 80vh); height: min(560px, 86vw, 80vh); object-fit: cover; clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); box-shadow: none; filter: drop-shadow(0 0 40px rgba(198, 255, 0, .25)); }

/* ── Демонстрация экрана */
.call-btn.share-on { background: var(--hud); color: #0a0c05; box-shadow: 0 0 30px rgba(198, 255, 0, .5); }
.call.screen-share #remoteVideo { object-fit: contain; }
.call.sharing #localVideo { transform: none; object-fit: contain; aspect-ratio: 16 / 9; width: min(340px, 38vw); background: #000; }
.call.sharing::after { content: '● ВЫ ДЕМОНСТРИРУЕТЕ ЭКРАН'; position: absolute; left: 50%; top: 16px; transform: translateX(-50%); z-index: 3; padding: 6px 14px; font: 700 11px var(--font-mono); letter-spacing: .12em; color: #0a0c05; background: var(--hud); clip-path: var(--chamfer-sm); animation: fadeIn .3s; }
.gc-tile.screen video { object-fit: contain; background: #000; }
.gc-tile.own.screen video { transform: none; }
.gc-tile.screen { border-color: var(--hud); }
.gcall-grid.presenting { grid-template-rows: minmax(0, 1fr) 150px; }
.gcall-grid.presenting .gc-tile.screen { grid-column: 1 / -1; order: -1; }
.gcall-grid.presenting .gc-tile:not(.screen) .gc-ava .ava { --s: 56px !important; }

/* ═══════════ v1.3: карта ═══════════ */
/* ── Компас */
.map-compass { position: absolute; right: 92px; top: 14px; z-index: 600; width: 128px; padding: 8px 8px 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; clip-path: var(--chamfer-sm); cursor: pointer; animation: pop .25s var(--spring); }
.map-compass .rose { width: 108px; height: 108px; overflow: visible; }
.rose-dial circle { fill: color-mix(in srgb, var(--bg) 70%, transparent); stroke: var(--glass-border); stroke-width: 1.5; }
.rose-dial line { stroke: var(--text-faint); stroke-width: 1; }
.rose-dial line.tk-l { stroke: var(--text); stroke-width: 2; }
.rose-dial text { font: 800 11px var(--font-mono); fill: var(--text-dim); }
.rose-dial text.n { fill: #ff3b3b; }
.rose-dial, .rose-needle { transition: transform .15s linear; transform-box: view-box; }
.nd-n { fill: #ff3b3b; } .nd-s { fill: var(--text-dim); } .nd-c { fill: var(--text); }
.map-compass:not(.sensor) .rose-needle { opacity: .55; }
.cmp-read { display: flex; flex-direction: column; align-items: center; line-height: 1.25; }
.cmp-read b { font-size: 18px; color: var(--accent); }
.cmp-read small { font-size: 10px; color: var(--text-dim); }
.cmp-read small:empty { display: none; }
.me-head { position: relative; width: 64px; height: 64px; }
.me-head b { position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #2a9de0; border: 3px solid #fff; box-shadow: 0 0 0 6px rgba(42, 157, 224, .25); }
.me-head .cone { position: absolute; inset: 0; transition: transform .15s linear; background: conic-gradient(from -30deg at 50% 50%, rgba(42, 157, 224, .55) 0deg 60deg, transparent 60deg); border-radius: 50%; -webkit-mask: radial-gradient(circle, #000 0 31px, transparent 32px); mask: radial-gradient(circle, #000 0 31px, transparent 32px); }
/* ── Профиль высот и прямая видимость */
.rp-prof { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--glass-border); }
.prof-chart { width: 100%; height: 84px; display: block; margin-bottom: 8px; }
.pf-area { fill: color-mix(in srgb, var(--accent) 22%, transparent); }
.pf-line { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.ls-ok, .ls-bad { stroke-width: 1.4; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.ls-ok { stroke: #4cd964; } .ls-bad { stroke: #ff3b3b; }
.ls-hit { fill: #ff3b3b; stroke: #fff; stroke-width: 1; vector-effect: non-scaling-stroke; }
.los-ok { color: #4cd964 !important; } .los-bad { color: #ff3b3b !important; }
.prof-wait { font-size: 11px; color: var(--text-dim); }
.prof-h { margin-top: 8px; font-size: 11px; color: var(--text-dim); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.ruler-panel .prof-h input[type=number][data-hobs], .ruler-panel .prof-h input[type=number][data-htgt] { display: inline-block; flex: none; width: 46px; height: auto; min-height: 0; padding: 2px 4px; margin: 0; font: inherit; text-align: center; }
/* Панель линейки — над легендой, прокручивается на низких экранах */
.ruler-panel { max-height: calc(100% - 76px); overflow-y: auto; }
.map-wrap:has(#rulerPanel:not(.hidden)) .map-legend { display: none; }
.map-tools { max-height: calc(100% - 28px); overflow-y: auto; scrollbar-width: none; }
.los-tip { font: 700 11px var(--font-mono); }
/* Сенсорный экран: перекрестие в центре — координаты и высота показываются для этой точки */
.touch-cross::after { content: ''; position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; z-index: 450; pointer-events: none;
  background: linear-gradient(var(--accent), var(--accent)) center / 2px 100% no-repeat, linear-gradient(var(--accent), var(--accent)) center / 100% 2px no-repeat; opacity: .8; }

.ruler-panel { position: absolute; left: 14px; top: 60px; z-index: 600; width: 280px; padding: 12px 14px; clip-path: var(--chamfer-sm); animation: pop .25s var(--spring); }
.rp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.rp-head > .ic { color: var(--amber); }
.rp-head b { flex: 1; font-family: var(--font-head); font-size: 12px; text-transform: uppercase; }
.seg { display: flex; border: 1px solid var(--glass-border); }
.seg button { padding: 4px 9px; font: 700 10px var(--font-mono); color: var(--text-dim); text-transform: uppercase; }
.seg button.on { background: var(--accent); color: var(--accent-ink); }
.rp-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 12px; }
.rp-grid span { color: var(--text-dim); }
.rp-grid b { text-align: right; color: var(--text); }
.rp-actions { display: flex; gap: 4px; margin-top: 10px; }
.ruler-label span { display: inline-block; transform: translate(10px, -26px); padding: 2px 7px; white-space: nowrap; font: 700 11px var(--font-mono); color: #111; background: #ffb800; }
.grid-label { font: 700 12px var(--font-mono); color: #ff5a1f; text-shadow: 0 0 3px #000, 0 0 6px #000; white-space: nowrap; }
.grid-label small { font-size: 9px; opacity: .8; }
.coords-block { margin: 6px 0; font-size: 11.5px; line-height: 1.55; color: var(--text-dim); }
.coords-block .btn { margin-top: 6px; }
.front-line { filter: drop-shadow(0 0 6px rgba(255, 59, 59, .8)); stroke-dasharray: 18 6; }
.route-end { width: 16px; height: 16px; background: var(--c); border: 2px solid #000; transform: rotate(45deg); }
.dr-mk { position: relative; }
.dr-mk .dr-dir { display: none; position: absolute; left: 50%; top: -12px; width: 0; height: 0; margin-left: -6px; border: 6px solid transparent; border-bottom: 10px solid currentColor; transform-origin: 6px 31px; transform: rotate(var(--hdg)); }
.dr-mk.has-hdg .dr-dir { display: block; color: #c6ff00; }
.color-pick { display: flex; gap: 8px; }
.color-pick label { cursor: pointer; }
.color-pick input { display: none; }
.color-pick i { display: block; width: 28px; height: 28px; border: 2px solid var(--glass-border); clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); transition: transform .15s; }
.color-pick label:has(input:checked) i { transform: scale(1.2); border-color: var(--text); box-shadow: 0 0 0 2px var(--text); }

/* ═══════════ v1.3: дроны ═══════════ */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hud-tel { position: absolute; right: 42px; top: 38px; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 11px; }
.hud-tel span { padding: 1px 6px; background: rgba(0, 0, 0, .45); }
.hud-tel em { font-style: normal; opacity: .65; margin-right: 6px; }
.hud-tel .armed { color: #ff3b3b; font-weight: 800; animation: blink 1s infinite; }
.hud-rec { color: #ff3b3b; animation: blink 1s infinite; }
.icon-btn.rec-on { color: #ff3b3b; animation: blink 1.2s infinite; }
.wall-name { display: none; }
#view-drones.wall { position: fixed; inset: 0; z-index: 4000; padding: 0; background: #000; overflow: hidden; }
#view-drones.wall .view-head { display: none; }
#view-drones.wall .drones-grid { height: 100%; padding: 2px; gap: 2px; grid-template-columns: repeat(auto-fit, minmax(min(480px, 100%), 1fr)); grid-auto-rows: 1fr; }
#view-drones.wall .drone-card { clip-path: none; border: 0; animation: none; }
#view-drones.wall .drone-info { display: none; }
#view-drones.wall .feed { aspect-ratio: auto; height: 100%; }
#view-drones.wall .wall-name { display: block; position: absolute; left: 42px; top: 38px; font: 800 14px var(--font-head); text-transform: uppercase; }
.dvr-list { display: flex; flex-direction: column; gap: 4px; max-height: 340px; overflow-y: auto; }
.dvr-row, .bk-row, .sess { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-left: 3px solid transparent; transition: background-color .15s; }
.dvr-row:hover, .bk-row:hover, .sess:hover { background: var(--glass-hover); border-left-color: var(--accent); }
.dvr-row > div, .bk-row > div, .sess > div { flex: 1; min-width: 0; }
.dvr-row b, .bk-row b, .sess b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.dvr-row small, .bk-row small, .sess small { color: var(--text-dim); font-size: 11.5px; }
.bk-row > .ic, .sess > .ic { color: var(--accent); }
.sess.cur { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.dvr-player { margin-top: 14px; }
.dvr-player video { width: 100%; max-height: 60vh; background: #000; }
.sub-h { font: 800 12px var(--font-head); text-transform: uppercase; margin: 14px 0 8px; color: var(--accent); }

/* ═══════════ v1.3: админка ═══════════ */
.units { padding: 6px; }
.unit-row { display: flex; align-items: center; gap: 12px; padding: 9px 10px 9px calc(12px + var(--d) * 28px); border-left: 3px solid transparent; position: relative; }
.unit-row:hover { background: var(--glass-hover); border-left-color: var(--accent); }
.unit-row::before { content: ''; position: absolute; left: calc(var(--d) * 28px - 8px); top: 0; bottom: 50%; width: 12px; border-left: 1px dashed var(--glass-border); border-bottom: 1px dashed var(--glass-border); display: var(--tree, block); }
.unit-row[style*="--d:0"]::before { display: none; }
.unit-ic { width: 34px; height: 34px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%); }
.unit-ic .ic { width: 16px; height: 16px; }
.unit-main { flex: 1; min-width: 0; }
.unit-main b { display: block; }
.unit-main small { color: var(--text-dim); font-size: 11.5px; }
.bk-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; margin-top: 8px; }
.form-lbl { display: flex; flex-direction: column; gap: 6px; font: 700 10.5px var(--font-mono); color: var(--text-dim); text-transform: uppercase; letter-spacing: .14em; }
.sys-kv { grid-template-columns: auto 1fr 0; }
.tfa-setup { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.tfa-setup img { background: #fff; padding: 8px; border-radius: 4px; }
.tfa-setup > div { flex: 1; min-width: 200px; }
.tfa-secret { display: block; font-family: var(--font-mono); font-size: 14px; letter-spacing: .08em; padding: 8px 10px; background: var(--input); border-left: 3px solid var(--accent); word-break: break-all; }
.sess-list { display: flex; flex-direction: column; gap: 2px; }
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(460px, 100%), 1fr)); gap: 14px; margin-top: 16px; }
.chart { padding: 16px 18px 12px; clip-path: var(--chamfer); }
.chart h4 { font: 800 12px var(--font-head); text-transform: uppercase; margin: 0 0 10px; }
.chart svg { width: 100%; height: 170px; display: block; overflow: visible; }
.chart .cg { stroke: var(--glass-border); stroke-width: 1; }
.chart .ct { fill: var(--text-faint); font: 10px var(--font-mono); }
.chart .cbar path { fill: var(--accent); transition: opacity .15s; }
.chart .cbar:hover path { opacity: .75; }
.chart .cbar:hover rect { fill: color-mix(in srgb, var(--accent) 8%, transparent); }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1.2fr) 2fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.hbar-l { display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-l .ic { width: 14px; height: 14px; color: var(--accent); flex: none; }
.hbar-t { height: 10px; background: color-mix(in srgb, var(--text) 6%, transparent); }
.hbar-t i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.hbar b { text-align: right; font-size: 12px; }

/* ═══════════ Версия сборки ═══════════ */
.build-tag {
  position: fixed; left: 0; right: 0; bottom: 4px; z-index: 10000; text-align: center; pointer-events: none;
  font: 600 9.5px var(--font-mono); letter-spacing: .22em; text-transform: uppercase; color: var(--text-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 12px;
}
.build-tag::before, .build-tag::after { content: ''; display: inline-block; width: 28px; height: 1px; margin: 0 10px; vertical-align: middle; background: color-mix(in srgb, var(--accent) 45%, transparent); }
#app { padding-bottom: 22px; }

/* ═══════════ Адаптив ═══════════ */
@media (max-width: 1100px) { :root { --side-w: 300px; } }
@media (max-width: 820px) {
  :root { --gap: 8px; --cut: 12px; }
  .bg-mark { font-size: 40vw; }
  #app, #app.no-side { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; padding: 8px 8px calc(20px + env(safe-area-inset-bottom)); }
  .build-tag { bottom: calc(3px + env(safe-area-inset-bottom)); font-size: 8.5px; letter-spacing: .14em; }
  .build-tag::before, .build-tag::after { width: 14px; margin: 0 6px; }
  .rail { grid-row: 2; flex-direction: row; justify-content: space-around; padding: 6px; gap: 0; }
  .rail::before { display: none; }
  .rail-logo, .rail-spacer, .rail-theme { display: none; }
  .rail-btn { width: 52px; height: 48px; }
  .rail-me { margin: 0; }
  .side, .main { grid-row: 1; grid-column: 1; }
  #app:not(.no-side) .main { display: none; }
  #app.chat-open:not(.no-side) .main { display: block; }
  #app.chat-open:not(.no-side) .side { display: none; }
  #app.chat-open:not(.no-side) .rail { display: none; }
  #app.chat-open:not(.no-side) { grid-template-rows: minmax(0, 1fr); }
  .mobile-only { display: inline-grid; }
  .chat-head { padding: 8px; }
  .chat-actions .icon-btn { width: 38px; }
  .bubble { max-width: 86%; }
  .li-actions { opacity: 1; }
  .view-head { padding: 4px 4px 12px; }
  .view-head h2 { font-size: 19px; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; padding: 9px 4px; font-size: 10px; letter-spacing: .06em; }
  .row2, .row3 { grid-template-columns: 1fr; }
  .rail-sos { width: 44px; height: 44px; margin: 0; font-size: 10px; }
  .ptt { left: 12px; right: 12px; width: auto; bottom: 80px; }
  .ptt-btn { aspect-ratio: auto; height: 150px; clip-path: var(--chamfer); }
  .ruler-panel { left: 8px; right: 8px; width: auto; top: auto; bottom: 30px; }
  .m-round { width: 180px; height: 180px; }
  .hbar { grid-template-columns: 1fr 1fr 32px; }
  .jump-down { bottom: 80px; }
  .m-sticker { width: 140px; height: 140px; }
  .emoji-panel { bottom: 70px; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; }
  .tbl tr { padding: 10px 6px; border-bottom: 1px solid var(--glass-border); }
  .tbl td { border: 0; padding: 4px 8px; }
  .row-actions { justify-content: flex-start; }
  .log { grid-template-columns: 1fr; gap: 2px; }
  .map-legend { display: none; }
  .map-tool { width: 52px; }
  .map-compass { right: 78px; top: 60px; width: 112px; }
  .map-compass .rose { width: 92px; height: 92px; }
  .map-hint { white-space: normal; width: 80%; text-align: center; }
  #toasts { left: 12px; right: 12px; bottom: 80px; align-items: stretch; }
  #localVideo { width: 110px; right: 12px; top: 12px; }
  /* Свёрнутый звонок на телефоне — над полем ввода, не закрывает его */
  .call.mini, .gcall.mini { width: min(270px, calc(100vw - 24px)); }
  .call.mini[data-corner^="b"], .gcall.mini[data-corner^="b"] { bottom: calc(86px + env(safe-area-inset-bottom)); }
  .call.mini[data-corner^="t"], .gcall.mini[data-corner^="t"] { top: calc(80px + env(safe-area-inset-top)); }
  .call.mini[data-corner$="r"], .gcall.mini[data-corner$="r"] { right: 12px; }
  .call.mini[data-corner$="l"], .gcall.mini[data-corner$="l"] { left: 12px; }
  .call-controls { gap: 18px; }
  .call:not(.mini) .call-controls { gap: 8px; padding: 0 8px; }   /* 5 кнопок в узкий экран телефона */
  .call:not(.mini) .call-btn { width: 60px; height: 60px; }
  .login-card h1 { font-size: 32px; }
}

/* Сенсорные экраны: долгое нажатие на сообщение открывает наше меню, а не системное выделение текста
   (скопировать текст можно пунктом «Копировать текст») */
@media (hover: none) and (pointer: coarse) {
  .msg .bubble { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ── Смена темы (View Transitions) */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 1; }
::view-transition-new(root) { z-index: 2; }
