/* ============================================================================
   Панель поддержки — тёмная тема.
   Ноль внешних запросов: системные шрифты, иконки — инлайновый SVG-спрайт.
   Один акцент (#ff9a3d), без градиентов, границы строго 1px.
   ========================================================================== */

:root{
  --bg:        #0b0b0d;
  --bg-pane:   #0e0e11;
  --bg-raise:  #141418;
  --bg-input:  #17171c;
  --bg-hover:  #191920;
  --bg-active: #1e1e26;

  --line:      #24242c;
  --line-soft: #1a1a20;

  --txt:       #ececf1;
  --txt-dim:   #9c9caa;
  --txt-mute:  #6a6a78;

  --accent:      #ff9a3d;
  --accent-ink:  #180f05;
  --accent-dim:  #c9762c;
  --accent-soft: rgba(255,154,61,.13);
  --accent-line: rgba(255,154,61,.28);

  --danger:      #ff5f56;
  --danger-soft: rgba(255,95,86,.12);
  --danger-line: rgba(255,95,86,.30);
  --ok:          #46d17f;

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 16px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --list-w: 340px;
  --head-h: 60px;
}

*,*::before,*::after{ box-sizing:border-box; }

html,body{ height:100%; }

body{
  margin:0;
  background:var(--bg);
  color:var(--txt);
  font-family:var(--font);
  font-size:14px;
  line-height:1.45;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  overflow:hidden;
}

body.booting .screen{ display:none !important; }

[hidden]{ display:none !important; }

button{ font:inherit; color:inherit; }
input,textarea{ font:inherit; color:inherit; }

a{ color:var(--accent); text-decoration:none; }
a:hover{ text-decoration:underline; }

.sprite{ position:absolute; width:0; height:0; overflow:hidden; }

.ic{
  width:18px; height:18px;
  flex:none;
  fill:none;
  stroke:currentColor;
  stroke-width:1.7;
  stroke-linecap:round;
  stroke-linejoin:round;
}

:focus{ outline:none; }
:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:2px;
  border-radius:6px;
}

.noscript{
  padding:40px; text-align:center; color:var(--txt-dim);
}

