/* M9 Messenger — палитра M9 Capital: красный #C90000, чёрный #0E0E0E, белый */
:root {
  --red: #C90000;
  --red-dark: #A60000;
  --black: #0E0E0E;

  --accent: var(--red);
  --accent-hover: var(--red-dark);
  --accent-text: #B00000;
  --accent-soft: #FBE4E4;
  --top: var(--black);
  --rail: #151515;
  --rail-hover: #242424;
  --bg: #F4F4F5;
  --panel: #FFFFFF;
  --line: #E6E6E9;
  --text: #0E0E0E;
  --muted: #6B6B73;
  --hover: #F6F6F7;
  --active: #FCEBEB;
  --chat-bg: #F1F2F4;
  --dots: rgba(0, 0, 0, .06);
  --in: #FFFFFF;
  --out: #E3E8EF;
  --quote-bg: rgba(0, 0, 0, .045);
  --input-bg: #FFFFFF;
  --composer: #F4F4F5;
  --badge: var(--red);
  --read: #2F9BE0;
  --shadow: 0 1px .5px rgba(14, 14, 14, .12);
  --pop: 0 12px 40px rgba(0, 0, 0, .18);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent-text: #FF5A5A; --accent-soft: #3A1515; --top: #000000; --rail: #0A0A0A; --rail-hover: #1D1D1F;
    --bg: #0B0B0C; --panel: #141416; --line: #26262A; --text: #EDEDEF; --muted: #9A9AA3; --hover: #1C1C1F;
    --active: #2B1414; --chat-bg: #0E0E10; --dots: rgba(255, 255, 255, .045); --in: #1F1F23; --out: #4A1616;
    --quote-bg: rgba(255, 255, 255, .06); --input-bg: #1F1F23; --composer: #141416; --read: #5CB8F5;
    --shadow: 0 1px .5px rgba(0, 0, 0, .5); --pop: 0 12px 40px rgba(0, 0, 0, .6); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent-text: #FF5A5A; --accent-soft: #3A1515; --top: #000000; --rail: #0A0A0A; --rail-hover: #1D1D1F;
  --bg: #0B0B0C; --panel: #141416; --line: #26262A; --text: #EDEDEF; --muted: #9A9AA3; --hover: #1C1C1F;
  --active: #2B1414; --chat-bg: #0E0E10; --dots: rgba(255, 255, 255, .045); --in: #1F1F23; --out: #4A1616;
  --quote-bg: rgba(255, 255, 255, .06); --input-bg: #1F1F23; --composer: #141416; --read: #5CB8F5;
  --shadow: 0 1px .5px rgba(0, 0, 0, .5); --pop: 0 12px 40px rgba(0, 0, 0, .6); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Inter, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
h1, h2 { margin: 0; }

/* ---------- фирменный знак ---------- */
.word { font-family: "Arial Black", Montserrat, "Segoe UI Black", sans-serif; font-weight: 900; font-style: normal; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; height: 100%; padding-right: 8px; }
.brand-mark { height: 24px; display: block; }
.brand-sep { width: 2px; height: 22px; background: #fff; transform: skewX(-9deg); }
.brand-word { font-family: "Arial Black", Montserrat, "Segoe UI Black", sans-serif; font-weight: 900; font-size: 14px;
  letter-spacing: .2em; transform: skewX(-9deg); color: #fff; white-space: nowrap; }

.lockup { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0 14px; }
.lockup-mark { width: 150px; display: block; }
.lockup-rule { width: 150px; height: 5px; background: var(--red); border-radius: 1px; }
.lockup-word { font-family: "Arial Black", Montserrat, "Segoe UI Black", sans-serif; font-weight: 900; font-size: 20px;
  letter-spacing: .2em; transform: skewX(-9deg); padding-left: .2em; }

/* ---------- вход ---------- */
.login { height: 100%; display: grid; place-items: center; padding: 16px; background: var(--black); position: relative; overflow: hidden; }
.login::before { content: ""; position: absolute; inset: -20%; background:
  radial-gradient(circle at 18% 22%, rgba(201, 0, 0, .35), transparent 40%),
  radial-gradient(circle at 85% 80%, rgba(201, 0, 0, .22), transparent 45%); }
.login-card { position: relative; width: 100%; max-width: 380px; background: var(--panel); border-radius: 18px; padding: 30px 28px 26px;
  display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.5); border-top: 4px solid var(--red); }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 500; }
.login-card input { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 11px 12px; outline: none; }
.login-card input:focus { border-color: var(--red); }
.login-card button { background: var(--red); color: #fff; border-radius: 10px; padding: 12px; font-weight: 700; margin-top: 4px; letter-spacing: .02em; }
.login-card button:hover { background: var(--red-dark); }
.login-err { color: var(--accent-text); font-size: 13px; min-height: 18px; }

/* ---------- каркас ---------- */
.shell { height: 100%; display: grid; grid-template-rows: 54px 1fr; }
.topbar { background: var(--top); display: flex; align-items: center; gap: 18px; padding: 0 14px 0 18px; min-width: 0; }
.topnav { display: flex; gap: 4px; flex: 1; justify-content: flex-end; }
.topnav-btn { position: relative; display: flex; align-items: center; gap: 7px; color: #B9B9C0; padding: 8px 14px; border-radius: 8px; font-weight: 600; font-size: 13.5px; }
.topnav-btn:hover { color: #fff; background: #1E1E20; }
.topnav-btn.active { color: #fff; background: #222225; box-shadow: inset 0 -2px 0 var(--red); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); display: inline-block; }
.top-right { display: flex; gap: 4px; padding-left: 10px; border-left: 1px solid #2A2A2D; }
.top-icon { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; color: #B9B9C0; }
.top-icon:hover { color: #fff; background: #1E1E20; }
.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; } :root[data-theme="dark"] .i-moon { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .i-sun { display: block; } :root:not([data-theme="light"]) .i-moon { display: none; } }

.app { min-height: 0; display: grid; grid-template-columns: 72px 360px 1fr; overflow: hidden; }
.app[data-view="mailing"] .list, .app[data-view="mailing"] .chat,
.app[data-view="brain"] .list, .app[data-view="brain"] .chat { display: none; }
.page { display: none; grid-column: 2 / 4; min-height: 0; min-width: 0; }
.home { display: none; grid-column: 1 / -1; min-height: 0; overflow-y: auto; background: var(--bg); }
.app[data-view="home"] .rail, .app[data-view="home"] .list, .app[data-view="home"] .chat { display: none; }
.app[data-view="home"] .home { display: block; }
.app[data-view="mailing"] #mailing-pane { display: block; overflow-y: auto; background: var(--bg); }
.app[data-view="brain"] #brain-pane { display: flex; flex-direction: column; background: var(--chat-bg); position: relative; }

/* колонка аккаунтов */
.rail { background: var(--rail); display: flex; flex-direction: column; padding: 10px 0; min-height: 0; }
.rail-accs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; gap: 6px; scrollbar-width: none; }
.rail-accs::-webkit-scrollbar { display: none; }
.rail-item { position: relative; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 14px; flex: none; }
.rail-item:hover { background: var(--rail-hover); }
.rail-item.active { background: var(--rail-hover); }
.rail-item.active::before { content: ""; position: absolute; left: -8px; top: 12px; bottom: 12px; width: 4px; border-radius: 0 4px 4px 0; background: var(--red); }
.rail-item .ava { width: 42px; height: 42px; font-size: 15px; }
.rail-all { width: 42px; height: 42px; border-radius: 12px; background: var(--red); color: #fff; display: grid; place-items: center;
  font-family: "Arial Black", Montserrat, sans-serif; font-weight: 900; font-size: 12px; letter-spacing: .04em; }
.rail-num { position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 800; color: #fff;
  background: var(--black); border: 1px solid #3A3A3D; border-radius: 6px; padding: 0 5px; line-height: 14px; }
.rail-item .badge { position: absolute; top: 2px; right: 2px; box-shadow: 0 0 0 2px var(--rail); }
.rail-item.off .ava { filter: grayscale(1); opacity: .4; }
.rail-item.off::after { content: ""; position: absolute; top: 6px; left: 6px; width: 10px; height: 10px; border-radius: 50%; background: #F5A524; border: 2px solid var(--rail); }
.rail-sep { width: 32px; height: 1px; background: #2B2B2E; margin: 4px 0; flex: none; }
.rail-bottom { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px solid #222; margin: 0 10px; }
.rail-brain { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: #FF6B5A;
  background: linear-gradient(135deg, #2A1212, #1A1A1C); border: 1px solid #3A1D1D; }
.rail-brain:hover, .rail-brain.active { color: #fff; background: var(--red); border-color: var(--red); }
.rail-me { width: 40px; height: 40px; border-radius: 50%; background: #2A2A2D; color: #E6E6E8; font-weight: 700; font-size: 13px; }
.rail-me:hover { background: #38383C; }

/* аватар */
.ava { position: relative; flex: none; width: 48px; height: 48px; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 17px; user-select: none; }
.ava img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--badge); color: #fff;
  font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; }

/* список чатов */
.list { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.list-head { padding: 14px 14px 0; }
.acc-card { margin-bottom: 12px; }
.acc-title { display: flex; align-items: center; gap: 10px; font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.acc-title .status { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; letter-spacing: 0; }
.status.on { background: #E3F6EA; color: #137A3A; } .status.off { background: #FFF1DC; color: #9A5B00; }
:root[data-theme="dark"] .status.on { background: #12321F; color: #6EE29A; } :root[data-theme="dark"] .status.off { background: #3A2A10; color: #F5B14C; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .status.on { background: #12321F; color: #6EE29A; } :root:not([data-theme="light"]) .status.off { background: #3A2A10; color: #F5B14C; } }
.acc-rows { margin-top: 8px; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 13px; }
.acc-rows dt { color: var(--muted); }
.acc-rows dd { margin: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-rows button { color: var(--accent-text); font-weight: 500; padding: 0; }
.acc-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--bg); border-radius: 10px; padding: 0 12px; color: var(--muted); border: 1px solid transparent; }
.search:focus-within { border-color: var(--red); }
.search input { flex: 1; border: 0; background: none; outline: none; padding: 9px 0; min-width: 0; }
.tabs { display: flex; gap: 6px; padding: 10px 0 8px; }
.tab { padding: 6px 12px; border-radius: 16px; background: var(--bg); color: var(--muted); font-size: 13px; font-weight: 600; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--black); color: #fff; }
:root[data-theme="dark"] .tab.active { background: var(--red); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tab.active { background: var(--red); } }
.dialogs { flex: 1; overflow-y: auto; border-top: 1px solid var(--line); }
.dlg { display: flex; gap: 12px; padding: 10px 14px; align-items: center; cursor: pointer; position: relative; }
.dlg::after { content: ""; position: absolute; left: 74px; right: 0; bottom: 0; border-bottom: 1px solid var(--line); }
.dlg:hover { background: var(--hover); }
.dlg.active { background: var(--active); }
.dlg.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--red); }
.dlg-body { flex: 1; min-width: 0; }
.dlg-top, .dlg-bot { display: flex; align-items: center; gap: 6px; }
.dlg-title { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dlg-time { font-size: 12px; color: var(--muted); flex: none; }
.dlg.unread .dlg-time { color: var(--text); font-weight: 700; }
.dlg-bot { margin-top: 3px; }
.dlg-text { flex: 1; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.dlg-text b { font-weight: 500; color: var(--text); opacity: .75; }
.chip { flex: none; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; line-height: 17px; background: var(--bg); color: var(--text); border: 1px solid var(--line); }
.own-tag { color: var(--accent-text); font-weight: 700; }
.own-toggle { display: flex; align-items: center; gap: 8px; padding: 0 2px 10px; font-size: 12.5px; color: var(--muted); cursor: pointer; user-select: none; }
.own-toggle input { display: none; }
.own-toggle span { width: 30px; height: 18px; border-radius: 9px; background: var(--line); position: relative; flex: none; transition: background 0.26s; }
.own-toggle span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.26s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.own-toggle input:checked + span { background: var(--red); }
.own-toggle input:checked + span::after { transform: translateX(12px); }
.kind { color: var(--muted); flex: none; font-size: 12px; }
.dlg-empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* чат */
.chat { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--chat-bg); }
.chat::before, .brain::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(var(--dots) 1px, transparent 1px); background-size: 18px 18px; }
.empty { position: relative; margin: auto; text-align: center; max-width: 400px; padding: 24px; }
.empty-mark { width: 120px; opacity: .9; }
.empty-title { font-size: 20px; font-weight: 700; margin: 18px 0 6px; }
.empty-sub { color: var(--muted); line-height: 1.5; }
.chat-inner { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 64px; }
.chat-head .ava { width: 42px; height: 42px; font-size: 15px; }
.chat-meta { flex: 1; min-width: 0; }
.chat-title { font-weight: 700; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.back { display: none; color: var(--muted); }
.btn-soft { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 8px; color: var(--accent-text); font-weight: 600; background: var(--accent-soft); white-space: nowrap; }
.btn-soft:hover { filter: brightness(.97); }
.btn-primary { background: var(--red); color: #fff; border-radius: 9px; padding: 10px 14px; font-weight: 700; }
.btn-primary:hover { background: var(--red-dark); }
.btn-danger { width: 100%; padding: 11px; border-radius: 9px; border: 1px solid var(--line); color: var(--accent-text); font-weight: 600; }
.btn-danger:hover { background: var(--accent-soft); border-color: transparent; }

.msgs { position: relative; flex: 1; overflow-y: auto; padding: 12px 6% 8px; display: flex; flex-direction: column; gap: 2px; font-size: var(--msg-size, 14px); }
.day { align-self: center; margin: 10px 0 6px; background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 8px; box-shadow: var(--shadow); }
.loader { align-self: center; color: var(--muted); font-size: 12px; padding: 8px; }
.row { display: flex; }
.row.out { justify-content: flex-end; }
.row.gap { margin-top: 8px; }
.bubble { position: relative; max-width: min(560px, 75%); background: var(--in); border-radius: 12px; padding: 6px 9px 7px;
  box-shadow: var(--shadow); line-height: 1.42; word-wrap: break-word; overflow-wrap: anywhere; }
.row.out .bubble { background: var(--out); }
.row.tail.in .bubble { border-top-left-radius: 3px; }
.row.tail.out .bubble { border-top-right-radius: 3px; }
.bubble.deleted { opacity: .78; outline: 1.5px dashed var(--muted); outline-offset: -1.5px; }
.bubble.deleted .text { text-decoration: line-through; text-decoration-color: rgba(128,128,128,.6); }
.del-note { font-size: 11.5px; font-weight: 700; color: var(--accent-text); margin-bottom: 3px; }
.edited-btn, .edited-mark { font-size: 11px; color: var(--muted); padding: 0; margin-right: 2px; }
.edited-btn { text-decoration: underline dotted; cursor: pointer; }
.edited-btn:hover { color: var(--accent-text); }
.hist { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); display: flex; flex-direction: column; gap: 4px; }
.hist-item { font-size: 12.5px; color: var(--muted); white-space: pre-wrap; }
.hist-item span { font-weight: 600; }
.who { font-size: 12.5px; font-weight: 700; margin-bottom: 2px; }
.text { white-space: pre-wrap; }
.text a, .ai-text a { color: var(--read); }
.meta { float: right; margin: 6px 0 -4px 10px; font-size: 11px; color: var(--muted); display: inline-flex; gap: 4px; align-items: center; white-space: nowrap; }
.meta .site { color: var(--muted); font-weight: 500; font-style: italic; }
.ticks { width: 16px; height: 11px; color: var(--muted); }
.ticks.read { color: var(--read); }
.quote { border-left: 3px solid var(--red); background: var(--quote-bg); border-radius: 6px; padding: 4px 8px; margin-bottom: 4px; font-size: 13px; cursor: pointer; }
.quote-who { font-weight: 700; color: var(--accent-text); font-size: 12.5px; }
.quote-text { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.media-img { display: block; max-width: 100%; max-height: 360px; border-radius: 8px; margin: -2px -5px 4px; cursor: zoom-in; background: var(--quote-bg); min-width: 120px; min-height: 80px; }
.media-sticker { display: block; width: 160px; height: 160px; object-fit: contain; }
.media-video { display: block; max-width: 100%; max-height: 360px; border-radius: 8px; margin-bottom: 4px; background: #000; }
.media-round { width: 220px; height: 220px; border-radius: 50%; object-fit: cover; background: #000; display: block; margin-bottom: 4px; }
audio { display: block; width: 260px; max-width: 100%; height: 40px; margin: 2px 0 4px; }
.file { display: flex; align-items: center; gap: 10px; background: var(--quote-bg); border-radius: 8px; padding: 8px 10px; margin-bottom: 4px; text-decoration: none; color: inherit; }
.file-ico { width: 36px; height: 36px; border-radius: 8px; background: var(--red); color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 800; flex: none; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.file-sub { font-size: 12px; color: var(--muted); }
.tag { font-style: italic; color: var(--muted); }
.reply-btn { position: absolute; top: 4px; opacity: 0; transition: opacity 0.2s; width: 26px; height: 26px; border-radius: 50%; background: var(--panel); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--muted); }
.row.in .reply-btn { right: -34px; }
.row.out .reply-btn { left: -34px; }
.row:hover .reply-btn { opacity: 1; }
.reply-btn:hover { color: var(--accent-text); }
.flash .bubble { animation: flash 2.04s; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--red); } 100% { box-shadow: var(--shadow); } }

/* ввод */
.composer { position: relative; background: var(--composer); padding: 8px 14px 10px; border-top: 1px solid var(--line); }
.composer-row { display: flex; align-items: flex-end; gap: 6px; }
.icon-btn { width: 42px; height: 42px; margin: 0; border-radius: 50%; display: grid; place-items: center; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.composer textarea { flex: 1; min-width: 0; box-sizing: border-box; display: block; margin: 0; resize: none; border: 1px solid var(--line); outline: none; background: var(--input-bg); border-radius: 21px; padding: 10px 16px; height: 42px; min-height: 42px; max-height: 180px; line-height: 20px; font-size: 14px; overflow-y: hidden; }
.composer textarea:focus { border-color: var(--red); }
.send { width: 42px; height: 42px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; flex: none; }
.send:hover { background: var(--red-dark); }
.send:disabled { opacity: .5; cursor: default; }
.composer-hint { font-size: 11.5px; color: var(--muted); padding: 5px 4px 0 52px; }
.bar { display: flex; align-items: center; gap: 8px; background: var(--panel); border-radius: 10px; padding: 6px 6px 6px 12px; margin-bottom: 8px; border-left: 4px solid var(--red); }
.bar-body { flex: 1; min-width: 0; }
.bar-who { font-weight: 700; color: var(--accent-text); font-size: 13px; }
.bar-text { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- рассылка ---------- */
.page-inner { max-width: 1100px; margin: 0 auto; padding: 24px 24px 40px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.page-sub { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; align-items: center; }
.page-actions select { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; outline: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; }
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 800; margin-top: 4px; letter-spacing: -.01em; }
.stat-value.small { font-size: 16px; display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.stat.main { background: var(--black); color: #fff; border-color: var(--black); }
.stat.main .stat-label { color: #A9A9B0; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 12px; font-size: 13px; font-weight: 700; }
.pill.on { background: #1B5E35; color: #CFF5DD; } .pill.off { background: var(--red); color: #fff; }
.timers { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.timer { font-size: 11.5px; padding: 2px 8px; border-radius: 6px; background: #222; color: #9A9AA0; }
.timer.on { background: #1B5E35; color: #CFF5DD; }
.page-tabs { padding: 16px 0 12px; }
.mail-list { display: flex; flex-direction: column; gap: 8px; }
.mail-day { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 10px 2px 2px; }
.mail-item { display: grid; grid-template-columns: 64px 1fr; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.mail-time { font-weight: 800; font-size: 15px; }
.mail-time small { display: block; font-weight: 500; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.mail-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.mail-top .arrow { color: var(--muted); }
.mail-top b { font-weight: 700; }
.kind-chip { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--bg); color: var(--muted); }
.late { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; background: #FFF1DC; color: #9A5B00; }
.st { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 6px; }
.st.sent { background: #E3F6EA; color: #137A3A; } .st.error { background: var(--accent-soft); color: var(--accent-text); }
.st.skipped, .st.stale { background: var(--bg); color: var(--muted); }
.mail-text { margin-top: 6px; white-space: pre-wrap; line-height: 1.45; color: var(--text); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.mail-empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- мозг ---------- */
.brain-ava { width: 42px; height: 42px; border-radius: 12px; background: var(--red); color: #fff; display: grid; place-items: center; flex: none; }
.ai-row { display: flex; gap: 10px; margin-top: 10px; }
.ai-row.user { justify-content: flex-end; }
.ai-row .bubble { max-width: min(720px, 85%); }
.ai-row.user .bubble { background: var(--out); }
.ai-text { line-height: 1.5; }
.ai-text p { margin: 0 0 8px; } .ai-text p:last-child { margin-bottom: 0; }
.ai-text ul { margin: 4px 0 8px; padding-left: 20px; }
.ai-text code { background: var(--quote-bg); padding: 1px 5px; border-radius: 4px; font-size: .92em; }
.ai-mini { width: 30px; height: 30px; border-radius: 9px; background: var(--red); color: #fff; display: grid; place-items: center; flex: none; margin-top: 2px; }
.typing span { display: inline-block; width: 7px; height: 7px; margin: 0 2px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: 0.34s; } .typing span:nth-child(3) { animation-delay: 0.68s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.suggest { position: relative; margin: auto; max-width: 520px; text-align: center; padding: 20px; }
.suggest-title { font-size: 19px; font-weight: 700; margin: 14px 0 6px; }
.suggest-sub { color: var(--muted); margin-bottom: 16px; line-height: 1.5; }
.suggest-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.suggest-chips button { background: var(--panel); border: 1px solid var(--line); padding: 8px 12px; border-radius: 18px; font-weight: 500; }
.suggest-chips button:hover { border-color: var(--red); color: var(--accent-text); }

/* ---------- всплывашки ---------- */
.menu { position: fixed; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--pop); padding: 6px; z-index: 30; min-width: 220px; }
.menu-head { padding: 8px 10px 10px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-head b { color: var(--text); display: block; font-size: 14px; }
.menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 7px; }
.menu button:hover { background: var(--hover); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal-card { width: 100%; max-width: 460px; max-height: calc(100% - 32px); overflow-y: auto; background: var(--panel); border-radius: 16px; box-shadow: var(--pop); border-top: 4px solid var(--red); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; }
.modal-head h2 { font-size: 19px; font-weight: 800; }
.modal-body { padding: 8px 18px 18px; display: flex; flex-direction: column; gap: 18px; }
.set-profile { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--bg); border-radius: 12px; }
.set-profile .rail-me { pointer-events: none; }
.set-group { display: flex; flex-direction: column; gap: 8px; }
.set-label { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.seg { display: flex; background: var(--bg); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; padding: 8px 6px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.set-group input[type="password"] { border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: 10px 12px; outline: none; }
.set-group input[type="password"]:focus { border-color: var(--red); }
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.switch input { display: none; }
.switch span { width: 38px; height: 22px; border-radius: 11px; background: var(--line); position: relative; flex: none; transition: background 0.26s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.26s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--red); }
.switch input:checked + span::after { transform: translateX(16px); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--black); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60; font-size: 13.5px; box-shadow: var(--pop); max-width: calc(100% - 32px); border-left: 4px solid #2E9E5B; }
.toast.err { border-left-color: var(--red); }
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: grid; place-items: center; z-index: 50; cursor: zoom-out; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }

.dialogs::-webkit-scrollbar, .msgs::-webkit-scrollbar, .page::-webkit-scrollbar { width: 6px; }
.dialogs::-webkit-scrollbar-thumb, .msgs::-webkit-scrollbar-thumb, .page::-webkit-scrollbar-thumb { background: rgba(128,128,128,.35); border-radius: 3px; }


/* ---------- заставка как в кино ---------- */
.intro { position: fixed; inset: 0; z-index: 100; background: #000; overflow: hidden; color: #fff; display: grid; place-items: center; }
.intro.out { animation: introOut 1s cubic-bezier(.7, 0, .3, 1) forwards; }
@keyframes introOut { 0% { opacity: 1; } 100% { opacity: 0; transform: scale(1.35); filter: blur(10px); } }
.intro-bar { position: absolute; left: 0; right: 0; height: 11vh; background: #000; z-index: 4; transition: transform 1.1s cubic-bezier(.7, 0, .3, 1); }
.intro-bar.top { top: 0; } .intro-bar.bottom { bottom: 0; }
.intro.final .intro-bar.top { transform: translateY(-100%); }
.intro.final .intro-bar.bottom { transform: translateY(100%); }
.intro-vignette { position: absolute; inset: 0; z-index: 2; pointer-events: none; background: radial-gradient(ellipse at center, transparent 35%, rgba(0,0,0,.85) 100%); }
.intro-grain { position: absolute; inset: -50%; z-index: 3; pointer-events: none; opacity: .09;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain .5s steps(6) infinite; }
@keyframes grain { 0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); }
  60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); } }

.intro-stage { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 4.5vh; z-index: 1;
  animation: stageOut 1.3s ease-in 7s forwards; }
@keyframes stageOut { to { opacity: 0; transform: scale(.96); filter: blur(8px); } }
.intro-logo { position: relative; width: min(46vw, 360px); }
.intro-m9 { display: block; width: 100%; opacity: 0; filter: blur(18px) brightness(.3); transform: scale(1.14);
  animation: m9In 3.2s cubic-bezier(.2, .7, .2, 1) .8s forwards; }
@keyframes m9In { 60% { opacity: 1; filter: blur(0) brightness(1.25); } 100% { opacity: 1; filter: blur(0) brightness(1); transform: scale(1); } }
.intro-glow { position: absolute; inset: -40% -25%; background: radial-gradient(ellipse at center, rgba(201,0,0,.55), transparent 62%);
  opacity: 0; filter: blur(20px); animation: glow 4.4s ease-out 1.2s forwards; }
@keyframes glow { 35% { opacity: 1; } 100% { opacity: .35; } }
.intro-sweep { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
  -webkit-mask: url(m9.svg) center / contain no-repeat; mask: url(m9.svg) center / contain no-repeat;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.95) 50%, transparent 65%) -200% 0 / 200% 100% no-repeat;
  animation: sweep 1.7s ease-in-out 3.5s forwards; }
@keyframes sweep { to { background-position: 200% 0; } }
.intro-presents { font-family: Inter, sans-serif; font-weight: 300; font-size: clamp(11px, 1.5vw, 15px); letter-spacing: .2em; color: #c9c9cf;
  opacity: 0; animation: presents 2.4s ease-out 4.3s forwards; padding-left: .6em; }
@keyframes presents { to { opacity: 1; letter-spacing: .75em; } }

.intro-title { position: absolute; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 2.4vh; }
.intro-rule { height: 4px; width: 0; background: var(--red); box-shadow: 0 0 24px rgba(201,0,0,.9); animation: rule 1.3s cubic-bezier(.7, 0, .2, 1) 8.3s forwards; }
@keyframes rule { to { width: min(64vw, 620px); } }
.intro-word { font-family: "Arial Black", Montserrat, "Segoe UI Black", sans-serif; font-weight: 900; font-size: clamp(34px, 8.2vw, 104px);
  letter-spacing: .14em; padding-left: .14em; transform: skewX(-9deg); line-height: 1; color: #fff; white-space: nowrap;
  clip-path: inset(0 100% 0 0); text-shadow: 0 0 40px rgba(255,255,255,.18); animation: word 1.6s cubic-bezier(.7, 0, .2, 1) 8.8s forwards; }
@keyframes word { to { clip-path: inset(0 0 0 0); } }
.intro.final .intro-title { animation: titleUp 1.3s cubic-bezier(.7, 0, .2, 1) forwards; }
.intro.final.mode-login .intro-title { animation-name: titleUpLogin; }
@keyframes titleUp { to { transform: translateY(-14vh) scale(.78); } }
@keyframes titleUpLogin { to { transform: translateY(-25vh) scale(.62); } }

.intro-cta { position: absolute; top: 56%; z-index: 5; display: flex; flex-direction: column; align-items: center;
  pointer-events: none; }
.intro.mode-login .intro-cta { top: 40%; }
.cta-start, .intro-login { display: none; }
.intro.mode-start .cta-start { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.intro.mode-login .intro-login { display: flex; }
.intro.ready .intro-cta { pointer-events: auto; }
.intro-cta .cta-start > *, .intro-cta .intro-login > * { opacity: 0; transform: translateY(26px); filter: blur(6px); }
.intro.ready .intro-cta .cta-start > *, .intro.ready .intro-cta .intro-login > * { animation: ctaUp .9s cubic-bezier(.2, .7, .2, 1) forwards; }
.intro.ready .intro-cta > * > *:nth-child(1) { animation-delay: .75s; }
.intro.ready .intro-cta > * > *:nth-child(2) { animation-delay: .9s; }
.intro.ready .intro-cta > * > *:nth-child(3) { animation-delay: 1.05s; }
.intro.ready .intro-cta > * > *:nth-child(4) { animation-delay: 1.2s; }
@keyframes ctaUp { to { opacity: 1; transform: none; filter: none; } }
.intro.ready .intro-start { animation-name: ctaUpSkew !important; }
@keyframes ctaUpSkew { from { opacity: 0; transform: translateY(26px) skewX(-9deg); filter: blur(6px); } to { opacity: 1; transform: skewX(-9deg); filter: none; } }
.intro-login { flex-direction: column; gap: 12px; width: min(340px, 84vw); }
.intro-login input { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.16); color: #fff; border-radius: 6px; padding: 13px 15px;
  font-size: 15px; outline: none; transition: border-color .25s, box-shadow .25s, background .25s; }
.intro-login input::placeholder { color: #8a8a92; }
.intro-login input:focus { border-color: var(--red); background: rgba(255,255,255,.09); box-shadow: 0 0 0 3px rgba(201,0,0,.25), 0 0 24px rgba(201,0,0,.25); }
.intro-login .intro-start { margin-top: 6px; }
.intro-err { min-height: 18px; color: #ff5a5a; font-size: 13px; text-align: center; }
.intro-login.shake { animation: shake .45s ease !important; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.intro-hello { color: #a9a9b0; font-size: 14px; letter-spacing: .04em; }
.intro-start { font-family: "Arial Black", Montserrat, sans-serif; font-weight: 900; font-size: 17px; letter-spacing: .4em; padding: 16px 44px 16px calc(44px + .4em);
  color: #fff; background: transparent; border: 2px solid var(--red); border-radius: 4px; transform: skewX(-9deg); position: relative; overflow: hidden;
  box-shadow: 0 0 30px rgba(201,0,0,.35), inset 0 0 20px rgba(201,0,0,.25); transition: background .25s, box-shadow .25s; }
.intro-start::after { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%) -150% 0 / 200% 100% no-repeat;
  animation: btnSweep 2.8s ease-in-out 1s infinite; }
@keyframes btnSweep { 40%, 100% { background-position: 150% 0; } }
.intro-start:hover { background: var(--red); box-shadow: 0 0 50px rgba(201,0,0,.75); }
.intro-skip { position: absolute; right: 22px; bottom: calc(11vh + 14px); z-index: 6; color: #77777f; font-size: 12.5px; letter-spacing: .08em; }
.intro-skip:hover { color: #fff; }
.intro.final .intro-skip { display: none; }

/* перемотка: сразу финальный кадр */
.intro.skipped .intro-stage { display: none; }
.intro.skipped .intro-rule { animation: none; width: min(64vw, 620px); }
.intro.skipped .intro-word { animation: none; clip-path: inset(0 0 0 0); }

/* вход после заставки — тоже без резкого света */
.login.from-intro { animation: loginIn .9s ease forwards; }
@keyframes loginIn { from { opacity: 0; } to { opacity: 1; } }


/* ---------- узкие экраны ---------- */
@media (max-width: 1100px) { .app { grid-template-columns: 72px 300px 1fr; } }
@media (max-width: 760px) {
  .shell { grid-template-rows: 50px 1fr; }
  .topbar { gap: 8px; padding: 0 8px 0 12px; }
  .brand-word, .brand-sep { display: none; }
  .topnav-btn { padding: 8px 10px; }
  .topnav-btn svg { display: none; }
  .top-right { padding-left: 4px; }
  .app { grid-template-columns: 60px 1fr; }
  .page { grid-column: 2 / 3; }
  .rail-item { width: 48px; height: 48px; }
  .rail-item .ava, .rail-all { width: 38px; height: 38px; }
  .chat { display: none; }
  .app.in-chat .list { display: none; }
  .app.in-chat .chat { display: flex; grid-column: 1 / -1; }
  .app.in-chat .rail { display: none; }
  .app.in-chat[data-view="brain"] #brain-pane { grid-column: 1 / -1; }
  .back { display: grid; }
  .msgs { padding: 10px 10px 6px; }
  .bubble { max-width: 86%; }
  .reply-btn { display: none; }
  .composer-hint { display: none; }
  .page-inner { padding: 16px; }
  .mail-item { grid-template-columns: 52px 1fr; gap: 10px; }
  #brain-reset { padding: 7px 9px; font-size: 12px; }
}

.media-card { display: flex; align-items: center; gap: 10px; background: var(--quote-bg); border-radius: 8px; padding: 8px 10px; margin-bottom: 4px; color: var(--muted); }
.media-card .file-ico { background: #3D3D42; }

/* ---------- статусы, присутствие, правка ---------- */
.app[data-view="audit"] .list, .app[data-view="audit"] .chat { display: none; }
.app[data-view="audit"] #audit-pane { display: block; overflow-y: auto; background: var(--bg); }
.tabs { flex-wrap: wrap; }
.meta-ctl { display: flex; gap: 6px; }
.meta-ctl select, .page-actions select { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 12.5px; font-weight: 500; outline: none; max-width: 170px; }
.meta-ctl select:focus { border-color: var(--red); }
.presence { font-size: 12px; color: #1F8A4C; margin-top: 3px; font-weight: 500; }
.presence .typing-now { color: var(--accent-text); }
.stc { flex: none; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px; line-height: 16px; }
.stc.work { background: #E3EEFF; color: #1F5BD6; } .stc.wait { background: #FFF1DC; color: #9A5B00; } .stc.done { background: var(--bg); color: var(--muted); }
:root[data-theme="dark"] .stc.work { background: #172A4A; color: #8DB4FF; } :root[data-theme="dark"] .stc.wait { background: #3A2A10; color: #F5B14C; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stc.work { background: #172A4A; color: #8DB4FF; } :root:not([data-theme="light"]) .stc.wait { background: #3A2A10; color: #F5B14C; } }
.assignee { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--black); color: #fff; font-size: 9px; font-weight: 700; display: grid; place-items: center; }
.draft { color: var(--accent-text); font-weight: 500; }
.msg-actions { position: absolute; top: 4px; display: flex; gap: 4px; opacity: 0; transition: opacity 0.2s; }
.row.in .msg-actions { right: -34px; }
.row.out .msg-actions { left: -64px; }
.row.out .msg-actions:has(.ma-edit) { left: -94px; }
.row:hover .msg-actions { opacity: 1; }
.msg-actions button { width: 26px; height: 26px; border-radius: 50%; background: var(--panel); box-shadow: var(--shadow); display: grid; place-items: center; color: var(--muted); }
.msg-actions button:hover { color: var(--accent-text); }
.row.editing .bubble { box-shadow: 0 0 0 2px var(--red); }
.newer-btn { position: absolute; right: 24px; bottom: 96px; z-index: 3; background: var(--black); color: #fff; border-radius: 18px; padding: 8px 14px; font-weight: 600; box-shadow: var(--pop); }

/* алерты и автоответ */
.top-icon { position: relative; }
.bell-badge { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.alerts-pop { position: fixed; top: 58px; right: 12px; width: min(420px, calc(100% - 24px)); max-height: calc(100% - 80px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--pop); z-index: 35; overflow: hidden; }
.alerts-head { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.alerts-list { overflow-y: auto; }
.al { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.al.link { cursor: pointer; }
.al.link:hover { background: var(--hover); }
.al.new { box-shadow: inset 3px 0 0 var(--red); }
.al-top { display: flex; align-items: center; gap: 6px; font-size: 13px; flex-wrap: wrap; }
.al-who { color: var(--text); font-weight: 500; }
.al-top time { margin-left: auto; color: var(--muted); font-size: 11.5px; }
.al-text { margin-top: 4px; color: var(--muted); font-size: 13px; white-space: pre-wrap; line-height: 1.4; }
.auto-toggle { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; user-select: none; white-space: nowrap; }
.auto-toggle input { display: none; }
.auto-toggle span { width: 30px; height: 18px; border-radius: 9px; background: var(--line); position: relative; flex: none; transition: background 0.26s; }
.auto-toggle span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.26s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.auto-toggle input:checked + span { background: var(--red); }
.auto-toggle input:checked + span::after { transform: translateX(12px); }
.auto-toggle:has(input:checked) { color: var(--accent-text); }
@media (max-width: 760px) { .auto-toggle { font-size: 0; gap: 0; } }

/* рассылки */
.switches { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; margin-bottom: 4px; }
.bswitch { display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; cursor: pointer; }
.bswitch.ro { cursor: default; }
.bswitch.on { border-color: var(--red); }
.bswitch input { display: none; }
.bswitch > span { width: 38px; height: 22px; border-radius: 11px; background: var(--line); position: relative; flex: none; margin-top: 2px; transition: background 0.26s; }
.bswitch > span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.26s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.bswitch input:checked + span { background: var(--red); }
.bswitch input:checked + span::after { transform: translateX(16px); }
.camp-bar { margin-bottom: 12px; }
.camp-list { display: flex; flex-direction: column; gap: 8px; }
.camp-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
.camp-card:hover { border-color: var(--red); }
.camp-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.camp-top b { flex: 1; font-size: 15px; }
.cst, .ist { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.cst.running, .ist.queued { background: #E3EEFF; color: #1F5BD6; }
.cst.review, .ist.ready { background: #FFF1DC; color: #9A5B00; }
.cst.done, .ist.sent { background: #E3F6EA; color: #137A3A; }
.ist.error { background: var(--accent-soft); color: var(--accent-text); }
.camp-counts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.btn-link { color: var(--accent-text); font-weight: 600; padding: 0; font-size: 13px; }
.camp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 10px 0 12px; flex-wrap: wrap; }
.camp-head h2 { font-size: 22px; font-weight: 800; }
.camp-warn { background: #FFF1DC; color: #9A5B00; border-radius: 10px; padding: 10px 12px; font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.camp-task { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; white-space: pre-wrap; }
.camp-task .set-label { display: block; margin-bottom: 4px; }
.camp-items { display: flex; flex-direction: column; gap: 8px; }
.ci { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.ci.off { opacity: .55; }
.ci-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.ci-top b { flex: 1; min-width: 120px; }
.ci-text { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: 8px 10px; resize: vertical; outline: none; line-height: 1.4; }
.ci-text:focus { border-color: var(--red); }
.ci-static { white-space: pre-wrap; color: var(--text); }
.ci-err { color: var(--accent-text); font-size: 12.5px; margin-top: 4px; }
.modal-card.wide { max-width: 640px; }
.fld { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.fld input, #camp-form textarea, .win input, .pick-filters select, .pick-filters input { border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: 9px 11px; outline: none; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text); font-size: 14px; }
#camp-form textarea { resize: vertical; }
.win { display: flex; gap: 10px; flex-wrap: wrap; }
.win label { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.pick-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.pick-filters input { flex: 1; min-width: 120px; }
.pick-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pick-list { max-height: 280px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.pk { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pk:last-child { border-bottom: 0; }
.pk:hover { background: var(--hover); }
.pk-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk input { accent-color: var(--red); }

/* быстрые ответы */
.tpl-pop { position: absolute; left: 14px; right: 14px; bottom: calc(100% - 4px); max-height: 280px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--pop); padding: 6px; z-index: 5; }
.tpl-item { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; }
.tpl-item b { display: block; font-size: 13px; }
.tpl-item span { display: block; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-item.sel, .tpl-item:hover { background: var(--hover); }
.tpl-empty { padding: 10px; color: var(--muted); font-size: 13px; }
.tpl-list { display: flex; flex-direction: column; gap: 6px; }
.tpl-row { display: flex; gap: 8px; align-items: flex-start; background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.tpl-row div { flex: 1; min-width: 0; }
.tpl-row b { display: block; font-size: 13px; }
.tpl-row span { display: block; color: var(--muted); font-size: 12.5px; white-space: pre-wrap; max-height: 3.6em; overflow: hidden; }
.tpl-row button { color: var(--muted); font-size: 12px; padding: 2px 4px; }
.tpl-row button:hover { color: var(--accent-text); }
.tpl-form { display: flex; flex-direction: column; gap: 6px; }
.tpl-form input, .tpl-form textarea { border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: 9px 11px; outline: none; resize: vertical; }
.tpl-form input:focus, .tpl-form textarea:focus { border-color: var(--red); }
.tpl-form-btns { display: flex; gap: 8px; }

/* поиск по сообщениям */
.sr-head { padding: 10px 14px 6px; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; background: var(--bg); border-bottom: 1px solid var(--line); }
.sr { padding: 9px 14px; cursor: pointer; border-bottom: 1px solid var(--line); }
.sr:hover { background: var(--hover); }
.sr-top { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.sr-top b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-top time { color: var(--muted); font-size: 12px; flex: none; }
.sr-text { color: var(--muted); font-size: 13px; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
mark { background: #FFE08A; color: inherit; border-radius: 3px; padding: 0 1px; }
:root[data-theme="dark"] mark { background: #6B5410; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) mark { background: #6B5410; } }

/* журнал */
.audit-list { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.au { display: grid; grid-template-columns: 110px 150px 1fr; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; align-items: baseline; }
.au:last-child { border-bottom: 0; }
.au time { color: var(--muted); font-variant-numeric: tabular-nums; }
.au .who { font-weight: 700; margin: 0; }
.au-what { min-width: 0; }
.au-act { font-weight: 600; }
.au-where { color: var(--muted); }
.au-text { color: var(--muted); margin-top: 3px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 760px) {
  .meta-ctl { display: none; }
  .au { grid-template-columns: 1fr; gap: 2px; }
  .page-actions { flex-wrap: wrap; }
}
@media (max-width: 1100px) { .meta-ctl select { max-width: 120px; } }
@media (max-width: 760px) { .msg-actions { display: none; } }

/* поле ввода без полосы прокрутки и стрелок */
.composer textarea { scrollbar-width: none; -ms-overflow-style: none; }
.composer textarea::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* подсказка под полем — с начала поля ввода (2 кнопки по 42px + отступы + внутренний отступ поля) */
.composer-hint { padding: 5px 4px 0 113px; }


/* ================= анимации по всему сайту ================= */
:root { --ease: cubic-bezier(.22, 1, .36, 1); --soft: cubic-bezier(.65, 0, .35, 1); }

/* появление сайта после заставки: шапка сверху, колонки по очереди */
.shell.enter .topbar { animation: fromTop 1.19s var(--ease) both; }
.shell.enter .rail { animation: fromLeft 1.19s var(--ease) 0.2s both; }
.shell.enter .list { animation: fadeUp 1.19s var(--ease) 0.41s both; }
.shell.enter .chat, .shell.enter .page { animation: fadeUp 1.36s var(--ease) 0.61s both; }
@keyframes fromTop { from { transform: translateY(-100%); opacity: 0; } }
@keyframes fromLeft { from { transform: translateX(-100%); opacity: 0; } }
@keyframes fadeUp { from { transform: translateY(14px); opacity: 0; } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: scale(.94) translateY(6px); } }

/* смена разделов: страница проявляется при каждом показе */
.page, .app[data-view="chats"] .list { animation: fadeUp 1.36s var(--ease) both; }
.camp-card, .ci, .mail-item, .au, .al, .stat, .bswitch { animation: fadeUp 1.27s var(--ease) both; }
.camp-card:nth-child(2), .mail-item:nth-child(2), .stat:nth-child(2) { animation-delay: 0.07s; }
.camp-card:nth-child(3), .mail-item:nth-child(3), .stat:nth-child(3) { animation-delay: 0.14s; }
.camp-card:nth-child(4), .mail-item:nth-child(4), .stat:nth-child(4) { animation-delay: 0.2s; }
.camp-card:nth-child(5), .mail-item:nth-child(5), .stat:nth-child(5) { animation-delay: 0.27s; }

/* чат въезжает, новое сообщение выпрыгивает */
.chat-enter { animation: chatIn 1.27s var(--ease) both; }
@keyframes chatIn { from { opacity: 0; transform: translateX(18px); } }
.row.pop .bubble { animation: bubblePop 1.1s var(--ease) both; }
.row.out.pop .bubble { transform-origin: 100% 100%; }
.row.in.pop .bubble { transform-origin: 0 100%; }
@keyframes bubblePop { from { opacity: 0; transform: scale(.85) translateY(14px); filter: blur(3px); } }
.dlg.enter { animation: fadeUp 1.19s var(--ease) both; }
.empty { animation: fadeUp 1.02s var(--ease) both; }
.empty-mark { animation: floatM9 5s ease-in-out infinite; }
@keyframes floatM9 { 50% { transform: translateY(-6px); filter: drop-shadow(0 10px 18px rgba(201,0,0,.25)); } }

/* окна и всплывашки */
.modal:not(.hidden) { animation: fadeIn 0.77s ease both; }
.modal:not(.hidden) .modal-card { animation: popIn 1.02s var(--ease) both; }
.menu:not(.hidden), .alerts-pop:not(.hidden), .tpl-pop:not(.hidden) { animation: popIn 0.77s var(--ease) both; transform-origin: top right; }
.toast:not(.hidden) { animation: toastIn 1.02s var(--ease) both; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px); } }
.lightbox:not(.hidden) { animation: fadeIn 0.34s ease both; }
.lightbox:not(.hidden) img { animation: popIn 0.51s var(--ease) both; }
.bar:not(.hidden) { animation: fadeUp 0.85s var(--ease) both; }
.presence:not(.hidden) { animation: fadeIn 0.51s ease both; }
.bell-badge:not(.hidden) { animation: popIn 1.02s var(--ease) both; }

/* отклик кнопок */
button, .rail-item, .tab, .dlg, .btn-soft, .btn-primary, .send, .icon-btn, .top-icon, .topnav-btn, .camp-card {
  transition: background-color 0.68s var(--ease), color 0.68s var(--ease), border-color 0.68s var(--ease), box-shadow 0.77s var(--ease), transform 0.77s var(--ease), opacity 0.68s var(--ease); }
button:active:not(:disabled), .rail-item:active, .send:active, .tab:active { transform: scale(.96); transition-duration: .2s; }
.send:hover { transform: scale(1.06); }
.rail-item:hover .ava, .rail-item:hover .rail-all { transform: scale(1.06); }
.rail-item .ava, .rail-all { transition: transform 0.85s var(--ease), filter 0.68s; }
.rail-item.active::before { animation: growY 0.51s var(--ease) both; }
@keyframes growY { from { transform: scaleY(0); } }
.dlg.active::before { animation: growY 0.42s var(--ease) both; }
.topnav-btn.active { animation: fadeIn 0.51s ease both; }
.camp-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.08); }

/* смена темы — плавно */
body, .topbar, .rail, .list, .chat, .composer, .chat-head, .bubble, .dlg, .panel, .stat, .camp-card, .modal-card {
  transition: background-color 0.59s ease, color 0.59s ease, border-color 0.59s ease; }
.intro-start:active { transform: skewX(-9deg) scale(.96) !important; }


/* ================= плавные переходы v2 ================= */

/* View Transitions: разделы, чаты, тема */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 1.19s; animation-timing-function: var(--soft); }
.vt-view::view-transition-old(root) { animation: vtOut 1.19s var(--soft) both; }
.vt-view::view-transition-new(root) { animation: vtIn 1.36s var(--ease) both; }
@keyframes vtOut { to { opacity: 0; transform: scale(.985); filter: blur(6px); } }
@keyframes vtIn { from { opacity: 0; transform: scale(1.012); filter: blur(6px); } }
.vt-chat::view-transition-old(root) { animation: vtFade 0.94s var(--soft) both; }
.vt-chat::view-transition-new(root) { animation: vtFadeIn 1.1s var(--ease) both; }
@keyframes vtFade { to { opacity: 0; } }
@keyframes vtFadeIn { from { opacity: 0; } }
::view-transition-group(chat-ava) { animation-duration: 1.27s; animation-timing-function: var(--ease); z-index: 10; }
::view-transition-old(chat-ava), ::view-transition-new(chat-ava) { animation-duration: 1.27s; height: 100%; object-fit: cover; }
.vt-theme::view-transition-old(root) { animation: none; z-index: 1; }
.vt-theme::view-transition-new(root) { animation: none; z-index: 2; mix-blend-mode: normal; }

/* переезжающая подсветка вкладок */
.has-ink { position: relative; isolation: isolate; }
.ink { position: absolute; left: 0; top: 0; z-index: -1; border-radius: 16px; pointer-events: none; opacity: 0;
  background: var(--black); transition: transform 1.02s var(--ease), width 1.02s var(--ease), height 1.02s var(--ease), opacity 0.68s ease; }
.has-ink > .tab.active { background: transparent !important; }
:root[data-theme="dark"] .ink { background: var(--red); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ink { background: var(--red); } }
.topnav.has-ink .ink { border-radius: 8px; background: #222225; box-shadow: inset 0 -2px 0 var(--red); }
.has-ink > .topnav-btn.active { background: transparent !important; box-shadow: none !important; }
.seg.has-ink .ink { border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
.seg.has-ink > button.on { background: transparent !important; box-shadow: none !important; }
.seg > button.on { position: relative; }

/* переезжающая подсветка активного акка */
.rail-accs { position: relative; }
.rail-ink { position: absolute; left: 0; top: 0; width: 4px; height: 32px; border-radius: 0 4px 4px 0; background: var(--red);
  box-shadow: 0 0 14px rgba(201,0,0,.7); opacity: 0; transition: transform 1.19s var(--ease), opacity 0.68s ease; z-index: 2; }
.rail-item.active::before { display: none; }

/* волна от клика */
.ripple-host { position: relative; overflow: hidden; }
.ripple { position: absolute; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgba(201,0,0,.28) 0%, rgba(201,0,0,.12) 40%, transparent 70%);
  transform: scale(0); animation: ripple 1.53s var(--ease) forwards; }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

/* подсветка за курсором */
.dlg::before, .camp-card::before, .bswitch::before, .stat::before, .al::before, .ci::before, .mail-item::before { content: none; }
.dlg, .camp-card, .bswitch, .stat, .al, .ci, .mail-item { background-image: radial-gradient(260px circle at var(--mx, -999px) var(--my, -999px), rgba(201,0,0,.07), transparent 60%); }
.stat.main { background-image: radial-gradient(260px circle at var(--mx, -999px) var(--my, -999px), rgba(201,0,0,.28), transparent 60%); }

/* сообщения всплывают каскадом при открытии чата */
.row.cascade .bubble { animation: cascadeUp 1.36s var(--ease) both; animation-delay: inherit; }
@keyframes cascadeUp { from { opacity: 0; transform: translateY(22px); filter: blur(4px); } }
.day { animation: fadeIn 1.36s ease both; }

/* мерцающие заготовки при загрузке */
.skel-wrap { display: flex; flex-direction: column; gap: 12px; padding-top: 18px; }
.skel-row { display: flex; }
.skel-row.out { justify-content: flex-end; }
.skel { height: 38px; border-radius: 12px; background: linear-gradient(100deg, var(--in) 30%, var(--hover) 50%, var(--in) 70%) 0 0 / 300% 100%;
  box-shadow: var(--shadow); animation: shimmer 1.6s ease-in-out infinite, fadeIn .6s ease both; }
.skel-row.out .skel { background-image: linear-gradient(100deg, var(--out) 30%, var(--hover) 50%, var(--out) 70%); }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* счётчик подпрыгнул, самолётик улетел */
.badge.bump { animation: bump 1.36s var(--ease); }
@keyframes bump { 30% { transform: scale(1.45); } 100% { transform: scale(1); } }
.send.fly svg { animation: fly 1.53s var(--soft); }
@keyframes fly { 45% { transform: translate(26px, -26px) rotate(-18deg); opacity: 0; } 46% { transform: translate(-22px, 22px); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* мягкое появление аватарок, когда подгрузилось фото */
.ava img { animation: fadeIn 1.36s ease both; }

/* полоса таймера у уведомления */
.toast { overflow: hidden; }
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--red); transform-origin: left; animation: toastBar 2.5s linear forwards; }
.toast.err::after { animation-duration: 8.5s; }
@keyframes toastBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }


/* ================= главное меню ================= */
.home { position: relative; background: var(--bg); }
.home-inner { min-height: 100%; max-width: 980px; margin: 0 auto; padding: 9vh 48px 6vh; display: flex; flex-direction: column; justify-content: center; }
.home-hi { color: var(--muted); font-size: 15px; letter-spacing: .02em; margin-bottom: 4.5vh; animation: fadeIn 2s ease .1s both; }
.home-menu { display: flex; flex-direction: column; align-items: flex-start; gap: 1.2vh; }
.hm { display: flex; align-items: center; padding: 6px 0; color: var(--text); cursor: pointer;
  animation: hmIn 1.6s var(--ease) both; transition: transform 1s var(--ease), color .8s ease; }
@keyframes hmIn { from { opacity: 0; transform: translateY(18px); filter: blur(4px); } }
.hm-rule { display: block; width: 0; height: 4px; margin-right: 0; background: var(--red); transform: skewX(-9deg);
  transition: width 1s var(--ease), margin-right 1s var(--ease); }
.hm-t { font-family: "Arial Black", Montserrat, "Segoe UI Black", sans-serif; font-weight: 900; text-transform: uppercase;
  font-size: clamp(30px, 5.4vw, 64px); line-height: 1.08; letter-spacing: .04em; transform: skewX(-9deg); }
.hm sup { align-self: flex-start; margin: .35em 0 0 .7em; font-size: 14px; font-weight: 700; color: var(--red); letter-spacing: .02em; }
.hm:hover { transform: translateX(10px); color: var(--red); }
.hm:hover .hm-rule { width: 46px; margin-right: 22px; }
.home-menu:hover .hm:not(:hover) { color: var(--muted); }
.home-foot { margin-top: 5vh; color: var(--muted); font-size: 13px; letter-spacing: .03em; animation: fadeIn 2s ease 1.1s both; }
@media (max-width: 760px) {
  .home-inner { padding: 6vh 22px; }
  .app[data-view="home"] { grid-template-columns: 1fr; }
}


/* ================= разделы только через меню ================= */
.app:not([data-view="chats"]) .rail { display: none; }
.page { grid-column: 1 / -1 !important; }
.app[data-view="alerts"] .list, .app[data-view="alerts"] .chat { display: none; }
.app[data-view="alerts"] #alerts-pane { display: block; overflow-y: auto; background: var(--bg); }
#alerts-pane .alerts-list { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.top-section { font-family: "Arial Black", Montserrat, sans-serif; font-weight: 900; font-size: 13px; letter-spacing: .22em; text-transform: uppercase;
  color: #8E8E96; transform: skewX(-9deg); margin-right: 14px; white-space: nowrap; animation: fadeIn 1.2s ease both; }
#menu-btn { animation: fadeIn 1s ease both; }
.topnav .ink { display: none; }

/* сторож */
.rail-item.warn::after { content: ""; position: absolute; top: 6px; left: 6px; width: 10px; height: 10px; border-radius: 50%; background: #F5A524; border: 2px solid var(--rail); }
.rail-item.off::after { background: var(--red); }
.foot-bad { color: var(--accent-text); font-weight: 600; }

/* пользователи */
.usr-list { display: flex; flex-direction: column; gap: 6px; }
.usr { display: flex; align-items: center; gap: 10px; background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.usr-ava { width: 32px; height: 32px; border-radius: 50%; background: var(--black); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.usr-b { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.usr-b b { font-size: 13.5px; }
.usr-b span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usr-form { display: flex; flex-direction: column; gap: 8px; border: 1px dashed var(--line); border-radius: 12px; padding: 12px; }
.usr-form-title { font-weight: 700; font-size: 13.5px; }
.usr-row { display: flex; gap: 8px; }
.usr-row input { flex: 1; min-width: 0; }
.usr-form input[type="text"], .usr-form input:not([type]), .usr-form input[type="password"] { border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: 9px 11px; outline: none; }
.usr-form input:focus { border-color: var(--red); }
.usr-form input[readonly] { opacity: .6; }
.usr-accs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.usr-acc { display: flex; align-items: center; gap: 5px; background: var(--bg); border-radius: 8px; padding: 5px 9px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.usr-acc input { accent-color: var(--red); }

/* ---------- мозг в чате, статус, карточка ---------- */
.chat-sub { display: flex; gap: 0; align-items: center; flex-wrap: wrap; }
.chat-sub-in { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.peer-st { color: var(--muted); white-space: pre; transition: color 1s ease; }
.peer-st.on { color: #1F8A4C; font-weight: 600; }
.typing-now .dots { display: inline-flex; gap: 2px; margin-left: 3px; }
.typing-now .dots i { width: 3px; height: 3px; border-radius: 50%; background: currentColor; animation: blink 1.4s infinite; }
.typing-now .dots i:nth-child(2) { animation-delay: .2s; } .typing-now .dots i:nth-child(3) { animation-delay: .4s; }
.head-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.head-btn:hover, .head-btn.on { background: var(--hover); color: var(--text); }
.head-btn.icon { padding: 7px; }
.ai-btn { color: var(--accent-text); }
.ai-btn.busy svg { animation: spinSoft 1.6s linear infinite; }
@keyframes spinSoft { to { transform: rotate(360deg); } }
#input.ai-filled { animation: aiFill 1.8s var(--ease); }
@keyframes aiFill { 0% { box-shadow: 0 0 0 3px rgba(201,0,0,.35); } 100% { box-shadow: 0 0 0 0 rgba(201,0,0,0); } }
.sum-panel { position: absolute; top: 72px; left: 50%; transform: translateX(-50%); width: min(620px, calc(100% - 32px)); z-index: 6;
  background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: 14px; box-shadow: var(--pop); padding: 12px 14px; }
.sum-panel:not(.hidden) { animation: popIn 1s var(--ease) both; }
.sum-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.sum-head .icon-btn { width: 30px; height: 30px; }
.sum-text { line-height: 1.55; font-size: 14px; }
.sum-text p { margin: 0 0 6px; }
.card { position: absolute; top: 64px; right: 0; bottom: 0; width: 330px; z-index: 5; background: var(--panel); border-left: 1px solid var(--line);
  overflow-y: auto; box-shadow: -12px 0 30px rgba(0,0,0,.06); }
.card:not(.hidden) { animation: cardIn 1.1s var(--ease) both; }
@keyframes cardIn { from { transform: translateX(40px); opacity: 0; } }
.card-in { position: relative; padding: 22px 20px 30px; display: flex; flex-direction: column; }
.card-x { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; }
.card-ava { display: flex; justify-content: center; margin: 6px 0 12px; }
.card-ava .ava { width: 96px; height: 96px; font-size: 32px; }
.card-name { text-align: center; font-size: 18px; font-weight: 800; }
.card-seen { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.card-dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 18px 0 4px; font-size: 13px; }
.card-dl dt { color: var(--muted); }
.card-dl dd { margin: 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-width: 0; }
.card-bio { white-space: pre-wrap; }
.card-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 6px; }
.card-stats div { background: var(--bg); border-radius: 12px; padding: 10px 12px; }
.card-stats b { display: block; font-size: 18px; font-weight: 800; }
.card-stats span { font-size: 11.5px; color: var(--muted); }
.card-h { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin: 16px 0 8px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ctag, .ltag { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent-text); }
.ctag button { color: inherit; font-size: 10px; padding: 0; opacity: .6; }
.ctag button:hover { opacity: 1; }
.ltag { flex: none; padding: 0 6px; line-height: 16px; font-size: 10.5px; }
#tag-in { border: 1px dashed var(--line); background: none; border-radius: 6px; padding: 3px 8px; font-size: 12px; width: 100px; outline: none; }
#tag-in:focus { border-color: var(--red); }
.card-note { width: 100%; min-height: 90px; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 9px 11px; resize: vertical; outline: none; line-height: 1.45; }
.card-note:focus { border-color: var(--red); }
@media (max-width: 1100px) { .head-btn span { display: none; } }
@media (max-width: 760px) { .card { width: 100%; } }

/* ---------- расписание, реакции, пересылка ---------- */
.row.out .msg-actions { left: -124px; }
.row.out .msg-actions:has(.ma-edit) { left: -154px; }
.row.in .msg-actions { right: -94px; }
.plan-pop { position: absolute; right: 60px; bottom: calc(100% - 2px); width: min(360px, calc(100% - 28px)); z-index: 6; background: var(--panel);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--pop); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.plan-pop:not(.hidden) { animation: popIn .8s var(--ease) both; transform-origin: bottom right; }
.plan-h { font-weight: 800; }
.plan-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.plan-chips button { background: var(--bg); border-radius: 16px; padding: 6px 11px; font-size: 12.5px; font-weight: 600; }
.plan-chips button:hover { color: var(--accent-text); }
#plan-at { border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: 8px 10px; outline: none; color: var(--text); }
.plan-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.sched-bar { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.sched-bar:not(.hidden) { animation: fadeUp .8s var(--ease) both; }
.sch { display: flex; align-items: center; gap: 8px; background: var(--panel); border-radius: 10px; padding: 6px 8px 6px 12px; font-size: 12.5px; border-left: 3px solid #1F5BD6; }
.sch.err { border-left-color: var(--red); }
.sch b { white-space: nowrap; }
.sch span { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sch em { color: var(--accent-text); font-style: normal; font-weight: 700; }
.sch button { color: var(--muted); padding: 2px 6px; }
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.rc { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 12px; background: rgba(0,0,0,.06); font-size: 13px; line-height: 20px; }
.rc span { font-size: 11px; font-weight: 700; color: var(--muted); }
.rc.me { background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(201,0,0,.35); }
:root[data-theme="dark"] .rc { background: rgba(255,255,255,.08); }
.react-pop { position: fixed; z-index: 40; display: flex; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--pop); padding: 5px; }
.react-pop:not(.hidden) { animation: popIn .6s var(--ease) both; transform-origin: bottom center; }
.react-pop button { font-size: 21px; width: 38px; height: 38px; border-radius: 50%; transition: transform .5s var(--ease); }
.react-pop button:hover { transform: scale(1.3) translateY(-3px); background: var(--hover); }
.fwd-q { border: 1px solid var(--line); background: var(--bg); border-radius: 9px; padding: 9px 11px; outline: none; color: var(--text); }
.fwd-q:focus { border-color: var(--red); }
.fwd-pk { width: 100%; text-align: left; }

/* ---------- аналитика ---------- */
:root { --viz-in: #C90000; --viz-out: #2F6DB3; --viz-grid: #E6E6E9; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --viz-in: #E5484D; --viz-out: #4C8DD6; --viz-grid: #2A2A2E; } }
:root[data-theme="dark"] { --viz-in: #E5484D; --viz-out: #4C8DD6; --viz-grid: #2A2A2E; }
.app[data-view="stats"] .list, .app[data-view="stats"] .chat { display: none; }
.app[data-view="stats"] #stats-pane { display: block; overflow-y: auto; background: var(--bg); }
.st-hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.hstat2 { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; animation: fadeUp 1.2s var(--ease) both; }
.hstat2 b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.hstat2 span { font-size: 12.5px; color: var(--muted); }
.st-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; margin-bottom: 14px; animation: fadeUp 1.3s var(--ease) both; min-width: 0; }
.st-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.st-grid .st-card { margin-bottom: 14px; }
.st-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.st-h b { font-size: 15px; }
.st-legend { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.st-legend .lg { width: 14px; height: 3px; border-radius: 2px; margin-left: 8px; }
.lg.in { background: var(--viz-in); } .lg.out { background: var(--viz-out); }
.st-chart { width: 100%; overflow: hidden; }
.viz { display: block; }
.viz .grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz .ax { fill: var(--muted); font-size: 11px; font-family: Inter, sans-serif; }
.viz .dl { fill: var(--text); font-size: 11.5px; font-weight: 600; font-family: Inter, sans-serif; }
.viz .ln { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 2400; stroke-dashoffset: 2400; animation: draw 2.4s var(--ease) .2s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.viz .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.viz .dot { stroke: var(--panel); stroke-width: 2; }
.viz .bar-row rect[rx], .viz .hb rect[rx] { transform-origin: left; animation: barIn 1.6s var(--ease) both; }
.viz .hb rect[rx] { transform-box: fill-box; transform-origin: bottom; animation-name: colIn; }
@keyframes barIn { from { transform: scaleX(0); } }
@keyframes colIn { from { transform: scaleY(0); } }
.bar-row:hover rect[rx], .hb:hover rect[rx] { opacity: .8; }
.viz-tip { position: fixed; z-index: 70; pointer-events: none; display: none; background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--pop); padding: 8px 11px; font-size: 12.5px; line-height: 1.6; color: var(--text); }
.viz-tip i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.st-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.st-table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.st-table td { padding: 9px 8px; border-bottom: 1px solid var(--line); }
.st-table tr:last-child td { border-bottom: 0; }
.st-table tbody tr { cursor: pointer; transition: background .6s; }
.st-table tbody tr:hover { background: var(--hover); }
.st-table .n { text-align: right; font-variant-numeric: tabular-nums; }
#st-days { min-width: 260px; }
@media (max-width: 900px) { .st-grid { grid-template-columns: 1fr; } }
.viz .bar-row rect[rx] { transform-box: fill-box; }
