/* Шрифты лежат вместе с приложением — без Google и без сети */
@font-face{font-family:'Permanent Marker';font-style:normal;font-weight:400;font-display:swap;src:url(fonts/permanent-marker.woff2) format('woff2')}
@font-face{font-family:'Manrope';font-style:normal;font-weight:200 800;font-display:swap;src:url(fonts/manrope-cyrillic-wght-normal.woff2) format('woff2');unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}
@font-face{font-family:'Manrope';font-style:normal;font-weight:200 800;font-display:swap;src:url(fonts/manrope-latin-ext-wght-normal.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:'Manrope';font-style:normal;font-weight:200 800;font-display:swap;src:url(fonts/manrope-latin-wght-normal.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

:root{
  --accent:#C2560E; --accent-2:#E8701A; --accent-soft:#FFF1E4; --accent-softer:#FFEBD8;
  --bg:#FFF6EE; --card:#FFFFFF; --line:#F1DCC8; --line-2:#EAD3BD;
  --ink:#2B1A0E; --ink-2:#4A2E1A; --muted:#6E4E36; --muted-2:#8A6448; --link:#B4500F;
  --ok:#2E7D32; --err:#B3261E;
  --marker:'Permanent Marker', Manrope, cursive;
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--ink);font-family:Manrope,system-ui,sans-serif;-webkit-font-smoothing:antialiased}
[hidden]{display:none !important}
button{font-family:inherit}
svg{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
.muted{color:var(--muted);margin:0;line-height:1.5}
.small{font-size:13px}
input,textarea{font-family:inherit;font-size:16px;color:var(--ink)}
input:focus,textarea:focus{outline:none;border-color:var(--accent-2) !important;box-shadow:0 0 0 4px rgba(232,112,26,.18)}

/* ---------- Заставка (рисуется в splash.js на canvas) ---------- */
.splash{position:fixed;inset:0;z-index:50;border:0;margin:0;padding:0;cursor:pointer;overflow:hidden;
  background:linear-gradient(158deg,#E57A26 0%,#C2560E 46%,#8A3409 100%);
  transition:opacity .6s ease,transform .6s cubic-bezier(.4,0,.2,1)}
.sp-cv{position:absolute;inset:0;display:block;width:100%;height:100%}
.splash.out{opacity:0;transform:scale(1.07);pointer-events:none}

/* ---------- Общие ---------- */
.logo-row{display:flex;align-items:center;gap:12px}
.logo-tile{width:36px;height:36px;border-radius:12px;background:var(--accent);color:#fff;display:flex;align-items:center;justify-content:center}
.logo-tile svg{transform:rotate(-8deg);stroke-width:2.2}
.logo-tile.big{width:56px;height:56px;border-radius:18px}
.logo-tile.big svg{width:30px;height:30px}
.wordmark{font-family:var(--marker);font-size:24px;line-height:1.1}
.wordmark.big{font-size:36px;letter-spacing:.5px}
.btn{height:48px;padding:0 20px;border:0;border-radius:14px;font-size:16px;font-weight:700;cursor:pointer}
.btn.primary{background:var(--accent);color:#fff}
.btn.primary:hover{background:#A9490B}
.btn.primary:disabled{opacity:.6;cursor:default}
.btn.ghost{background:var(--accent-soft);color:#8A3A08}
.btn.sm{height:36px;padding:0 12px;font-size:14px}
.icon-btn{width:44px;height:44px;border:0;border-radius:12px;background:transparent;color:var(--muted-2);cursor:pointer;display:flex;align-items:center;justify-content:center}
.icon-btn.soft{background:var(--accent-soft);color:var(--link)}
.icon-btn:disabled{opacity:.45;cursor:not-allowed}
.field{display:flex;flex-direction:column;gap:8px;font-size:14px;font-weight:600;color:var(--ink-2)}
.field input{height:52px;border:1.5px solid var(--line-2);border-radius:14px;padding:0 16px;background:#FFFBF7;font-weight:500}
.note{display:flex;gap:12px;align-items:flex-start;background:var(--accent-soft);border-radius:14px;padding:14px 16px}
.note svg{color:var(--link);margin-top:1px}
.note p{margin:0;font-size:13px;line-height:1.5;color:var(--muted)}
.note.warn{background:#FFF4E0}
.form-error{margin:0;min-height:0;color:var(--err);font-size:14px;font-weight:600}
.form-error:empty{display:none}
.ava{width:46px;height:46px;border-radius:50%;background:#F6B27A;color:#5A2C08;font-weight:800;display:flex;align-items:center;justify-content:center;flex-shrink:0;position:relative}
.ava .dot{position:absolute;right:0;bottom:0;width:12px;height:12px;border-radius:50%;background:var(--ok);border:2px solid #fff}

/* ---------- Регистрация ---------- */
.reg{min-height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:48px 20px;gap:28px}
.card{width:100%;max-width:420px;background:var(--card);border:1px solid var(--line);border-radius:24px;padding:36px 32px;display:flex;flex-direction:column;gap:20px;box-shadow:0 12px 40px rgba(122,60,14,.08)}
.card h1{margin:0 0 6px;font-size:26px;font-weight:800}
.card .btn{height:54px;font-size:17px}
.link-btn{font-size:14px;font-weight:600;color:var(--link);cursor:pointer}
.link-btn:hover{color:#8A3A08;text-decoration:underline}

/* ---------- Приложение ---------- */
.app{height:100%;display:flex}
.side{width:340px;flex-shrink:0;background:var(--card);border-right:1px solid var(--line);display:flex;flex-direction:column;min-height:0}
.side-top{padding:20px 20px 30px;display:flex;align-items:center;justify-content:space-between}
.conn{font-size:12px;color:var(--muted-2);font-weight:600}
.conn.on{color:var(--ok)}
.search{padding:4px 20px 12px}
.search input{width:100%;height:44px;border:1.5px solid var(--line);border-radius:12px;padding:0 14px;font-size:15px;background:#FFFBF7}
.list{flex:1;overflow-y:auto;padding:0 10px;display:flex;flex-direction:column;gap:2px}
.item{all:unset;box-sizing:border-box;display:flex;gap:12px;align-items:center;padding:12px 10px;border-radius:14px;cursor:pointer}
.item:hover{background:#FFF6EE}
.item.active{background:var(--accent-softer)}
.item:focus-visible{outline:2px solid var(--accent-2)}
.item .txt{flex:1;min-width:0}
.item .row{display:flex;justify-content:space-between;gap:8px;align-items:center}
.item .nm{font-weight:700;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.item .tm{font-size:12px;color:var(--muted-2);flex-shrink:0}
.item .pv{font-size:14px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.badge{min-width:22px;height:22px;padding:0 6px;border-radius:11px;background:var(--accent);color:#fff;font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.list-empty{padding:24px 12px;color:var(--muted);font-size:14px;line-height:1.5;text-align:center}
.me{margin:12px;padding:12px;border-radius:14px;background:var(--bg);display:flex;align-items:center;gap:12px}
.me-ava{width:40px;height:40px;background:var(--accent);color:#fff}
.me-txt{flex:1;min-width:0}
.me-name{font-weight:700;font-size:14px}
.me-txt .mono{font-size:12px;color:var(--muted-2)}

.chat{flex:1;min-width:0;display:flex;flex-direction:column;min-height:0}
.empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;padding:24px;text-align:center;color:var(--muted)}
.empty p{margin:0}
.chat-wrap{flex:1;display:flex;flex-direction:column;min-height:0}
.chat-head{height:72px;flex-shrink:0;padding:0 20px;background:var(--card);border-bottom:1px solid var(--line);display:flex;align-items:center;gap:12px}
.chat-head .ava{width:44px;height:44px}
.back{display:none}
.peer-txt{flex:1;min-width:0}
.peer-name{font-weight:700;font-size:16px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.peer-st{font-size:13px;color:var(--muted-2);font-weight:600}
.peer-st.on{color:var(--ok)}
.msgs{flex:1;overflow-y:auto;padding:20px 24px;display:flex;flex-direction:column;gap:8px}
.sys{align-self:center;font-size:12px;font-weight:600;color:var(--muted-2);background:#FBE6D3;padding:6px 12px;border-radius:10px;display:flex;align-items:center;gap:6px;text-align:center}
.sys svg{width:12px;height:12px;stroke-width:2.4}
.day{align-self:center;font-size:12px;font-weight:700;color:var(--muted-2);padding:6px 0}
.bub{max-width:min(70%,560px);padding:10px 14px;font-size:15px;line-height:1.45;white-space:pre-wrap;overflow-wrap:anywhere}
.bub.in{align-self:flex-start;background:var(--card);border:1px solid var(--line);border-radius:18px 18px 18px 6px}
.bub.out{align-self:flex-end;background:var(--accent);color:#fff;border-radius:18px 18px 6px 18px}
.bub .meta{font-size:11px;text-align:right;margin-top:4px;color:var(--muted-2);display:flex;justify-content:flex-end;gap:4px;align-items:center}
.bub.out .meta{color:#FFE2C8}
.bub .tk{letter-spacing:-.15em;margin-right:.15em}
.bub.out .tk.read{color:#FFE066;font-weight:900;font-size:15px;line-height:1;-webkit-text-stroke:.6px #FFE066;
  text-shadow:-1.5px 0 0 #000,1.5px 0 0 #000,0 -1.5px 0 #000,0 1.5px 0 #000,-1.1px -1.1px 0 #000,1.1px -1.1px 0 #000,-1.1px 1.1px 0 #000,1.1px 1.1px 0 #000}
.composer{padding:12px 20px 18px;display:flex;gap:10px;align-items:flex-end}
.composer textarea{flex:1;min-width:0;min-height:48px;max-height:160px;resize:none;border:1.5px solid var(--line);border-radius:14px;padding:12px 16px;font-size:15px;line-height:1.4;background:var(--card)}
.icon-btn.send{width:48px;height:48px;border-radius:14px;background:var(--accent);color:#fff}

/* ---------- Группы ---------- */
.top-btns{display:flex;gap:8px}
.ava.grp{background:linear-gradient(145deg,#E8701A,#A9490B);color:#fff}
.ava.grp svg{width:22px;height:22px}
.who{font-size:12px;font-weight:800;margin-bottom:2px}
.dlg-list{max-height:300px;overflow-y:auto;display:flex;flex-direction:column;gap:2px;font-weight:500}
.chk{display:flex;align-items:center;gap:12px;padding:8px 10px;border-radius:12px;cursor:pointer;font-weight:600;color:var(--ink)}
.chk:hover{background:var(--bg)}
.chk input{width:20px;height:20px;accent-color:var(--accent);flex-shrink:0}
.chk .ava,.mem .ava{width:36px;height:36px;font-size:14px}
.mem{display:flex;align-items:center;gap:12px;padding:8px 10px;border-radius:12px;color:var(--ink);font-weight:600}
.mem .sub{font-size:12px;color:var(--muted-2);font-weight:500}
.mem .tag{margin-left:auto;font-size:11px;font-weight:700;color:var(--link);background:var(--accent-soft);padding:3px 8px;border-radius:8px}
#mem-add{flex:1;min-width:0;height:44px;border:1.5px solid var(--line-2);border-radius:12px;padding:0 12px;background:#FFFBF7}
.btn.danger{background:#FCE8E6;color:#B3261E}
.msgs > .sys:not(:first-child){font-weight:600}
textarea:disabled{background:#F6EEE7;cursor:not-allowed}

/* ---------- Звонок ---------- */
.call{position:fixed;inset:0;z-index:45;color:#fff;overflow:hidden;display:flex;flex-direction:column;align-items:center;justify-content:space-between;padding:56px 20px calc(36px + env(safe-area-inset-bottom));
  background:radial-gradient(70% 55% at 50% 38%,rgba(232,112,26,.55),rgba(232,112,26,0) 65%),linear-gradient(165deg,#5A2208 0%,#2E1004 60%,#1A0902 100%)}
.tiles{position:absolute;inset:0;display:grid;gap:3px;background:#120601;opacity:0;pointer-events:none;transition:opacity .4s;grid-auto-rows:1fr}
.call.has-video .tiles{opacity:1}
.tile{position:relative;overflow:hidden;background:radial-gradient(60% 60% at 50% 45%,rgba(232,112,26,.45),rgba(232,112,26,0) 70%),linear-gradient(165deg,#5A2208,#1A0902);display:flex;align-items:center;justify-content:center;min-height:0}
.tile video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;opacity:0}
.tile.vid video{opacity:1}
.tile.vid .tile-ava{opacity:0}
.tile audio{display:none}
.tile-ava{width:84px !important;height:84px !important;font-size:34px;border:3px solid rgba(255,255,255,.25)}
.tile-name{position:absolute;left:10px;top:10px;max-width:calc(100% - 20px);font-size:13px;font-weight:700;padding:4px 10px;border-radius:999px;background:rgba(0,0,0,.45);color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.inv-item{all:unset;box-sizing:border-box;display:flex;align-items:center;gap:12px;padding:8px 10px;border-radius:12px;cursor:pointer;font-weight:600;color:var(--ink)}
.inv-item:hover{background:var(--bg)}
.inv-item:focus-visible{outline:2px solid var(--accent-2)}
.inv-item .ava{width:36px;height:36px;font-size:14px}
.inv-dlg .handle-in{width:100%}
.call.has-video .call-center{opacity:0;pointer-events:none}
.call.has-video::after{content:'';position:absolute;inset:auto 0 0 0;height:180px;background:linear-gradient(transparent,rgba(0,0,0,.55));pointer-events:none}
.call > *:not(.tiles){position:relative;z-index:1}
.call-path{position:absolute !important;top:16px;left:50%;transform:translateX(-50%);font-size:12px;font-weight:700;white-space:nowrap;display:flex;flex-direction:column;align-items:center;gap:6px}
.call-path > span{padding:6px 12px;border-radius:999px;background:rgba(0,0,0,.35);backdrop-filter:blur(6px)}
.path-ico{width:72px;height:30px;fill:none;stroke:currentColor;stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round;filter:drop-shadow(0 1px 2px rgba(0,0,0,.55))}
.call-path.direct{color:#9EF0C0}.call-path.relay{color:#FFD58A}
.call-center{display:flex;flex-direction:column;align-items:center;gap:14px;margin-top:8vh;transition:opacity .3s}
.call-ring{border-radius:50%;padding:10px}
.call.ringing .call-ring{animation:ringPulse 1.6s ease-out infinite}
@keyframes ringPulse{0%{box-shadow:0 0 0 0 rgba(255,190,130,.55)}100%{box-shadow:0 0 0 34px rgba(255,190,130,0)}}
.call-ava{width:120px !important;height:120px !important;font-size:46px;border:3px solid rgba(255,255,255,.25)}
.call-name{font-size:28px;font-weight:800;text-align:center}
.call-st{font-size:16px;font-weight:600;color:#FFE2C8;min-height:22px;font-variant-numeric:tabular-nums}
.lv{position:absolute !important;right:16px;top:56px;width:min(28vw,180px);aspect-ratio:3/4;object-fit:cover;border-radius:16px;border:2px solid rgba(255,255,255,.6);background:#000;transform:scaleX(-1);z-index:2 !important}
.call-btns{display:flex;gap:22px;align-items:center}
.cbtn{width:64px;height:64px;border-radius:50%;border:0;cursor:pointer;background:rgba(255,255,255,.18);color:#fff;display:flex;align-items:center;justify-content:center;backdrop-filter:blur(6px)}
.cbtn svg{width:26px;height:26px}
.cbtn.off{background:#fff;color:#2B1A0E}
.cbtn.end{background:#D93025}.cbtn.end svg{transform:rotate(135deg)}
.cbtn.ok{background:#1E9E5A}
.cbtn:focus-visible{outline:3px solid #fff;outline-offset:3px}

.opt{font-weight:500;color:var(--muted-2)}
.handle-in{flex:1;min-width:0;height:44px;border:1.5px solid var(--line-2);border-radius:12px;padding:0 12px;background:#FFFBF7}
.hd{color:var(--link);font-weight:700}

/* ---------- Чат во время звонка ---------- */
/* компьютер: звонок слева, чат собеседника справа */
body.call-chat .call{right:400px}
body.call-chat .app .side{display:none}
body.call-chat .app .chat{display:flex !important;position:fixed;top:0;right:0;bottom:0;width:400px;z-index:46;border-left:1px solid var(--line);background:var(--bg);box-shadow:-12px 0 30px rgba(40,15,3,.25)}
body.call-chat .chat .back{display:none !important}
body.call-chat .chat .call-btn{display:none}
body.call-chat .lv{right:16px}
#c-chat.on{background:#fff;color:#2B1A0E}
/* телефон: звонок сверху, чат снизу */
@media (max-width:900px){
  body.call-chat .call{right:0;bottom:auto;height:40vh;padding:12px 16px 14px;justify-content:flex-end}
  body.call-chat .call-center{margin-top:0;gap:6px}
  body.call-chat .call-ava{width:64px !important;height:64px !important;font-size:26px}
  body.call-chat .call-name{font-size:18px}
  body.call-chat .call-ring{padding:4px}
  body.call-chat .cbtn{width:50px;height:50px}
  body.call-chat .call-btns{gap:14px}
  body.call-chat .call-path{top:8px}
  body.call-chat .call-path .path-ico{display:none}
  body.call-chat .lv{top:10px;width:min(22vw,110px)}
  body.call-chat .app .chat{top:40vh;width:auto;left:0;border-left:0;box-shadow:0 -10px 24px rgba(40,15,3,.25)}
  body.call-chat .chat .chat-head{height:52px}
}

/* ---------- Диалоги ---------- */
.dlg{border:0;border-radius:22px;padding:0;width:min(440px,calc(100vw - 32px));box-shadow:0 24px 60px rgba(60,30,10,.25);color:var(--ink)}
.dlg::backdrop{background:rgba(43,26,14,.35)}
.dlg-body{padding:28px;display:flex;flex-direction:column;gap:18px}
.dlg h2{margin:0;font-size:22px;font-weight:800}
.dlg-btns{display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap}
.found{display:flex;align-items:center;gap:12px;padding:12px;border-radius:14px;background:var(--bg);font-weight:700}
.id-row{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.big-id{font-size:22px;color:var(--ink)}
.fp{font-size:12px;font-weight:500;color:var(--muted);background:var(--bg);padding:10px 12px;border-radius:10px;word-break:break-all;line-height:1.5}

.toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%) translateY(20px);background:var(--ink);color:#fff;padding:12px 18px;border-radius:12px;font-size:14px;font-weight:600;opacity:0;pointer-events:none;transition:.25s;z-index:60;max-width:calc(100vw - 32px)}
.toast.show{opacity:1;transform:translateX(-50%)}

/* ---------- Телефон ---------- */
@media (max-width:760px){
  .side{width:100%;border-right:0}
  .chat{display:none}
  .app.in-chat .side{display:none}
  .app.in-chat .chat{display:flex}
  .back{display:flex}
  .chat-head{padding:0 8px 0 4px}
  .msgs{padding:16px 12px}
  .composer{padding:10px 10px calc(12px + env(safe-area-inset-bottom))}
  .bub{max-width:85%}
  .card{padding:28px 22px}
}


.robot{display:flex;align-items:center;gap:14px;height:60px;padding:0 16px;border:1.5px solid var(--line-2);border-radius:14px;background:#FFFBF7;cursor:pointer;user-select:none;font-weight:600;color:var(--ink)}
.robot:focus-visible{outline:2px solid var(--accent-2);outline-offset:2px}
.robot-box{width:28px;height:28px;border:2px solid #B9A493;border-radius:7px;background:#fff;display:grid;place-items:center;flex-shrink:0;transition:background .2s,border-color .2s}
.robot-box svg{width:20px;height:20px;fill:none;stroke:#fff;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:24;stroke-dashoffset:24;transition:stroke-dashoffset .35s ease .05s}
.robot[data-state="busy"]{cursor:progress}
.robot[data-state="busy"] .robot-box{border-color:transparent;border-top-color:#C2560E;border-right-color:#C2560E;border-radius:50%;animation:robot-spin .8s linear infinite}
.robot[data-state="done"]{cursor:default}
.robot[data-state="done"] .robot-box{background:#2E9E5B;border-color:#2E9E5B}
.robot[data-state="done"] .robot-box svg{stroke-dashoffset:0}
@keyframes robot-spin{to{transform:rotate(360deg)}}

/* ---------- Несколько устройств ---------- */
.join-btn{display:flex;align-items:center;justify-content:center;gap:8px}
.pair-code{font-size:38px;font-weight:800;letter-spacing:.22em;text-align:center;padding:16px 8px 16px calc(8px + .22em);
  background:var(--accent-soft);border:2px dashed var(--line-2);border-radius:16px;color:var(--ink);user-select:all}
.pair-code.expired{opacity:.35;text-decoration:line-through}
.pair-timer{margin:0;text-align:center;font-weight:700;color:var(--link)}
.pair-st{margin:0;min-height:1.2em;text-align:center;font-size:14px;color:var(--muted)}
.pair-st.ok{color:var(--ok);font-weight:700}
.pair-in{font-size:26px !important;letter-spacing:.25em;text-transform:uppercase;text-align:center}
.dev .ava{background:var(--accent-soft);color:var(--link)}
.dev .ava svg{width:18px;height:18px}
.dev .btn{margin-left:auto}
.dev .sub.on{color:var(--ok)}
#hist-st{text-align:left}

/* ---------- Файлы ---------- */
.composer .attach{flex:none;width:48px;height:48px}
.bub.has-file{min-width:240px}
.fcard{display:grid;grid-template-columns:40px 1fr;grid-template-areas:"prev prev" "ico info" "act act";gap:4px 10px;align-items:center;margin-bottom:4px;white-space:normal}
.fcard .fprev{grid-area:prev;max-width:100%;max-height:280px;border-radius:12px;display:block;cursor:pointer;margin-bottom:4px;object-fit:contain;background:rgba(0,0,0,.06)}
.fcard .fico{grid-area:ico;width:40px;height:40px;border-radius:12px;display:grid;place-items:center;background:var(--accent-soft);color:var(--link)}
.bub.out .fcard .fico{background:rgba(255,255,255,.18);color:#fff}
.fcard .fico svg{width:22px;height:22px}
.fcard .finfo{grid-area:info;min-width:0}
.fcard .fname{font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fcard .fsub{font-size:12.5px;opacity:.8}
.fcard .fact{grid-area:act;display:flex;gap:8px}
.fcard .fact:empty{display:none}
.fcard .fbtn{margin-top:4px}
.fcard .fbtn{background:var(--accent-soft);color:var(--link)}
.bub.out .fcard .fbtn{background:rgba(255,255,255,.2);color:#fff;border-color:transparent}
.chat-wrap.drop .msgs{outline:3px dashed var(--accent);outline-offset:-10px}
.sel-row{display:flex;flex-wrap:wrap;align-items:center;gap:8px;font-size:15px}
.sel-row select{font:inherit;padding:8px 10px;border:1.5px solid var(--line);border-radius:10px;background:var(--card);color:var(--ink)}

.dlg-head{display:flex;align-items:center;justify-content:space-between;gap:12px;position:sticky;top:-28px;z-index:3;margin:-28px -28px 0;padding:22px 20px 10px 28px;background:var(--card);border-radius:22px 22px 0 0}
.dlg-x{width:40px;height:40px}
/* уведомления о входящих файлах */
.fnotes{position:fixed;top:14px;right:14px;z-index:55;display:flex;flex-direction:column;gap:10px;width:min(380px,calc(100vw - 28px));pointer-events:none}
.fnote{pointer-events:auto;display:grid;grid-template-columns:40px 1fr auto;gap:4px 12px;align-items:center;background:var(--card);border:1px solid var(--line);border-radius:16px;padding:12px 10px 12px 12px;box-shadow:0 12px 32px rgba(60,30,10,.18);animation:fnIn .25s ease}
@keyframes fnIn{from{opacity:0;transform:translateY(-8px)}}
.fnote .fico{width:40px;height:40px;border-radius:12px;display:grid;place-items:center;background:var(--accent-soft);color:var(--link)}
.fnote .ft{font-size:14px;line-height:1.35;min-width:0;cursor:pointer}
.fnote .ft b{overflow-wrap:anywhere}
.fnote .fs{font-size:12.5px;color:var(--muted);margin-top:2px}
.fnote .fx{width:32px;height:32px;align-self:start}
.fnote .fx svg{width:16px;height:16px}
.fnote .fa{grid-column:2/4;display:flex;gap:8px}
.fnote .fa:empty{display:none}
@media (max-width:760px){.fnotes{top:auto;bottom:calc(84px + env(safe-area-inset-bottom));right:14px}}
.fnote .fbtn{background:var(--accent);color:#fff}

/* ---------- Действия с сообщением ---------- */
.bub{position:relative}
.bub-more{position:absolute;top:50%;transform:translateY(-50%);right:-36px;width:30px;height:30px;border:0;border-radius:50%;display:grid;place-items:center;cursor:pointer;
  background:var(--card);color:var(--muted);box-shadow:0 2px 8px rgba(60,30,10,.12);opacity:0;transition:opacity .15s;padding:0}
.bub-more svg{width:16px;height:16px}
.bub.out .bub-more{right:auto;left:-36px}
.bub-more::before{content:'';position:absolute;inset:-6px -10px}
.bub:hover .bub-more,.bub-more:focus-visible{opacity:1}
@media (hover:none){.bub-more{display:none}}
.msg-menu{position:fixed;z-index:70;min-width:200px;background:var(--card);border:1px solid var(--line);border-radius:14px;box-shadow:0 14px 36px rgba(60,30,10,.22);padding:6px;display:flex;flex-direction:column}
.msg-menu .mi{border:0;background:none;text-align:left;font:inherit;font-size:15px;font-weight:600;padding:11px 14px;border-radius:10px;cursor:pointer;color:var(--ink)}
.msg-menu .mi:hover,.msg-menu .mi:focus-visible{background:var(--accent-soft);outline:none}
.msg-menu .mi.danger{color:var(--err)}
.msgs .sys{cursor:default}

/* ---------- Удаление аккаунта ---------- */
.danger-zone{border-top:1px solid var(--line);padding-top:16px;display:flex;justify-content:center}
.btn.del-acc{background:transparent;color:var(--err);border:1.5px solid rgba(179,38,30,.35)}
.btn.del-acc:hover{background:rgba(179,38,30,.06)}
.btn.del-acc.solid{background:var(--err);color:#fff;border-color:var(--err)}
.btn.del-acc.solid:disabled{opacity:.45;cursor:not-allowed}
.del-list{margin:0;padding-left:20px;display:flex;flex-direction:column;gap:6px;font-size:14.5px;line-height:1.45}
.del-code{font-size:30px;font-weight:800;letter-spacing:.3em;text-align:center;padding:10px 8px 10px calc(8px + .3em);background:rgba(179,38,30,.07);color:var(--err);border:2px dashed rgba(179,38,30,.3);border-radius:14px;user-select:none}
.del-in{font-size:24px !important;letter-spacing:.3em;text-align:center}
/* Android-приложение: переключатель звука в звонке и плашка обновления */
#c-spk svg path{fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
#c-spk[data-route=earpiece] .w2,#c-spk[data-route=wired] .w2,#c-spk[data-route=bluetooth] .w2{display:none}
#c-spk.loud{background:var(--accent-2)}
.apk-banner{position:fixed;left:12px;right:12px;bottom:calc(12px + env(safe-area-inset-bottom));z-index:60;display:flex;align-items:center;gap:10px;padding:10px 12px;border-radius:14px;background:#2B1A0E;color:#fff;box-shadow:0 8px 24px rgba(0,0,0,.25);font-size:14px}
.apk-banner span{flex:1}
.apk-banner .btn{background:var(--accent);color:#fff;border:0;border-radius:10px;padding:8px 14px;font-weight:600}
.apk-x{background:none;border:0;color:#fff;font-size:22px;line-height:1;padding:0 4px;cursor:pointer}
/* версия под конвертиком в шапке: «vers 1.0.8 · 12.01-14» (приложение · страницы) */
.logo-col{position:relative}
.app-ver{position:absolute;left:0;top:calc(100% + 13px);font-size:10px;line-height:1;color:var(--muted-2);font-weight:600;letter-spacing:.02em;white-space:nowrap}
/* телефон: кнопки звонка в 2 ряда по 3 — сверху микрофон / пригласить / чат, снизу камера / звук / завершить */
@media (max-width:560px){
  body:not(.call-chat) #call-active.call-btns{display:grid;grid-template-columns:repeat(3,64px);gap:18px 30px;justify-content:center}
  #call-active #c-mic{order:1} #call-active #c-add{order:2} #call-active #c-chat{order:3}
  #call-active #c-cam{order:4} #call-active #c-spk{order:5} #call-active #c-end{order:6}
  /* звонок + чат: одна строка из 6 кнопок должна влезть в узкий экран (360px), иначе «завершить» справа обрезается */
  body.call-chat .cbtn{width:44px;height:44px} body.call-chat .cbtn svg{width:22px;height:22px}
  body.call-chat .call-btns{gap:8px}
}
/* телефон: окно ввода кода — у верха экрана, чтобы клавиатура не закрывала поле */
@media (max-width:760px){
  #join-dlg{margin-top:calc(14px + env(safe-area-inset-top));margin-bottom:auto}
}
/* «Поделиться» из других приложений: выбор чата */
.share-list{max-height:min(55vh,460px);overflow:auto;display:flex;flex-direction:column;gap:4px}
.share-item{display:flex;align-items:center;gap:12px;padding:8px 10px;border:0;border-radius:14px;background:none;font:inherit;color:var(--ink);text-align:left;cursor:pointer}
.share-item:hover,.share-item:focus-visible{background:var(--card)}
.share-item .ava{width:42px;height:42px;font-size:17px;flex:none}
.share-item span{font-weight:600;font-size:16px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* «Работа в фоне»: подсказка для Infinix/Tecno/Itel; на таком телефоне — выделена */
.bg-xos{margin-top:6px}
.bg-xos.mine{color:var(--ink);background:var(--accent-soft);border-radius:12px;padding:10px 12px}
/* ответ на сообщение: цитата в пузыре и полоска над полем ввода */
.quote{border-left:3px solid var(--accent);background:rgba(194,86,14,.08);border-radius:8px;padding:5px 9px;margin:0 0 6px;cursor:pointer;white-space:normal;max-width:100%}
.bub.out .quote{border-left-color:#fff;background:rgba(255,255,255,.18)}
.quote .q-who{font-size:12px;font-weight:800;color:var(--accent)}
.bub.out .quote .q-who{color:#fff}
.quote .q-text{font-size:13px;line-height:1.35;opacity:.85;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.reply-bar{display:flex;align-items:center;gap:10px;margin:0 20px -4px;padding:8px 8px 8px 12px;border-left:3px solid var(--accent);background:var(--card);border-radius:12px;border:1px solid var(--line);border-left-width:3px;cursor:pointer}
.reply-bar[hidden]{display:none}
.reply-body{flex:1;min-width:0}
.reply-who{font-size:12px;font-weight:800;color:var(--accent)}
.reply-text{font-size:13px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.reply-x{flex:none;width:34px;height:34px}
@media (max-width:760px){.reply-bar{margin:0 10px -2px}}
.bub.flash{animation:bubflash 1.2s ease}
@keyframes bubflash{0%,40%{box-shadow:0 0 0 4px rgba(194,86,14,.45)}100%{box-shadow:0 0 0 0 rgba(194,86,14,0)}}
/* кнопка отправки: «Летящий конверт» (вариант Б — крупнее, 03.12.2026) */
.icon-btn.send svg.send-ico{width:24px;height:24px;stroke-width:1.9}
/* полоска над первым непрочитанным */
.unread-div{align-self:stretch;display:flex;align-items:center;gap:10px;margin:6px 0;font-size:12px;font-weight:800;color:var(--accent);text-transform:none}
.unread-div::before,.unread-div::after{content:'';flex:1;height:1px;background:var(--accent);opacity:.35}
/* присутствие: в сети — зелёная точка, в фоне — серое колечко с белой серединой, не в сети — без точки */
.peer-st.bg{color:#8E8E8E}
.peer-st .st-dot{display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:6px;vertical-align:1px;background:var(--ok)}
.peer-st.bg .st-dot{background:#fff;border:2px solid #9A9A9A;width:9px;height:9px;vertical-align:-1px}
.peer-st .st-on{color:var(--ok)} .peer-st .st-bg{color:#8E8E8E}
.ava .dot.bg{background:#fff;border:2.5px solid #9A9A9A;width:9px;height:9px}
.sub.bg{color:#8E8E8E}
.apk-banner.stack{bottom:calc(76px + env(safe-area-inset-bottom))}
.web-banner b{white-space:nowrap;font-weight:700}
/* просмотр фото и видео на весь экран */
.viewer{position:fixed;inset:0;z-index:90;background:#0E0905;display:flex;flex-direction:column}
.v-bar{display:flex;align-items:center;gap:10px;padding:calc(10px + env(safe-area-inset-top)) 12px 10px;color:#fff;background:rgba(0,0,0,.35)}
.v-name{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-weight:600;font-size:15px}
.v-x{background:none;border:0;color:#fff;font-size:30px;line-height:1;padding:0 6px;cursor:pointer}
.v-stage{flex:1;min-height:0;display:flex;align-items:center;justify-content:center;overflow:hidden;touch-action:none;padding-bottom:env(safe-area-inset-bottom)}
.v-media{max-width:100%;max-height:100%;object-fit:contain;user-select:none;-webkit-user-select:none}
video.v-media{width:100%;background:#000}
.fvwrap{position:relative;cursor:pointer}
.fvwrap video{display:block;width:100%;max-height:260px;object-fit:cover;border-radius:10px;background:#000;pointer-events:none}
.fplay{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:52px;height:52px;border-radius:50%;background:rgba(0,0,0,.55);color:#fff;font-size:22px;display:flex;align-items:center;justify-content:center;padding-left:4px;box-sizing:border-box}
img.fprev{cursor:zoom-in}
.fact .btn.ghost{background:transparent;border:1px solid currentColor}   /* «Открыть» у файла (не трогать «Отмена» в окнах) */
/* блокировка: вместо поля ввода — полоска */
.blocked-bar{display:flex;align-items:center;justify-content:center;gap:12px;flex-wrap:wrap;padding:14px 16px calc(14px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--card);color:var(--muted);font-size:14px;text-align:center}
.blocked-bar[hidden]{display:none}
.ask-check{display:flex;gap:10px;align-items:flex-start;margin:12px 0 4px;font-size:15px;cursor:pointer}
.ask-check input{width:20px;height:20px;margin-top:1px;accent-color:var(--accent);flex:none}
.peer-txt,.chat-head #peer-ava{cursor:pointer}