/* --- scrollbars ---------------------------------------------------------- */
.list, .messages, .modal-body, .pop-list{
  scrollbar-width:thin;
  scrollbar-color:#2c2c35 transparent;
}
.list::-webkit-scrollbar,
.messages::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.pop-list::-webkit-scrollbar{ width:10px; }
.list::-webkit-scrollbar-thumb,
.messages::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.pop-list::-webkit-scrollbar-thumb{
  background:#2c2c35; border-radius:99px;
  border:3px solid transparent; background-clip:content-box;
}
.list::-webkit-scrollbar-thumb:hover,
.messages::-webkit-scrollbar-thumb:hover{ background:#3a3a46; background-clip:content-box; }

/* ==========================================================================
   Кнопки, поля
   ========================================================================== */

.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:7px;
  height:36px; padding:0 14px;
  border:1px solid var(--line);
  border-radius:var(--r-sm);
  background:var(--bg-raise);
  color:var(--txt);
  font-size:13.5px; font-weight:500;
  cursor:pointer;
  white-space:nowrap;
  transition:background .12s ease, border-color .12s ease, color .12s ease, opacity .12s ease;
}
.btn:hover{ background:var(--bg-hover); border-color:#2e2e38; }
.btn:active{ background:var(--bg-active); }
.btn:disabled{ opacity:.5; cursor:default; pointer-events:none; }

.btn-sm{ height:30px; padding:0 11px; font-size:12.5px; }
.btn-block{ width:100%; height:42px; font-size:14.5px; }

.btn-accent{
  background:var(--accent); border-color:var(--accent); color:var(--accent-ink); font-weight:600;
}
.btn-accent:hover{ background:#ffa855; border-color:#ffa855; }
.btn-accent:active{ background:var(--accent-dim); border-color:var(--accent-dim); }

.btn-ghost{ background:transparent; }
.btn-ghost:hover{ background:var(--bg-hover); }
.btn-ghost.is-on{
  background:var(--accent-soft); border-color:var(--accent-line); color:var(--accent);
}
.btn-ghost-danger.is-on{
  background:var(--danger-soft); border-color:var(--danger-line); color:var(--danger);
}
.btn-quiet{ background:transparent; border-color:transparent; color:var(--txt-dim); }
.btn-quiet:hover{ background:var(--bg-hover); color:var(--txt); }

.btn-danger{
  background:transparent; border-color:var(--danger-line); color:var(--danger);
}
.btn-danger:hover{ background:var(--danger-soft); border-color:var(--danger); }

.icon-btn{
  display:inline-flex; align-items:center; justify-content:center;
  width:34px; height:34px;
  border:1px solid transparent; border-radius:var(--r-sm);
  background:transparent; color:var(--txt-dim);
  cursor:pointer;
  transition:background .12s ease, color .12s ease;
}
.icon-btn:hover{ background:var(--bg-hover); color:var(--txt); }
.icon-btn:active{ background:var(--bg-active); }
.icon-btn-sm{ width:26px; height:26px; }
.icon-btn-sm .ic{ width:15px; height:15px; }
.icon-btn.is-on{ color:var(--accent); background:var(--accent-soft); }

.input{
  width:100%; height:40px;
  padding:0 12px;
  border:1px solid var(--line);
  border-radius:var(--r-sm);
  background:var(--bg-input);
  color:var(--txt);
  font-size:14px;
  transition:border-color .12s ease, background .12s ease;
}
.input::placeholder{ color:var(--txt-mute); }
.input:hover{ border-color:#2e2e38; }
.input:focus{ border-color:var(--accent-line); background:#191920; outline:none; }
textarea.input{ height:auto; padding:9px 12px; resize:vertical; line-height:1.5; }
.input-sm{ height:34px; font-size:13px; }

.field{ display:block; margin-bottom:12px; }
.field-label{
  display:block; margin-bottom:6px;
  font-size:12px; font-weight:500; color:var(--txt-dim);
}

.form-error{
  margin:2px 0 12px;
  padding:9px 11px;
  border:1px solid var(--danger-line);
  border-radius:var(--r-sm);
  background:var(--danger-soft);
  color:#ff8f88;
  font-size:13px;
}
.form-ok{
  margin:2px 0 12px;
  padding:9px 11px;
  border:1px solid rgba(70,209,127,.28);
  border-radius:var(--r-sm);
  background:rgba(70,209,127,.10);
  color:var(--ok);
  font-size:13px;
}
.hint{ font-size:12px; color:var(--txt-mute); }
.hint-block{ margin:10px 0 0; }

/* ==========================================================================
   1. Вход
   ========================================================================== */

.screen-login{
  height:100dvh;
  display:flex; align-items:center; justify-content:center;
  padding:24px;
}
.login-card{
  width:100%; max-width:352px;
  padding:28px 26px 26px;
  border:1px solid var(--line);
  border-radius:var(--r-lg);
  background:var(--bg-pane);
}
.login-mark{
  display:flex; align-items:center; justify-content:center;
  width:44px; height:44px; margin-bottom:16px;
  border:1px solid var(--accent-line); border-radius:var(--r);
  background:var(--accent-soft); color:var(--accent);
}
.login-mark .ic{ width:22px; height:22px; }
.login-title{ margin:0; font-size:21px; font-weight:650; letter-spacing:-.2px; }
.login-sub{ margin:3px 0 22px; font-size:13px; color:var(--txt-mute); }
.login-card .btn-block{ margin-top:6px; }
.login-card.is-busy{ opacity:.65; pointer-events:none; }

/* ==========================================================================
   2. Панель — каркас
   ========================================================================== */

.panel{
  display:grid;
  grid-template-columns:var(--list-w) 1fr;
  /* minmax(0,1fr), а не auto: строка auto тянется по max-content колонок, и при
     сотнях диалогов список вырастал бы ниже экрана — вместе с композером чата.
     Здесь строка жёстко равна высоте окна, а прокручиваются .list и .messages. */
  grid-template-rows:minmax(0, 1fr);
  height:100dvh;
  overflow:hidden;
}

/* --- левая колонка ------------------------------------------------------- */

.pane-list{
  display:flex; flex-direction:column;
  min-width:0; min-height:0;   /* иначе flex-элементы внутри не дадут ей сжаться */
  border-right:1px solid var(--line);
  background:var(--bg-pane);
}

.list-head{
  display:flex; align-items:center; justify-content:space-between;
  height:var(--head-h); padding:0 10px 0 16px;
  border-bottom:1px solid var(--line-soft);
  flex:none;
}
.brand{ display:flex; align-items:center; gap:9px; min-width:0; }
.brand-name{ font-size:15px; font-weight:600; letter-spacing:-.1px; }
.brand-dot{
  width:8px; height:8px; border-radius:50%;
  background:var(--txt-mute);
  transition:background .2s ease, box-shadow .2s ease;
}
.brand-dot.is-live{ background:var(--ok); box-shadow:0 0 0 3px rgba(70,209,127,.14); }
.brand-dot.is-down{ background:var(--danger); box-shadow:0 0 0 3px rgba(255,95,86,.14); }

.search{
  position:relative;
  padding:10px 12px 8px;
  flex:none;
}
.search-ic{
  position:absolute; left:23px; top:50%; transform:translateY(-42%);
  color:var(--txt-mute); pointer-events:none;
  width:16px; height:16px;
}
.search-input{
  width:100%; height:36px;
  padding:0 32px 0 34px;
  border:1px solid var(--line); border-radius:var(--r-sm);
  background:var(--bg-input); color:var(--txt);
  font-size:13.5px;
}
.search-input::placeholder{ color:var(--txt-mute); }
.search-input:focus{ border-color:var(--accent-line); outline:none; }
.search-clear{
  position:absolute; right:16px; top:50%; transform:translateY(-42%);
  display:flex; align-items:center; justify-content:center;
  width:22px; height:22px; padding:0;
  border:0; border-radius:6px; background:transparent;
  color:var(--txt-mute); cursor:pointer;
}
.search-clear:hover{ background:var(--bg-hover); color:var(--txt); }
.search-clear .ic{ width:14px; height:14px; }

.tabs{
  display:flex; gap:4px;
  padding:2px 12px 10px;
  border-bottom:1px solid var(--line-soft);
  flex:none;
}
.tab{
  display:inline-flex; align-items:center; gap:6px;
  height:28px; padding:0 10px;
  border:1px solid transparent; border-radius:99px;
  background:transparent; color:var(--txt-dim);
  font-size:12.5px; font-weight:500;
  cursor:pointer; white-space:nowrap;
  transition:background .12s ease, color .12s ease, border-color .12s ease;
}
.tab:hover{ background:var(--bg-hover); color:var(--txt); }
.tab.is-active{
  background:var(--accent-soft); border-color:var(--accent-line); color:var(--accent);
}
.tab-badge{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:17px; height:17px; padding:0 5px;
  border-radius:99px;
  background:var(--accent); color:var(--accent-ink);
  font-size:10.5px; font-weight:700; line-height:1;
}
.tab.is-active .tab-badge{ background:var(--accent); color:var(--accent-ink); }

.list{ flex:1 1 auto; overflow-y:auto; overscroll-behavior:contain; padding:6px 8px 14px; }

.list-state{
  padding:26px 20px; text-align:center;
  font-size:13px; color:var(--txt-mute);
}

/* --- элемент списка ------------------------------------------------------ */

.item{
  position:relative;
  display:flex; gap:11px; align-items:flex-start;
  width:100%; padding:10px 10px 10px 11px;
  border:1px solid transparent; border-radius:var(--r);
  background:transparent; text-align:left;
  cursor:pointer;
  transition:background .12s ease;
}
.item:hover{ background:var(--bg-hover); }
.item.is-active{ background:var(--bg-active); border-color:var(--line); }
.item.is-active::before{
  content:""; position:absolute; left:0; top:12px; bottom:12px;
  width:2px; border-radius:2px; background:var(--accent);
}

.avatar{
  display:flex; align-items:center; justify-content:center;
  width:38px; height:38px; flex:none;
  border:1px solid var(--line); border-radius:11px;
  background:var(--bg-raise);
  color:var(--txt-dim);
  font-size:15px; font-weight:600;
  text-transform:uppercase;
  user-select:none;
}
.avatar-lg{ width:38px; height:38px; }
.avatar-sm{ width:34px; height:34px; font-size:13px; border-radius:10px; }
.avatar.is-unread{ border-color:var(--accent-line); background:var(--accent-soft); color:var(--accent); }
.avatar.is-blocked{ border-color:var(--danger-line); color:var(--danger); }

.item-main{ flex:1 1 auto; min-width:0; }
.item-row{ display:flex; align-items:baseline; gap:8px; min-width:0; }
.item-row + .item-row{ margin-top:2px; }

.item-name{
  flex:0 1 auto; min-width:0;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font-size:13.8px; font-weight:600; letter-spacing:-.1px; color:var(--txt);
}
.item-uname{
  flex:0 1 auto; min-width:0;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font-size:12px; color:var(--txt-mute);
}
.item-time{ margin-left:auto; flex:none; font-size:11.5px; color:var(--txt-mute); }

.item-prev{
  flex:1 1 auto; min-width:0;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font-size:12.8px; color:var(--txt-dim);
}
.item.is-unread .item-prev{ color:var(--txt); }
.prev-you{ color:var(--txt-mute); }

.badge{
  display:inline-flex; align-items:center; justify-content:center;
  min-width:18px; height:18px; padding:0 5px; flex:none;
  border-radius:99px;
  background:var(--accent); color:var(--accent-ink);
  font-size:11px; font-weight:700; line-height:1;
}

.chips{ display:flex; gap:5px; flex:none; }
.chip{
  display:inline-flex; align-items:center; gap:4px;
  height:17px; padding:0 6px;
  border:1px solid var(--line); border-radius:5px;
  background:var(--bg-raise);
  font-size:10.5px; font-weight:600; letter-spacing:.2px;
  color:var(--txt-mute);
  text-transform:uppercase;
  white-space:nowrap;
}
.chip .ic{ width:11px; height:11px; stroke-width:2.2; }
.chip-closed{ color:var(--txt-mute); }
.chip-blocked{ border-color:var(--danger-line); background:var(--danger-soft); color:var(--danger); }
.chip-verified{ border-color:rgba(70,209,127,.26); background:rgba(70,209,127,.10); color:var(--ok); }
.chip-quarantine{ border-color:var(--accent-line); background:var(--accent-soft); color:var(--accent); }

/* --- правая колонка ------------------------------------------------------ */

.pane-chat{
  position:relative;
  display:flex; flex-direction:column;
  min-width:0; min-height:0;
  background:var(--bg);
}

.chat-empty{
  flex:1 1 auto;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:6px; padding:32px; text-align:center;
}
.empty-ic{ width:40px; height:40px; color:#2f2f3a; stroke-width:1.4; margin-bottom:6px; }
.empty-title{ margin:0; font-size:15px; font-weight:600; color:var(--txt-dim); }
.empty-sub{ margin:0; font-size:13px; color:var(--txt-mute); }

.chat{
  position:relative;
  flex:1 1 auto;
  display:flex; flex-direction:column;
  min-height:0;
}

.chat-head{
  display:flex; align-items:center; gap:11px;
  min-height:var(--head-h); padding:10px 14px;
  border-bottom:1px solid var(--line-soft);
  background:var(--bg-pane);
  flex:none;
}
.back-btn{ display:none; margin-left:-6px; }
/* Шапка держит ровно две строки: имя+флаги и мета. Ничего не переносится —
   имя обрезается многоточием, мета тоже. */
.chat-who{ min-width:0; flex:1 1 auto; overflow:hidden; }
.chat-name-row{ display:flex; align-items:center; gap:7px; min-width:0; }
.chat-name{
  flex:0 1 auto; min-width:3em;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font-size:14.5px; font-weight:650; letter-spacing:-.1px;
}
.chat-flags{ display:flex; gap:5px; flex:0 0 auto; }
.chat-meta{
  margin-top:1px;
  font-size:11.8px; color:var(--txt-mute);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.chat-meta > span{ margin-right:5px; }
.chat-meta .dot{ opacity:.5; }
.chat-meta .mono{ font-family:var(--mono); font-size:11px; }
.chat-actions{ display:flex; gap:6px; flex:none; margin-left:auto; }

/* заметка */
.note-panel{
  padding:12px 14px;
  border-bottom:1px solid var(--line-soft);
  background:var(--bg-pane);
  flex:none;
}
.note-text{
  width:100%;
  padding:9px 11px;
  border:1px solid var(--line); border-radius:var(--r-sm);
  background:var(--bg-input); color:var(--txt);
  font-size:13.5px; line-height:1.5;
  resize:vertical;
}
.note-text:focus{ border-color:var(--accent-line); outline:none; }
.note-actions{
  display:flex; align-items:center; gap:8px;
  margin-top:8px;
}
.note-actions .hint{ margin-right:auto; }

/* --- лента сообщений ----------------------------------------------------- */

.messages{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overscroll-behavior:contain;
  padding:16px 18px 8px;
  display:flex; flex-direction:column;
}

.date-sep{
  align-self:center;
  margin:12px 0 14px;
  padding:3px 11px;
  border:1px solid var(--line-soft); border-radius:99px;
  background:var(--bg-raise);
  font-size:11.5px; font-weight:500; color:var(--txt-mute);
  position:sticky; top:0; z-index:2;
}
.date-sep:first-child{ margin-top:0; }

.msg{
  display:flex; flex-direction:column;
  max-width:min(72%, 620px);
  margin-top:8px;
  align-self:flex-start;
}
.msg.grouped{ margin-top:3px; }
.msg.from-admin{ align-self:flex-end; align-items:flex-end; }

.bubble{
  position:relative;
  padding:8px 11px 6px;
  border:1px solid var(--line);
  border-radius:14px;
  background:var(--bg-raise);
  font-size:14px; line-height:1.48;
  overflow-wrap:anywhere;
}
.msg.from-user  .bubble{ border-bottom-left-radius:5px; }
.msg.from-admin .bubble{
  border-color:var(--accent-line);
  background:var(--accent-soft);
  border-bottom-right-radius:5px;
}
.msg.grouped.from-user  .bubble{ border-top-left-radius:5px; }
.msg.grouped.from-admin .bubble{ border-top-right-radius:5px; }

.bubble-text{ white-space:pre-wrap; }
.bubble-text .lnk{ color:var(--accent); text-decoration:underline; text-underline-offset:2px; }
.msg.from-admin .bubble-text .lnk{ color:#ffb469; }

.bubble-foot{
  display:flex; align-items:center; gap:5px; justify-content:flex-end;
  margin-top:3px;
  font-size:10.5px; color:var(--txt-mute);
  user-select:none;
}
.msg.from-admin .bubble-foot{ color:rgba(255,154,61,.62); }
.bubble-foot .ic{ width:12px; height:12px; stroke-width:2.4; }

/* медиа */
.media{ margin:-2px 0 5px; }
.media img{
  display:block;
  max-width:100%; max-height:320px;
  border-radius:9px; border:1px solid var(--line-soft);
  cursor:zoom-in;
  background:#000;
}
.media video{
  display:block;
  max-width:100%; max-height:340px;
  border-radius:9px; border:1px solid var(--line-soft);
  background:#000;
}
.media audio{ display:block; width:min(280px,100%); height:36px; }
.media-file{
  display:flex; align-items:center; gap:9px;
  padding:8px 10px;
  border:1px solid var(--line); border-radius:9px;
  background:var(--bg-input);
  color:var(--txt); text-decoration:none;
  max-width:100%;
}
.media-file:hover{ background:var(--bg-hover); text-decoration:none; }
.media-file .ic{ color:var(--accent); }
.media-file-name{
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font-size:13px;
}
.media-file-hint{ font-size:11px; color:var(--txt-mute); }
.media-caption{ margin-top:2px; }

.jump-new{
  position:absolute; left:50%; bottom:96px; transform:translateX(-50%);
  display:inline-flex; align-items:center; gap:6px;
  height:30px; padding:0 12px;
  border:1px solid var(--accent-line); border-radius:99px;
  background:#1b150e; color:var(--accent);
  font-size:12.5px; font-weight:600;
  cursor:pointer;
  z-index:4;
}
.jump-new:hover{ background:#221a10; }

/* --- композер ------------------------------------------------------------ */

.composer{
  flex:none;
  padding:10px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top:1px solid var(--line-soft);
  background:var(--bg-pane);
}
.composer-row{
  display:flex; align-items:flex-end; gap:6px;
  padding:5px 6px;
  border:1px solid var(--line); border-radius:var(--r);
  background:var(--bg-input);
  transition:border-color .12s ease;
}
.composer-row:focus-within{ border-color:var(--accent-line); }
.composer-text{
  flex:1 1 auto;
  min-height:34px; max-height:168px;
  padding:7px 4px;
  border:0; background:transparent; color:var(--txt);
  font-size:14px; line-height:1.45;
  resize:none; overflow-y:auto;
}
.composer-text::placeholder{ color:var(--txt-mute); }
.composer-text:focus{ outline:none; }

.send-btn{
  display:flex; align-items:center; justify-content:center;
  width:34px; height:34px; flex:none;
  border:0; border-radius:var(--r-sm);
  background:var(--accent); color:var(--accent-ink);
  cursor:pointer;
  transition:background .12s ease, opacity .12s ease;
}
.send-btn:hover{ background:#ffa855; }
.send-btn:disabled{ background:var(--bg-active); color:var(--txt-mute); cursor:default; }
.send-btn.is-busy .ic{ animation:pulse .9s ease-in-out infinite; }
@keyframes pulse{ 0%,100%{opacity:1} 50%{opacity:.35} }

.attach-chip{
  display:flex; align-items:center; gap:8px;
  margin-bottom:8px; padding:6px 8px 6px 10px;
  border:1px solid var(--accent-line); border-radius:var(--r-sm);
  background:var(--accent-soft);
  font-size:12.5px;
}
.attach-chip .ic{ color:var(--accent); width:16px; height:16px; }
.attach-name{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.attach-size{ color:var(--txt-mute); flex:none; margin-left:auto; }

/* --- быстрые ответы ------------------------------------------------------ */

.canned-pop{
  position:absolute; left:14px; bottom:74px; z-index:6;
  width:min(380px, calc(100% - 28px));
  max-height:min(60vh, 420px);
  display:flex; flex-direction:column;
  border:1px solid var(--line); border-radius:var(--r);
  background:var(--bg-raise);
  box-shadow:0 14px 40px rgba(0,0,0,.55);
  overflow:hidden;
}
.pop-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:9px 8px 9px 13px;
  border-bottom:1px solid var(--line-soft);
  font-size:12px; font-weight:600; letter-spacing:.3px;
  color:var(--txt-mute); text-transform:uppercase;
}
.pop-list{ overflow-y:auto; padding:6px; flex:1 1 auto; }
.pop-empty{ padding:16px 12px; text-align:center; font-size:12.5px; color:var(--txt-mute); }

.canned-item{
  display:flex; align-items:flex-start; gap:8px;
  padding:8px 8px 8px 10px;
  border-radius:var(--r-sm);
}
.canned-item:hover{ background:var(--bg-hover); }
.canned-pick{
  flex:1 1 auto; min-width:0;
  border:0; background:transparent; text-align:left;
  cursor:pointer; padding:0;
}
.canned-title{ font-size:13px; font-weight:600; margin-bottom:1px; }
.canned-body{
  font-size:12px; color:var(--txt-mute);
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;
  overflow:hidden;
}
.canned-del{ flex:none; color:var(--txt-mute); }
.canned-del:hover{ color:var(--danger); background:var(--danger-soft); }

.pop-add{
  display:flex; align-items:center; justify-content:center; gap:6px;
  height:38px; flex:none;
  border:0; border-top:1px solid var(--line-soft);
  background:transparent; color:var(--txt-dim);
  font-size:12.5px; font-weight:500;
  cursor:pointer;
}
.pop-add:hover{ background:var(--bg-hover); color:var(--txt); }

.canned-new{
  padding:10px; border-top:1px solid var(--line-soft);
  display:flex; flex-direction:column; gap:7px;
}
.canned-new-actions{ display:flex; justify-content:flex-end; gap:7px; }

/* ==========================================================================
   3. Модалка настроек / лайтбокс / тосты
   ========================================================================== */

.modal-back{
  position:fixed; inset:0; z-index:40;
  display:flex; align-items:center; justify-content:center;
  padding:20px;
  background:rgba(4,4,6,.72);
  animation:fade .12s ease;
}
@keyframes fade{ from{opacity:0} to{opacity:1} }

.modal{
  width:100%; max-width:400px;
  max-height:calc(100dvh - 40px);
  display:flex; flex-direction:column;
  border:1px solid var(--line); border-radius:var(--r-lg);
  background:var(--bg-pane);
  box-shadow:0 20px 60px rgba(0,0,0,.6);
  overflow:hidden;
}
.modal-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:13px 10px 13px 18px;
  border-bottom:1px solid var(--line-soft);
  flex:none;
}
.modal-title{ margin:0; font-size:15.5px; font-weight:650; }
.modal-body{ padding:16px 18px 20px; overflow-y:auto; }
.modal-sep{ height:1px; background:var(--line-soft); margin:18px 0; }
.modal-sect{
  margin-bottom:11px;
  font-size:11.5px; font-weight:600; letter-spacing:.4px;
  color:var(--txt-mute); text-transform:uppercase;
}

.who{ display:flex; align-items:center; gap:11px; margin-bottom:16px; }
.who-login{ font-size:14.5px; font-weight:600; }
.who-sub{ font-size:12px; color:var(--txt-mute); }

.switch{ display:flex; align-items:center; gap:10px; cursor:pointer; user-select:none; }
.switch input{ position:absolute; opacity:0; width:0; height:0; }
.switch-track{
  position:relative; width:38px; height:22px; flex:none;
  border:1px solid var(--line); border-radius:99px;
  background:var(--bg-input);
  transition:background .14s ease, border-color .14s ease;
}
.switch-knob{
  position:absolute; top:3px; left:3px;
  width:14px; height:14px; border-radius:50%;
  background:var(--txt-mute);
  transition:transform .14s ease, background .14s ease;
}
.switch input:checked + .switch-track{ background:var(--accent-soft); border-color:var(--accent-line); }
.switch input:checked + .switch-track .switch-knob{ transform:translateX(16px); background:var(--accent); }
.switch input:focus-visible + .switch-track{ outline:2px solid var(--accent); outline-offset:2px; }
.switch-label{ font-size:13.5px; }

.pw-rules{
  list-style:none; margin:0 0 12px; padding:0;
  display:flex; flex-direction:column; gap:4px;
}
.pw-rules li{
  position:relative; padding-left:18px;
  font-size:12px; color:var(--txt-mute);
  transition:color .12s ease;
}
.pw-rules li::before{
  content:""; position:absolute; left:4px; top:7px;
  width:5px; height:5px; border-radius:50%; background:currentColor;
}
.pw-rules li.ok{ color:var(--ok); }
.pw-rules li.bad{ color:var(--danger); }

.lightbox{
  position:fixed; inset:0; z-index:50;
  display:flex; align-items:center; justify-content:center;
  padding:28px;
  background:rgba(3,3,5,.9);
}
.lightbox-img{
  max-width:100%; max-height:100%;
  border-radius:var(--r); border:1px solid var(--line);
  object-fit:contain;
}
.lightbox-close{
  position:absolute; top:14px; right:16px;
  color:var(--txt-dim); background:var(--bg-raise); border-color:var(--line);
}

.toast-wrap{
  position:fixed; left:50%; bottom:24px; transform:translateX(-50%);
  z-index:60;
  display:flex; flex-direction:column; gap:8px; align-items:center;
  pointer-events:none;
}
.toast{
  max-width:min(420px, calc(100vw - 32px));
  padding:9px 14px;
  border:1px solid var(--line); border-radius:99px;
  background:var(--bg-raise);
  font-size:13px; color:var(--txt);
  box-shadow:0 10px 30px rgba(0,0,0,.5);
  animation:toast-in .16s ease;
}
.toast-err{ border-color:var(--danger-line); background:#1c1011; color:#ff9d96; }
@keyframes toast-in{ from{opacity:0; transform:translateY(8px)} to{opacity:1; transform:none} }

/* ==========================================================================
   Адаптив
   ========================================================================== */

/* Узкое окно: подписи у кнопок диалога прячем, остаются иконки с подсказками —
   иначе шапка съедает место у имени и мета-строки. */
@media (max-width:1180px){
  .btn-label{ display:none; }
  .chat-actions .btn{ width:36px; padding:0; }
}

@media (max-width:900px){
  .panel{ grid-template-columns:1fr; }
  .pane-chat{ display:none; }
  body.chat-open .pane-list{ display:none; }
  body.chat-open .pane-chat{ display:flex; }

  .back-btn{ display:inline-flex; }
  .chat-head{ padding:9px 10px; }
  .messages{ padding:12px 12px 6px; }
  .msg{ max-width:86%; }
  .composer{ padding:8px 10px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .canned-pop{ left:10px; width:calc(100% - 20px); bottom:70px; }
  .jump-new{ bottom:86px; }
  .modal{ max-width:none; }
}

@media (max-width:400px){
  .chat-actions{ gap:3px; }
}

@media (prefers-reduced-motion:reduce){
  *{ animation-duration:.01ms !important; transition-duration:.01ms !important; }
}

/* Фото поверх буквы: буква остаётся под ним и показывается, если картинка
   не загрузилась (onerror удаляет <img>). */
.avatar{ position:relative; overflow:hidden; }
.avatar-img{
  position:absolute; inset:0; width:100%; height:100%;
  object-fit:cover; border-radius:inherit; display:block;
}

/* Полоска "кто это в игре" под именем в шапке чата. */
.player-strip{ display:flex; flex-wrap:wrap; gap:5px; margin-top:5px; }
.pchip{
  display:inline-flex; align-items:baseline; gap:4px;
  padding:2px 7px; border:1px solid var(--line-soft); border-radius:7px;
  background:var(--bg-soft); font-size:11px; line-height:1.5; white-space:nowrap;
}
.pchip-k{ color:var(--txt-mute); font-weight:600; }
.pchip-v{ color:var(--txt); font-variant-numeric:tabular-nums; }
.pchip.is-accent{ border-color:var(--accent-line); }
.pchip.is-accent .pchip-v{ color:var(--accent); }
@media (max-width:900px){ .player-strip{ display:none; } }
