:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #1b1f24;
  --muted: #6a737d;
  --border: #dde2e8;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --mine: #dbe9ff;
  --theirs: #ffffff;
  --ok: #1a7f37;
  --bad: #cf222e;
  --warn: #9a6700;
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #20262e;
    --text: #e6e9ed;
    --muted: #8b949e;
    --border: #2a313a;
    --accent: #3b82f6;
    --mine: #1d3557;
    --theirs: #20262e;
    --ok: #3fb950;
    --bad: #f85149;
    --warn: #d29922;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.45 "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-optical-sizing: auto;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--bad); min-height: 1.2em; margin: 0; }

.btn {
  border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px;
  padding: 8px 14px; cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .6; cursor: default; }
.icon-btn {
  border: 0; background: transparent; width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; font-size: 17px; display: inline-grid; place-items: center; flex: none;
}
.icon-btn:hover { background: var(--surface-2); }

input, textarea, select {
  width: 100%; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 8px 10px;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }

/* ---------- вход ---------- */
.auth { height: 100%; display: grid; place-items: center; padding: 16px; overflow: auto; }
.auth-card {
  width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px; display: grid; gap: 14px;
}
.auth-card h1 { margin: 0; font-size: 24px; }
.auth-card p { margin: 0; }
.auth-logo { width: 56px; height: 56px; }

/* ---------- раскладка ---------- */
.app { display: flex; height: 100%; }
.sidebar {
  width: 320px; flex: none; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 12px; gap: 8px; }
.me { display: flex; gap: 10px; align-items: center; min-width: 0; }
.me-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-actions { display: flex; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); margin-right: 6px; }
.dot.on { background: var(--ok); }
.search { margin: 0 12px 8px; width: auto; }
.chat-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.chat-item { display: flex; gap: 10px; padding: 10px 12px; cursor: pointer; align-items: center; }
.chat-item:hover { background: var(--surface-2); }
.chat-item.active { background: var(--mine); }
.chat-item .body { flex: 1; min-width: 0; }
.chat-item .row { display: flex; justify-content: space-between; gap: 8px; }
.chat-item .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .last { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { background: var(--accent); color: var(--accent-text); border-radius: 10px; font-size: 12px; padding: 0 7px; min-width: 20px; text-align: center; }

.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 15px; background: var(--accent);
}

