/* Pilot — минималистичный тёмный интерфейс в духе Telegram: «жидкое стекло», мягкие анимации. */
:root {
  --bg: #0a0a0c;
  --surface: #17171a;
  --surface-2: #1f1f23;
  --surface-3: #2a2a2f;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --text: #f3f3f5;
  --muted: #9a9aa3;
  --dim: #6b6b74;
  --accent: #8774e1;
  --accent-2: #6ab3f3;
  --accent-soft: rgba(135, 116, 225, .16);
  --grad: linear-gradient(135deg, #9b8af0 0%, #6f8ff5 100%);
  --ok: #4fd18b;
  --warn: #f5c15c;
  --err: #ff6b6b;
  --bubble-in: #212124;
  --bubble-out: #7667d6;
  /* жидкое стекло */
  --glass: rgba(34, 34, 40, .58);
  --glass-strong: rgba(30, 30, 36, .82);
  --glass-border: rgba(255, 255, 255, .09);
  --glass-shine: inset 0 1px 0 rgba(255, 255, 255, .13), inset 0 -1px 0 rgba(0, 0, 0, .25);
  --blur: blur(28px) saturate(180%);
  --shadow: 0 18px 50px -18px rgba(0, 0, 0, .75);
  --r: 18px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text); overflow: hidden;
  font: 14px/1.45 -apple-system, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased; letter-spacing: -.003em;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 6px; font-size: 12px; }
h1, h2, h3 { letter-spacing: -.02em; }
[hidden] { display: none !important; }
/* иконки-линии */
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

@keyframes fade-up { from { opacity: 0; transform: translateY(8px); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
@keyframes slide-left { from { opacity: 0; transform: translateX(24px); } }
@keyframes msg-in { from { opacity: 0; transform: translateY(10px) scale(.96); } }
@keyframes float { 50% { transform: translateY(-10px) scale(1.04); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 50% { opacity: .45; } }

.bg-glow {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(700px 480px at 0% 0%, rgba(135, 116, 225, .13), transparent 62%),
    radial-gradient(760px 520px at 100% 100%, rgba(106, 179, 243, .09), transparent 62%);
}
.app { position: relative; z-index: 1; display: flex; height: 100vh; height: 100dvh; }

/* ---------- боковая панель ---------- */
.rail { width: 236px; flex: none; display: flex; flex-direction: column; gap: 20px; padding: 18px 12px; }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px; }
.logo {
  width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center;
  background: var(--grad); color: #fff; box-shadow: 0 8px 22px -8px rgba(135, 116, 225, .9), var(--glass-shine);
}
.logo svg { width: 19px; height: 19px; stroke-width: 2.2; }
.brand-name { font-weight: 700; font-size: 16px; }
.brand-sub { color: var(--dim); font-size: 11.5px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 0; background: none;
  color: var(--muted); font: inherit; font-weight: 500; cursor: pointer; text-align: left;
  transition: background .2s, color .2s, transform .15s var(--ease);
}
.nav-item:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.nav-item:active { transform: scale(.97); }
.nav-item.active { background: var(--accent-soft); color: var(--text); }
.nav-item.active svg { color: var(--accent); }
.nav-item span { flex: 1; }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; background: var(--accent); color: #fff; animation: pop .3s var(--spring);
}

.rail-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.pilot-card {
  padding: 14px; border-radius: 20px; background: var(--glass); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shine); transition: border-color .4s, box-shadow .4s;
}
.pilot-card.on { border-color: rgba(135, 116, 225, .55); box-shadow: var(--glass-shine), 0 12px 40px -14px rgba(135, 116, 225, .8); }
.pilot-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pilot-title { font-weight: 600; }
.pilot-sub { font-size: 12px; color: var(--dim); transition: color .3s; }
.pilot-card.on .pilot-sub { color: var(--ok); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: rgba(0, 0, 0, .35); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: none; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600;
  padding: 7px 4px; border-radius: 9px; cursor: pointer; transition: background .25s var(--ease), color .2s; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: rgba(255, 255, 255, .11); color: var(--text); box-shadow: var(--glass-shine); }
.seg.method button { font-size: 12.5px; padding: 9px 6px; }

.conn-list { display: flex; flex-direction: column; gap: 6px; padding: 0 8px 2px; }
.conn { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--muted); }
.conn span { margin-left: auto; color: var(--dim); max-width: 118px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex: none; transition: background .3s, box-shadow .3s; }
.dot.on { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.warn { background: var(--warn); animation: pulse 1.4s infinite; }
.dot.err { background: var(--err); }

/* ---------- переключатель ---------- */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: none; }
.switch.big { width: 50px; height: 30px; }
.switch input { display: none; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #3a3a41; cursor: pointer; transition: background .3s var(--ease); }
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35); transition: transform .35s var(--spring), width .2s;
}
.switch.big span::after { width: 24px; height: 24px; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch.big input:checked + span::after { transform: translateX(20px); }

/* ---------- страницы ---------- */
.view { flex: 1; min-width: 0; display: flex; animation: fade-in .3s var(--ease); }
.page { flex-direction: column; overflow-y: auto; padding: 34px 40px 110px; animation: fade-up .4s var(--ease); }
.page-head h1 { margin: 0 0 6px; font-size: 27px; font-weight: 700; }
.page-head p { margin: 0 0 26px; color: var(--muted); }

/* ---------- список чатов ---------- */
.chatlist {
  width: 332px; flex: none; display: flex; flex-direction: column; margin: 10px 0;
  background: rgba(20, 20, 23, .6); border: 1px solid var(--line); border-radius: 22px; overflow: hidden;
}
.chatlist-head { padding: 18px 14px 10px; }
.chatlist-head h2 { margin: 0 4px 12px; font-size: 19px; font-weight: 700; }
.search {
  display: flex; align-items: center; gap: 8px; padding: 0 13px; height: 40px; border-radius: 99px;
  background: rgba(255, 255, 255, .06); color: var(--dim); transition: background .2s, box-shadow .2s, color .2s;
}
.search:focus-within { background: rgba(255, 255, 255, .09); box-shadow: 0 0 0 2px rgba(135, 116, 225, .5); color: var(--accent); }
.search input, .search input:hover, .search input:focus { flex: 1; background: none; border: 0; outline: 0; box-shadow: none; padding: 0; border-radius: 0; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 11px; }
.chip {
  border: 0; background: rgba(255, 255, 255, .06); color: var(--muted); font: inherit; font-size: 12px; font-weight: 600;
  padding: 6px 12px; border-radius: 99px; cursor: pointer; transition: background .2s, color .2s, transform .15s var(--ease);
}
.chip:hover { color: var(--text); background: rgba(255, 255, 255, .1); }
.chip:active { transform: scale(.94); }
.chip.active { background: var(--accent); color: #fff; }

.chatlist-items { flex: 1; overflow-y: auto; padding: 4px 8px 16px; }
.chat-item {
  display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 14px; cursor: pointer;
  transition: background .18s, transform .15s var(--ease);
}
.chat-item:hover { background: rgba(255, 255, 255, .05); }
.chat-item:active { transform: scale(.985); }
.chat-item.active { background: var(--accent); }
.chat-item.active .chat-last, .chat-item.active .chat-time { color: rgba(255, 255, 255, .78); }
.chat-item.active .pill.ai, .chat-item.active .acc-tag { background: rgba(255, 255, 255, .2); color: #fff; }
.chat-main { flex: 1; min-width: 0; }
.chat-row { display: flex; align-items: center; gap: 6px; }
.chat-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.chat-time { font-size: 11.5px; color: var(--dim); flex: none; }
.chat-last { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.pill { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px; flex: none; }
.pill.ai { background: var(--accent-soft); color: #b9adff; }
.pill.draft { background: rgba(245, 193, 92, .16); color: var(--warn); }
.pill.unread { background: var(--accent); color: #fff; min-width: 20px; text-align: center; }
.chat-item.active .pill.unread { background: #fff; color: var(--accent); }
.acc-tag {
  flex: none; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 10.5px; font-weight: 600; color: var(--muted); background: rgba(255, 255, 255, .07); padding: 1px 6px; border-radius: 6px;
}

.avatar {
  width: 48px; height: 48px; border-radius: 50%; flex: none; display: grid; place-items: center;
  font-weight: 600; font-size: 17px; color: #fff; position: relative; user-select: none;
}
.avatar.lg { width: 42px; height: 42px; font-size: 15px; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.xl { width: 120px; height: 120px; font-size: 46px; box-shadow: 0 16px 40px -14px rgba(0, 0, 0, .8); }
.avatar > span { position: relative; z-index: 0; }
.avatar > img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; z-index: 1; animation: fade-in .3s; }
.avatar .pf {
  position: absolute; right: -2px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%; z-index: 2;
  display: grid; place-items: center; border: 2px solid #141417;
}
.avatar .pf.telegram { background: #2aabee; }
.avatar .pf.twitter { background: #000; }
.avatar .pf svg { width: 10px; height: 10px; stroke-width: 2.6; }
.chat-item.active .avatar .pf { border-color: var(--accent); }
.list-empty { color: var(--dim); text-align: center; padding: 40px 20px; font-size: 13px; }
.list-empty.loading { margin: auto; animation: pulse 1.4s infinite; }

/* ---------- переписка ---------- */
.conversation { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.empty-state { margin: auto; text-align: center; max-width: 400px; padding: 20px; animation: fade-up .5s var(--ease); }
.empty-state h3 { margin: 24px 0 8px; font-size: 19px; font-weight: 600; }
.empty-state p { color: var(--muted); margin: 0; }
.empty-orb {
  width: 108px; height: 108px; border-radius: 50%; margin: 0 auto; background: var(--grad);
  box-shadow: 0 0 80px rgba(135, 116, 225, .55), inset 0 2px 10px rgba(255, 255, 255, .4); animation: float 6s ease-in-out infinite;
}

.conv { flex: 1; position: relative; min-height: 0; animation: fade-in .25s; }
.conv-head {
  position: absolute; top: 10px; left: 14px; right: 14px; z-index: 6; display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; border-radius: 24px; cursor: pointer;
  background: var(--glass); backdrop-filter: var(--blur); border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shine), 0 10px 34px -16px rgba(0, 0, 0, .8); transition: background .25s;
}
.conv-head:hover { background: rgba(44, 44, 52, .62); }
.conv-meta { flex: 1; min-width: 0; }
.conv-title { font-weight: 600; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-sub { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-actions { display: flex; gap: 8px; }

.messages {
  position: absolute; inset: 0; overflow-y: auto; padding: 86px 7% 112px; display: flex; flex-direction: column; gap: 2px;
  background:
    radial-gradient(520px 380px at 18% 22%, rgba(135, 116, 225, .12), transparent 62%),
    radial-gradient(560px 420px at 84% 78%, rgba(106, 179, 243, .09), transparent 62%),
    radial-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px) 0 0 / 24px 24px;
}
.day { display: flex; flex-direction: column; gap: 2px; }
.day-sep { position: sticky; top: 62px; z-index: 3; display: flex; justify-content: center; padding: 10px 0; pointer-events: none; }
.day-sep span {
  background: var(--glass); backdrop-filter: var(--blur); border: 1px solid var(--glass-border); box-shadow: var(--glass-shine);
  color: #e3e3ea; font-size: 12.5px; font-weight: 600; padding: 4px 12px; border-radius: 99px;
}
.group { display: flex; align-items: flex-end; gap: 8px; margin: 4px 0; }
.group.out { justify-content: flex-end; }
.group-avatar { position: sticky; bottom: 4px; align-self: flex-end; }
.group-msgs { display: flex; flex-direction: column; gap: 2px; max-width: min(540px, 74%); }
.group.out .group-msgs { align-items: flex-end; }
.group.in .group-msgs { align-items: flex-start; }
.day:last-of-type > .group:last-of-type .msg:last-child { animation: msg-in .32s var(--spring); }

.msg { position: relative; display: flex; align-items: center; gap: 4px; max-width: 100%; }
.msg.out { flex-direction: row-reverse; }
.bubble {
  position: relative; padding: 7px 11px 7px 12px; line-height: 1.38; font-size: 15px; color: #fff;
  white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; box-shadow: 0 1px 2px rgba(0, 0, 0, .28);
}
.msg.in .bubble { background: var(--bubble-in); border-radius: 7px 18px 18px 7px; }
.msg.out .bubble { background: var(--bubble-out); border-radius: 18px 7px 7px 18px; }
.group.in .msg:first-child .bubble { border-top-left-radius: 18px; }
.group.out .msg:first-child .bubble { border-top-right-radius: 18px; }
.group.in .msg:last-child .bubble { border-bottom-left-radius: 5px; }
.group.out .msg:last-child .bubble { border-bottom-right-radius: 5px; }
.sender { font-size: 13px; font-weight: 600; margin-bottom: 1px; color: var(--accent-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg.out .sender { color: rgba(255, 255, 255, .82); }
.msg .text a { color: #a9d4ff; text-decoration: underline; }
.msg.out .text a { color: #fff; }
.meta {
  float: right; display: inline-flex; white-space: nowrap; align-items: center; gap: 4px; margin: 7px -3px -3px 12px;
  font-size: 11.5px; line-height: 1; color: rgba(255, 255, 255, .5); user-select: none;
}
.msg.out .meta { color: rgba(255, 255, 255, .72); }
.tick { font-size: 12px; font-weight: 700; }
.tick.err { color: #ffd0d0; }
.ai-mark { font-size: 11px; }
.edited { font-style: italic; }
.msg.failed .bubble { outline: 1.5px solid var(--err); }
.msg-more {
  opacity: 0; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--glass-border); cursor: pointer; flex: none;
  background: var(--glass); backdrop-filter: var(--blur); color: #ddd; font-size: 15px; line-height: 1;
  transition: opacity .15s, transform .15s var(--ease);
}
.msg:hover .msg-more, .msg-more:focus { opacity: 1; }
.msg-more:hover { transform: scale(1.12); }

/* вложения */
.media-chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 500; color: rgba(255, 255, 255, .9);
  background: rgba(255, 255, 255, .1); border-radius: 10px; padding: 5px 10px; margin: 2px 0 4px;
}
.media-chip + .text { display: block; }
.m-photo {
  position: relative; display: block; margin: -3px -7px 5px -8px; border-radius: 14px; overflow: hidden;
  width: 300px; max-width: calc(100% + 15px); min-height: 150px; cursor: zoom-in;
  background: linear-gradient(100deg, rgba(255, 255, 255, .05) 30%, rgba(255, 255, 255, .12) 50%, rgba(255, 255, 255, .05) 70%) 0 0 / 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.m-photo.loaded { animation: none; background: #000; min-height: 0; }
.m-photo img, .m-photo video { display: block; width: 100%; max-height: 420px; object-fit: cover; opacity: 0; transition: opacity .35s; }
.m-photo.loaded img, .m-photo.loaded video { opacity: 1; }
.m-photo.round { width: 200px; height: 200px; border-radius: 50%; }
.m-photo.round img { height: 100%; }
.m-badge, .m-play { position: absolute; background: rgba(0, 0, 0, .55); backdrop-filter: blur(8px); color: #fff; font-weight: 700; }
.m-badge { top: 8px; left: 8px; font-size: 11px; padding: 2px 7px; border-radius: 8px; }
.m-play { top: 50%; left: 50%; transform: translate(-50%, -50%); width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; padding-left: 3px; }
.m-sticker { width: 168px; height: 168px; display: grid; place-items: center; }
.m-sticker img, .m-sticker video { max-width: 100%; max-height: 100%; object-fit: contain; opacity: 0; transform: scale(.9); transition: opacity .3s, transform .3s var(--spring); }
.m-sticker.loaded img, .m-sticker.loaded video { opacity: 1; transform: none; }
.m-sticker.loaded:hover img { transform: scale(1.06); }
/* стикер или картинка без текста — время в стеклянной плашке поверх */
.bubble.bare { background: none !important; box-shadow: none; padding: 0; }
.bubble.bare .sender { display: none; }
.bubble.media-only { padding-bottom: 4px; }
.bubble.media-only .m-photo { margin-bottom: -1px; }
.bubble.bare .meta, .bubble.media-only .meta {
  float: none; position: absolute; right: 6px; bottom: 6px; margin: 0; padding: 4px 8px; border-radius: 99px;
  background: rgba(0, 0, 0, .5); backdrop-filter: blur(8px); color: #fff;
}

.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(0, 0, 0, .86); backdrop-filter: blur(14px); display: grid; place-items: center; cursor: zoom-out; animation: fade-in .2s; }
.lightbox img, .lightbox video { max-width: 92vw; max-height: 92vh; border-radius: 12px; box-shadow: var(--shadow); animation: pop .3s var(--spring); }

.load-older {
  align-self: center; margin: 4px 0 10px; border: 1px solid var(--glass-border); cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600;
  color: #e3e3ea; background: var(--glass); backdrop-filter: var(--blur); padding: 6px 14px; border-radius: 99px; transition: background .2s;
}
.load-older:hover { background: rgba(135, 116, 225, .4); }

.draft-card {
  align-self: flex-end; width: min(540px, 82%); margin-top: 10px; padding: 14px; border-radius: 22px; animation: fade-up .35s var(--ease);
  background: var(--glass); backdrop-filter: var(--blur); border: 1px solid rgba(135, 116, 225, .5); box-shadow: var(--glass-shine), 0 14px 40px -18px rgba(135, 116, 225, .8);
}
.draft-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: #c3b9ff; margin-bottom: 8px; }
.draft-card textarea { width: 100%; min-height: 70px; resize: vertical; }
.draft-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* поле ввода — парящая стеклянная панель */
.dock { position: absolute; left: 14px; right: 14px; bottom: 12px; z-index: 6; display: flex; flex-direction: column; gap: 6px; }
.edit-bar {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 16px; border-radius: 18px; color: var(--accent-2); animation: fade-up .25s var(--ease);
  background: var(--glass-strong); backdrop-filter: var(--blur); border: 1px solid var(--glass-border); box-shadow: var(--glass-shine);
}
.edit-info { flex: 1; min-width: 0; display: flex; flex-direction: column; border-left: 2px solid var(--accent-2); padding-left: 10px; }
.edit-info b { font-size: 13px; font-weight: 600; }
.edit-info span { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.composer { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea, .composer textarea:hover {
  flex: 1; resize: none; max-height: 160px; padding: 13px 18px; border-radius: 24px; font-size: 15px;
  background: var(--glass); backdrop-filter: var(--blur); border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shine), 0 10px 34px -16px rgba(0, 0, 0, .8);
}
.composer textarea:focus { border-color: rgba(135, 116, 225, .6); box-shadow: var(--glass-shine), 0 0 0 3px rgba(135, 116, 225, .18); }

/* ---------- панель «Информация» (как User Info в Telegram) ---------- */
.chatpanel {
  width: 348px; flex: none; margin: 10px 10px 10px 0; padding: 0 12px 20px; overflow-y: auto; border-radius: 22px;
  background: rgba(15, 15, 17, .82); border: 1px solid var(--line); animation: slide-left .35s var(--ease);
}
.info-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 14px; padding: 14px 4px 10px; background: linear-gradient(rgba(15, 15, 17, .96) 70%, transparent); }
.info-head h3 { margin: 0; font-size: 18px; font-weight: 600; }
.info-hero { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 18px 8px 22px; animation: fade-up .4s var(--ease); }
.info-name { margin-top: 18px; font-size: 20px; font-weight: 600; max-width: 100%; overflow-wrap: anywhere; }
.info-status { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.info-card { background: var(--surface-2); border-radius: 20px; padding: 6px; margin-bottom: 12px; animation: fade-up .45s var(--ease); }
.info-row { display: flex; align-items: center; gap: 16px; padding: 9px 12px; border-radius: 14px; transition: background .2s; }
.info-row.click { cursor: pointer; }
.info-row.click:hover { background: rgba(255, 255, 255, .05); }
.info-row .ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex: none; font-style: normal; font-weight: 700; font-size: 17px; }
.info-row .ic svg { width: 19px; height: 19px; stroke-width: 2; }
.ic.green { background: #4cc764; } .ic.blue { background: #3a9bf0; } .ic.violet { background: var(--accent); } .ic.red { background: #f0544a; }
.info-row .tx { flex: 1; min-width: 0; }
.info-row .v { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-row .l { font-size: 13px; color: var(--muted); }
.info-tabs { background: var(--surface-2); border-radius: 99px; padding: 5px; margin-bottom: 12px; animation: fade-up .5s var(--ease); }
.info-tabs button { padding: 9px 6px; border-radius: 99px; font-size: 13px; }
.info-tabs button.active { background: var(--accent-soft); color: #c3b9ff; box-shadow: none; }
.info-card.pad { padding: 14px; animation-duration: .55s; }
.info-card.pad .l { font-size: 13px; color: var(--muted); margin-bottom: 8px; display: flex; justify-content: space-between; }
.info-card.pad textarea { width: 100%; min-height: 150px; background: rgba(0, 0, 0, .28); }
.info-card.pad .hint { margin-top: 8px; }
.saved { color: var(--ok); opacity: 0; transition: opacity .3s; }
.saved.show { opacity: 1; }

/* ---------- формы ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--text); background: rgba(255, 255, 255, .055); border: 1px solid transparent;
  border-radius: 13px; padding: 10px 13px; outline: none; transition: border-color .2s, box-shadow .2s, background .2s;
}
input::placeholder, textarea::placeholder { color: var(--dim); }
textarea { resize: vertical; line-height: 1.45; }
input:hover, select:hover, textarea:hover { background-color: rgba(255, 255, 255, .075); }
input:focus, select:focus, textarea:focus { border-color: rgba(135, 116, 225, .7); box-shadow: 0 0 0 3px rgba(135, 116, 225, .16); }
select {
  appearance: none; padding-right: 32px; background-repeat: no-repeat;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px;
}
select option { background: #1f1f23; }
.hint { font-size: 12px; color: var(--dim); }
.hint.ok { color: var(--ok); } .hint.err { color: var(--err); }
.muted { color: var(--muted); margin: 0 0 16px; }
.muted-inline { color: var(--dim); font-weight: 400; }
.range { display: flex; align-items: center; gap: 8px; }
.range input { width: 0; flex: 1; text-align: center; }
.range span { color: var(--dim); }

.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); }
.setting-label { font-weight: 500; }
.setting-hint { font-size: 12px; color: var(--dim); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
  border-radius: 99px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: transform .18s var(--ease), filter .2s, background .2s, box-shadow .2s;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: scale(.95); }
.btn.sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn.icon { width: 48px; height: 48px; padding: 0; border-radius: 50%; }
.btn.icon svg { width: 20px; height: 20px; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 8px 22px -10px rgba(135, 116, 225, .95), var(--glass-shine); }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: rgba(255, 255, 255, .07); color: var(--text); border-color: var(--glass-border); }
.btn.ghost:hover { background: rgba(255, 255, 255, .12); }
.btn.danger { color: var(--err); }
.btn.ok { background: var(--ok); color: #06281a; }
.btn.danger-fill { background: #e5484d; color: #fff; }
.btn.danger-fill:hover, .btn.ok:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .55; cursor: progress; transform: none; }
.btn.w100 { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row.center { justify-content: center; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%; border: 0; background: none; color: var(--muted); font: inherit; font-size: 16px;
  display: grid; place-items: center; cursor: pointer; flex: none; transition: background .2s, color .2s, transform .15s var(--ease);
}
.icon-btn:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.icon-btn:active { transform: scale(.9); }
.icon-btn[data-act="remove"]:hover { background: rgba(255, 107, 107, .12); color: var(--err); }

/* ---------- карточки ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.grid2.wide-left { grid-template-columns: 1.4fr 1fr; }
.grid2.tight { gap: 12px; }
.accounts-grid { align-items: stretch; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.card {
  background: var(--glass); backdrop-filter: var(--blur); border: 1px solid var(--glass-border); border-radius: 24px;
  padding: 22px; box-shadow: var(--glass-shine), var(--shadow); animation: fade-up .45s var(--ease) backwards;
}
.card:nth-child(2) { animation-delay: .05s; } .card:nth-child(3) { animation-delay: .1s; } .card:nth-child(4) { animation-delay: .15s; }
.card h3 { margin: 0 0 16px; font-size: 16px; font-weight: 600; }
.acc-card { display: flex; flex-direction: column; }
.card-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.card-head h3 { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-title { flex: 1; min-width: 0; }
.card-sub { font-size: 12.5px; color: var(--muted); }
.card-sub.ok { color: var(--ok); } .card-sub.err { color: var(--err); }
.pf-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; flex: none; box-shadow: var(--glass-shine); }
.pf-icon svg { width: 21px; height: 21px; }
.pf-icon.tg { background: linear-gradient(135deg, #37bbfe, #1e96d1); }
.pf-icon.tw { background: #000; border: 1px solid var(--line-2); }
.add-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; min-height: 250px;
  border: 1.5px dashed rgba(135, 116, 225, .4); background: rgba(135, 116, 225, .05); transition: background .3s, border-color .3s;
}
.add-card:hover { background: rgba(135, 116, 225, .09); border-color: rgba(135, 116, 225, .7); }
.add-plus {
  width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font-size: 32px; font-weight: 300; margin-bottom: 6px;
  background: var(--accent); color: #fff; box-shadow: 0 12px 30px -10px rgba(135, 116, 225, .9), var(--glass-shine); transition: transform .4s var(--spring);
}
.add-card:hover .add-plus { transform: scale(1.08); }
.add-title { font-weight: 600; font-size: 17px; }
.add-sub { color: var(--muted); font-size: 13px; margin-bottom: 10px; }

.connected-box {
  display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-radius: 16px; margin-bottom: 14px; font-weight: 500;
  background: rgba(79, 209, 139, .09); border: 1px solid rgba(79, 209, 139, .25);
}
.error-box { padding: 12px 14px; border-radius: 14px; background: rgba(255, 107, 107, .09); border: 1px solid rgba(255, 107, 107, .3); color: #ffb9b9; font-size: 13px; margin-bottom: 14px; }
.test-out { margin-top: 14px; padding: 10px 14px; border-radius: 18px 18px 18px 5px; white-space: pre-wrap; background: var(--bubble-out); animation: msg-in .35s var(--spring); }
.savebar { position: fixed; bottom: 0; left: 236px; right: 0; padding: 16px 40px; display: flex; justify-content: flex-end; background: linear-gradient(transparent, var(--bg) 45%); pointer-events: none; }
.savebar .btn { pointer-events: auto; }

.phone-input { position: relative; display: flex; align-items: center; }
.phone-input input { flex: 1; padding-left: 44px; font-size: 16px; font-variant-numeric: tabular-nums; }
.phone-flag { position: absolute; left: 14px; font-size: 18px; pointer-events: none; }
.code-info { padding: 13px 15px; border-radius: 16px; margin-bottom: 16px; background: rgba(106, 179, 243, .08); border: 1px solid rgba(106, 179, 243, .25); }
.code-via { font-weight: 500; } .code-via b { color: var(--accent-2); }
.code-hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
.code-input { font-size: 22px; letter-spacing: .4em; text-align: center; font-weight: 600; }
.help { margin-top: 16px; color: var(--muted); font-size: 13px; }
.help summary { cursor: pointer; color: var(--text); font-weight: 500; }
.help ul { margin: 10px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.input-btn { display: flex; gap: 8px; }
.input-btn input { flex: 1; min-width: 0; }
.input-btn .btn { height: auto; }
.qr-wrap { display: flex; gap: 22px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.qr-box { width: 236px; height: 236px; border-radius: 22px; background: #fff; overflow: hidden; flex: none; display: grid; place-items: center; box-shadow: 0 14px 44px -14px rgba(135, 116, 225, .8); animation: pop .4s var(--spring); }
.qr-box img { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.qr-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; color: var(--muted); }
.qr-steps b { color: var(--text); font-weight: 600; }

/* ---------- журнал ---------- */
.logs { padding: 6px 0; }
.log { display: flex; gap: 14px; padding: 10px 22px; border-bottom: 1px solid var(--line); font-size: 13px; }
.log:last-child { border-bottom: 0; }
.log time { color: var(--dim); flex: none; width: 120px; font-variant-numeric: tabular-nums; }
.log .lvl { flex: none; width: 7px; height: 7px; border-radius: 50%; margin-top: 7px; background: var(--dim); }
.log .lvl.ok { background: var(--ok); } .log .lvl.warn { background: var(--warn); } .log .lvl.error { background: var(--err); } .log .lvl.info { background: var(--accent-2); }

/* ---------- всплывающие элементы ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 90; pointer-events: none; }
.toast {
  padding: 11px 18px; border-radius: 99px; max-width: 440px; font-weight: 500; animation: fade-up .35s var(--spring);
  background: var(--glass-strong); backdrop-filter: var(--blur); border: 1px solid var(--glass-border); box-shadow: var(--glass-shine), var(--shadow);
}
.toast.err { border-color: rgba(255, 107, 107, .55); } .toast.ok { border-color: rgba(79, 209, 139, .5); }
.ctx-menu {
  position: fixed; z-index: 60; min-width: 210px; padding: 6px; border-radius: 16px; transform-origin: top left; animation: pop .18s var(--spring);
  background: var(--glass-strong); backdrop-filter: var(--blur); border: 1px solid var(--glass-border); box-shadow: var(--glass-shine), 0 22px 50px -12px rgba(0, 0, 0, .8);
}
.ctx-menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; border-radius: 10px; background: none; color: var(--text); font: inherit; font-weight: 500; cursor: pointer; text-align: left; transition: background .15s; }
.ctx-menu button:hover { background: rgba(255, 255, 255, .09); }
.ctx-menu button.danger { color: #ff8a8a; }
.modal-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .5); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; animation: fade-in .2s; }
.modal { width: min(400px, 100%); padding: 24px; border-radius: 26px; animation: pop .3s var(--spring); background: var(--glass-strong); backdrop-filter: var(--blur); border: 1px solid var(--glass-border); box-shadow: var(--glass-shine), var(--shadow); }
.modal h3 { margin: 0 0 8px; font-size: 18px; font-weight: 600; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; user-select: none; }
.check input { display: none; }
.check span { width: 21px; height: 21px; border-radius: 7px; border: 2px solid #6b6b74; display: grid; place-items: center; flex: none; transition: background .2s, border-color .2s, transform .25s var(--spring); }
.check input:checked + span { background: var(--accent); border-color: var(--accent); transform: scale(1.06); }
.check input:checked + span::after { content: "✓"; color: #fff; font-size: 13px; font-weight: 800; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .1); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, .2); background-clip: content-box; }
::selection { background: rgba(135, 116, 225, .45); }

@media (max-width: 1320px) { .chatpanel { width: 300px; } .chatlist { width: 290px; } }
@media (max-width: 1080px) {
  .grid2, .grid2.wide-left { grid-template-columns: 1fr; }

  .chatpanel { position: absolute; right: 0; top: 0; bottom: 0; z-index: 20; background: rgba(15, 15, 17, .96); backdrop-filter: var(--blur); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- статус ИИ ---------- */
.conv-sub.live { color: var(--accent-2); animation: pulse 1.6s infinite; }
.pill.err { background: rgba(255, 107, 107, .18); color: #ff9b9b; }
.pill.live { animation: pulse 1.4s infinite; }
.ai-bar {
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; border-radius: 18px; animation: fade-up .3s var(--ease);
  background: var(--glass-strong); backdrop-filter: var(--blur); border: 1px solid rgba(255, 107, 107, .45); box-shadow: var(--glass-shine);
}
.ai-bar.retrying { border-color: rgba(245, 193, 92, .45); }
.ai-bar-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; font-style: normal; font-weight: 800; background: var(--err); color: #fff; }
.ai-bar.retrying .ai-bar-ic { background: var(--warn); color: #3a2a00; animation: pulse 1.4s infinite; }
.ai-bar-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ai-bar-tx b { font-size: 13.5px; font-weight: 600; }
.ai-bar-tx span { font-size: 12.5px; color: var(--muted); }
.ai-bar.declined { border-color: rgba(245, 193, 92, .45); }
.ai-bar.declined .ai-bar-ic { background: var(--warn); color: #3a2a00; }

/* ---------- готовый автоответ с таймером ---------- */
.sched-card {
  align-self: flex-end; width: min(520px, 82%); margin-top: 10px; padding: 14px; border-radius: 22px; animation: fade-up .35s var(--ease);
  background: var(--glass); backdrop-filter: var(--blur); border: 1px solid rgba(106, 179, 243, .55);
  box-shadow: var(--glass-shine), 0 14px 40px -18px rgba(106, 179, 243, .7);
}
.sched-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.sched-ring { position: relative; width: 38px; height: 38px; flex: none; display: grid; place-items: center; }
.sched-ring svg { position: absolute; inset: 0; width: 38px; height: 38px; transform: rotate(-90deg); }
.sched-ring circle { fill: none; stroke: rgba(255, 255, 255, .12); stroke-width: 3; }
.sched-ring circle.prog { stroke: var(--accent-2); stroke-linecap: round; stroke-dasharray: 97.4; transition: stroke-dashoffset .25s linear; }
.sched-sec { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sched-title { font-weight: 600; font-size: 13.5px; color: #cfe6ff; }
.sched-sub { font-size: 12.5px; color: var(--muted); }
.sched-preview { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.sched-bubble {
  max-width: 100%; padding: 7px 12px; border-radius: 18px 7px 7px 18px; background: var(--bubble-out); opacity: .72;
  white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; border: 1px dashed rgba(255, 255, 255, .35);
}
.sched-bubble:first-child { border-top-right-radius: 18px; }
.sched-bubble:last-child { border-bottom-right-radius: 5px; }
.tick.wait { font-size: 10px; }
.ai-bar.skipped { border-color: rgba(106, 179, 243, .4); }
.ai-bar.skipped .ai-bar-ic { background: var(--accent-2); color: #08202b; }

/* ---------- аккаунты: переключатель и настройки ---------- */
.acc-switch { flex: none; display: flex; gap: 6px; overflow-x: auto; margin: 0 0 12px; padding-bottom: 2px; scrollbar-width: none; }
.acc-switch::-webkit-scrollbar { display: none; }
.acc-tab {
  position: relative; display: inline-flex; align-items: center; gap: 7px; flex: none; max-width: 170px;
  padding: 5px 10px 5px 5px; border-radius: 99px; border: 1px solid var(--glass-border); cursor: pointer;
  background: rgba(255, 255, 255, .05); color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600;
  transition: background .2s, color .2s, border-color .2s, transform .15s var(--ease);
}
.acc-tab:hover { color: var(--text); background: rgba(255, 255, 255, .09); }
.acc-tab:active { transform: scale(.95); }
.acc-tab.active { background: var(--accent-soft); border-color: rgba(135, 116, 225, .6); color: var(--text); }
.acc-tab-ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.acc-tab-ic.all { background: rgba(255, 255, 255, .1); font-size: 13px; }
.acc-tab-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-tab-n { color: var(--dim); font-weight: 500; font-variant-numeric: tabular-nums; }
.acc-tab.active .acc-tab-n { color: #c3b9ff; }
.acc-tab-dot { position: absolute; top: 3px; right: 3px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.avatar.xs { width: 22px; height: 22px; font-size: 10px; }

.acc-settings { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); animation: fade-in .3s; }
.acc-sec-title { font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.acc-stats-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.acc-stats { color: var(--muted); font-size: 13px; }
.acc-settings .setting-row { border-top: 0; padding-top: 6px; }
.acc-settings textarea { min-height: 110px; }
.lbl-row { display: flex; justify-content: space-between; }
.info-row.click .l { color: var(--accent-2); }

/* ---------- ИИ аккаунтов ---------- */
.acc-switch.big { margin-bottom: 18px; }
.acc-switch.big .acc-tab { max-width: 280px; padding: 7px 14px 7px 7px; font-size: 13.5px; }
.acc-switch.big .acc-tab-ic { width: 28px; height: 28px; }
.acc-switch.big .avatar.xs { width: 28px; height: 28px; font-size: 12px; }
.acc-tab-off { font-size: 11px; color: var(--warn); }
.savebar-note { align-self: center; margin-right: 14px; color: var(--warn); font-size: 13px; pointer-events: none; }
.empty-ai { max-width: 520px; }
.acc-ai-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: rgba(135, 116, 225, .08); border: 1px solid rgba(135, 116, 225, .22); margin-bottom: 12px; }
.acc-ai-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--accent); color: #fff; font-weight: 700; }
.acc-ai-tx { flex: 1; min-width: 0; }
.acc-ai-line { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-ai-sub { font-size: 12.5px; color: var(--muted); }
.warn-text { color: var(--warn); }
.conn-ai { font-size: 10px; color: var(--dim); margin-left: 4px; }
.conn-ai.on { color: var(--accent); }
.conn span { margin-left: auto; }

/* ================= меню как в Telegram ================= */
.rail { display: none; }
.menu-btn {
  position: fixed; top: 18px; left: 18px; z-index: 40; width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; color: var(--muted); background: transparent; transition: background .2s, color .2s, transform .15s var(--ease);
}
.menu-btn:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.menu-btn:active { transform: scale(.9); }
.menu-btn svg { width: 22px; height: 22px; }
.menu-dot { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }
.chatlist { margin-left: 10px; }
.chatlist-head { padding-left: 62px; }
.chatlist-head h2 { margin-top: 6px; display: flex; align-items: baseline; gap: 8px; }
.chatlist-head h2 small { font-size: 13px; font-weight: 500; color: var(--accent-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatlist-head .search, .chatlist-head .chips { margin-left: -48px; }
.page { padding-left: 80px; }
.savebar { left: 0; }

.drawer-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .45); backdrop-filter: blur(2px); animation: fade-in .2s; }
.drawer {
  position: fixed; top: 10px; left: 10px; bottom: 10px; z-index: 55; width: 300px; display: flex; flex-direction: column;
  padding: 14px 10px 10px; border-radius: 22px; overflow-y: auto;
  background: var(--glass-strong); backdrop-filter: var(--blur); border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shine), 0 30px 80px -20px rgba(0, 0, 0, .9);
  transform: translateX(-110%); opacity: 0; transition: transform .35s var(--ease), opacity .25s; pointer-events: none;
}
.drawer.open { transform: none; opacity: 1; pointer-events: auto; }
.drawer-head { padding: 4px 6px 10px; }
.drawer-me { display: flex; align-items: center; gap: 12px; }
.drawer-me-name { font-weight: 700; font-size: 15px; }
.drawer-me-sub { font-size: 12px; color: var(--muted); }
.drawer-accs { display: flex; flex-direction: column; gap: 2px; }
.drawer-acc {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 10px; border: 0; border-radius: 12px; cursor: pointer;
  background: none; color: var(--text); font: inherit; text-align: left; transition: background .15s;
}
.drawer-acc:hover { background: rgba(255, 255, 255, .06); }
.drawer-acc.active { background: var(--accent-soft); }
.drawer-acc-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.drawer-acc-tx b { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-acc-tx small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-check { color: var(--accent); font-weight: 800; }
.drawer-acc .avatar.sm { width: 36px; height: 36px; font-size: 13px; }
.avatar.all-ava { background: rgba(255, 255, 255, .1); color: var(--text); font-size: 16px; }
.avatar.add-ava { background: none; border: 1.5px dashed var(--line-2); color: var(--muted); font-size: 20px; font-weight: 400; }
.drawer-acc.add b { font-weight: 500; color: var(--muted); }
.drawer-sep { height: 1px; background: var(--line); margin: 10px 6px; flex: none; }
.drawer .nav-item { padding: 9px 12px; }
.drawer .nav-item.danger { color: #ff9b9b; }
.drawer .pilot-card { margin: 0 2px; }
.drawer-foot { margin-top: auto; padding-top: 10px; display: flex; flex-direction: column; gap: 2px; }
.drawer-ver { font-size: 11px; color: var(--dim); padding: 8px 12px 2px; }

/* журнал и админ-панель */
.log-acc { flex: none; font-size: 11px; font-weight: 600; color: var(--muted); background: rgba(255, 255, 255, .07); padding: 2px 7px; border-radius: 6px; height: fit-content; margin-top: 1px; }
.admin-tabs { max-width: 560px; margin-bottom: 14px; }
.admin-tabs button { padding: 10px; font-size: 13px; }
.admin-tabs i { font-style: normal; margin-left: 6px; padding: 1px 7px; border-radius: 99px; background: rgba(255, 255, 255, .1); font-size: 11px; }
.admin-list { padding: 6px; }
.admin-user { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 16px; flex-wrap: wrap; }
.admin-user + .admin-user { border-top: 1px solid var(--line); border-radius: 0; }
.admin-user-tx { flex: 1; min-width: 200px; }
.admin-user-name { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.admin-user-sub { font-size: 12.5px; color: var(--muted); }
.btn.sm.danger { color: #ff9b9b; }
@media (max-width: 1080px) { .page { padding-left: 70px; } }

/* ---------- уведомления справа снизу ---------- */
.notices { position: fixed; right: 18px; bottom: 18px; z-index: 95; display: flex; flex-direction: column-reverse; gap: 10px; width: min(360px, calc(100vw - 36px)); }
.notice {
  position: relative; display: flex; align-items: flex-start; gap: 12px; padding: 12px 34px 12px 12px; border-radius: 18px; cursor: pointer;
  background: var(--glass-strong); backdrop-filter: var(--blur); border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shine), 0 18px 50px -14px rgba(0, 0, 0, .85); animation: slide-left .35s var(--spring);
  transition: opacity .25s, transform .25s;
}
.notice:hover { border-color: rgba(135, 116, 225, .55); }
.notice.out { opacity: 0; transform: translateX(30px); }
.notice .avatar.sm { width: 40px; height: 40px; font-size: 14px; }
.notice-tx { flex: 1; min-width: 0; }
.notice-top { display: flex; align-items: baseline; gap: 8px; }
.notice-top b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notice-top span { margin-left: auto; flex: none; font-size: 11.5px; color: var(--accent-2); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice-text { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.notice-x { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: none; color: var(--dim); cursor: pointer; }
.notice-x:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.notify-card { margin-top: 8px !important; }
.notify-card .pilot-title { font-size: 13.5px; }
#chat-context { width: 100%; background: rgba(0, 0, 0, .28); }

/* ================= телефон ================= */
.conv-back { display: none; }
@media (max-width: 760px) {
  body { font-size: 15px; }
  /* поля ввода ≥16px — иначе iPhone увеличивает страницу при фокусе */
  input, select, textarea, .composer textarea { font-size: 16px; }

  .menu-btn { top: max(10px, env(safe-area-inset-top)); left: 10px; }
  .drawer { top: 0; left: 0; bottom: 0; width: min(320px, 86vw); border-radius: 0 22px 22px 0; }

  /* один экран за раз: список чатов → переписка */
  #view-chats { position: relative; }
  .chatlist { width: 100%; margin: 0; border-radius: 0; border: 0; background: transparent; }
  .chatlist-head { padding: 14px 12px 8px 60px; }
  .chatlist-head h2 { font-size: 21px; margin: 2px 0 12px; }
  .chatlist-head .search, .chatlist-head .chips { margin-left: -48px; }
  .chatlist-items { padding: 2px 6px 90px; }
  .chat-item { padding: 9px 8px; }
  .conversation { display: none; }
  body.chat-open .chatlist { display: none; }
  body.chat-open .conversation { display: flex; }
  body.chat-open .menu-btn { display: none; }
  .empty-state { display: none; }

  .conv-back { display: grid; margin-left: -4px; }
  .conv-head { top: 0; left: 0; right: 0; border-radius: 0; padding: max(8px, env(safe-area-inset-top)) 8px 8px;
               border-width: 0 0 1px 0; }
  .conv-head .avatar.lg { width: 38px; height: 38px; font-size: 14px; }
  .conv-title { font-size: 15px; }
  .conv-sub { font-size: 12px; }
  #btn-generate { width: 38px; height: 38px; padding: 0; border-radius: 50%; }
  #btn-generate .btn-text { display: none; }
  .messages { padding: 70px 10px 100px; }
  .group-msgs { max-width: 86%; }
  .msg .bubble { font-size: 15.5px; }
  .msg-more { opacity: .5; width: 24px; height: 24px; font-size: 13px; }  /* на телефоне нет наведения — кнопка видна всегда */
  .m-photo { width: 240px; }
  .m-sticker { width: 130px; height: 130px; }
  .draft-card, .sched-card { width: 100%; }
  .dock { left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom)); }
  .composer textarea { padding: 11px 16px; }
  .btn.icon { width: 44px; height: 44px; }

  /* информация о собеседнике — поверх переписки */
  .chatpanel { position: fixed; inset: 0; z-index: 35; width: 100%; margin: 0; border-radius: 0; border: 0;
               background: #0e0e11; padding: 0 12px calc(20px + env(safe-area-inset-bottom)); }
  .info-head { padding-top: max(12px, env(safe-area-inset-top)); }

  /* страницы */
  .page { padding: 64px 12px 110px; }
  .page-head h1 { font-size: 23px; }
  .page-head p { margin-bottom: 16px; font-size: 14px; }
  .card { padding: 16px; border-radius: 20px; }
  .grid2, .grid2.wide-left, .grid2.tight { grid-template-columns: 1fr; gap: 12px; }
  .acc-switch.big .acc-tab { max-width: 220px; }
  .savebar { padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); }
  .savebar .btn { width: 100%; }
  .savebar-note { display: none !important; }
  .qr-wrap { justify-content: center; }
  .qr-box { width: 220px; height: 220px; }
  .log { flex-wrap: wrap; gap: 4px 10px; padding: 10px 14px; }
  .log time { width: auto; }
  .log > div { flex-basis: 100%; }
  .admin-user .btn-row { width: 100%; }
  .acc-ai-row { flex-wrap: wrap; }
  .acc-ai-row .btn { width: 100%; }

  /* уведомления и всплывающие окна */
  .notices { right: 8px; left: 8px; width: auto; bottom: calc(80px + env(safe-area-inset-bottom)); }
  .toasts { top: max(10px, env(safe-area-inset-top)); bottom: auto; width: calc(100% - 24px); }
  .toast { max-width: 100%; text-align: center; border-radius: 16px; }
  .modal { padding: 20px; }
  .ctx-menu { min-width: 190px; }
}
/* колонки сетки не раздуваются от длинного содержимого */
.grid2 > *, .stack > * { min-width: 0; }
@media (max-width: 760px) {
  .seg button { white-space: normal; line-height: 1.25; }
  .acc-tab-n { display: none; }
}