.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.empty { margin: auto; color: var(--muted); padding: 16px; text-align: center; }
.chat-view { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.chat-title { flex: 1; min-width: 0; }
.chat-title > div:first-child { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back { display: none; }

.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.msg { max-width: min(640px, 85%); display: flex; flex-direction: column; align-self: flex-start; }
.msg.mine { align-self: flex-end; }
.msg .bubble {
  background: var(--theirs); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 7px 11px; word-wrap: break-word; overflow-wrap: anywhere; position: relative;
}
.msg.mine .bubble { background: var(--mine); border-color: transparent; }
.msg .author { font-size: 12px; font-weight: 600; color: var(--accent); margin: 6px 0 2px 4px; }
.msg .meta { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; user-select: none; }
.msg .meta .failed { color: var(--bad); cursor: pointer; }
.msg .deleted { color: var(--muted); font-style: italic; }
.msg .actions { display: none; gap: 2px; margin-top: 2px; }
.msg:hover .actions, .msg:focus-within .actions { display: flex; }
.msg.mine .actions { justify-content: flex-end; }
.msg .actions button { border: 0; background: var(--surface-2); border-radius: 6px; font-size: 12px; padding: 2px 8px; cursor: pointer; }
.thread-link { font-size: 12px; color: var(--accent); cursor: pointer; margin-top: 3px; background: none; border: 0; padding: 0; text-align: left; }
.msg.mine .thread-link { text-align: right; }
.system { align-self: center; font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 3px 10px; margin: 6px 0; }
.day { align-self: center; font-size: 12px; color: var(--muted); margin: 8px 0; }

.file { display: flex; gap: 10px; align-items: center; cursor: pointer; text-decoration: none; color: inherit; }
.file .ic { font-size: 24px; }
.file .fn { font-weight: 500; }
.img-preview { max-width: 100%; max-height: 320px; border-radius: 8px; display: block; cursor: zoom-in; }

.approval { min-width: 260px; }
.approval h4 { margin: 0 0 4px; font-size: 15px; }
.approval .desc { white-space: pre-wrap; margin-bottom: 8px; }
.approval .state { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 1px 8px; margin-bottom: 6px; }
.state.pending { background: #fff3cd; color: #7a5800; }
.state.approved { background: #d1f5dc; color: #116329; }
.state.rejected { background: #ffd8d8; color: #a40e26; }
.approval ul { list-style: none; margin: 0 0 8px; padding: 0; font-size: 13px; }
.approval li { padding: 2px 0; }
.approval li .c { color: var(--muted); display: block; padding-left: 22px; }
.approval .btns { display: flex; gap: 6px; }

.composer { display: flex; align-items: flex-end; gap: 4px; padding: 8px; background: var(--surface); border-top: 1px solid var(--border); }
.composer textarea { resize: none; max-height: 160px; border-radius: 18px; padding: 8px 14px; }
.send { color: var(--accent); }
.banner { padding: 12px; text-align: center; color: var(--muted); background: var(--surface); border-top: 1px solid var(--border); }

/* ---------- правая панель ---------- */
.panel { width: 360px; flex: none; background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.panel-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; min-height: 0; }
.panel-body .messages { padding: 12px; }
.panel-body .section { padding: 12px; border-bottom: 1px solid var(--border); display: grid; gap: 8px; }
.member { display: flex; align-items: center; gap: 8px; }
.member .n { flex: 1; min-width: 0; }
.safety { font-family: ui-monospace, Consolas, monospace; font-size: 13px; letter-spacing: .5px; word-spacing: 4px; background: var(--surface-2); padding: 8px; border-radius: 8px; }
.warn { color: var(--warn); }

/* ---------- диалог и уведомления ---------- */
dialog { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--text); width: min(440px, calc(100% - 32px)); padding: 0; }
dialog::backdrop { background: rgb(0 0 0 / .4); }
#dialog-form { padding: 20px; display: grid; gap: 12px; }
#dialog-form h3 { margin: 0; }
.dialog-btns { display: flex; justify-content: flex-end; gap: 8px; }
.checks { display: grid; gap: 4px; max-height: 220px; overflow: auto; }
.checks label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }
.checks input { width: auto; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #24292f; color: #fff;
  padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: calc(100% - 32px);
}

/* ---------- звонок ---------- */
.call { position: fixed; inset: 0; z-index: 40; color: #fff; background: radial-gradient(120% 90% at 50% 0%, #1d2240 0%, #0b0d14 60%, #07080c 100%); display: flex; flex-direction: column; }
.call-top { position: absolute; left: 0; right: 0; top: 0; padding: max(18px, env(safe-area-inset-top)) 20px 28px; text-align: center; pointer-events: none;
  background: linear-gradient(#000a, #0000); z-index: 2; }
.call-name { font-size: 22px; font-weight: 600; text-shadow: 0 1px 3px #0008; }
.call-state { font-size: 14px; opacity: .8; margin-top: 2px; font-variant-numeric: tabular-nums; }
.call-grid { flex: 1; display: grid; gap: 8px; padding: 72px 10px 110px; min-height: 0; }
.call-grid.n1 { grid-template-columns: 1fr; }
.call-grid.n2 { grid-template-columns: 1fr 1fr; }
.call-grid.n3, .call-grid.n4 { grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; }
.call-grid.n5, .call-grid.n6 { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; }
@media (max-width: 700px) {
  .call-grid.n2 { grid-template-columns: 1fr; grid-auto-rows: 1fr; }
  .call-grid.n5, .call-grid.n6 { grid-template-columns: 1fr 1fr; }
}
.call-tile { position: relative; border-radius: 16px; overflow: hidden; background: #ffffff0d; display: grid; place-items: center; min-height: 0; transition: opacity .2s; }
.call-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.call-tile.has-video video { opacity: 1; }
.call-tile.screen video { object-fit: contain; background: #000; }
.call-tile.me { order: 99; }
.call-tile.me video { transform: scaleX(-1); }
.call-tile.me.screen video { transform: none; }
.call-tile.weak { opacity: .55; }
.call-ava { position: relative; transition: opacity .25s; }
.call-ava .avatar { width: 96px; height: 96px; font-size: 34px; box-shadow: 0 0 0 6px #ffffff10, 0 0 0 14px #ffffff08; }
.call-tile.has-video .call-ava { opacity: 0; }
.call-label { position: absolute; left: 10px; bottom: 10px; padding: 3px 10px; border-radius: 10px; background: #0007; font-size: 13px; backdrop-filter: blur(6px); max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* личный звонок: собеседник на весь экран, я — в углу */
.call-grid.dm { display: block; position: relative; padding: 0; }
.call-grid.dm .call-tile:not(.me) { position: absolute; inset: 0; border-radius: 0; background: transparent; }
.call-grid.dm .call-tile:not(.me) video { object-fit: contain; }
.call-grid.dm .call-tile:not(.me) .call-label { display: none; }
.call-grid.dm .call-tile.me { position: absolute; right: 14px; top: max(84px, calc(env(safe-area-inset-top) + 70px)); width: 28vw; max-width: 200px; aspect-ratio: 3 / 4; z-index: 3;
  box-shadow: 0 6px 24px #0009; border-radius: 14px; }
.call-grid.dm .call-tile.me:not(.has-video) { display: none; }
.call-grid.dm .call-tile.me .call-label { display: none; }
.call-grid.dm .call-ava .avatar { width: 128px; height: 128px; font-size: 46px; }

/* входящий: пульсирующий аватар звонящего не нужен — просто крупно имя */
.call.ringing .call-top { top: 30%; background: none; }
.call.ringing .call-name { font-size: 30px; }
.call.ringing .call-state { font-size: 16px; animation: callPulse 1.6s ease-in-out infinite; }
@keyframes callPulse { 50% { opacity: .45; } }

.call-controls { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 14px;
  padding: 24px 12px max(26px, env(safe-area-inset-bottom)); background: linear-gradient(#0000, #000b); z-index: 2; }
.round { width: 58px; height: 58px; border-radius: 50%; border: 0; background: #ffffff24; color: #fff; cursor: pointer; display: grid; place-items: center;
  backdrop-filter: blur(10px); transition: transform .12s, background .15s; }
.round:hover { background: #ffffff38; }
.round:active { transform: scale(.94); }
.round .ic { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.round#call-hangup .ic, .round#call-accept .ic { fill: currentColor; stroke: none; }
.round.off { background: #fff; color: #111; }
.round.on { background: #3b82f6; }
.round.green { background: #22c55e; }
.round.green:hover { background: #16a34a; }
.round.red { background: #ef4444; }
.round.red:hover { background: #dc2626; }
.call.ringing .round.green { animation: callPulse 1.6s ease-in-out infinite; }
@media (max-width: 420px) { .round { width: 52px; height: 52px; } .call-controls { gap: 10px; } }

.pin-bar.call-join { color: #16a34a; font-weight: 600; }

/* ---------- мобильная раскладка ---------- */
@media (max-width: 1100px) {
  .panel { position: fixed; right: 0; top: 0; bottom: 0; z-index: 20; width: min(380px, 100%); box-shadow: -4px 0 20px rgb(0 0 0 / .15); }
}
@media (max-width: 720px) {
  .sidebar { width: 100%; border-right: 0; }
  .chat { display: none; }
  .app.in-chat .sidebar { display: none; }
  .app.in-chat .chat { display: flex; }
  .back { display: inline-grid; }
  .messages { padding: 10px; }
  .msg { max-width: 92%; }
  .panel { width: 100%; }
  .chat-head, .side-head { padding-top: max(8px, env(safe-area-inset-top)); }
  .composer { padding-bottom: max(8px, env(safe-area-inset-bottom)); }
}

/* ---------- версия 1.1–1.2 ---------- */
.col { display: flex; flex-direction: column; gap: 8px; }
.col0 { display: flex; flex-direction: column; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.overdue { color: var(--bad); font-weight: 600; }
.btn.ghost { background: transparent; }
label.inline { display: flex; flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
label.inline input { width: auto; }
.radios { display: grid; gap: 4px; }
.radios label { display: flex; flex-direction: row; gap: 8px; align-items: center; color: var(--text); font-size: 14px; }
.radios input { width: auto; }
.checks .ord { min-width: 18px; color: var(--accent); font-weight: 600; }
dialog.wide { width: min(560px, calc(100% - 32px)); }
select { width: 100%; }

/* ---------- фирменная тема «Орбиты» ---------- */
:root {
  --bg: #f1f2fa;
  --surface: #fcfcff;
  --surface-2: #eff0fa;
  --text: #1b2140;
  --muted: #747c9d;
  --border: #dfe2f1;
  --accent: #625bd8;
  --accent-text: #ffffff;
  --mine: #eae8ff;
  --theirs: #ffffff;
  --ok: #168a75;
  --bad: #d64b62;
  --warn: #a87918;
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #080e22;
    --surface: #10172d;
    --surface-2: #18213b;
    --text: #edf0ff;
    --muted: #9da8c8;
    --border: #293454;
    --accent: #a198ff;
    --accent-text: #11142e;
    --mine: #29264e;
    --theirs: #151d35;
    --ok: #68d5bd;
    --bad: #ff8299;
    --warn: #f0c879;
    color-scheme: dark;
  }
}
body { background: var(--bg); }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button, a { transition: background-color .16s ease, color .16s ease, border-color .16s ease, transform .16s ease, box-shadow .16s ease; }
button:focus-visible, a:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 58%, transparent); outline-offset: 2px; }
.btn { border-radius: 10px; font-weight: 600; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 34%, var(--border)); transform: translateY(-1px); }
.btn.primary { box-shadow: 0 5px 14px color-mix(in srgb, var(--accent) 24%, transparent); }
.icon-btn:hover { color: var(--accent); }
input, textarea, select { border-radius: 10px; }
.auth {
  background-color: var(--bg);
  background-image: radial-gradient(ellipse at 16% 19%, rgb(111 85 219 / .16), transparent 34%),
    radial-gradient(ellipse at 84% 79%, rgb(55 182 192 / .14), transparent 32%);
}
.auth-card {
  width: min(430px, 100%); position: relative; overflow: hidden;
  border-color: color-mix(in srgb, var(--border) 70%, var(--accent));
  border-radius: 24px; padding: 34px; gap: 17px;
  box-shadow: 0 24px 80px rgb(27 38 82 / .12);
}
.auth-card::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg,#5969e8,#8a6df2,#62d8d2); }
.auth-logo { width: 64px; height: 64px; border-radius: 19px; box-shadow: 0 12px 26px rgb(89 105 232 / .26); }
.auth-card h1 { letter-spacing: -.04em; font-size: 29px; }
.tabs { border-radius: 12px; padding: 4px; }
.tab { border-radius: 9px; padding: 9px 5px; }
.tab.active { color: var(--accent); box-shadow: 0 2px 8px rgb(25 34 60 / .09); }
.sidebar { background: var(--surface); border-right-color: var(--border); box-shadow: 4px 0 24px rgb(20 30 65 / .025); }
.side-head { padding: 15px 12px; }
.search { border-radius: 11px; background: var(--surface-2); border-color: transparent; }
.search:focus { background: var(--surface); border-color: var(--accent); }
.chat-item { margin: 2px 7px; border-radius: 12px; padding: 11px 10px; }
.chat-item.active { background: color-mix(in srgb, var(--accent) 11%, var(--surface)); }
.avatar { background-image: linear-gradient(145deg,#6676e8,#946bd2); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .17); }
.chat {
  background-color: var(--bg);
  background-image: radial-gradient(ellipse at 82% 84%, rgb(58 165 180 / .07), transparent 38%),
    radial-gradient(ellipse at 18% 12%, rgb(115 92 214 / .07), transparent 36%);
}
.empty { text-shadow: 0 1px 12px color-mix(in srgb, var(--accent) 10%, transparent); }
.chat-head { min-height: 64px; padding: 10px 18px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); }
.messages {
  padding: 22px clamp(14px, 3vw, 40px); gap: 6px;
  background-color: var(--bg);
  background-image: var(--chat-bg);
  background-size: var(--chat-bg-size, cover);
  background-position: center, center calc(42% + var(--wallpaper-offset-y, 0px));
  background-repeat: no-repeat;
}
.chat-view > .messages .day { color: #f4f3ff; background: rgb(var(--shade-rgb) / .62); border: 1px solid rgb(255 255 255 / .12); border-radius: 12px; padding: 4px 11px; }
.chat-view > .messages .msg .meta { color: rgb(244 243 255 / .88); text-shadow: 0 1px 3px rgb(0 0 0 / .6); }
.panel-body .messages { background: var(--surface); }
.msg .bubble { border-radius: 15px; box-shadow: 0 2px 8px rgb(26 37 75 / .04); }
.msg.mine .bubble { background: linear-gradient(145deg, color-mix(in srgb, var(--mine) 88%, var(--accent) 12%), var(--mine)); }
.composer { padding: 11px 14px; gap: 7px; background: color-mix(in srgb, var(--surface) 95%, transparent); backdrop-filter: blur(12px); }
.composer textarea { border-color: var(--border); background: var(--surface-2); }
.composer textarea:focus { background: var(--surface); }
.composer .send { background: var(--accent); color: var(--accent-text); border-radius: 13px; }
.panel { box-shadow: -12px 0 34px rgb(20 30 65 / .08); }
.panel-head, .list-row { border-color: var(--border); }
.section { padding: 16px !important; }
.section a { color: var(--accent); font-size: 13px; font-weight: 600; }
.section a:hover, .auth-links a:hover { text-decoration: underline; }
.account-delete { background: color-mix(in srgb, var(--bad) 5%, var(--surface)); }
.auth-links { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; padding-top: 3px; }
.auth-links a { color: var(--muted); text-decoration: none; font-size: 12px; }
.toast { background: #202941; box-shadow: 0 10px 30px rgb(0 0 0 / .22); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
@media (max-width: 720px) {
  .auth-card { padding: 27px 22px; border-radius: 21px; }
  .chat-head { min-height: 58px; padding-inline: 8px; }
  .messages { padding: 12px; }
}

/* вход */
.tabs { display: flex; gap: 4px; background: var(--surface-2); border-radius: 10px; padding: 3px; }
.tab { flex: 1; border: 0; background: transparent; border-radius: 8px; padding: 7px 4px; cursor: pointer; font-size: 13px; }
.tab.active { background: var(--surface); box-shadow: 0 1px 3px rgb(0 0 0 / .12); font-weight: 600; }
.link-wait { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 8px 0; }
.code { font-family: ui-monospace, Consolas, monospace; background: var(--surface-2); border-radius: 8px; padding: 4px 10px; letter-spacing: 1px; }
.code.big { font-size: 28px; font-weight: 700; letter-spacing: 3px; padding: 8px 16px; }
.fp { font-family: ui-monospace, Consolas, monospace; font-size: 20px; font-weight: 700; color: var(--accent); letter-spacing: 2px; }

/* аватары */
.avatar.sm { width: 28px; height: 28px; font-size: 12px; }
.avatar.xl { width: 88px; height: 88px; font-size: 34px; }
.avatar-edit { display: flex; gap: 14px; align-items: center; }
.profile { justify-items: center; text-align: center; }
.profile .big { font-size: 18px; }
.badge-soft { font-size: 11px; background: var(--surface-2); border-radius: 6px; padding: 1px 6px; color: var(--muted); margin-left: 4px; }
.badge-soft.bad { color: var(--bad); }

/* боковая панель */
.side-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.side-scroll .chat-list { overflow: visible; }
.badge-host { position: relative; }
.dot-badge { position: absolute; top: 2px; right: 0; background: var(--bad); color: #fff; font-size: 10px; border-radius: 8px; padding: 0 4px; min-width: 16px; line-height: 16px; text-align: center; }
.list-head { padding: 10px 12px 4px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.list-row { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 12px; cursor: pointer; border-bottom: 1px solid var(--border); }
.list-row:hover { background: var(--surface-2); }
.list-row .row { justify-content: space-between; flex-wrap: nowrap; }
.list-row.admin-user { flex-direction: row; align-items: center; gap: 10px; }
.list-row.blocked { opacity: .6; }
mark { background: #ffe58f; color: inherit; border-radius: 3px; }
.search-in { margin: 4px 0; }

/* сообщения */
.msg.with-av { flex-direction: row; gap: 6px; align-items: flex-start; }
.msg-av { width: 28px; flex: none; padding-top: 22px; }
.msg-main { display: flex; flex-direction: column; min-width: 0; }
.msg.mine .msg-main { align-items: flex-end; }
.bubble.mentioned { box-shadow: inset 3px 0 0 var(--accent); }
.mention { color: var(--accent); font-weight: 500; }
.mention.me { background: var(--mine); border-radius: 4px; padding: 0 2px; }
.quote { display: flex; flex-direction: column; border-left: 3px solid var(--accent); background: rgb(127 127 127 / .1); border-radius: 6px; padding: 3px 8px; margin-bottom: 4px; cursor: pointer; font-size: 13px; max-width: 420px; }
.quote span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reactions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 0 8px; font-size: 13px; cursor: pointer; line-height: 22px; }
.chip.mine { border-color: var(--accent); background: var(--mine); }
.palette { display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 3px 6px; margin-top: 3px; box-shadow: 0 2px 8px rgb(0 0 0 / .12); }
.palette button { border: 0; background: transparent; font-size: 19px; cursor: pointer; border-radius: 8px; padding: 1px 3px; }
.palette button:hover { background: var(--surface-2); }
.msg .actions button { font-size: 14px; padding: 1px 6px; }
.flash .bubble { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: none; } }
.voice { display: flex; align-items: center; gap: 8px; }
.voice audio { height: 36px; max-width: 260px; }
.file.video { border: 0; background: transparent; padding: 0; font: inherit; color: inherit; text-align: left; }
.approval .btns { flex-wrap: wrap; }
.approval li.cur { font-weight: 600; }

/* закреплённое, ответ, упоминания, запись */
.pin-bar { display: flex; gap: 10px; align-items: center; width: 100%; border: 0; border-bottom: 1px solid var(--border); background: var(--surface); padding: 6px 14px; text-align: left; cursor: pointer; }
.pin-bar .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pin-ic { font-size: 18px; }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--surface); border-top: 1px solid var(--border); font-size: 13px; }
.reply-bar span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--accent); padding-left: 8px; }
.mention-box { background: var(--surface); border-top: 1px solid var(--border); max-height: 220px; overflow-y: auto; }
.mention-box button { display: flex; gap: 8px; align-items: center; width: 100%; border: 0; background: transparent; padding: 6px 12px; cursor: pointer; text-align: left; }
.mention-box button:hover, .mention-box button.sel { background: var(--surface-2); }
.recording { align-items: center; padding: 8px 12px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* справочник */
.people { display: grid; gap: 2px; max-height: 50vh; overflow-y: auto; }
.person { display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; cursor: pointer; color: var(--text); font-size: 14px; }
.person:hover { background: var(--surface-2); }
.person input { width: auto; }
.person:has(input:checked) { background: var(--mine); }
.member .n { display: flex; flex-direction: column; }

/* просмотр фото и видео */
.lightbox { position: fixed; inset: 0; background: rgb(0 0 0 / .92); z-index: 45; display: flex; flex-direction: column; }
.lb-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: #fff; }
.lb-bar span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-bar .icon-btn { color: #fff; text-decoration: none; }
.lb-content { flex: 1; display: grid; place-items: center; min-height: 0; padding: 0 12px 12px; }
.lb-content img, .lb-content video { max-width: 100%; max-height: calc(100vh - 80px); border-radius: 6px; }

@media (prefers-color-scheme: dark) {
  .state.pending { background: #3d2f00; color: #f5c84c; }
  .state.approved { background: #0f3d1f; color: #6fdc8c; }
  .state.rejected { background: #4a1418; color: #ff8a8a; }
  mark { background: #7a6100; }
}

/* ================= Космический интерфейс (по макету) =================
   Тёмная тема включена всегда: макет рассчитан на тёмный фон и обои с туманностью. */
:root, :root:is(*) {
  --bg: #0a0c1d;
  --surface: #10122a;
  --surface-2: #191c3a;
  --surface-3: #22264a;
  --text: #ecebff;
  --muted: #8d92b6;
  --border: rgb(255 255 255 / .07);
  --accent: #8b6cf6;
  --accent-text: #ffffff;
  --mine: #7058e2;
  --theirs: rgb(var(--glass-rgb) / .92);
  --ok: #3ad29f;
  --bad: #ff7a93;
  --warn: #f0c879;
  --radius: 16px;
  color-scheme: dark;
}
body { background: var(--bg); color: var(--text); }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-btn { color: var(--muted); width: 38px; height: 38px; border-radius: 12px; }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
input, textarea, select { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.btn.primary { background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); color: #fff; }

/* раскладка: панель значков | список чатов | чат | правая панель */
.app { display: flex; height: 100%; background: var(--bg); }
.rail {
  width: 68px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 16px 0 14px; background: var(--rail-bg); border-right: 1px solid var(--border);
}
.rail-logo { width: 42px; height: 42px; border-radius: 13px; margin-bottom: 10px; box-shadow: 0 6px 20px rgb(var(--acc2-rgb) / .45); }
.rail-btn {
  width: 44px; height: 44px; border-radius: 14px; border: 1px solid transparent; background: transparent;
  color: var(--muted); display: grid; place-items: center; cursor: pointer; position: relative;
}
.rail-btn .ic { width: 21px; height: 21px; }
.rail-btn:hover { color: var(--text); background: var(--surface-2); }
.rail-btn.active { color: #fff; background: var(--surface-2); border-color: rgb(var(--acc-rgb) / .35); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .03); }
.rail-grow { flex: 1; }
.rail .avatar { width: 34px; height: 34px; font-size: 12px; cursor: default; }
.rail .dot-badge { top: 4px; right: 4px; background: var(--accent); }

.sidebar { width: 310px; background: var(--surface); border-right: 1px solid var(--border); box-shadow: none; }
.side-head { padding: 20px 16px 10px 20px; align-items: flex-start; }
.side-title { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.me-line { display: flex; align-items: center; gap: 4px; margin-top: 2px; white-space: nowrap; overflow: hidden; }
.me-line .sep { opacity: .5; }
.me-line #me-name { overflow: hidden; text-overflow: ellipsis; }
.side-actions .icon-btn { color: var(--muted); }
.search-box { display: flex; flex-direction: row; align-items: center; gap: 8px; margin: 6px 16px 12px; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; color: var(--muted); }
.search-box:focus-within { border-color: rgb(var(--acc-rgb) / .55); }
.search-box .ic { width: 17px; height: 17px; }
.search-box input { border: 0; background: transparent; padding: 10px 0; outline: none; color: var(--text); }
.search-box input:focus { outline: none; }

.chat-list .list-head { padding: 14px 20px 6px; font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; list-style: none; }
.chat-item { margin: 2px 10px; padding: 10px; border-radius: 14px; border: 1px solid transparent; position: relative; gap: 12px; }
.chat-item:hover { background: var(--surface-2); }
.chat-item.active { background: rgb(var(--acc-rgb) / .13); border-color: rgb(var(--acc-rgb) / .28); }
.chat-item .name { color: var(--text); font-weight: 600; }
.chat-item .last { color: var(--muted); }
.chat-item .time { color: var(--muted); font-size: 12px; flex: none; }
.chat-item .badge { background: var(--accent); color: #fff; border-radius: 10px; font-size: 11px; font-weight: 700; min-width: 20px; line-height: 20px; padding: 0 6px; }
.chat-pin { position: absolute; right: 8px; top: 8px; width: 24px; height: 24px; border: 0; border-radius: 8px; background: var(--surface-3);
  color: var(--muted); display: none; place-items: center; cursor: pointer; }
.chat-pin .ic { width: 14px; height: 14px; }
.chat-item:hover .chat-pin { display: grid; }
.chat-item:hover .time { visibility: hidden; }
.chat-pin.on { color: var(--accent); }
.av-wrap { position: relative; flex: none; display: inline-flex; }
.online-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--ok); border: 2px solid var(--surface); }

.avatar { width: 46px; height: 46px; border-radius: 15px; font-size: 15px; font-weight: 700; letter-spacing: .02em; color: #fff;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .12); }
.avatar.sm { width: 30px; height: 30px; border-radius: 10px; font-size: 11px; }
.avatar.xl { width: 92px; height: 92px; border-radius: 28px; font-size: 32px; }

/* шапка чата */
.chat { background: var(--bg); background-image: none; }
.chat-head { min-height: 72px; padding: 12px 20px; gap: 12px; background: rgb(var(--glass-rgb) / .92); border-bottom: 1px solid var(--border); backdrop-filter: blur(14px); }
.chat-head .avatar { width: 44px; height: 44px; border-radius: 14px; }
#chat-name { font-size: 16px; font-weight: 700; color: var(--text); }
#chat-sub { color: var(--muted); }
#chat-sub.online { color: var(--ok); }
.chat-head .icon-btn { color: var(--muted); }
.chat-head .icon-btn:hover { color: var(--text); }
.empty { color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.empty-logo { width: 72px; height: 72px; border-radius: 22px; opacity: .9; box-shadow: 0 10px 40px rgb(var(--acc2-rgb) / .35); }

/* сообщения */
.messages { padding: 26px clamp(16px, 4vw, 56px); gap: 10px; }
.msg { max-width: min(560px, 78%); }
.msg .bubble { background: var(--theirs); color: #ecebff; border: 0; border-radius: 18px 18px 18px 6px; padding: 12px 16px;
  box-shadow: 0 8px 26px rgb(0 0 0 / .28); backdrop-filter: blur(10px); line-height: 1.5; }
.msg.mine .bubble { background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); color: #fff; border-radius: 18px 18px 6px 18px; box-shadow: var(--mine-shadow, 0 8px 26px rgb(var(--acc2-rgb) / .35)); }
.msg .meta { margin-top: 5px; padding: 0 4px; font-size: 11px; text-align: left; }
.msg.mine .meta { text-align: right; }
.msg .author { color: var(--acc-soft); }
.msg .bubble a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.msg .deleted { color: rgb(236 235 255 / .6); }
.quote { background: rgb(255 255 255 / .09); border-left-color: rgb(255 255 255 / .55); color: inherit; }
.quote span { color: rgb(236 235 255 / .75); }
.chat-view > .messages .day, .system { background: rgb(var(--shade-rgb) / .7); color: #cfd0ec; border: 1px solid var(--border); border-radius: 12px; padding: 4px 12px; font-size: 12px; }
.chip { background: rgb(var(--glass-rgb) / .9); border-color: var(--border); color: var(--text); }
.chip.mine { background: rgb(var(--acc-rgb) / .35); border-color: rgb(var(--acc-rgb) / .6); }
.palette { background: var(--surface-2); border-color: var(--border); }
.msg .actions button { background: rgb(var(--glass-rgb) / .9); color: var(--text); }
.thread-link { color: var(--acc-soft); }
.file .fn { color: inherit; }
.approval .state.pending { background: rgb(240 200 121 / .18); color: #f3cf86; }
.approval .state.approved { background: rgb(58 210 159 / .18); color: #6ee3b8; }
.approval .state.rejected { background: rgb(255 122 147 / .18); color: #ff9aae; }
.approval .btn { background: rgb(255 255 255 / .12); border-color: rgb(255 255 255 / .16); color: #fff; }
.pin-bar { background: rgb(var(--glass-rgb) / .92); color: var(--text); border-bottom-color: var(--border); }
.reply-bar, .mention-box { background: var(--surface); border-color: var(--border); }
.mention.me { background: rgb(255 255 255 / .18); }
mark { background: rgb(var(--acc-rgb) / .45); color: #fff; }

/* поле ввода */
.composer { padding: 12px 18px 16px; background: rgb(var(--glass-rgb) / .94); border-top: 1px solid var(--border); gap: 8px; align-items: center; }
.composer textarea { background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px; padding: 11px 16px; color: var(--text); }
.composer textarea:focus { border-color: rgb(var(--acc-rgb) / .55); outline: none; background: var(--surface-2); }
.composer .send { width: 42px; height: 42px; border-radius: 14px; background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); color: #fff; }
.composer .send:hover { background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); color: #fff; }

/* правая панель, диалоги, вход */
.panel { background: var(--surface); border-left: 1px solid var(--border); box-shadow: -16px 0 40px rgb(0 0 0 / .35); }
.panel-head { border-color: var(--border); }
.panel-body .messages { background: var(--surface); }
.list-row { color: var(--text); border-color: var(--border); }
.list-row:hover { background: var(--surface-2); }
.account-delete { background: rgb(255 122 147 / .07); }
dialog { background: var(--surface); color: var(--text); border-color: var(--border); }
.person:hover, .mention-box button:hover, .mention-box button.sel { background: var(--surface-2); }
.person:has(input:checked) { background: rgb(var(--acc-rgb) / .2); }
.toast { background: var(--toast-bg); border: 1px solid var(--border); }
.auth { background-color: var(--bg); }
.auth-card { background: var(--surface); border-color: rgb(var(--acc-rgb) / .25); box-shadow: 0 30px 90px rgb(0 0 0 / .45); }
.tabs { background: var(--surface-2); }
.tab { color: var(--muted); }
.tab.active { background: var(--surface-3); color: #fff; }
.code { background: var(--surface-2); }

/* телефоны: панель значков становится нижней панелью вкладок */
@media (max-width: 720px) {
  .app { flex-direction: column; }
  .rail { order: 2; width: 100%; height: calc(58px + env(safe-area-inset-bottom)); flex-direction: row; justify-content: space-around;
    padding: 6px 8px env(safe-area-inset-bottom); border-right: 0; border-top: 1px solid var(--border); }
  .rail-logo, .rail-grow, .rail .avatar { display: none; }
  .app.in-chat .rail { display: none; }
  .sidebar { flex: 1; min-height: 0; width: 100%; }
  .app .chat { flex: 1; min-height: 0; }
  .msg { max-width: 88%; }
  /* на телефоне наведения нет: закрепляют из информации о чате */
  .chat-pin, .chat-item:hover .chat-pin { display: none; }
  .chat-item:hover .time { visibility: visible; }
}
/* ================= Чистая светлая тема (Настройки → Оформление) ================= */
:root[data-theme="light"] {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f2f8;
  --surface-3: #e8eaf4;
  --text: #1b1f3b;
  --muted: #6b7194;
  --border: #e3e5f0;
  --accent: var(--grad-b);
  --accent-text: #ffffff;
  --mine: var(--grad-b);
  --theirs: #ffffff;
  --ok: #17a37a;
  --bad: #d64b62;
  --warn: #a87918;
  color-scheme: light;
}
[data-theme="light"] body { background: var(--bg); color: var(--text); }
[data-theme="light"] .rail { background: #fafbfe; }
[data-theme="light"] .rail-btn.active { background: var(--acc-tint); color: var(--accent); border-color: var(--acc-tint-2); }
[data-theme="light"] .rail-logo { box-shadow: 0 6px 16px rgb(var(--acc2-rgb) / .25); }
[data-theme="light"] .sidebar { background: var(--surface); }
[data-theme="light"] .chat-item.active { background: var(--acc-tint); border-color: var(--acc-tint-2); }
[data-theme="light"] .chat-head { background: rgb(255 255 255 / .94); }
[data-theme="light"] .messages {
  background-color: var(--bg);
  background-image: var(--chat-bg);
  background-size: var(--chat-bg-size, cover);
  background-position: 0 0;
}
[data-theme="light"] .msg .bubble { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgb(27 31 59 / .06), 0 4px 14px rgb(27 31 59 / .05); backdrop-filter: none; }
[data-theme="light"] .msg.mine .bubble { background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); color: #fff; box-shadow: 0 4px 14px rgb(var(--acc2-rgb) / .25); }
[data-theme="light"] .chat-view > .messages .msg .meta, [data-theme="light"] .msg .meta { color: var(--muted); text-shadow: none; }
[data-theme="light"] .msg .author { color: var(--accent); }
[data-theme="light"] .msg .deleted { color: var(--muted); }
[data-theme="light"] .msg:not(.mine) .quote { background: var(--acc-tint); border-left-color: var(--accent); }
[data-theme="light"] .msg:not(.mine) .quote span { color: var(--muted); }
[data-theme="light"] .chat-view > .messages .day, [data-theme="light"] .system { background: #fff; color: var(--muted); border-color: var(--border); }
[data-theme="light"] .chip { background: #fff; color: var(--text); border-color: var(--border); }
[data-theme="light"] .chip.mine { background: var(--acc-tint); border-color: var(--acc-tint-2); }
[data-theme="light"] .msg .actions button { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgb(27 31 59 / .1); }
[data-theme="light"] .thread-link { color: var(--accent); }
[data-theme="light"] .msg:not(.mine) .approval .btn { background: var(--surface-2); border-color: var(--border); color: var(--text); }
[data-theme="light"] .approval .state.pending { background: #fff3d6; color: #8a5d00; }
[data-theme="light"] .approval .state.approved { background: #dbf5ea; color: #0e7a56; }
[data-theme="light"] .approval .state.rejected { background: #ffe1e6; color: #b3203b; }
[data-theme="light"] .msg:not(.mine) .mention.me { background: var(--acc-tint); }
[data-theme="light"] mark { background: var(--acc-tint-2); color: var(--text); }
[data-theme="light"] .pin-bar { background: #fff; }
[data-theme="light"] .composer { background: rgb(255 255 255 / .96); }
[data-theme="light"] .composer textarea { background: var(--surface-2); }
[data-theme="light"] .panel { box-shadow: -12px 0 32px rgb(27 31 59 / .08); }
[data-theme="light"] .person:has(input:checked) { background: var(--acc-tint); }
[data-theme="light"] .tab.active { background: #fff; color: var(--accent); }
[data-theme="light"] .auth-card { border-color: var(--acc-tint-2); box-shadow: 0 24px 70px rgb(27 31 59 / .1); }
[data-theme="light"] .account-delete { background: #fff5f7; }
[data-theme="light"] .toast { background: #1b1f3b; color: #fff; }

/* выбор темы в настройках */
.theme-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-pick label { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; color: var(--text); font-size: 13px; }
.theme-pick input { position: absolute; opacity: 0; pointer-events: none; }
.theme-pick label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-swatch { width: 100%; height: 34px; border-radius: 8px; border: 1px solid var(--border); }
.theme-swatch.dark { background: linear-gradient(135deg, #0a0c1d 55%, var(--grad-b) 55%); }
.theme-swatch.light { background: linear-gradient(135deg, #ffffff 55%, var(--grad-b) 55%); }
.theme-swatch.system { background: linear-gradient(90deg, #0a0c1d 50%, #ffffff 50%); }
/* текст внутри своих (фиолетовых) пузырей — в обеих темах */
.msg.mine .bubble .mention { color: #fff; font-weight: 700; }
.msg.mine .bubble .mention.me { background: rgb(255 255 255 / .2); }
.msg.mine .bubble .muted, .msg.mine .approval .c, .msg.mine .approval li .muted { color: rgb(255 255 255 / .78); }
.msg.mine .approval .overdue { color: #ffd6de; }
.msg.mine .approval li { color: #fff; }
.msg.mine .file .muted { color: rgb(255 255 255 / .78); }
/* ================= Предложение установить на Android ================= */
.install-sheet { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center;
  background: rgb(5 6 16 / 0); transition: background .3s ease; }
.install-sheet.open { background: rgb(5 6 16 / .55); }
.install-card {
  width: min(460px, 100%); margin: 0 auto; padding: 26px 24px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  background: var(--surface); color: var(--text); border-radius: 28px 28px 0 0; border: 1px solid var(--border); border-bottom: 0;
  box-shadow: 0 -20px 60px rgb(0 0 0 / .35); transform: translateY(105%); transition: transform .32s cubic-bezier(.2, .8, .2, 1);
  background-image: radial-gradient(ellipse at 50% 0%, rgb(var(--acc-rgb) / .22), transparent 60%);
}
.install-sheet.open .install-card { transform: none; }
.install-card::before { content: ""; width: 42px; height: 5px; border-radius: 3px; background: var(--border); margin: -10px 0 4px; }
.install-hero { position: relative; width: 96px; height: 96px; margin: 4px 0 2px; }
.install-icon { position: relative; z-index: 1; width: 96px; height: 96px; border-radius: 26px; box-shadow: 0 14px 34px rgb(var(--acc2-rgb) / .45); }
.install-glow { position: absolute; inset: -18px; border-radius: 50%; background: radial-gradient(circle, rgb(var(--acc-rgb) / .45), transparent 65%);
  filter: blur(6px); animation: install-glow 3.2s ease-in-out infinite; }
@keyframes install-glow { 50% { transform: scale(1.12); opacity: .7; } }
.install-card h3 { margin: 4px 0 0; font-size: 22px; letter-spacing: -.02em; }
.install-card p { margin: 0; max-width: 340px; }
.install-points { list-style: none; margin: 6px 0 4px; padding: 0; display: grid; gap: 8px; width: 100%; text-align: left; }
.install-points li { display: flex; gap: 12px; align-items: center; padding: 10px 14px; border-radius: 14px; background: var(--surface-2); font-size: 14px; }
.install-points span { font-size: 18px; }
.install-go { width: 100%; padding: 14px; font-size: 16px; border-radius: 16px; }
.install-card .btn.ghost { width: 100%; border-color: transparent; color: var(--muted); }
.install-manual { width: 100%; padding: 12px 14px; border-radius: 14px; background: rgb(var(--acc-rgb) / .14); font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .install-glow { animation: none; } }.install-card a.install-go { display: block; text-align: center; text-decoration: none; }
.install-steps { margin: 4px 0 2px; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 8px; width: 100%; text-align: left; }
.install-steps li { counter-increment: step; display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; border-radius: 14px;
  background: var(--surface-2); font-size: 14px; line-height: 1.4; }
.install-steps li::before { content: counter(step); flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--grad-a), var(--grad-b)); color: #fff; font-size: 12px; font-weight: 700; }
/* ================= Сообщения в стиле Telegram ================= */
body { font-family: "Golos Text", "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif; font-size: 15px; }
.messages { gap: 2px; padding: 12px clamp(10px, 3vw, 48px) 16px; }
:root:not([data-theme="light"]) .chat-view > .messages {
  background-image: var(--chat-bg);
}
.msg { max-width: min(540px, 76%); }
.msg.first { margin-top: 8px; }
.msg.with-av { gap: 8px; align-items: flex-end; }
.msg-av { width: 32px; padding-top: 0; align-self: flex-end; }
.msg-av .avatar.sm { width: 32px; height: 32px; border-radius: 50%; font-size: 12px; }
.msg-main { position: relative; }

.msg .bubble { font-size: 15px; line-height: 1.375; padding: 6px 10px 7px 11px; border-radius: 6px 17px 17px 6px; box-shadow: 0 1px 2px rgb(0 0 0 / .25); }
.msg.first .bubble { border-top-left-radius: 17px; }
.msg.last .bubble { border-bottom-left-radius: 4px; }
.msg.mine .bubble { border-radius: 17px 6px 6px 17px; }
.msg.mine.first .bubble { border-top-right-radius: 17px; }
.msg.mine.last .bubble { border-bottom-right-radius: 4px; }
/* «хвостик» у последнего сообщения серии */
.msg.last .bubble::after { content: ""; position: absolute; bottom: 0; left: -7px; width: 9px; height: 13px; background: inherit;
  clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.msg.mine.last .bubble::after { left: auto; right: -7px; clip-path: polygon(0 0, 100% 100%, 0 100%); background: var(--grad-b); }
[data-theme="light"] .msg.mine.last .bubble::after { background: var(--grad-b); }
.msg .bubble.emoji-only::after, .msg .bubble.media::after { display: none; }

/* имя автора внутри пузыря, цвет по участнику */
.msg .bubble .author { margin: 0 0 2px; font-size: 13.5px; font-weight: 600; color: hsl(var(--nc) 80% 74%); }
[data-theme="light"] .msg .bubble .author { color: hsl(var(--nc) 60% 42%); }

/* время и галочки внутри пузыря */
.msg .bubble .meta { float: right; position: relative; top: 5px; margin: 0 -3px 0 10px; padding: 0; font-size: 11.5px; line-height: 1.6;
  color: rgb(236 235 255 / .5); white-space: nowrap; user-select: none; text-shadow: none; text-align: right; }
.chat-view > .messages .msg .bubble .meta { color: rgb(236 235 255 / .5); text-shadow: none; }
.msg.mine .bubble .meta, .chat-view > .messages .msg.mine .bubble .meta { color: rgb(255 255 255 / .72); }
[data-theme="light"] .msg:not(.mine) .bubble .meta, [data-theme="light"] .chat-view > .messages .msg:not(.mine) .bubble .meta { color: #8a90ad; }
.tick { letter-spacing: -3px; margin-right: 3px; }
.tick.read { color: #b9f3ff; }
.msg .bubble .approval + .meta, .msg .bubble .voice + .meta, .msg .bubble .file + .meta, .msg .bubble .caption + .meta { float: none; display: block; top: 0; margin: 4px -2px -2px 0; }

/* фото без подписи: время поверх картинки */
.msg .bubble.media { padding: 3px; }
.msg .bubble.media .img-preview { border-radius: 14px; display: block; }
.msg .bubble.media .meta, .chat-view > .messages .msg .bubble.media .meta { position: absolute; right: 9px; bottom: 9px; top: auto; float: none; margin: 0;
  padding: 1px 7px; border-radius: 10px; background: rgb(0 0 0 / .5); color: #fff; }

/* крупные эмодзи без пузыря */
.msg .bubble.emoji-only { background: none !important; box-shadow: none !important; backdrop-filter: none; padding: 0 2px; font-size: 44px; line-height: 1.15; }
.msg .bubble.emoji-only .meta, .chat-view > .messages .msg .bubble.emoji-only .meta { float: none; display: inline-block; top: -6px; margin-left: 6px;
  font-size: 11px; padding: 1px 7px; border-radius: 10px; background: rgb(0 0 0 / .45); color: #fff; }

/* цитата ответа — как в Telegram */
.msg .bubble .quote { border-left: 3px solid hsl(var(--nc) 80% 70%); background: rgb(255 255 255 / .07); border-radius: 4px 8px 8px 4px;
  padding: 3px 8px 4px; margin: 2px 0 5px; }
.msg .bubble .quote b { color: hsl(var(--nc) 80% 76%); font-size: 13.5px; }
.msg.mine .bubble .quote { border-left-color: #fff; background: rgb(255 255 255 / .14); }
.msg.mine .bubble .quote b { color: #fff; }
[data-theme="light"] .msg:not(.mine) .bubble .quote { background: var(--acc-tint); }
[data-theme="light"] .msg:not(.mine) .bubble .quote b { color: hsl(var(--nc) 60% 42%); }

/* кнопки действий всплывают над пузырём и не сдвигают ленту */
.msg .actions { display: none; position: absolute; top: -16px; right: 4px; z-index: 3; gap: 1px; padding: 3px; margin: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 6px 18px rgb(0 0 0 / .3); }
.msg.mine .actions { right: auto; left: 4px; }
.msg:hover .actions, .msg:focus-within .actions { display: flex; }
.msg .actions button { background: transparent !important; box-shadow: none !important; border-radius: 8px; padding: 3px 6px; font-size: 15px; }
.msg .actions button:hover { background: var(--surface-2) !important; }
.reactions { margin-top: 4px; }
.msg.mine .reactions { justify-content: flex-end; }

/* дата прилипает при прокрутке */
.chat-view > .messages .day { position: sticky; top: 6px; z-index: 4; align-self: center; margin: 10px 0 6px; padding: 3px 11px; font-size: 13px; font-weight: 500; }
.system { font-size: 13px; }

/* список чатов плотнее, как в мессенджерах */
.chat-item { padding: 8px 10px; gap: 11px; }
.chat-item .avatar { width: 50px; height: 50px; border-radius: 50%; }
.chat-item .name { font-size: 15px; }
.chat-item .last { font-size: 14px; }
.online-dot { right: 1px; bottom: 1px; }
.chat-head .avatar { border-radius: 50%; }
/* ================= Контекстное меню сообщения (правая кнопка / долгое нажатие) ================= */
.msg .actions { display: none !important; }
.msg-menu { position: fixed; z-index: 70; min-width: 220px; padding: 6px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: 0 14px 40px rgb(0 0 0 / .38); opacity: 0; transform: scale(.96); transform-origin: top left;
  transition: opacity .12s ease, transform .12s ease; }
.msg-menu.open { opacity: 1; transform: none; }
.menu-reactions { display: flex; gap: 2px; padding: 2px 2px 6px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.menu-reactions button { border: 0; background: transparent; font-size: 21px; padding: 4px; border-radius: 10px; cursor: pointer; transition: transform .1s; }
.menu-reactions button:hover { background: var(--surface-2); transform: scale(1.15); }
.menu-reactions button.on { background: rgb(var(--acc-rgb) / .22); }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: transparent; color: var(--text);
  padding: 8px 12px; border-radius: 9px; font-size: 14px; text-align: left; cursor: pointer; }
.menu-item span { width: 20px; text-align: center; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--bad); }
@media (hover: none) {
  /* на телефоне долгое нажатие открывает меню, а не системное выделение */
  .msg .bubble { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
}
/* файл в своём пузыре — без подчёркивания ссылки */
.msg .bubble a.file { text-decoration: none; }
.msg .bubble .file { cursor: pointer; }
.install-manual a { color: var(--accent); font-weight: 600; text-decoration: underline; }

/* сводка места на сервере */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stats div { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); }
.stats b { font-size: 17px; }
.stats span { color: var(--muted); font-size: 12px; }
.load-more { align-self: center; margin: 6px 0 10px; padding: 6px 14px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font-size: 13px; }
/* ---------- всплывающие уведомления о сообщениях ---------- */
.msg-pops { position: fixed; top: max(14px, env(safe-area-inset-top)); right: 14px; z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 28px)); pointer-events: none; }
.msg-pop { pointer-events: auto; display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; text-align: left; cursor: pointer;
  border: 1px solid var(--border); border-radius: 16px; color: var(--text); font: inherit;
  background: rgb(var(--glass-rgb) / .98); backdrop-filter: blur(16px);
  box-shadow: 0 10px 32px rgb(0 0 0 / .35); transform: translateX(24px); opacity: 0; transition: transform .25s ease, opacity .25s ease; }
.msg-pop.show { transform: none; opacity: 1; }
.msg-pop .avatar { width: 42px; height: 42px; flex: none; }
.msg-pop .col0 { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.msg-pop b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-pop-text { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.msg-pop-x { flex: none; align-self: flex-start; color: var(--muted); font-size: 13px; padding: 2px 4px; border-radius: 6px; }
.msg-pop-x:hover { color: var(--text); background: var(--surface-2); }
@media (max-width: 700px) { .msg-pops { left: 10px; right: 10px; width: auto; } .msg-pop { transform: translateY(-16px); } }

/* ---------- сотрудники ---------- */
[data-theme="light"] .msg-pop { background: #fff; box-shadow: 0 10px 32px rgb(20 22 60 / .18); }
.person-item .time.ok { color: #22c55e; }
.person-item .chat-pin { display: none; }
.notify-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.call-unmute { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); z-index: 4; }

/* «печатает…» */
.chat-sub.typing, #chat-sub.typing, .chat-item .last.typing { color: var(--accent); }
#chat-sub.typing::after, .chat-item .last.typing::after { content: ''; }

/* ================= Голосовые как в Telegram ================= */
.vp { display: flex; align-items: center; gap: 10px; min-width: 230px; max-width: 320px; padding: 2px 0; }
.vp-play { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  background: var(--accent); color: #fff; transition: transform .12s ease; }
.vp-play:active { transform: scale(.92); }
.vp-play .ic { width: 22px; height: 22px; }
.msg.mine .vp-play { background: rgb(255 255 255 / .95); color: var(--grad-b); }
.vp.loading .vp-play .ic { animation: pulse 1s infinite; }
.vp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.vp-wave { height: 26px; display: flex; align-items: center; gap: 2px; cursor: pointer; }
.vp-wave i { flex: 1; min-width: 2px; max-width: 3px; border-radius: 2px; background: rgb(var(--acc-rgb) / .35); transition: background-color .08s linear; }
.vp-wave i.on { background: var(--accent); }
.msg.mine .vp-wave i { background: rgb(255 255 255 / .42); }
.msg.mine .vp-wave i.on { background: #fff; }
.vp-info { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.msg.mine .vp-info { color: rgb(255 255 255 / .8); }
.vp-new { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.vp-speed { margin-left: auto; border: 0; border-radius: 8px; padding: 0 6px; font: inherit; font-size: 11px; font-weight: 700; line-height: 18px; cursor: pointer;
  background: rgb(var(--acc-rgb) / .14); color: var(--accent); }
.msg.mine .vp-speed { background: rgb(255 255 255 / .2); color: #fff; }
.msg .bubble .vp + .meta { float: none; display: block; top: 0; margin: 2px -2px -2px 0; }
/* светлые палитры: свои сообщения светлые с тёмным текстом — плеер тоже */
[data-theme="light"][data-palette="classic"] .msg.mine .vp-play { background: var(--accent); color: #fff; }
[data-theme="light"][data-palette="classic"] .msg.mine .vp-wave i { background: rgb(var(--acc-rgb) / .35); }
[data-theme="light"][data-palette="classic"] .msg.mine .vp-wave i.on { background: var(--accent); }
[data-theme="light"][data-palette="classic"] .msg.mine .vp-info { color: #4fae4e; }
[data-theme="light"][data-palette="classic"] .msg.mine .vp-speed { background: rgb(79 174 78 / .15); color: #3a8f39; }

/* ================= Поле ввода: микрофон ↔ «Отправить», запись удержанием ================= */
.composer:not(.has-text):not(.no-voice) .send { display: none; }
.composer.has-text #btn-voice { display: none; }
#btn-voice { touch-action: none; user-select: none; -webkit-user-select: none; }
.composer.recording-hold > :not(#btn-voice):not(.rec-inline):not(.rec-lock) { visibility: hidden; position: absolute; pointer-events: none; }
.composer.recording-hold #btn-voice { position: relative; width: 52px; height: 52px; border-radius: 50%; background: var(--bad); color: #fff;
  transform: scale(1.15); box-shadow: 0 0 0 8px rgb(255 80 100 / .18); transition: transform .15s ease; }
.composer.rec-cancel-armed #btn-voice { background: var(--muted); box-shadow: none; }
.rec-inline { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 6px; font-variant-numeric: tabular-nums; }
.rec-inline .rec-dot { flex: none; }
.rec-level { flex: 1; height: 26px; display: flex; align-items: center; gap: 2px; overflow: hidden; }
.rec-level i { flex: 1; max-width: 3px; height: 15%; border-radius: 2px; background: var(--bad); opacity: .75; transition: height .08s linear; }
.rec-hint { color: var(--muted); font-size: 13px; white-space: nowrap; }
.composer.rec-cancel-armed .rec-hint { color: var(--bad); }
.rec-lock { position: absolute; right: 26px; bottom: 74px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  box-shadow: 0 6px 18px rgb(0 0 0 / .2); animation: rec-lock-float 1.4s ease-in-out infinite; }
.rec-lock small { font-size: 10px; }
.rec-lock.near { color: var(--accent); }
.composer { position: relative; }
@keyframes rec-lock-float { 50% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) { .rec-lock { animation: none; } .vp-wave i, .rec-level i { transition: none; } }

/* поле ввода: без стрелок прокрутки, пока текст помещается (высоту ведёт autoGrow) */
.composer textarea { overflow-y: hidden; scrollbar-width: thin; }
/* закреплённая плашка даты плотная — соседняя не просвечивает */
.chat-view > .messages .day { background: rgb(var(--shade-rgb) / .94); }

/* ================= Просмотр файлов внутри Орбиты ================= */
.msg .bubble .file { display: flex; align-items: center; gap: 10px; min-width: 220px; max-width: 340px; padding: 4px 2px; border: 0; background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer; }
.fbadge { flex: none; width: 44px; height: 48px; border-radius: 10px; display: grid; place-items: center; font-size: 11px; font-weight: 800;
  letter-spacing: .03em; color: #fff; background: #7b8794; position: relative; }
.fbadge::after { content: ""; position: absolute; top: 0; right: 0; width: 12px; height: 12px; border-radius: 0 10px 0 6px; background: rgb(255 255 255 / .35); }
.fbadge.pdf { background: #e5484d; } .fbadge.doc { background: #2f6fe4; } .fbadge.xls { background: #1f9d55; }
.fbadge.txt { background: #6b7280; } .fbadge.aud { background: #8e4ec6; } .fbadge.vid { background: #d6409f; }
.msg .bubble .file .fn { font-weight: 600; word-break: break-all; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.msg .bubble .file:hover .fn { text-decoration: underline; }

.lb-content.doc { display: block; place-items: normal; justify-items: normal; overflow: auto; padding: 16px 12px 28px; background: #2a2d33; }
/* полоса над документом плотная — шапка чата под окном просмотра не просвечивает */
.lightbox:has(.lb-content.doc) { background: #1d1f24; }
.lightbox:has(.lb-content.doc) .lb-bar { background: #16181c; border-bottom: 1px solid rgb(255 255 255 / .06); }
.vw-loading, .vw-none { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 60vh; color: #e8e8ea; text-align: center; padding: 20px; }
.vw-icon { font-size: 54px; }
.vw-none .muted { color: #a9acb3; max-width: 420px; }
.vw-pdf { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.vw-pages { color: #c9ccd2; }
.vw-page { background: #fff; box-shadow: 0 4px 18px rgb(0 0 0 / .35); max-width: 100%; }
.vw-page canvas { width: 100%; height: 100%; display: block; }
.vw-frame { display: block; width: min(980px, 100%); height: calc(100% - 4px); min-height: 70vh; margin: 0 auto; border: 0; border-radius: 6px; background: #fff; }
.vw-sheet { display: flex; flex-direction: column; height: 100%; gap: 8px; }
.vw-sheet .vw-frame { width: 100%; flex: 1; }
.vw-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.vw-tabs button { border: 0; border-radius: 8px; padding: 5px 12px; background: #3a3e46; color: #e8e8ea; cursor: pointer; font: inherit; font-size: 13px; }
.vw-tabs button.on { background: #1f9d55; color: #fff; }
.vw-table { overflow: auto; max-width: 100%; background: #fff; border-radius: 6px; }
.vw-table table { border-collapse: collapse; font-size: 13px; color: #1b1f24; }
.vw-table th { position: sticky; top: 0; background: #eef1f4; font-weight: 700; }
.vw-table td, .vw-table th { border: 1px solid #dde1e6; padding: 4px 8px; white-space: nowrap; }
.vw-text { margin: 0 auto; max-width: 1100px; padding: 18px 20px; background: #1e2026; color: #e6e6e6; border-radius: 8px;
  font: 13px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.vw-note { color: #c9ccd2; text-align: center; font-size: 13px; }
.vw-audio { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; min-height: 60vh; color: #fff; }

/* таблицы (Excel, CSV) — во всю высоту, полоса листов и масштаба снизу, как в Excel */
.lb-content.doc:has(.vw-sheet) { padding: 0; }
.vw-sheet { display: flex; flex-direction: column; height: 100%; gap: 0; }
.vw-sheet-body { flex: 1; min-height: 0; }
.vw-frame.vw-grid { width: 100%; height: 100%; min-height: 0; border-radius: 0; }
.vw-sheetbar { display: flex; align-items: center; gap: 10px; padding: 0 10px; min-height: 40px; background: #f3f4f6; border-top: 1px solid #c8cbd0; color: #3c4043; }
.vw-sheetbar .vw-tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; }
.vw-sheetbar .vw-tabs button { border: 0; border-radius: 0 0 6px 6px; padding: 7px 14px; background: transparent; color: #3c4043; font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.vw-sheetbar .vw-tabs button:hover { background: #e7e9ec; }
.vw-sheetbar .vw-tabs button.on { background: #fff; color: #1e7145; font-weight: 700; box-shadow: inset 0 3px 0 #1e7145; }
.vw-sheetbar .vw-note { color: #60656c; font-size: 12px; }
.vw-zoom { display: flex; align-items: center; gap: 4px; margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; }
.vw-zoom button { width: 26px; height: 26px; border: 1px solid #c8cbd0; border-radius: 6px; background: #fff; color: #3c4043; font-size: 16px; line-height: 1; cursor: pointer; }
.vw-zoom span { min-width: 40px; text-align: center; }

/* закреплённые даты: под верхней не просвечивают остальные */
.chat-view > .messages .day.day-under { visibility: hidden; }

/* «печатает» — карандаш пишет, точки бегут волной */
.tp { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); }
.tp-pen { position: relative; display: inline-block; width: 13px; height: 13px; }
.tp-pen svg { width: 13px; height: 13px; display: block; transform-origin: 20% 85%; animation: tp-pen 1.1s ease-in-out infinite; }
.tp-pen i { position: absolute; left: 0; bottom: -2px; height: 1.5px; border-radius: 1px; background: currentColor; opacity: .7; animation: tp-line 1.1s ease-in-out infinite; }
.tp-dots { display: inline-flex; gap: 3px; margin-left: 1px; }
.tp-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: tp-dot 1.2s ease-in-out infinite; }
.tp-dots i:nth-child(2) { animation-delay: .15s; }
.tp-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes tp-dot { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes tp-pen { 0%, 100% { transform: translateX(0) rotate(0); } 25% { transform: translateX(2px) rotate(-8deg); } 50% { transform: translateX(4px) rotate(4deg); } 75% { transform: translateX(6px) rotate(-6deg); } }
@keyframes tp-line { 0% { width: 0; } 80%, 100% { width: 12px; } }
@media (prefers-reduced-motion: reduce) { .tp-pen svg, .tp-pen i, .tp-dots i { animation: none; } .tp-pen i { width: 12px; } }

/* согласования: замечания и «исправлено» */
.state.remarks, .approval .state.remarks { background: rgb(96 165 250 / .18); color: #7cb4ff; }
[data-theme="light"] .approval .state.remarks { background: #e0edff; color: #1d5fc4; }
.approval li .c.rm { border-left: 2px solid #7cb4ff; padding-left: 6px; }
.approval li .c.fx { color: #6ee3b8; }
[data-theme="light"] .approval li .c.fx { color: #0e7a56; }
