/* Цвета и шрифт — те же, что в «Пульте менеджера» */
:root {
  color-scheme: light;
  --bg: #f4f7fd;
  --surface: #ffffff;
  --surface-2: #e7effc;
  --ink: #10142b;
  --ink-2: #545b78;
  --ink-muted: #8890ac;
  --border: rgba(16, 20, 43, 0.09);
  --border-strong: rgba(16, 20, 43, 0.16);
  --accent: #1b2ad1;
  --accent-ink: #ffffff;
  --accent-soft: #e4e8fc;
  --accent-mid: #6672e0;
  --good: #17a673;
  --good-soft: #e1f6ec;
  --warning: #c98a0a;
  --warning-soft: #fcf0d8;
  --critical: #9c2a1e;
  --critical-soft: #f7e3e0;
  --column: #edf2fb;
  --overlay: rgba(16, 20, 43, 0.42);
  --shadow: 0 1px 2px rgba(16, 20, 43, 0.04), 0 8px 24px -16px rgba(16, 20, 43, 0.16);
  --shadow-lg: 0 24px 60px -20px rgba(16, 20, 43, 0.45);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #131314;
    --surface: #1e1f20;
    --surface-2: #2a2b2d;
    --ink: #e8eaed;
    --ink-2: #c4c7c5;
    --ink-muted: #9aa0a6;
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);
    --accent: #8ab4f8;
    --accent-ink: #0b1220;
    --accent-soft: #1e2a3d;
    --accent-mid: #5f8fd9;
    --good: #3ddba3;
    --good-soft: #15291f;
    --warning: #fbbf24;
    --warning-soft: #392d12;
    --critical: #f4837a;
    --critical-soft: #3a201e;
    --column: #18191a;
    --overlay: rgba(0, 0, 0, 0.6);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 24px -16px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131314;
  --surface: #1e1f20;
  --surface-2: #2a2b2d;
  --ink: #e8eaed;
  --ink-2: #c4c7c5;
  --ink-muted: #9aa0a6;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --accent: #8ab4f8;
  --accent-ink: #0b1220;
  --accent-soft: #1e2a3d;
  --accent-mid: #5f8fd9;
  --good: #3ddba3;
  --good-soft: #15291f;
  --warning: #fbbf24;
  --warning-soft: #392d12;
  --critical: #f4837a;
  --critical-soft: #3a201e;
  --column: #18191a;
  --overlay: rgba(0, 0, 0, 0.6);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 10px 24px -16px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.8);
}

* { box-sizing: border-box; }
html, body, #app { margin: 0; height: 100%; }
body {
  font-family: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
  background: var(--bg);
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
svg.i { width: 17px; height: 17px; flex: none; }
.boot { padding: 40px; color: var(--ink-muted); }
.brand-logo-svg { height: 30px; width: auto; display: block; color: var(--ink); }

/* ---------- кнопки и поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: 10px; cursor: pointer; white-space: nowrap; font-weight: 500;
  transition: border-color .12s, background .12s;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; }
.btn:focus-visible, .input:focus-visible, .tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--ink); }
.btn-danger { color: var(--critical); }
.btn-danger:hover { border-color: var(--critical); background: var(--critical-soft); }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn-icon { padding: 6px; min-width: 32px; }

.input, select.input, textarea.input {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); outline: none; transition: border-color .12s, box-shadow .12s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input:disabled { background: var(--surface-2); color: var(--ink-2); }
textarea.input { resize: vertical; min-height: 72px; }
.search-wrap { position: relative; flex: 0 1 280px; }
.search-wrap svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-muted); width: 16px; height: 16px; }
.search-wrap .input { padding-left: 34px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink-muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 .wide { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; }

/* ---------- вход ---------- */
/* две половины: слева тёмно-синяя панель (затемнённый фирменный фон ПСГ), справа светлая сторона с формой */
.auth-wrap {
  min-height: 100%; display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  background: var(--bg);
}
.auth-side {
  display: flex; flex-direction: column; gap: 28px;
  padding: 32px 48px; color: #fff;
  background:
    radial-gradient(700px 500px at 0% 0%, rgba(27,42,209,.75), transparent 65%),
    linear-gradient(160deg, rgba(14,23,84,.93) 0%, rgba(7,11,40,.97) 100%),
    url(bg-brand.jpg) center / cover no-repeat, #0b1240;
}
.as-logo .brand-logo-svg { height: 36px; color: #fff; }
/* кубик ПСГ водяным знаком в правом нижнем углу панели */
.auth-side { position: relative; overflow: hidden; }
.auth-side::after {
  content: ''; position: absolute; right: -6%; bottom: -10%; width: 58%; aspect-ratio: 1000 / 1104;
  background: url(psg-cube.png) center / contain no-repeat; opacity: .07; pointer-events: none;
}
.auth-side > * { position: relative; z-index: 1; }
.as-main { display: flex; flex-direction: column; gap: 12px; max-width: 860px; margin: auto 0; }
.as-now { display: flex; align-items: baseline; gap: 14px; color: rgba(255,255,255,.7); }
.as-clock { font-size: 40px; font-weight: 300; letter-spacing: -0.02em; color: #9aa6ff; line-height: 1; }
.as-date { font-size: 15px; }
.as-date::first-letter { text-transform: uppercase; }
.as-title { margin: 2px 0 0; font-size: clamp(28px, 2.9vw, 48px); line-height: 1.02; letter-spacing: -0.03em; font-weight: 700; }
.as-lead { margin: 0 0 6px; font-size: 19px; line-height: 1.45; color: rgba(255,255,255,.72); max-width: 680px; }
.as-quote {
  margin: 0 0 14px; padding: 12px 16px 13px; border-left: 3px solid #e02b2b; border-radius: 0 12px 12px 0;
  background: rgba(255,255,255,.06); font-size: 19px; line-height: 1.45; font-weight: 500; color: #fff;
}
.as-quote-k { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: #ff8a8a; margin-bottom: 3px; }
.as-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.as-tile {
  display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 2px; align-items: center;
  padding: 18px 18px; border-radius: 14px;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.10);
}
.as-tile .as-ic { grid-row: span 2; }
.as-tile b { font-size: 16px; font-weight: 600; line-height: 1.25; }
.as-tile small { font-size: 14px; line-height: 1.35; color: rgba(255,255,255,.58); }
.as-ic {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: #2b3ae0; color: #fff; box-shadow: 0 6px 16px -6px rgba(43,58,224,.8);
}
.as-foot { font-size: 12px; color: rgba(255,255,255,.45); }
.auth-main {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 56px 32px 20px;
  background: radial-gradient(700px 480px at 100% 0%, var(--accent-soft), transparent 62%), var(--bg);
}
.auth-theme { position: absolute; top: 20px; right: 20px; }
.auth-card {
  width: 100%; max-width: 500px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px); border: 1px solid var(--border);
  border-radius: 22px; padding: 40px 40px 36px; box-shadow: var(--shadow), 0 30px 60px -40px rgba(27,42,209,.35);
  display: flex; flex-direction: column; gap: 14px; margin: auto 0;
}
.ac-logo { display: none; }
.ac-logo .brand-logo-svg { height: 30px; }
.auth-card h1 { margin: 0; font-size: 32px; letter-spacing: -0.02em; }
.auth-card { font-size: 15px; }
.auth-card p { margin: -6px 0 4px; color: var(--ink-2); }
.auth-card .input { padding: 15px 15px; font-size: 15px; background: var(--surface-2); border-color: transparent; }
.auth-card .input:focus { background: var(--surface); border-color: var(--accent); }
.auth-card .field > span, .field-row label { font-size: 13px; font-weight: 600; color: var(--ink); }
.field-row { display: flex; justify-content: space-between; align-items: baseline; }
.field-row .linkbtn { font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; border: 0; }
.field-row .linkbtn:hover { text-decoration: underline; }
.pass-wrap { position: relative; }
.pass-wrap .input { padding-right: 44px; }
.pass-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none;
  padding: 7px; border-radius: 8px; color: var(--ink-muted); cursor: pointer; display: grid;
}
.pass-eye:hover, .pass-eye[aria-pressed="true"] { color: var(--accent); }
.pass-gen { display: flex; gap: 8px; }
.pass-gen .input { flex: 1; min-width: 0; }
.auth-back { align-self: center; font-size: 14px; color: var(--ink-2); text-decoration: none; border: 0; }
.auth-back:hover { color: var(--accent); }
.forgot-hint { font-size: 13px; color: var(--ink-2); background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; }
.auth-card .check { color: var(--ink-2); }
.auth-card .btn-primary { padding: 17px; font-size: 16px; border-radius: 12px; margin-top: 4px; }
.auth-card .err:empty { min-height: 0; margin: -8px 0; }
.auth-foot { font-size: 12px; color: var(--ink-muted); text-align: center; }
@media (max-width: 1150px) { .as-tiles { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .ac-logo { display: block; }
  .auth-main { padding: 64px 16px 20px; }
  .auth-card { padding: 26px 22px; }
}
.err { color: var(--critical); min-height: 18px; font-size: 13px; }

/* ---------- каркас: боковая панель как в Пульте ---------- */
.layout { display: grid; grid-template-columns: 236px minmax(0, 1fr) 64px; height: 100%; transition: grid-template-columns .18s ease; }
.layout.collapsed { grid-template-columns: 68px minmax(0, 1fr) 64px; }
.work { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.work .main { flex: 1; min-height: 0; }

/* шапка: поиск слева, «Пригласить» и профиль справа */
.header {
  display: flex; align-items: center; gap: 12px; padding: 12px 24px; min-height: 62px;
  background: var(--surface); border-bottom: 1px solid var(--border); position: relative; z-index: 12;
}
.header .spacer { flex: 1; }
.gsearch { position: relative; flex: 0 1 440px; }
.gsearch > svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-muted); width: 16px; height: 16px; }
.gsearch .input { padding-left: 36px; background: var(--bg); border-color: transparent; }
.gsearch .input:focus { background: var(--surface); border-color: var(--accent); }
.search-results { padding: 6px; }
.picker-list.search-results { max-height: min(460px, 70vh); }
.picker-list.search-results button { display: flex; align-items: center; gap: 10px; }
.sr-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); padding: 8px 10px 4px; }
.sr-ico { flex: none; width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--c, var(--ink-2)); }
.sr-txt { min-width: 0; }
.sr-txt > div:first-child { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-empty { padding: 14px 10px; color: var(--ink-muted); }
.btn-invite { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 600; }
.btn-invite:hover { border-color: var(--accent); }
.profile { position: relative; }
.profile-btn {
  display: flex; align-items: center; gap: 9px; border: 1px solid transparent; background: transparent;
  padding: 4px 8px 4px 4px; border-radius: 999px; cursor: pointer; font-weight: 600;
}
.profile-btn:hover { background: var(--surface-2); }
.profile-btn svg { width: 15px; height: 15px; color: var(--ink-muted); }
.pname { max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); width: 250px; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 40;
}
.menu-head { display: flex; align-items: center; gap: 10px; padding: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.menu-head .who { font-weight: 700; }
.menu-head .role { font-size: 12px; color: var(--ink-muted); }
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; text-align: left;
  padding: 9px 10px; border-radius: 9px; cursor: pointer; font-weight: 500; color: var(--ink-2);
}
.menu button:hover { background: var(--surface-2); color: var(--ink); }
.menu button.danger { color: var(--critical); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }

/* правая панель */
.rail { background: var(--surface); border-left: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; padding: 14px 6px; gap: 6px; }
.rail-btn {
  all: unset; box-sizing: border-box; cursor: pointer; width: 52px; padding: 8px 2px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; color: var(--ink-2);
}
.rail-btn svg { width: 21px; height: 21px; color: var(--accent); }
.rail-btn:hover { background: var(--accent-soft); color: var(--ink); }
.rail-btn:focus-visible { outline: 2px solid var(--accent); }
.side {
  display: flex; flex-direction: column; gap: 2px; padding: 20px 14px;
  background: var(--bg); border-right: 1px solid var(--border); overflow-y: auto; overflow-x: hidden;
}
.side-brand { display: flex; align-items: center; gap: 8px; padding: 2px 6px 18px 8px; min-height: 52px; }
.side-brand .brand-logo-svg { height: 26px; max-width: 150px; }
.side-brand .crm-tag {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--accent);
  background: var(--accent-soft); padding: 2px 7px; border-radius: 6px;
}
.collapse-btn {
  all: unset; box-sizing: border-box; cursor: pointer; margin-left: auto; flex: none;
  width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--ink-muted);
}
.collapse-btn:hover { background: var(--surface-2); color: var(--ink); }
.collapse-btn svg { width: 15px; height: 15px; transition: transform .18s; }
.nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-muted); padding: 14px 12px 6px; white-space: nowrap;
}
.nav-btn {
  all: unset; box-sizing: border-box; cursor: pointer; white-space: nowrap;
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  font-weight: 600; font-size: 13.5px; color: var(--ink-2);
}
.nav-btn svg { color: var(--ink-muted); }
/* «Сервисы» в левом меню: значки-логотипы, стрелка «открыть в новой вкладке» */
.svc-link { text-decoration: none; }
.svc-ico { width: 22px; height: 22px; border-radius: 6px; flex: none; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; }
.svc-pulse { background: #2f5be6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12h4l2-5 4 10 2-5h6'/%3E%3C/svg%3E") center / 16px no-repeat; }
.svc-c1 { background: #ffd200; color: #d52b1e; font-weight: 800; font-size: 11px; letter-spacing: -.3px; }
.svc-link > svg:last-child { margin-left: auto; width: 14px; height: 14px; opacity: 0; transition: opacity .15s; }
.svc-link:hover > svg:last-child { opacity: .7; }
.layout.collapsed .svc-link > svg:last-child { display: none; }
.layout.collapsed .nav-btn span.svc-ico { display: inline-flex; }
@media (max-width: 860px) { .svc-link, .nav-label.svc-label { display: none !important; } }
.nav-btn:hover { background: var(--surface-2); color: var(--ink); }
.nav-btn.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.nav-btn.on svg { color: var(--accent-ink); }
.nav-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.me .who { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .role { font-size: 12px; color: var(--ink-muted); }
.me > div { min-width: 0; }

.layout.collapsed .side { padding: 20px 10px; }
.layout.collapsed .side-brand { justify-content: center; padding: 2px 0 18px; }
.layout.collapsed .side-brand .brand-logo-svg, .layout.collapsed .side-brand .crm-tag { display: none; }
.layout.collapsed .collapse-btn { margin: 0; }
.layout.collapsed .collapse-btn svg { transform: rotate(180deg); }
.layout.collapsed .nav-label { opacity: 0; height: 0; padding: 8px 0 0; overflow: hidden; }
.layout.collapsed .nav-btn { justify-content: center; padding: 10px; }
.layout.collapsed .nav-btn span, .layout.collapsed .me > div { display: none; }
.layout.collapsed .me { justify-content: center; padding: 8px 0; }

.avatar {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; color: #fff; background: var(--av, var(--accent-mid)); letter-spacing: .02em;
}
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }

.main { overflow: auto; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 18px 24px 14px;
  background: var(--bg); position: sticky; top: 0; z-index: 5;
}
.topbar h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.topbar .spacer { flex: 1; }
.subbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 0 24px 14px; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 12px; flex-wrap: wrap; }
.tab {
  border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; cursor: pointer;
  font-weight: 600; font-size: 13px; color: var(--ink-2);
}
.tab:hover { color: var(--ink); }
.tab.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.kpis { display: flex; gap: 18px; margin-left: auto; color: var(--ink-2); font-size: 13px; }
.kpis b { color: var(--ink); font-size: 15px; margin-left: 4px; }
.content { padding: 0 24px 24px; }

/* ---------- канбан ---------- */
.board { display: flex; gap: 12px; padding: 0 24px 24px; overflow-x: auto; align-items: flex-start; flex: 1; }
/* автопрокрутка у края воронки: мягкая подсветка края, куда едет доска */
.edge-hint { position: absolute; width: 56px; pointer-events: none; opacity: 0; transition: opacity .15s; z-index: 3; }
.edge-hint.left { left: 0; background: linear-gradient(90deg, rgba(47,91,230,.18), transparent); }
.edge-hint.right { right: 0; background: linear-gradient(270deg, rgba(47,91,230,.18), transparent); }
.edge-hint.on { opacity: 1; }
/* карточка компании: сделки компании и «+ Сделка» сверху */
.co-topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-radius: 14px;
  background: var(--surface, #fff); border: 1px solid var(--line, #e3e8f0); }
.co-topbar .spacer { flex: 1; }
.co-count { background: none; border: 0; font: inherit; color: inherit; cursor: pointer; padding: 4px 6px; border-radius: 8px; font-size: 15px; }
.co-count b { font-size: 18px; color: var(--accent, #2f5be6); }
.co-count:hover { background: var(--accent-soft, rgba(47,91,230,.08)); }
.co-deals-box { grid-column: 1 / -1; }
.co-deals-box .sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.co-deals { max-height: 340px; overflow-y: auto; margin-top: 8px; }
.seg-n { font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-muted); }
.seg button.on .seg-n { background: var(--accent); color: var(--accent-ink); }
/* сумма в карточке сделки — кликабельна всегда */
.amount-click { background: none; border: 0; padding: 2px 6px; margin-left: -6px; border-radius: 8px; cursor: pointer; font: inherit; color: inherit; text-align: left; border-bottom: 1px dashed transparent; }
.amount-click:hover:not(:disabled) { background: var(--accent-soft, rgba(47,91,230,.08)); border-bottom-color: currentColor; }
.amount-click:disabled { cursor: default; }
.amount-in { max-width: 220px; font-size: 18px; font-weight: 700; }
.col {
  flex: 0 0 272px; background: var(--column); border-radius: var(--radius);
  display: flex; flex-direction: column; max-height: calc(100vh - 150px); transition: background .12s;
}
.col.drop { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.col-head { padding: 10px 10px 8px; }
.col-pill {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--c, #8fa3bf); color: var(--cfg, #fff); border-radius: 9px; padding: 7px 11px;
  font-weight: 600; font-size: 13px;
}
.col-pill .cnt { background: color-mix(in srgb, var(--cfg, #fff) 22%, transparent); border-radius: 999px; padding: 0 8px; font-size: 12px; }
.col-sum { color: var(--ink-2); font-size: 13px; font-weight: 600; margin: 7px 2px 0; }
.col-body { padding: 2px 10px 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 60px; }
.col-add {
  border: 1px dashed var(--border-strong); background: transparent; color: var(--ink-muted);
  border-radius: 10px; padding: 7px; cursor: pointer; font-weight: 500;
}
.col-add:hover { color: var(--accent); border-color: var(--accent); background: var(--surface); }
.col-empty { color: var(--ink-muted); font-size: 12.5px; text-align: center; padding: 10px 0 4px; }
.card {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 12px 11px 15px; box-shadow: var(--shadow); cursor: grab; display: flex; flex-direction: column; gap: 4px;
  transition: border-color .12s, transform .12s;
}
.card::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c, transparent); }
.card:hover { border-color: var(--accent-mid); transform: translateY(-1px); }
.card.dragging { opacity: .4; }
.card-title { font-weight: 600; word-break: break-word; line-height: 1.3; }
.card-co { color: var(--ink-2); font-size: 13px; display: flex; align-items: center; gap: 5px; }
.card-co svg { width: 13px; height: 13px; color: var(--ink-muted); }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.card-amount { font-weight: 700; font-size: 14.5px; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.chip.good { background: var(--good-soft); color: var(--good); }

/* ---------- таблицы ---------- */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); }
tbody tr { cursor: pointer; transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
td .cell-main { display: flex; align-items: center; gap: 10px; font-weight: 600; }
td .sub { color: var(--ink-muted); font-size: 12.5px; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-muted); }
.empty svg { width: 34px; height: 34px; margin-bottom: 8px; opacity: .6; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--good-soft); color: var(--good); }
.badge.off { background: var(--surface-2); color: var(--ink-muted); }
.badge.role { background: var(--accent-soft); color: var(--accent); }

/* ---------- окно справа ---------- */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 20; display: flex; justify-content: flex-end; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  width: min(920px, 100%); height: 100%; background: var(--bg); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; animation: slide .2s ease-out;
}
.drawer.narrow { width: min(520px, 100%); }
@keyframes slide { from { transform: translateX(40px); opacity: .4; } }
.drawer-head { padding: 18px 22px 14px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.drawer-title { display: flex; align-items: flex-start; gap: 10px; }
.drawer-title h3 { margin: 0; font-size: 20px; flex: 1; word-break: break-word; letter-spacing: -0.01em; }
.drawer-title .eyebrow { display: block; font-size: 12px; font-weight: 600; color: var(--ink-muted); margin-bottom: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.drawer.narrow .drawer-body { grid-template-columns: 1fr; }
.drawer-foot { display: flex; gap: 10px; padding: 14px 22px; background: var(--surface); border-top: 1px solid var(--border); }
.drawer-foot .spacer { flex: 1; }
.box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.box h4 { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); }
.stack { display: flex; flex-direction: column; gap: 18px; }

/* полоса стадий как в Битриксе */
.stagebar { display: flex; gap: 3px; overflow-x: auto; padding-bottom: 2px; }
.stagebar button {
  flex: 1 0 auto; min-width: 84px; border: 0; cursor: pointer; padding: 8px 14px 8px 18px;
  background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; font-weight: 600; white-space: nowrap;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
  transition: filter .12s;
}
.stagebar button:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: 8px 0 0 8px; padding-left: 14px; }
.stagebar button:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 10px 50%); border-radius: 0 8px 8px 0; }
.stagebar button.past, .stagebar button.on { background: var(--c); color: var(--cfg, #fff); }
.stagebar button.past { filter: saturate(.55) brightness(1.08); }
.stagebar button:hover { filter: brightness(1.05); }

.feed { display: flex; flex-direction: column; gap: 12px; }
.feed-item { display: flex; gap: 10px; }
.feed-item .dotline { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--accent-mid)); margin-top: 5px; }
.feed-item .meta { font-size: 12px; color: var(--ink-muted); }
.feed-item .txt { white-space: pre-wrap; word-break: break-word; }
.feed-item.link { cursor: pointer; border-radius: 10px; padding: 6px; margin: -6px; }
.feed-item.link:hover { background: var(--surface-2); }
.bubble { background: var(--surface-2); border-radius: 4px 12px 12px 12px; padding: 8px 11px; margin-top: 3px; }
.hint { color: var(--ink-muted); font-size: 12.5px; margin: 0; }
.comment-form { display: flex; flex-direction: column; gap: 8px; }
.comment-form .row { display: flex; justify-content: flex-end; }

/* выбор компании */
.picker { position: relative; }
.picker-list {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 30;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg);
  max-height: 260px; overflow-y: auto; padding: 4px;
}
.picker-list button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; cursor: pointer; border-radius: 8px; }
.picker-list button:hover { background: var(--accent-soft); }
.picker-list .sub { color: var(--ink-muted); font-size: 12px; }
.picker-list .create { color: var(--accent); font-weight: 600; }
.picked { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 11px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); }
.picked a { color: var(--accent); cursor: pointer; flex: 1; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.picked a svg { width: 15px; height: 15px; }

/* ---------- настройки воронок ---------- */
.pipes-layout { display: grid; grid-template-columns: 240px 1fr; gap: 18px; align-items: start; }
.pipe-list { display: flex; flex-direction: column; gap: 4px; }
.pipe-list button {
  text-align: left; border: 1px solid transparent; background: transparent; padding: 10px 12px;
  border-radius: 10px; cursor: pointer; font-weight: 600; color: var(--ink-2); display: flex; justify-content: space-between;
}
.pipe-list button:hover { background: var(--surface-2); color: var(--ink); }
.pipe-list button.on { background: var(--surface); border-color: var(--border); color: var(--ink); box-shadow: var(--shadow); }
.pipe-list button .cnt { color: var(--ink-muted); font-weight: 500; }
.pipe-list .add { color: var(--accent); }
.stage-row { display: grid; grid-template-columns: 22px 38px minmax(140px, 1fr) 130px auto auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.stage-row:last-of-type { border-bottom: 0; }
.stage-row .num { color: var(--ink-muted); font-size: 12px; text-align: center; }
.stage-row input[type=color] { width: 38px; height: 34px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); cursor: pointer; }
.stage-row .flags { display: flex; gap: 12px; font-size: 13px; }
.stage-row .acts { display: flex; gap: 4px; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg);
  max-width: calc(100% - 32px); font-weight: 500; animation: fade .15s;
}
.toast.bad { background: var(--critical); color: #fff; }

/* ---------- телефон: меню снизу, как в Пульте ---------- */
@media (max-width: 860px) {
  .layout, .layout.collapsed { grid-template-columns: 1fr; padding-bottom: 64px; }
  .side, .layout.collapsed .side {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; flex-direction: row; align-items: center;
    padding: 6px 8px; gap: 2px; border-right: 0; border-top: 1px solid var(--border-strong); overflow-x: auto; background: var(--surface);
  }
  .side-brand, .nav-label, .me, .collapse-btn { display: none; }
  .rail { display: none; }
  .header { padding: 10px 16px; gap: 8px; }
  .gsearch { flex: 1 1 auto; }
  .btn-invite span, .pname, .profile-btn > svg { display: none; }
  .btn-invite { padding: 8px 10px; }
  .nav-btn, .layout.collapsed .nav-btn { flex-direction: column; gap: 3px; padding: 6px 12px; font-size: 10.5px; justify-content: center; }
  .layout.collapsed .nav-btn span { display: inline; }
  .topbar { padding: 14px 16px 10px; }
  .subbar { padding: 0 16px 12px; }
  .search-wrap { flex: 1 1 100%; }
  .kpis { margin-left: 0; }
  .board { padding: 0 16px 16px; }
  .col { flex-basis: 84vw; max-height: none; }
  .content { padding: 0 16px 16px; }
  .drawer-body { grid-template-columns: 1fr; padding: 16px; }
  .drawer-head, .drawer-foot { padding-left: 16px; padding-right: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .pipes-layout { grid-template-columns: 1fr; }
  .stage-row { grid-template-columns: 22px 38px 1fr; }
  .stage-row select, .stage-row .flags, .stage-row .acts, .stage-row > .btn { grid-column: 3; }
}

/* ==================== чаты ==================== */
:root { --chat-bg-color: #f3f3f6; --bubble-mine: #dfe5ff; --bubble-other: #ffffff; --chat-bg-icons: url(chat-bg-icons-light.svg); --chat-bg-waves: url(chat-bg-waves-light.svg); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --chat-bg-color: #232730; --bubble-mine: #2c3c63; --bubble-other: #2a2f3a; --chat-bg-icons: url(chat-bg-icons-dark.svg); --chat-bg-waves: url(chat-bg-waves-dark.svg); }
}
:root[data-theme="dark"] { --chat-bg-color: #232730; --bubble-mine: #2c3c63; --bubble-other: #2a2f3a; --chat-bg-icons: url(chat-bg-icons-dark.svg); --chat-bg-waves: url(chat-bg-waves-dark.svg); }

.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #e03131; color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
.nav-badge[hidden] { display: none; }
.layout.collapsed .nav-btn { position: relative; }
.layout.collapsed .nav-badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }

.main.chat-main { overflow: hidden; }
.chat-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px minmax(0, 1fr); }
.chat-side { display: flex; flex-direction: column; gap: 12px; padding: 18px 14px 0; border-right: 1px solid var(--border); background: var(--surface); min-height: 0; }
.chat-side-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.chat-side-head h2 { margin: 0; font-size: 22px; }
.chat-list { flex: 1; overflow-y: auto; margin: 0 -14px; padding: 0 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.chat-item { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 12px; }
.chat-item .avatar { width: 42px; height: 42px; font-size: 14px; }
.chat-item .avatar svg { width: 20px; height: 20px; }
.chat-item:hover { background: var(--surface-2); }
.chat-item.on { background: var(--accent-soft); }
.ci-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ci-top, .ci-bottom { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ci-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-time { font-size: 12px; color: var(--ink-muted); flex: none; }
.ci-prev { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item.unread .ci-prev { color: var(--ink-2); font-weight: 500; }
.ci-badge { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 11.5px; display: inline-flex; align-items: center; justify-content: center; }
.chat-sep { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); padding: 14px 10px 4px; }

.chat-pane { position: relative; display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--chat-bg-color); }
.chat-pane.dropping::after { content: "Отпустите, чтобы прикрепить файлы"; position: absolute; inset: 12px; border: 2px dashed var(--accent); border-radius: 16px; background: color-mix(in srgb, var(--accent-soft) 85%, transparent); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--accent); z-index: 5; }
.chat-empty { margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 30px; background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); max-width: 360px; }
.chat-empty svg { width: 40px; height: 40px; color: var(--accent); margin-bottom: 4px; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; background: var(--surface); border-bottom: 1px solid var(--border); z-index: 2; }
.chat-head .avatar { width: 40px; height: 40px; }
.chat-head-txt { flex: 1; min-width: 0; }
.chat-head-title { font-weight: 700; font-size: 16px; }
.chat-head .hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-back { display: none; }

.chat-scroll-wrap { position: relative; flex: 1; min-height: 0; }
.chat-scroll { position: absolute; inset: 0; overflow-y: auto; padding: 16px 18px; background-color: var(--chat-bg-color); }
.chat-pane.bg-icons .chat-scroll { background-image: var(--chat-bg-icons); background-size: 520px 520px; background-repeat: repeat; }
/* «Волны» — картинка на весь экран, сообщения прокручиваются поверх неё */
.chat-pane.bg-waves .chat-scroll-wrap { background: var(--chat-bg-color) var(--chat-bg-waves) center / cover no-repeat; }
.chat-pane.bg-waves .chat-scroll { background: transparent; }
.chat-pane.bg-icons .chat-empty, .chat-pane.bg-waves .chat-empty { position: relative; z-index: 1; }
.chat-pane.bg-icons:not(:has(.chat-scroll)) { background: var(--chat-bg-color) var(--chat-bg-icons) 0 0 / 520px 520px repeat; }
.chat-pane.bg-waves:not(:has(.chat-scroll)) { background: var(--chat-bg-color) var(--chat-bg-waves) center / cover no-repeat; }
.chat-msgs { display: flex; flex-direction: column; gap: 2px; max-width: 860px; margin: 0 auto; }
.chat-more { text-align: center; margin-bottom: 8px; }
.chat-hello { margin: 60px auto; text-align: center; color: var(--ink-2); background: var(--surface); padding: 20px 26px; border-radius: 16px; box-shadow: var(--shadow); }
.chat-day { text-align: center; margin: 14px 0 8px; }
.chat-day span { display: inline-block; font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--surface); padding: 4px 12px; border-radius: 999px; box-shadow: var(--shadow); }
.chat-main-col .chat-scroll { padding-bottom: 40px; }
/* «Имя Фамилия печатает…» — плашка внизу ленты, как в Б24 */
.chat-typing { position: absolute; left: 18px; bottom: 8px; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 200px);
  padding: 5px 12px 5px 10px; border-radius: 999px; background: rgba(255,255,255,.92); color: #4a5568; font-size: 14px; font-weight: 500;
  box-shadow: 0 1px 4px rgba(0,0,0,.12); pointer-events: none; opacity: 0; transform: translateY(6px); transition: opacity .15s, transform .15s; }
.chat-typing.on { opacity: 1; transform: none; }
.chat-typing .typing-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: #2f5be6; animation: typingDot 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2) { animation-delay: .15s; }
.typing-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typingDot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (max-width: 700px) { .chat-typing { left: 10px; max-width: calc(100% - 20px); } }
.chat-newmsg { position: absolute; right: 22px; bottom: 14px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; padding: 8px 14px; border-radius: 999px; cursor: pointer; box-shadow: var(--shadow-lg); }

.msg-row { display: flex; align-items: flex-end; gap: 8px; margin-top: 8px; }
.msg-row.grouped { margin-top: 2px; }
.msg-row.mine { justify-content: flex-end; }
.avatar-gap { width: 24px; flex: none; }
.msg-col { display: flex; flex-direction: column; max-width: min(560px, 78%); min-width: 0; }
.msg-row.mine .msg-col { align-items: flex-end; }
.msg-line { position: relative; display: flex; align-items: center; max-width: 100%; }
.msg-row.mine .msg-line { flex-direction: row-reverse; }
.bubble-msg {
  position: relative; background: var(--bubble-other); border-radius: 16px 16px 16px 6px; padding: 8px 12px 6px;
  box-shadow: 0 1px 1.5px rgba(16, 20, 43, .12); min-width: 64px; max-width: 100%; word-break: break-word;
}
.msg-row.mine .bubble-msg { background: var(--bubble-mine); border-radius: 16px 16px 6px 16px; }
.msg-row.grouped .bubble-msg { border-radius: 16px; }
.bubble-msg.deleted { opacity: .7; font-style: italic; }
.msg-author { font-size: 12.5px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.msg-text { white-space: pre-wrap; line-height: 1.45; }
.msg-text a { color: var(--accent); }
.msg-text.big-emoji { font-size: 38px; line-height: 1.2; }
.msg-meta { display: flex; align-items: center; justify-content: flex-end; gap: 3px; font-size: 11px; color: var(--ink-muted); margin-top: 2px; float: right; margin-left: 10px; position: relative; top: 4px; }
.msg-tick svg { width: 15px; height: 15px; }
.msg-tick.read { color: var(--accent); }
.msg-media { display: grid; gap: 3px; margin: -2px -6px 6px; border-radius: 12px; overflow: hidden; }
.msg-media.n1 { grid-template-columns: 1fr; }
.msg-media.n2, .msg-media.n4 { grid-template-columns: 1fr 1fr; }
.msg-media.n3 { grid-template-columns: 1fr 1fr 1fr; }
.media-item { all: unset; cursor: zoom-in; display: block; background: var(--surface-2); }
.media-item img { display: block; width: 100%; max-height: 340px; object-fit: cover; }
.msg-media.n1 .media-item img { max-width: 420px; object-fit: contain; }
.media-item.video { cursor: default; }
.media-item video { display: block; width: 100%; max-width: 440px; max-height: 340px; background: #000; }
.msg-file { display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 2px -4px 6px; border-radius: 10px; background: color-mix(in srgb, var(--surface-2) 70%, transparent); color: inherit; text-decoration: none; }
.msg-file:hover { background: var(--surface-2); }
.msg-file > svg { color: var(--ink-muted); }
.mf-ico { width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.mf-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.mf-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.mf-size { font-size: 12px; color: var(--ink-muted); }

/* панель реакций появляется над углом пузыря и не занимает места в строке */
.msg-actions {
  position: absolute; top: -20px; right: -6px; z-index: 3; display: flex; gap: 1px; padding: 3px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .12s;
}
.msg-row.mine .msg-actions { right: auto; left: -6px; }
.msg-line:hover .msg-actions, .msg-actions:focus-within { opacity: 1; pointer-events: auto; }
.qa { border: 0; background: none; cursor: pointer; width: 28px; height: 28px; border-radius: 50%; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); }
.qa:hover { background: var(--surface-2); transform: scale(1.12); }
.qa svg { width: 16px; height: 16px; }
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
/* реакции внизу пузыря: полоска появляется при наведении на сообщение, место в ленте не занимает */
.react-anchor { position: relative; height: 0; align-self: stretch; z-index: 4; }
.react-bar { position: absolute; top: -12px; left: 14px; display: flex; gap: 1px; padding: 2px 4px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transform: translateY(4px); transition: opacity .12s, transform .12s; }
.msg-row.mine .react-bar { left: auto; right: 14px; }
.msg-col:hover .react-bar, .react-bar:focus-within { opacity: 1; pointer-events: auto; transform: none; }
.rb { border: 0; background: none; cursor: pointer; width: 30px; height: 30px; border-radius: 50%; font-size: 18px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); transition: transform .1s; }
.rb:hover { background: var(--surface-2); transform: scale(1.25); }
.rb svg { width: 17px; height: 17px; }
.reaction { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 2px 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font-size: 14px; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.reaction b { font-size: 12px; color: var(--ink-2); }
.reaction.mine { border-color: var(--accent); background: var(--accent-soft); }

.composer { background: var(--surface); border-top: 1px solid var(--border); padding: 8px 14px 12px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.composer-tools { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.tb { border: 0; background: none; cursor: pointer; min-width: 32px; height: 30px; padding: 0 6px; border-radius: 8px; color: var(--ink-2); font-size: 14px; display: inline-flex; align-items: center; justify-content: center; }
.tb:hover { background: var(--surface-2); color: var(--ink); }
.tb.on { background: var(--accent-soft); color: var(--accent); }
.tb svg { width: 18px; height: 18px; }
.tb-sep { width: 1px; height: 18px; background: var(--border-strong); margin: 0 4px; }
.tb-hint { margin-left: auto; font-size: 11.5px; color: var(--ink-muted); }
.composer-row { display: flex; align-items: flex-end; gap: 8px; }
.composer-input {
  flex: 1; min-height: 42px; max-height: 180px; overflow-y: auto; padding: 10px 14px; border-radius: 14px;
  border: 1px solid var(--border-strong); background: var(--bg); outline: none; line-height: 1.45; word-break: break-word; white-space: pre-wrap;
}
.composer-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer-input:not(.filled):empty::before { content: attr(data-placeholder); color: var(--ink-muted); pointer-events: none; }
.composer-send { width: 44px; height: 42px; padding: 0; border-radius: 14px; }
.composer-send svg { width: 19px; height: 19px; }
.composer-pending { display: flex; gap: 8px; flex-wrap: wrap; }
.composer-pending[hidden] { display: none; }
.pend { position: relative; display: flex; align-items: center; gap: 8px; padding: 6px 30px 6px 6px; border-radius: 12px; background: var(--surface-2); max-width: 260px; }
.pend.err { background: var(--critical-soft); }
.pend img, .pend-ico { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; }
.pend-ico { background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; }
.pend-txt { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.pend-txt .mf-name { max-width: 170px; }
.pend-bar { height: 4px; background: var(--border-strong); border-radius: 4px; overflow: hidden; width: 140px; }
.pend-bar span { display: block; height: 100%; background: var(--accent); }
.pend-x { position: absolute; top: 4px; right: 4px; border: 0; background: none; cursor: pointer; font-size: 18px; line-height: 1; color: var(--ink-muted); width: 22px; height: 22px; border-radius: 50%; }
.pend-x:hover { background: var(--surface); color: var(--ink); }

.pop { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 8px; }
.color-pop { display: grid; grid-template-columns: repeat(7, 30px); gap: 6px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; }
.swatch:hover { transform: scale(1.12); }
.emoji-pop { width: 352px; max-width: calc(100vw - 24px); }
.emoji-tabs { display: flex; gap: 2px; margin-bottom: 6px; flex-wrap: wrap; }
.emoji-tabs button { border: 0; background: none; padding: 5px 9px; border-radius: 8px; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.emoji-tabs button.on { background: var(--accent-soft); color: var(--accent); }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 2px; max-height: 220px; overflow-y: auto; overflow-x: hidden; padding-right: 2px; }
.emoji-grid button { border: 0; background: none; cursor: pointer; font-size: 22px; height: 36px; border-radius: 8px; }
.emoji-grid button:hover { background: var(--surface-2); transform: scale(1.15); }
.bg-pop { display: flex; flex-direction: column; gap: 4px; min-width: 200px; }
.bg-pop button { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 6px; border-radius: 10px; cursor: pointer; text-align: left; font-weight: 600; color: var(--ink-2); }
.bg-pop button:hover { background: var(--surface-2); }
.bg-pop button.on { background: var(--accent-soft); color: var(--accent); }
.bg-thumb { width: 54px; height: 38px; border-radius: 8px; flex: none; border: 1px solid var(--border-strong); background-color: var(--chat-bg-color); }
.bg-thumb.icons { background-image: var(--chat-bg-icons); background-size: 160px; }
.bg-thumb.waves { background-image: var(--chat-bg-waves); background-size: cover; }

.member-list { display: flex; flex-direction: column; gap: 2px; max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: 12px; padding: 6px; }
.member-check { padding: 6px 8px; border-radius: 9px; gap: 10px; }
.member-check:hover { background: var(--surface-2); }

.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(5, 8, 18, .92); display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; padding: 40px 60px; animation: fade .15s; }
.lightbox img { max-width: 100%; max-height: calc(100% - 50px); object-fit: contain; border-radius: 8px; cursor: zoom-out; }
.lb-cap { color: #dfe3ee; font-size: 13px; }
.lb-dl { position: absolute; top: 16px; right: 16px; background: rgba(255,255,255,.12); color: #fff; border-color: transparent; text-decoration: none; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); border: 0; background: rgba(255,255,255,.12); color: #fff; width: 46px; height: 46px; border-radius: 50%; font-size: 30px; line-height: 1; cursor: pointer; }
.lb-nav.prev { left: 14px; } .lb-nav.next { right: 14px; }

@media (max-width: 860px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-layout.has-active .chat-side { display: none; }
  .chat-layout:not(.has-active) .chat-pane { display: none; }
  .chat-back { display: inline-flex; }
  .tb-hint { display: none; }
  .msg-col { max-width: 86%; }
  .chat-scroll { padding: 12px 10px; }
  .lightbox { padding: 50px 10px; }
}

/* ==================== роли и права ==================== */
.badge.uc { background: var(--accent-soft); color: var(--accent); }
.badge.partner { background: var(--warning-soft); color: var(--warning); }
.table-scroll { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.perm-table th, .perm-table td { white-space: normal; vertical-align: top; padding: 10px 10px; }
.perm-table th { text-transform: none; letter-spacing: 0; min-width: 160px; }
.perm-table th:first-child, .perm-table td:first-child { min-width: 190px; position: sticky; left: 0; background: var(--surface); z-index: 1; }
.perm-table tbody tr { cursor: default; }
.perm-table tbody tr:hover { background: transparent; }
.perm-table td.center { text-align: center; }
.perm-table .check { justify-content: center; }
.role-name { font-weight: 700; padding: 6px 8px; }
.role-kind { font-size: 11px; color: var(--ink-muted); font-weight: 600; margin-top: 4px; }
.pipe-checks { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.pipe-checks .check { justify-content: flex-start; }
.team-row { display: grid; grid-template-columns: 90px minmax(160px, 1fr) auto auto auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.team-row.add { grid-template-columns: 90px 1fr auto; border-bottom: 0; }
.team-row.with-am { grid-template-columns: 90px minmax(160px, 1fr) minmax(200px, 260px) auto auto auto; }
.team-row.add.with-am { grid-template-columns: 90px 1fr minmax(200px, 260px) auto; }
.perm-table .perm-admin { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.role-name-fixed { font-weight: 700; padding: 9px 0; }
.team-row .badge { text-align: center; }
@media (max-width: 860px) { .team-row, .team-row.add, .team-row.with-am, .team-row.add.with-am { grid-template-columns: 1fr; } }

/* ==================== лента ==================== */
.feed-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; padding: 18px 24px 30px; align-items: start; max-width: 1320px; width: 100%; }
.feed-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.feed-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 14px; }
.feed-composer { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 4px 18px 14px; }
.feed-composer.dropping { box-shadow: 0 0 0 2px var(--accent); }
.fc-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.fc-tab { border: 0; background: none; cursor: pointer; padding: 12px 0 10px; font-size: 12.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.fc-tab:hover { color: var(--ink); }
.fc-tab.on { color: var(--accent); border-bottom-color: var(--accent); }
.fc-placeholder { display: block; width: 100%; text-align: left; border: 0; background: none; cursor: text; padding: 16px 2px 4px; font-size: 16px; color: var(--ink-muted); }
.feed-composer.open .fc-placeholder { display: none; }
.fc-body { display: flex; flex-direction: column; gap: 10px; }
.feed-composer.open .fc-body { padding-top: 14px; }
.fc-title { font-weight: 600; }
.fc-editor { border: 1px solid var(--border-strong); border-radius: 12px; overflow: hidden; }
.fc-editor .composer-input { border: 0; border-radius: 0; min-height: 110px; max-height: 420px; background: var(--surface); box-shadow: none; }
.fc-editor .composer-tools { border-top: 1px solid var(--border); padding: 4px 6px; background: var(--bg); }
.fc-drop { border: 2px dashed var(--border-strong); background: none; border-radius: 12px; padding: 18px; cursor: pointer; color: var(--ink-2); font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 8px; }
.fc-drop:hover { border-color: var(--accent); color: var(--accent); }
.fc-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fc-foot .spacer { flex: 1; }
.fc-to { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-2); }
.fc-aud { width: auto; max-width: 280px; }
.poll-edit { display: flex; flex-direction: column; gap: 6px; }
.pe-row { display: flex; align-items: center; gap: 8px; }

.feed-head { display: flex; align-items: center; gap: 16px; margin-top: 6px; }
.feed-head h2 { margin: 0; font-size: 26px; }
.feed-search { flex: 0 1 280px; }
.feed-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { border: 1px solid var(--border-strong); background: var(--surface); padding: 5px 12px; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.chip-btn:hover { border-color: var(--accent); color: var(--ink); }
.chip-btn.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.feed-new { align-self: center; border: 0; background: var(--accent); color: var(--accent-ink); padding: 8px 16px; border-radius: 999px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-lg); }
.feed-new[hidden] { display: none; }
.feed-pinned, .feed-list { display: flex; flex-direction: column; gap: 14px; }
.feed-pinned:empty { display: none; }
.feed-more { text-align: center; }
.feed-empty { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 40px; text-align: center; color: var(--ink-muted); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.feed-empty svg { width: 34px; height: 34px; }

.post { position: relative; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.post > .avatar { width: 48px; height: 48px; font-size: 15px; }
.post.important { border-left: 4px solid #e03131; }
.post.pinned-open { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.post.pinned-mini { cursor: pointer; background: var(--surface-2); align-items: center; padding: 14px 18px; }
.post.pinned-mini > .avatar { width: 44px; height: 44px; }
.pm-body { min-width: 0; }
.pm-text { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pin-ico { color: var(--ink-muted); display: inline-flex; }
.pin-ico svg { width: 16px; height: 16px; }
.post-tools { display: flex; align-items: flex-start; gap: 2px; }
.post-menu { letter-spacing: 1px; color: var(--ink-muted); font-weight: 700; }
.post-head { margin-bottom: 6px; }
.post-who { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 4px; }
.post-author { color: var(--accent); font-weight: 600; cursor: default; }
.post-arrow { color: var(--ink-muted); }
.post-aud { color: var(--ink-2); }
.badge.imp { background: #e03131; color: #fff; margin-left: 6px; }
.post-date { font-size: 12.5px; color: var(--ink-muted); margin-top: 2px; }
.post-title { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.post-text { white-space: pre-wrap; line-height: 1.55; word-break: break-word; }
.post-text a { color: var(--accent); }
.post-collapse { position: relative; }
.post-collapse.clipped { max-height: 330px; overflow: hidden; }
.post-collapse.clipped::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 70px; background: linear-gradient(transparent, var(--surface)); pointer-events: none; }
.post-collapse.clipped.open { max-height: none; }
.post-collapse.clipped.open::after { display: none; }
.post-expand { display: block; margin: -2px auto 4px; border: 1px solid var(--border-strong); background: var(--surface); width: 64px; height: 26px; border-radius: 14px 14px 0 0; border-bottom: 0; cursor: pointer; color: var(--ink-muted); position: relative; z-index: 1; }
.post-expand[hidden] { display: none; }
.post-expand svg { width: 16px; height: 16px; transition: transform .15s; }
.post-expand.open svg { transform: rotate(180deg); }
.post-event { display: flex; align-items: center; gap: 12px; background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; margin: 4px 0 10px; }
.pe-ico { width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.pe-when { font-weight: 700; }
.post-files { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.post-media { display: grid; gap: 4px; border-radius: 12px; overflow: hidden; max-width: 620px; }
.post-media.n1 { grid-template-columns: 1fr; }
.post-media.n2, .post-media.n4 { grid-template-columns: 1fr 1fr; }
.post-media.n3 { grid-template-columns: 1fr 1fr 1fr; }
.post-media .media-item img { max-height: 380px; }
.post-docs { display: flex; gap: 10px; font-size: 13.5px; }
.pd-label { color: var(--ink-2); font-weight: 600; }
.pd-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.pd-row svg { width: 15px; height: 15px; color: #e03131; }
.pd-row a { color: var(--accent); text-decoration: none; }
.pd-row a:hover { text-decoration: underline; }
.pd-size { color: var(--ink-muted); font-size: 12.5px; }
.post-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; color: var(--ink-muted); }
.post-actions.muted { margin-top: 4px; gap: 14px; }
.pa { border: 0; background: none; padding: 0; cursor: pointer; color: var(--ink-muted); display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
.pa:hover { color: var(--accent); }
.pa svg { width: 16px; height: 16px; }
.pa.on { color: #e03131; font-weight: 600; }
.pa.on svg { fill: #e03131; stroke: #e03131; }
.views { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; color: var(--ink-muted); font-size: 12.5px; }
.views svg { width: 15px; height: 15px; }
.post-likers { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); margin-top: 10px; }
.post-likers svg { width: 15px; height: 15px; fill: #e03131; stroke: #e03131; }
.post-comments { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.post-comments:empty { display: none; }
.pc-more { align-self: flex-start; border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-weight: 600; font-size: 13px; }
.pc { display: flex; gap: 10px; }
.pc-main { background: var(--bg); border-radius: 4px 12px 12px 12px; padding: 7px 11px; min-width: 0; flex: 1; }
.pc-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-muted); }
.pc-meta b { color: var(--ink); font-size: 13px; }
.pc-del { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--ink-muted); font-size: 16px; line-height: 1; }
.pc-text { white-space: pre-wrap; word-break: break-word; }
.pc-form { display: flex; gap: 10px; margin-top: 12px; align-items: flex-start; }
.pc-editor { flex: 1; min-width: 0; border: 1px solid var(--border-strong); border-radius: 12px; overflow: hidden; background: var(--surface); }
.pc-editor .composer-input { border: 0; border-radius: 0; min-height: 38px; padding: 8px 12px; background: var(--surface); box-shadow: none; }
.pc-tools { display: none; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding: 3px 6px; background: var(--bg); }
.post.commenting .pc-tools { display: flex; }

.poll { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-width: 560px; }
.poll-opt { position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; text-align: left; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 10px; padding: 9px 12px; cursor: pointer; }
.poll-opt:hover { border-color: var(--accent); }
.poll-opt.mine { border-color: var(--accent); }
.poll-bar { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent-soft); z-index: 0; transition: width .3s; }
.poll-opt > *:not(.poll-bar) { position: relative; z-index: 1; }
.poll-radio { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; }
.poll-opt.mine .poll-radio { border-color: var(--accent); background: radial-gradient(var(--accent) 45%, transparent 50%); }
.poll-txt { flex: 1; font-weight: 500; }
.poll-pct { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.poll-foot { display: flex; align-items: center; justify-content: space-between; }

.menu-pop { display: flex; flex-direction: column; min-width: 180px; }
.menu-pop button { display: flex; align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 8px 10px; border-radius: 9px; cursor: pointer; color: var(--ink-2); font-weight: 500; }
.menu-pop button:hover { background: var(--surface-2); color: var(--ink); }
.menu-pop button.danger { color: var(--critical); }

.widget { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.w-title { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 15px; border-left: 3px solid var(--accent); padding-left: 10px; margin-bottom: 4px; }
.w-plus { border: 0; background: none; color: var(--accent); font-size: 22px; line-height: 1; cursor: pointer; }
.w-row { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; }
.w-row b { font-size: 16px; }
.w-item { all: unset; box-sizing: border-box; display: flex; gap: 10px; align-items: flex-start; padding: 6px 4px; border-radius: 10px; cursor: pointer; }
.w-item:hover { background: var(--surface-2); }
.w-item > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.w-name { color: var(--accent); font-weight: 600; font-size: 13.5px; }
.w-sub { color: var(--ink-muted); font-size: 12.5px; line-height: 1.35; }
.w-sub.today { color: var(--good); font-weight: 700; }
.w-online { flex-direction: row; align-items: center; gap: 14px; }
.wo-circle { width: 54px; height: 54px; border-radius: 50%; border: 3px solid #3ddbc3; display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; flex: none; }
.wo-avatars { display: flex; }
.wo-avatars .avatar { border: 2px solid var(--surface); margin-left: -6px; }
.wo-avatars .avatar:first-child { margin-left: 0; }

@media (max-width: 1100px) { .feed-wrap { grid-template-columns: 1fr; } .feed-side { position: static; } }
@media (max-width: 860px) {
  .feed-wrap { padding: 12px 12px 20px; }
  .post { grid-template-columns: 36px minmax(0, 1fr) auto; gap: 10px; padding: 14px; }
  .post > .avatar { width: 36px; height: 36px; font-size: 12px; }
  .fc-tabs { gap: 14px; }
  .feed-head h2 { font-size: 22px; }
}

/* ---------- сделки v5: вид, фильтр, дела ---------- */
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 12px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg svg { width: 16px; height: 16px; }
.btn-on { border-color: var(--accent); color: var(--accent); }
.btn-badge { background: var(--accent); color: var(--accent-ink); border-radius: 999px; font-size: 11px; padding: 0 6px; margin-left: 2px; line-height: 18px; }
.linkbtn { border: 0; background: none; color: var(--accent); cursor: pointer; font-weight: 600; padding: 0; font: inherit; font-weight: 600; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn.sm { font-size: 12px; }
.kpi-link { border: 0; background: none; padding: 0; font: inherit; color: var(--ink-2); cursor: pointer; }
.kpi-link b { margin-left: 4px; color: var(--warning); font-size: 15px; }
.kpi-link.bad b { color: var(--critical); }
.kpi-link:hover { text-decoration: underline; }

.filter-panel { margin: 0 24px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.filter-panel[hidden] { display: none; }
.fp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 14px; }
.fp-range { display: flex; gap: 6px; align-items: center; }
.fp-range .input { min-width: 0; }
.fp-quick { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fp-actions { display: flex; gap: 10px; align-items: center; }
.fp-actions .spacer { flex: 1; }
.chip-btn.sm { padding: 3px 10px; font-size: 12px; }
.chip-btn svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 4px; }
.fchips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fchip { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 12.5px; font-weight: 600; }
.fchip button { border: 0; background: transparent; color: inherit; cursor: pointer; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.fchip button:hover { background: var(--surface); }
.fchip svg { width: 12px; height: 12px; }

.act-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); width: fit-content; white-space: nowrap; }
.act-chip svg { width: 12px; height: 12px; }
.act-chip.bad { background: var(--critical-soft); color: var(--critical); }
.act-chip.none { background: var(--warning-soft); color: var(--warning); }
.card .act-chip { margin-top: 2px; }
.ct-chip { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); letter-spacing: .03em; }
.ct-chip.pul { background: var(--accent-soft); color: var(--accent); }
.ct-chip.nul { background: var(--good-soft); color: var(--good); }
.ct-chip.fl { background: var(--warning-soft); color: var(--warning); }
.tz-chip { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); letter-spacing: .03em; white-space: nowrap; cursor: help; }

.deal-list { padding: 0 24px 24px; }
.deal-table td { vertical-align: middle; }
.deal-table .td-title { white-space: normal; min-width: 240px; max-width: 420px; }
.deal-table .td-title .cell-main { display: block; }
.stage-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--cfg, #fff); background: var(--c); }
.who-cell { display: inline-flex; align-items: center; gap: 8px; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover, th.sortable.on { color: var(--ink); }
th .arr { margin-left: 4px; }
tfoot td { font-weight: 700; background: var(--surface-2); border-bottom: 0; }

.drawer.wide { width: min(1180px, 100%); }
.tl-composer { gap: 12px; }
.tl-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-top: -6px; }
.tl-tabs button { border: 0; background: transparent; padding: 8px 12px; cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 6px; align-items: center; }
.tl-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.tl-tabs svg { width: 16px; height: 16px; }
.tl-form { display: flex; flex-direction: column; gap: 10px; }
.tl-form .row, .act-done-form .row { display: flex; justify-content: flex-end; gap: 8px; }
.act-types { display: flex; gap: 6px; flex-wrap: wrap; }
.act-when { display: grid; grid-template-columns: 1fr 104px 1.2fr; gap: 8px; }
.act-row { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.act-row.bad { border-color: color-mix(in srgb, var(--critical) 40%, transparent); background: var(--critical-soft); }
.act-check { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); cursor: pointer; display: grid; place-items: center; color: transparent; padding: 0; margin-top: 3px; }
.act-check:hover, .act-check:focus-visible { border-color: var(--good); color: var(--good); outline: none; }
.act-check svg { width: 13px; height: 13px; }
.act-ico { flex: none; width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.act-ico svg { width: 16px; height: 16px; }
.act-main { flex: 1; min-width: 0; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.act-subj { font-weight: 600; word-break: break-word; }
.act-deal { font-size: 12.5px; color: var(--accent); word-break: break-word; }
.act-desc { font-size: 13px; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.act-meta { font-size: 12px; color: var(--ink-muted); }
.act-row.bad .act-due { color: var(--critical); font-weight: 600; }
.act-done-form { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 12px; background: var(--surface-2); }
.act-empty { color: var(--warning); background: var(--warning-soft); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.tl-done { flex: none; width: 18px; height: 18px; border-radius: 50%; background: var(--good); color: #fff; display: grid; place-items: center; margin-top: 1px; }
.tl-done svg { width: 12px; height: 12px; }
/* «Запланировано» в карточке — заметный блок */
.planned-box { border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 70%); box-shadow: 0 6px 22px color-mix(in srgb, var(--accent) 14%, transparent); }
.planned-box.has-over { border-color: color-mix(in srgb, var(--critical) 45%, transparent); background: linear-gradient(180deg, var(--critical-soft), var(--surface) 70%); }
.planned-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.planned-head h4 { margin: 0; color: var(--ink); font-size: 13px; }
.planned-ic { width: 26px; height: 26px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.planned-ic svg { width: 15px; height: 15px; }
.planned-box.has-over .planned-ic { background: var(--critical); }
.planned-n { min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.planned-over { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--critical); }
.planned-box .act-row { box-shadow: var(--shadow); }
.planned-box .act-subj { font-weight: 700; font-size: 14.5px; }
.act-due { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.act-due.today { background: var(--warning-soft); color: var(--warning); }
.act-due.over, .act-row.bad .act-due { background: var(--critical); color: #fff; }
/* закрепление */
.pin-btn { all: unset; cursor: pointer; flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; color: var(--ink-muted); opacity: .45; }
.pin-btn svg, .pin-mark svg { width: 15px; height: 15px; }
.feed-item:hover .pin-btn, .act-row:hover .pin-btn, .pin-btn.on, .pin-btn:focus-visible { opacity: 1; }
.pin-btn:hover { background: var(--surface-2); color: var(--accent); }
.pin-btn.on { color: var(--accent); }
.pin-mark { color: var(--accent); flex: none; }
.feed-item.pinned .bubble { box-shadow: inset 3px 0 0 var(--accent); }
.act-row.pinned { border-color: var(--accent-mid); }
/* история: вкладки и дни */
.hist-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 10px; }
.hist-tabs button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--surface); }
.hist-tabs button:hover { border-color: var(--accent-mid); color: var(--accent); }
.hist-tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.hist-tabs .n { font-size: 11.5px; font-weight: 700; opacity: .7; }
.hist-day { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-muted); padding: 4px 0 0; display: flex; align-items: center; gap: 5px; }
.hist-day svg { width: 13px; height: 13px; }
.hist-day.pin { color: var(--accent); }
.hist-pins { display: flex; flex-direction: column; gap: 10px; padding: 10px 12px 12px; margin-bottom: 12px; border-radius: 12px; background: var(--accent-soft); }

/* ---------- чаты: крупнее текст, ответ / пересылка / правка, закрепление, аватарки групп ---------- */
.chat-main .msg-text { font-size: 15.5px; line-height: 1.5; }
.chat-main .msg-author { font-size: 13.5px; }
.chat-main .msg-meta { font-size: 12px; }
.chat-main .ci-title { font-size: 15px; }
.chat-main .ci-prev { font-size: 14px; }
.chat-main .composer-input { font-size: 15.5px; line-height: 1.5; }
.chat-main .mf-name { font-size: 14.5px; }
.msg-fwd { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-muted); font-style: italic; margin-bottom: 3px; }
.msg-fwd svg { width: 13px; height: 13px; }
.msg-quote { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 1px; margin: 2px 0 5px; padding: 4px 9px; border-left: 3px solid var(--accent); border-radius: 6px; background: color-mix(in srgb, var(--accent) 9%, transparent); max-width: 100%; }
.msg-quote b { font-size: 12.5px; color: var(--accent); }
.msg-quote span { font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.msg-edited { font-style: italic; margin-right: 3px; }
.bubble-msg.sending { opacity: .75; }
.bubble-msg.failed { box-shadow: 0 0 0 2px var(--critical); }
.msg-tick.sending svg { width: 12px; height: 12px; }
.msg-retry { all: unset; cursor: pointer; color: var(--critical); font-weight: 700; margin-left: 4px; }
.composer-bar { display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 10px; border-left: 3px solid var(--accent); border-radius: 8px; background: var(--accent-soft); }
.composer-bar[hidden] { display: none; }
.cb-ic { color: var(--accent); display: inline-flex; }
.cb-ic svg { width: 18px; height: 18px; }
.cb-main { flex: 1; min-width: 0; font-size: 13.5px; }
.cb-main b { color: var(--accent); }
.cb-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.fwd-pop { display: flex; flex-direction: column; gap: 8px; padding: 12px; width: 320px; max-width: calc(100vw - 32px); }
.fwd-list { display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; }
.fwd-item { all: unset; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; font-size: 14px; }
.fwd-item:hover, .fwd-item:focus-visible { background: var(--surface-2); }
.ci-pin { flex: none; display: inline-flex; color: var(--ink-muted); opacity: 0; padding: 0 2px; cursor: pointer; }
.ci-pin svg { width: 14px; height: 14px; }
.chat-item:hover .ci-pin, .ci-pin:focus-visible { opacity: .6; }
.ci-pin:hover { opacity: 1 !important; color: var(--accent); }
.ci-pin.on { opacity: 1; color: var(--accent); }
.chat-sep.pin { display: flex; align-items: center; gap: 5px; color: var(--accent); }
.chat-sep.pin svg { width: 12px; height: 12px; }
.avatar.photo { background-size: cover; background-position: center; color: transparent; }
.avatar.has-photo { position: relative; overflow: hidden; }
.avatar.has-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.avatar.notes-av { background: linear-gradient(135deg, #4f8cff, #1b2ad1); color: #fff; }
.avatar.notes-av svg { width: 55%; height: 55%; }
.chat-head-who { all: unset; cursor: pointer; display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; border-radius: 10px; padding: 2px 6px 2px 2px; }
.chat-head-who:hover .chat-head-title span:first-child { color: var(--accent); text-decoration: underline; }
.chat-head-who:focus-visible { outline: 2px solid var(--accent); }
.msg-av { all: unset; cursor: pointer; border-radius: 50%; flex: none; }
.msg-av:focus-visible { outline: 2px solid var(--accent); }
.cp-card.uc .cp-big-av { width: 160px; height: 160px; font-size: 48px; }
.uc-photo { cursor: zoom-in; }
.cp-photo-btn { position: relative; border: 0; cursor: pointer; background-size: cover; background-position: center; overflow: hidden; }
.cp-photo-hint { position: absolute; inset: auto 0 0 0; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 4px 0; font-size: 11px; font-weight: 600; color: #fff; background: rgba(16, 20, 43, .55); opacity: 0; transition: opacity .15s; }
.cp-photo-hint svg { width: 12px; height: 12px; }
.cp-photo-btn:hover .cp-photo-hint, .cp-photo-btn:focus-visible .cp-photo-hint { opacity: 1; }

/* «островки» сообщений как в Б24: белые карточки, мягкая тень, имя автора цветом, плашки дней */
.chat-main .bubble-msg { border-radius: 18px; padding: 9px 14px 7px; box-shadow: 0 1px 2px rgba(16, 32, 70, .14); }
.chat-main .msg-row:not(.mine) .bubble-msg { border-bottom-left-radius: 18px; }
.chat-main .msg-row:not(.mine):not(.grouped) .bubble-msg { border-top-left-radius: 6px; }
.chat-main .msg-row.mine:not(.grouped) .bubble-msg { border-top-right-radius: 6px; }
.chat-main .msg-author { font-weight: 700; margin-bottom: 3px; }
.chat-main .msg-row .avatar, .chat-main .msg-av .avatar { width: 40px; height: 40px; font-size: 14px; }
.chat-main .avatar-gap { width: 40px; }
.chat-main .msg-col { max-width: min(640px, 80%); }
.chat-main .chat-day span { background: rgba(30, 40, 70, .38); color: #fff; box-shadow: none; font-size: 12.5px; padding: 5px 14px; backdrop-filter: blur(4px); }
.chat-main .msg-file { background: color-mix(in srgb, var(--surface-2) 55%, transparent); padding: 8px 12px 8px 8px; }
.mf-badge { position: relative; flex: none; width: 34px; height: 40px; display: grid; place-items: center; color: var(--ink-muted); }
.mf-badge svg { width: 34px; height: 40px; stroke-width: 1.2; }
.mf-badge i { position: absolute; left: -3px; bottom: 4px; font-style: normal; font-size: 9px; font-weight: 800; color: #fff; background: #7b8794; border-radius: 3px; padding: 1px 3px; letter-spacing: .02em; }
.mf-badge.pdf i { background: #d93a2b; }
.mf-badge.xls i { background: #1f9d55; }
.mf-badge.doc i { background: #2b6cd9; }
.mf-badge.ppt i { background: #e0732a; }
.mf-badge.zip i { background: #8a6d3b; }
.chat-seen-line { display: flex; margin: 8px 0 4px 48px; }
.csl { display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px; border-radius: 999px; background: rgba(30, 40, 70, .38); color: #fff; font-size: 12.5px; font-weight: 600; backdrop-filter: blur(4px); }
.csl svg { width: 15px; height: 15px; }
.csl-more { all: unset; cursor: pointer; text-decoration: underline; }
.csl-pop { min-width: 220px; }
.csl-u { display: flex; align-items: center; gap: 8px; padding: 5px 10px; font-size: 13.5px; }

/* текст сообщений крупнее; свои сообщения — насыщенный синий с белым текстом */
.chat-main .msg-text { font-size: 17px; line-height: 1.5; }
.chat-main .msg-text.big-emoji { font-size: 34px; }
.chat-main .composer-input { font-size: 16.5px; }
.chat-main .msg-author { font-size: 14px; }
.chat-main .msg-meta { font-size: 12.5px; }
.chat-main .msg-row.mine .bubble-msg { background: #2f5be6; color: #fff; }
.chat-main .msg-row.mine .msg-meta, .chat-main .msg-row.mine .msg-edited { color: rgba(255, 255, 255, .78); }
.chat-main .msg-row.mine .msg-tick, .chat-main .msg-row.mine .msg-tick.read { color: #fff; }
.chat-main .msg-row.mine .msg-text a { color: #fff; text-decoration: underline; }
.chat-main .msg-row.mine .msg-quote { background: rgba(255, 255, 255, .16); border-left-color: #fff; }
.chat-main .msg-row.mine .msg-quote b, .chat-main .msg-row.mine .msg-quote span { color: #fff; }
.chat-main .msg-row.mine .msg-fwd { color: rgba(255, 255, 255, .8); }
.chat-main .msg-row.mine .msg-file { background: rgba(255, 255, 255, .16); color: #fff; }
.chat-main .msg-row.mine .msg-file .mf-size, .chat-main .msg-row.mine .msg-file > svg { color: rgba(255, 255, 255, .8); }
.chat-main .msg-row.mine .mf-badge { color: rgba(255, 255, 255, .85); }
.chat-main .msg-row.mine .msg-retry { color: #ffd2cc; }
.chat-main .msg-row.mine .reaction { background: rgba(255, 255, 255, .9); }

/* окно подгонки фото для аватарки */
.crop-ov { position: fixed; inset: 0; z-index: 500; background: rgba(10, 16, 40, .55); display: grid; place-items: center; padding: 16px; }
.crop-box { background: var(--surface); color: var(--ink); border-radius: 16px; padding: 18px; width: 360px; max-width: 100%; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-lg); }
.crop-box h3 { margin: 0; font-size: 17px; }
.crop-stage { position: relative; width: 300px; height: 300px; margin: 0 auto; border-radius: 12px; overflow: hidden; touch-action: none; }
.crop-cv { display: block; cursor: grab; }
.crop-cv:active { cursor: grabbing; }
.crop-ring { position: absolute; inset: 0; pointer-events: none; border-radius: 50%; box-shadow: 0 0 0 200px rgba(10, 16, 40, .45); outline: 2px solid rgba(255, 255, 255, .9); outline-offset: -2px; }
.crop-zoom { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink-muted); }
.crop-zoom input { flex: 1; accent-color: var(--accent); }
.crop-act { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- статистика телефонии ---------- */
.tel-bar { flex-wrap: wrap; gap: 10px; }
.tel-periods button { white-space: nowrap; }
.tel-custom { display: inline-flex; align-items: center; gap: 6px; }
.tel-custom[hidden] { display: none; }
.input.input-sm { padding: 6px 10px; font-size: 13.5px; height: auto; width: auto; }
.tel-page { display: flex; flex-direction: column; gap: 14px; }
.tel-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.tel-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.tt-l { font-size: 12px; color: var(--ink-muted); font-weight: 600; }
.tt-v { font-size: 24px; font-weight: 700; margin: 2px 0; font-variant-numeric: tabular-nums; }
.tt-s { font-size: 12px; color: var(--ink-muted); }
.tel-tile.bad .tt-v { color: var(--critical); }
.tel-box-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.tel-box-h h4 { margin: 0; }
.tel-box-h .seg { margin-left: auto; }
.table-card.flat { box-shadow: none; }
.tel-table td.num, .tel-table th.num { text-align: right; }
.tel-table td.bad { color: var(--critical); font-weight: 600; }
.tel-table tbody tr { cursor: pointer; }
.tel-table tfoot td { font-weight: 700; }
.rate-pill { font-weight: 700; }
.rate-pill.low { color: var(--critical); }
.tel-talk { position: relative; min-width: 120px; }
.tel-bar-in { position: absolute; right: 16px; bottom: 6px; height: 4px; border-radius: 4px; background: var(--accent); opacity: .55; }
.tel-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-muted); margin-left: auto; }
.tel-legend .lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 8px; }
.lg.dials, .tc-bars .b.dials { background: color-mix(in srgb, var(--accent) 35%, var(--surface)); }
.lg.ok, .tc-bars .b.ok { background: var(--accent); }
.lg.in, .tc-bars .b.in { background: var(--good); }
.tel-chart-wrap { position: relative; }
.tel-chart { display: flex; align-items: flex-end; gap: 3px; height: 190px; padding-top: 8px; overflow-x: auto; }
.tc-col { flex: 1 0 18px; max-width: 46px; height: 100%; display: flex; flex-direction: column; cursor: pointer; border-radius: 6px; outline: none; }
.tc-col:hover, .tc-col:focus-visible { background: var(--surface-2); }
.tc-bars { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; padding: 0 2px; }
.tc-bars .b { flex: 1; max-width: 9px; border-radius: 3px 3px 0 0; min-height: 0; }
.tc-x { text-align: center; font-size: 10.5px; color: var(--ink-muted); padding-top: 3px; }
.tc-col.we .tc-x { color: var(--critical); }
.tel-tip { position: absolute; top: 0; z-index: 5; width: 220px; padding: 8px 10px; border-radius: 10px; background: var(--ink); color: var(--surface); font-size: 12.5px; line-height: 1.45; box-shadow: var(--shadow-lg); pointer-events: none; }
.tel-tip[hidden] { display: none; }
.tel-cb { border-color: color-mix(in srgb, var(--critical) 40%, transparent); }
.tel-cb-list { display: flex; flex-direction: column; gap: 6px; }
.tel-cb-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.tel-cb-row .tl-ic { margin: 0; }
.tel-cb-main { flex: 1; min-width: 0; }
.tel-cb-main a { font-weight: 700; }
.tel-cb-when { font-size: 12.5px; color: var(--ink-muted); white-space: nowrap; }
.tel-tries { margin-left: 8px; font-size: 11.5px; font-weight: 700; color: var(--critical); background: var(--critical-soft); padding: 1px 7px; border-radius: 999px; }
.tel-deal { color: var(--accent); cursor: pointer; }
.tel-ok-note { display: flex; align-items: center; gap: 6px; color: var(--good); font-weight: 600; }
.tel-ok-note svg { width: 16px; height: 16px; }
.tel-list-f { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.tel-audio { width: 260px; height: 32px; }
.tel-table td .tl-ic { margin: 0; width: 24px; height: 24px; box-shadow: none; }
.heat-wrap { position: relative; overflow-x: auto; margin-top: 8px; }
.heat { display: grid; gap: 3px; min-width: 520px; }
.heat-x { text-align: center; font-size: 11px; color: var(--ink-muted); }
.heat-y { font-size: 12px; color: var(--ink-2); font-weight: 600; display: flex; align-items: center; }
.heat-c { height: 30px; border-radius: 6px; background: var(--surface-2); display: grid; place-items: center; font-size: 11.5px; font-weight: 600; color: var(--ink-2); cursor: default; outline: none; }
.heat-c.dark { color: #fff; }
.heat-c.na { background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 4px, var(--surface) 4px, var(--surface) 8px); }
.heat-c:hover, .heat-c:focus-visible { box-shadow: 0 0 0 2px var(--ink); }
.tel-tips { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.tel-tips li { display: flex; align-items: baseline; gap: 8px; font-size: 14px; }
.tel-tips .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); transform: translateY(-1px); }
.tel-tips li.good .dot { background: var(--good); }
.tel-tips li.bad .dot { background: var(--critical); }

/* канбан «в работе»: зоны закрытия сделки внизу, видны только пока тянешь карточку */
.close-drop { position: fixed; left: 50%; bottom: 18px; transform: translate(-50%, 140%); z-index: 40; display: flex; gap: 12px; transition: transform .18s ease-out; pointer-events: none; }
.close-drop.on { transform: translate(-50%, 0); pointer-events: auto; }
.close-zone { display: flex; align-items: center; justify-content: center; gap: 8px; width: 260px; height: 64px; border-radius: 14px; border: 2px dashed var(--c); background: color-mix(in srgb, var(--c) 14%, var(--surface)); color: var(--ink); font-weight: 700; box-shadow: var(--shadow-lg); }
.close-zone svg { width: 18px; height: 18px; color: var(--c); }
.close-zone.drop { background: var(--c); color: #fff; border-style: solid; }
.close-zone.drop svg { color: #fff; }

/* лента истории сделки: вертикальная линия, значки на линии, карточки */
.tl-feed { position: relative; display: flex; flex-direction: column; gap: 8px; padding-left: 2px; }
.tl-feed::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--border); border-radius: 2px; }
.tl-day { position: relative; z-index: 1; display: flex; margin: 8px 0 2px; }
.tl-day span { margin-left: 0; padding: 3px 11px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-size: 11.5px; font-weight: 700; letter-spacing: .03em; }
.tl-item { position: relative; z-index: 1; display: flex; gap: 10px; align-items: flex-start; }
.tl-ic { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--ink-muted); box-shadow: 0 0 0 3px var(--surface); margin-top: 6px; }
.tl-ic svg { width: 14px; height: 14px; }
.tl-ic.acc { background: var(--accent); }
.tl-ic.good { background: var(--good); }
.tl-ic.bad { background: var(--critical); }
.tl-ic.muted { background: var(--surface-2); color: var(--ink-muted); }
.tl-card { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; }
.tl-head { display: flex; align-items: center; gap: 8px; min-height: 24px; }
.tl-title { flex: 1; min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13.5px; }
.tl-time { flex: none; font-size: 12px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.tl-dur { font-size: 12px; font-weight: 700; color: var(--ink-2); background: var(--surface-2); padding: 1px 7px; border-radius: 999px; }
.tl-ok { font-size: 11.5px; font-weight: 600; color: var(--good); background: var(--good-soft); padding: 1px 7px; border-radius: 999px; }
.tl-text { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; line-height: 1.45; }
.tl-result { color: var(--ink-2); background: var(--surface-2); border-radius: 8px; padding: 5px 8px; }
.tl-meta { font-size: 12px; color: var(--ink-muted); }
.tl-item.mini .tl-ic { width: 20px; height: 20px; margin: 4px 4px 0; box-shadow: 0 0 0 3px var(--surface); }
.tl-item.mini .tl-ic svg { width: 11px; height: 11px; }
.tl-item.mini .tl-card { border: 0; background: transparent; padding: 3px 0; flex-direction: row; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.tl-item.mini .tl-head { flex: 1; min-height: 0; }
.tl-item.mini .tl-title { font-size: 13px; color: var(--ink-2); }
.tl-item.mini .tl-meta { flex-basis: 100%; }
.tl-arrow { color: var(--ink-muted); }
.tl-item.pinned .tl-card { border-color: var(--accent-mid); box-shadow: inset 3px 0 0 var(--accent); }
.tl-card .call-rec { margin: 2px 0; }
.hist-pin-t { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); margin-bottom: 4px; }
.hist-pin-t svg { width: 13px; height: 13px; }
.hist-pins .tl-feed::before { display: none; }
/* перенос дела */
.resched-btn { flex: none; align-self: center; }
.resched-btn svg { width: 13px; height: 13px; }
.resched-pop { display: flex; flex-direction: column; gap: 10px; padding: 12px; width: 320px; max-width: calc(100vw - 32px); }
.resched-t { font-weight: 700; font-size: 13.5px; }
.resched-in { display: grid; grid-template-columns: 1fr 110px; gap: 8px; }
.resched-pop .row { display: flex; justify-content: flex-end; }

/* «Список» как в Б24: полоска стадий, дела, клиент */
.sbar-wrap { min-width: 150px; max-width: 190px; }
.sbar { display: flex; gap: 2px; height: 9px; }
.sbar span { flex: 1; border-radius: 2px; background: var(--surface-2); border: 1px solid var(--border); }
.sbar span.on { border-color: transparent; }
.sbar-name { font-size: 12px; color: var(--ink-muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-table .td-title { min-width: 220px; max-width: 300px; }
.deal-table td.td-act, .deal-table td.td-client { white-space: normal; min-width: 170px; max-width: 260px; }
.deal-table .lt-title { color: var(--accent); font-weight: 500; cursor: pointer; }
.deal-table tr:hover .lt-title { text-decoration: underline; }
.lt-last { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; margin-top: 6px; }
.lt-done { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--good-soft); color: var(--good); }
.lt-act { display: flex; align-items: center; gap: 5px; }
.lt-act svg { width: 13px; height: 13px; color: var(--accent); flex: none; }
.lt-act.bad svg { color: var(--critical); }
.lt-client { color: var(--accent); }
.deal-table td .sub a { color: inherit; }

/* «Дела» как в Б24: колонки по сроку ближайшего дела */
.acol .col-add.quick { border-style: solid; background: var(--surface); color: var(--ink); font-weight: 600; }
.acard { cursor: pointer; gap: 3px; }
.acard::before { display: none; }
.acard-top { display: flex; align-items: flex-start; gap: 8px; }
.acard-top .card-title { flex: 1; }
.acard-cnt { flex: none; min-width: 18px; height: 18px; border-radius: 999px; background: var(--surface-2); color: var(--ink-muted); font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 5px; }
.acard-cnt.on { background: var(--accent); color: #fff; }
.acard-date { font-size: 12px; color: var(--ink-muted); }
.acard-next { display: flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-2); }
.acard-next svg { width: 13px; height: 13px; color: var(--accent); flex: none; }
.acard-next.bad, .acard-next.bad svg { color: var(--critical); }
.acard-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.acard-ic { display: flex; align-items: center; gap: 10px; }
.acard-ic a, .acard-ic button, .acard-ic > span { color: var(--ink-muted); display: inline-flex; background: none; border: 0; padding: 0; cursor: pointer; }
.acard-ic a:hover, .acard-ic button:hover { color: var(--accent); }
.acard-ic .off { opacity: .35; cursor: default; }
.acard-ic svg { width: 16px; height: 16px; }

/* звонилка: окно звонка в углу */
.dial-win { position: fixed; right: 20px; bottom: 20px; z-index: 300; width: 340px; max-width: calc(100vw - 32px); background: var(--surface, #fff); color: var(--ink);
  border: 1px solid var(--line, rgba(0,0,0,.1)); border-radius: 14px; box-shadow: 0 12px 40px rgba(16, 32, 70, .22); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.dial-top { display: flex; align-items: center; gap: 10px; }
.dial-ic { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--good); color: #fff; display: grid; place-items: center; }
.dial-ic svg { width: 17px; height: 17px; }
.dial-who { flex: 1; min-width: 0; }
.dial-who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dial-num { font-size: 12px; color: var(--ink-muted); }
.dial-time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-muted); }
.dial-st { font-size: 13px; color: var(--ink-muted); }
.dial-st.ok { color: var(--ink); }
.dial-st.bad { color: var(--critical); }
.dial-win .row { display: flex; gap: 8px; justify-content: flex-end; }
.lead-dial { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; font-weight: 600; }
.lead-dial svg { width: 15px; height: 15px; color: var(--good); }
/* звонок из АТС в истории сделки */
.call-ic { flex: none; width: 18px; height: 18px; border-radius: 50%; color: #fff; display: grid; place-items: center; margin-top: 1px; background: var(--accent); }
.call-ic svg { width: 11px; height: 11px; }
.call-ic.in { background: var(--good); }
.call-ic.bad { background: var(--critical); }
.call-rec { margin: 6px 0 2px; }
.call-rec audio { width: 100%; max-width: 420px; height: 36px; display: block; }
.call-rec .btn svg { width: 12px; height: 12px; fill: currentColor; }
.box-bad h4 { color: var(--critical); }

.rail-btn { position: relative; }
.rail-badge { position: absolute; top: 2px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-size: 10.5px; display: inline-flex; align-items: center; justify-content: center; }
.rail-badge.bad { background: #e03131; color: #fff; }
.rail-badge[hidden] { display: none; }

@media (max-width: 760px) {
  .act-when { grid-template-columns: 1fr 1fr; }
  .act-when select { grid-column: 1 / -1; }
  .filter-panel { margin: 0 16px 14px; }
  .deal-list { padding: 0 16px 16px; }
}

.kpis span, .kpis .kpi-link { white-space: nowrap; }
@media (min-width: 900px) { .fp-wide { grid-column: span 2; } }
@media (max-width: 760px) {
  .kpis { flex-wrap: wrap; margin-left: 0; gap: 4px 14px; width: 100%; }
}

/* ---------- шапка «Сделки» как в Битрикс24 (06.11) ---------- */
.deals-top { flex-wrap: wrap; gap: 10px; }
.deals-top h2 { margin-right: 4px; }
.split-btn { display: inline-flex; }
.split-btn > .btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split-btn > .split-arrow { border-top-left-radius: 0; border-bottom-left-radius: 0; padding: 0 8px; border-left: 1px solid rgba(255, 255, 255, 0.35); }
.split-btn svg, .pipe-btn svg { width: 16px; height: 16px; }
.pipe-btn { font-weight: 600; max-width: 260px; }
.pipe-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsearch { position: relative; flex: 1 1 360px; max-width: 640px; }
.fs-box { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; min-height: 38px; padding: 3px 4px 3px 5px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; cursor: text; }
.fs-box:hover, .fs-box:focus-within { border-color: var(--accent); }
.fs-chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); color: var(--ink); border: 1px solid var(--border); border-radius: 7px; padding: 2px 3px 2px 9px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.fs-chip button { border: 0; background: transparent; color: var(--ink-muted); cursor: pointer; width: 20px; height: 20px; border-radius: 5px; display: grid; place-items: center; padding: 0; }
.fs-chip button:hover { color: var(--ink); background: var(--border); }
.fs-chip svg { width: 12px; height: 12px; }
.fs-input { flex: 1 1 80px; min-width: 80px; border: 0; outline: none; background: transparent; color: var(--ink); font: inherit; font-size: 14px; padding: 5px 4px; }
.fs-input::placeholder { color: var(--ink-muted); }
.fs-icon { border: 0; background: transparent; color: var(--ink-muted); width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; cursor: pointer; padding: 0; flex: none; }
.fs-icon:hover { color: var(--ink); background: var(--surface-2); }
.fs-icon[hidden] { display: none; }
.fs-icon svg { width: 17px; height: 17px; }
.fsearch .filter-panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 40; width: min(820px, calc(100vw - 32px)); margin: 0; padding: 0; flex-direction: row; gap: 0; box-shadow: var(--shadow-lg); overflow: hidden; }
.fp-presets { flex: none; width: 190px; padding: 12px 8px; background: var(--surface-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.fp-presets-t { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); padding: 2px 10px 8px; }
.fp-presets button { border: 0; background: transparent; text-align: left; padding: 8px 10px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.fp-presets button:hover { background: var(--surface); color: var(--ink); }
.fp-presets button.on { background: var(--accent-soft); color: var(--accent); }
.fp-main { flex: 1; min-width: 0; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.seg-flat button { padding: 6px 14px; }
.counters { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 12px; }
.counter { border: 0; background: transparent; padding: 5px 10px 5px 6px; border-radius: 9px; cursor: pointer; font: inherit; font-weight: 600; font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.counter:hover { color: var(--ink); }
.counter.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.counter svg { width: 14px; height: 14px; margin-left: -3px; }
.counter .cnt { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--border-strong); color: var(--ink-2); }
.counter .cnt.has { background: var(--accent); color: var(--accent-ink); }
.counter .cnt.bad { background: var(--critical); color: #fff; }
.menu-pop button.on { background: var(--accent-soft); color: var(--accent); }
.menu-pop svg { width: 16px; height: 16px; flex: none; }
.menu-n { margin-left: auto; padding-left: 14px; font-size: 12.5px; color: var(--ink-muted); }
.menu-n.bad { color: var(--critical); }
.menu-sep { height: 1px; background: var(--border); margin: 4px 6px; }
.kpi-bad b { color: var(--critical); }

/* вид «Дела» */
.acts-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.td-check { width: 40px; }
.act-check { width: 22px; height: 22px; border-radius: 50%; border: 1.6px solid var(--border-strong); background: var(--surface); color: transparent; cursor: pointer; display: grid; place-items: center; padding: 0; }
.act-check:hover { border-color: var(--good); color: var(--good); }
.act-check.on { background: var(--good); border-color: var(--good); color: #fff; }
.act-check svg { width: 13px; height: 13px; }
.act-ic { display: inline-flex; color: var(--accent); margin-right: 6px; vertical-align: -3px; }
.act-ic svg { width: 16px; height: 16px; }
.due-bad { color: var(--critical); font-weight: 600; }

/* вид «Календарь» */
.cal-wrap { padding: 0 24px 24px; }
.cal-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.cal-head h3 { margin: 0 6px; font-size: 17px; min-width: 150px; text-align: center; }
.cal-head .cal-next svg { transform: scaleX(-1); }
.cal-head .hint { margin-left: 8px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-dow { padding: 8px 10px; font-size: 12px; font-weight: 700; color: var(--ink-muted); text-transform: uppercase; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal-day { min-height: 112px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.wknd { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.cal-day.out { opacity: .5; }
.cal-num { font-size: 12.5px; font-weight: 700; color: var(--ink-2); padding: 1px 4px; align-self: flex-start; border-radius: 999px; }
.cal-day.today .cal-num { background: var(--accent); color: var(--accent-ink); }
.cal-act { display: flex; gap: 5px; align-items: baseline; border: 0; border-left: 3px solid var(--c, var(--accent)); background: var(--surface-2); border-radius: 5px; padding: 3px 6px; font: inherit; font-size: 12px; text-align: left; cursor: pointer; color: var(--ink); min-width: 0; width: 100%; }
.cal-act:hover { background: var(--accent-soft); }
.cal-act.bad { background: var(--critical-soft); }
.cal-act.done .cal-s { text-decoration: line-through; color: var(--ink-muted); }
.cal-t { font-weight: 700; color: var(--ink-2); flex: none; }
.cal-s { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-more { border: 0; background: none; color: var(--accent); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; text-align: left; padding: 2px 6px; }
.cal-pop { display: flex; flex-direction: column; gap: 4px; width: 300px; max-height: 360px; overflow: auto; }
.cal-pop-t { font-weight: 700; padding: 2px 4px 6px; }
@media (max-width: 760px) {
  .fsearch { flex-basis: 100%; max-width: none; }
  .fsearch .filter-panel { flex-direction: column; max-height: 70vh; overflow-y: auto; }
  .fp-presets { width: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); }
  .fp-presets-t { display: none; }
  .cal-wrap { padding: 0 16px 16px; }
  .cal-day { min-height: 70px; }
  .cal-s { display: none; }
}

/* ---------- свои поля и контакты в карточках (перенос из Б24, 06.11) ---------- */
.ro-val { padding: 8px 0; color: var(--ink-2); }
.multi-check { display: flex; flex-wrap: wrap; gap: 4px 14px; max-height: 180px; overflow: auto; padding: 4px 0; }
.multi-check .check { font-size: 13px; }
.more-fields { display: inline-block; margin-top: 10px; font-size: 13px; }
.box > .grid2 + .grid2 { margin-top: 12px; }
.contact-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.contact { display: flex; gap: 10px; align-items: center; padding: 8px 10px; background: var(--surface-2); border-radius: 10px; }
.contact .sub a { color: var(--accent); text-decoration: none; }
.contact .sub a:hover { text-decoration: underline; }
.mini-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mini-table th { text-align: left; font-size: 12px; color: var(--ink-muted); font-weight: 700; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.mini-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
.mini-table .num { text-align: right; white-space: nowrap; }
.mini-table tfoot td { font-weight: 700; border-bottom: 0; }
.load-more { display: flex; justify-content: center; padding: 14px; border-top: 1px solid var(--border); }

/* лиды: подпись в меню «Создать сделку в воронке» */
.menu-pop .menu-sep-t { padding: 6px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); }

/* пометка о ночной синхронизации с Битрикс24 в шапке «Сделки»/«Лиды» */
.sync-note { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-muted); white-space: nowrap; cursor: help; }
.sync-note svg { width: 14px; height: 14px; }
.sync-note.bad { color: var(--bad, #c0392b); font-weight: 600; }

/* фото сотрудника в аватарке */
.avatar.photo { background-size: cover; background-position: center; background-color: var(--surface-2); color: transparent; }
/* личный профиль */
.profile-dw .profile-head { display: flex; align-items: center; gap: 18px; }
.profile-photo { flex: none; width: 96px; height: 96px; border-radius: 50%; background: var(--surface-2) center / cover no-repeat; display: grid; place-items: center; color: var(--ink-muted); box-shadow: inset 0 0 0 1px var(--line, rgba(0,0,0,.08)); }
.profile-photo.empty { border: 2px dashed var(--line-strong, #c5cbd8); box-shadow: none; }
.profile-photo svg { width: 38px; height: 38px; }
.profile-dw .welcome { background: var(--accent-soft, #eef0ff); border-color: transparent; }
.profile-dw .welcome p { margin: 6px 0 0; }
.phones { display: flex; flex-direction: column; gap: 8px; }
.phone-row { display: flex; gap: 8px; align-items: center; }
.phone-row .input { flex: 1; min-width: 0; }
.btn-icon-gap { width: 38px; flex: none; }
.overlay.locked { cursor: default; }
.badge.invited { background: var(--warn-soft, #fff4dc); color: var(--warn, #9a6700); }
.bad-text { color: var(--bad, #c0392b); }
@media (max-width: 560px) { .profile-dw .profile-head { flex-direction: column; align-items: flex-start; } }
/* профиль — одна аккуратная колонка */
.drawer.profile-dw { width: min(620px, 100%); }
.drawer.profile-dw .drawer-body { grid-template-columns: 1fr; }
.drawer.profile-dw .box.profile-head { display: flex; flex-direction: row; align-items: center; gap: 18px; }
@media (max-width: 560px) { .drawer.profile-dw .box.profile-head { flex-direction: column; align-items: flex-start; } }

/* ---------- фон страницы как в Пульте (06.11): html[data-bg], выбор в меню профиля, ключ crm_bg ---------- */
html[data-bg] { background: var(--page-bg); }
html[data-bg] body { background: transparent; }
html[data-bg="brand"]  { --page-bg: url(bg-brand.jpg) center / cover no-repeat, #f3f6fc; }
html[data-bg="mesh"]   { --page-bg: radial-gradient(1100px 620px at 8% -8%, #d9e1ff 0%, rgba(217,225,255,0) 62%), radial-gradient(900px 560px at 100% 0%, #dcefff 0%, rgba(220,239,255,0) 58%), radial-gradient(1000px 700px at 78% 105%, #e9e2ff 0%, rgba(233,226,255,0) 60%), #f4f7fd; }
html[data-bg="aurora"] { --page-bg: radial-gradient(820px 520px at 14% 8%, rgba(27,42,209,0.20), rgba(27,42,209,0) 62%), radial-gradient(760px 520px at 88% 16%, rgba(0,170,200,0.17), rgba(0,170,200,0) 62%), radial-gradient(960px 640px at 58% 104%, rgba(132,86,255,0.17), rgba(132,86,255,0) 62%), linear-gradient(160deg, #eaf0fe 0%, #f3effd 55%, #e9f6f8 100%); }
html[data-bg="waves"]  { --page-bg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 900' preserveAspectRatio='none'><path d='M0 0H1440V170C1180 250 900 90 600 160S160 220 0 140Z' fill='%236672e0' fill-opacity='.07'/><path d='M0 640C300 550 540 760 880 660S1300 560 1440 610V900H0Z' fill='%231b2ad1' fill-opacity='.06'/><path d='M0 730C380 650 660 830 1000 730S1330 670 1440 700V900H0Z' fill='%231b2ad1' fill-opacity='.08'/></svg>") center / 100% 100% no-repeat, linear-gradient(180deg, #eef2fd 0%, #f6f8fe 100%); }
/* меню слева и шапка раздела — полупрозрачные, чтобы фон было видно */
html[data-bg] .side { background: rgba(255,255,255,0.45); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
html[data-bg] .topbar { background: rgba(244,247,253,0.55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
/* тёмная тема: картинку не показываем, вместо неё тёмные градиенты как в Пульте */
:root[data-theme="dark"][data-bg="brand"], :root[data-theme="dark"][data-bg="mesh"] { --page-bg: radial-gradient(1100px 620px at 8% -8%, #1b2a6e 0%, rgba(27,42,110,0) 62%), radial-gradient(900px 560px at 100% 0%, #13305a 0%, rgba(19,48,90,0) 58%), radial-gradient(1000px 700px at 78% 105%, #2a1d5e 0%, rgba(42,29,94,0) 60%), #0a0f26; }
:root[data-theme="dark"][data-bg="aurora"] { --page-bg: radial-gradient(820px 520px at 14% 8%, rgba(70,90,255,0.30), rgba(70,90,255,0) 62%), radial-gradient(760px 520px at 88% 16%, rgba(0,190,220,0.20), rgba(0,190,220,0) 62%), radial-gradient(960px 640px at 58% 104%, rgba(140,90,255,0.26), rgba(140,90,255,0) 62%), #0a0f26; }
:root[data-theme="dark"][data-bg="waves"] { --page-bg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 900' preserveAspectRatio='none'><path d='M0 0H1440V170C1180 250 900 90 600 160S160 220 0 140Z' fill='%235765c2' fill-opacity='.10'/><path d='M0 640C300 550 540 760 880 660S1300 560 1440 610V900H0Z' fill='%237484f0' fill-opacity='.10'/><path d='M0 730C380 650 660 830 1000 730S1330 670 1440 700V900H0Z' fill='%237484f0' fill-opacity='.12'/></svg>") center / 100% 100% no-repeat, #0a0f26; }
:root[data-theme="dark"][data-bg] .side { background: rgba(10,15,38,0.30); }
:root[data-theme="dark"][data-bg] .topbar { background: rgba(10,15,38,0.45); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"])[data-bg="brand"], :root:not([data-theme="light"])[data-bg="mesh"] { --page-bg: radial-gradient(1100px 620px at 8% -8%, #1b2a6e 0%, rgba(27,42,110,0) 62%), radial-gradient(900px 560px at 100% 0%, #13305a 0%, rgba(19,48,90,0) 58%), radial-gradient(1000px 700px at 78% 105%, #2a1d5e 0%, rgba(42,29,94,0) 60%), #0a0f26; }
  :root:not([data-theme="light"])[data-bg="aurora"] { --page-bg: radial-gradient(820px 520px at 14% 8%, rgba(70,90,255,0.30), rgba(70,90,255,0) 62%), radial-gradient(760px 520px at 88% 16%, rgba(0,190,220,0.20), rgba(0,190,220,0) 62%), radial-gradient(960px 640px at 58% 104%, rgba(140,90,255,0.26), rgba(140,90,255,0) 62%), #0a0f26; }
  :root:not([data-theme="light"])[data-bg="waves"] { --page-bg: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 900' preserveAspectRatio='none'><path d='M0 0H1440V170C1180 250 900 90 600 160S160 220 0 140Z' fill='%235765c2' fill-opacity='.10'/><path d='M0 640C300 550 540 760 880 660S1300 560 1440 610V900H0Z' fill='%237484f0' fill-opacity='.10'/><path d='M0 730C380 650 660 830 1000 730S1330 670 1440 700V900H0Z' fill='%237484f0' fill-opacity='.12'/></svg>") center / 100% 100% no-repeat, #0a0f26; }
  :root:not([data-theme="light"])[data-bg] .side { background: rgba(10,15,38,0.30); }
  :root:not([data-theme="light"])[data-bg] .topbar { background: rgba(10,15,38,0.45); }
}
/* переключатель в меню профиля */
.bg-pick { padding: 6px 10px 8px; }
.bg-pick-label { display: flex; align-items: center; gap: 10px; font-weight: 500; color: var(--ink-2); margin-bottom: 8px; }
.bg-pick-row { display: flex; gap: 8px; padding-left: 27px; }
.bg-sw { all: unset; box-sizing: border-box; cursor: pointer; width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--border-strong); }
.bg-sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bg-sw[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.bg-sw[data-v="plain"]  { background: #f4f7fd; }
.bg-sw[data-v="brand"]  { background: url(bg-brand.jpg) center / cover, #f3f6fc; }
.bg-sw[data-v="mesh"]   { background: radial-gradient(circle at 20% 20%, #c9d4ff, transparent 70%), radial-gradient(circle at 90% 90%, #e2d8ff, transparent 70%), #f4f7fd; }
.bg-sw[data-v="aurora"] { background: radial-gradient(circle at 20% 25%, rgba(27,42,209,.45), transparent 60%), radial-gradient(circle at 85% 30%, rgba(0,170,200,.4), transparent 60%), radial-gradient(circle at 55% 100%, rgba(132,86,255,.45), transparent 60%), #eef2fd; }
.bg-sw[data-v="waves"]  { background: linear-gradient(170deg, #f4f7fd 55%, #c9d1fb 56%, #c9d1fb 70%, #aab5f6 71%); }

/* ---------- шапка как в Битрикс24 (06.11): ☰ · Лиды/Сделки/Клиенты/Аналитика · лупа · Пригласить · Помощь · время+фото ---------- */
.header { gap: 10px; padding: 10px 20px 10px 12px; }
.hburger { all: unset; box-sizing: border-box; cursor: pointer; width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); flex: none; }
.hburger:hover { background: var(--surface-2); color: var(--ink); }
.hburger svg { width: 20px; height: 20px; }
.htabs { display: flex; align-items: center; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.htab { all: unset; box-sizing: border-box; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; padding: 8px 13px; border-radius: 10px; font-weight: 500; font-size: 14.5px; color: var(--ink-2); }
.htab:hover { background: var(--surface-2); color: var(--ink); }
.htab.on { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.htab svg { width: 14px; height: 14px; color: var(--ink-muted); }
.hburger:focus-visible, .htab:focus-visible, .hsearch-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.menu-pop button:disabled { opacity: .5; cursor: default; }
.menu-pop button:disabled:hover { background: none; }
/* лупа: по клику раскрывается строка поиска */
.gsearch.hsearch { flex: none; width: 38px; height: 38px; transition: width .18s ease; }
.gsearch.hsearch.open { width: min(360px, 40vw); }
.hsearch-btn { all: unset; box-sizing: border-box; cursor: pointer; position: absolute; left: 0; top: 0; z-index: 1; width: 38px; height: 38px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); }
.hsearch-btn:hover { background: var(--surface-2); color: var(--ink); }
.hsearch-btn svg { width: 18px; height: 18px; }
.hsearch.open .hsearch-btn:hover { background: transparent; }
.gsearch.hsearch .input { height: 38px; padding-left: 38px; opacity: 0; pointer-events: none; transition: opacity .12s; }
.gsearch.hsearch.open .input { opacity: 1; pointer-events: auto; }
.gsearch.hsearch .search-results { min-width: 340px; }
/* «Пригласить» и «Помощь» — кнопки-пилюли */
.hpill { border: 1px solid var(--border-strong); background: transparent; color: var(--ink); border-radius: 999px; padding: 6px 14px; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; }
.hpill:hover { border-color: var(--accent); color: var(--accent); }
.hpill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* время и фото */
.profile-btn.hclock { background: var(--surface-2); border-color: var(--border); padding: 3px 3px 3px 11px; gap: 7px; }
.profile-btn.hclock:hover { border-color: var(--accent); background: var(--surface-2); }
.profile-btn.hclock > svg { width: 15px; height: 15px; color: var(--ink-muted); }
.hclock-time { font-weight: 700; font-size: 14px; letter-spacing: .01em; }
.profile-btn.hclock .avatar { width: 32px; height: 32px; }
/* помощь */
.help-list { display: flex; flex-direction: column; gap: 14px; }
.help-item b { display: block; margin-bottom: 3px; }
.help-item p, .help-foot { margin: 0; color: var(--ink-2); }
.help-foot { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--border); }
@media (max-width: 1100px) { .htab { padding: 8px 9px; font-size: 13.5px; } }
@media (max-width: 860px) {
  .hburger, .htabs { display: none; }
  .header .spacer { display: none; }
  .gsearch.hsearch { flex: 1 1 auto; width: auto; }
  .gsearch.hsearch .input { opacity: 1; pointer-events: auto; }
  .gsearch.hsearch .search-results { min-width: 0; }
  .hpill { padding: 6px 10px; }
}

/* чат берёт фон из меню профиля («Фон»): переписка прозрачная, под ней фон страницы */
html[data-bg] .chat-pane, html[data-bg] .chat-scroll, html[data-bg] .chat-scroll-wrap { background: transparent; }

/* ---------- шапка чата как в Битрикс24 (06.11): «Видеозвонок ▾», добавить, поиск, панель ---------- */
.chat-tools { display: flex; align-items: center; gap: 4px; flex: none; }
.call-split { display: inline-flex; align-items: stretch; border-radius: 999px; overflow: hidden; background: var(--accent); color: var(--accent-ink); margin-right: 6px; }
.call-split button { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; font-weight: 600; font-size: 13.5px; }
.call-split .cs-main { padding: 7px 10px 7px 15px; }
.call-split .cs-more { padding: 7px 10px 7px 8px; border-left: 1px solid rgba(255,255,255,.35); }
.call-split .cs-more svg { width: 14px; height: 14px; }
.call-split button:hover { background: rgba(255,255,255,.14); }
.call-split button:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: -3px; }
button.call-split.join { all: unset; box-sizing: border-box; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; padding: 7px 15px; border-radius: 999px; background: var(--good); color: #fff; font-weight: 600; font-size: 13.5px; margin-right: 6px; animation: callPulse 1.6s ease-in-out infinite; }
button.call-split.join svg { width: 16px; height: 16px; }
@keyframes callPulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--good) 22%, transparent); } }
.chat-tool { all: unset; box-sizing: border-box; cursor: pointer; width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-muted); }
.chat-tool svg { width: 19px; height: 19px; }
.chat-tool:hover { background: var(--surface-2); color: var(--ink); }
.chat-tool.on { background: var(--accent-soft); color: var(--accent); }
.chat-tool:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chat-body { flex: 1; min-height: 0; display: flex; }
.chat-main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-panel { width: 320px; flex: none; display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-left: 1px solid var(--border); }
.chat-panel[hidden] { display: none; }
.cp-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--border); }
.cp-body { flex: 1; overflow-y: auto; padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.cp-sec { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); margin-top: 6px; }
.cp-members { display: flex; flex-direction: column; gap: 8px; }
.cp-member { display: flex; align-items: center; gap: 10px; }
.cp-m-txt { min-width: 0; } .cp-m-txt > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-files { display: flex; flex-direction: column; gap: 6px; }
.cp-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.cp-thumb { all: unset; cursor: pointer; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-2); }
.cp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cp-doc { max-width: none; }
.cp-results { display: flex; flex-direction: column; gap: 4px; }
.cp-hit { all: unset; box-sizing: border-box; cursor: pointer; padding: 8px 10px; border-radius: 10px; display: flex; flex-direction: column; gap: 3px; }
.cp-hit:hover { background: var(--surface-2); }
.cp-hit-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.cp-hit-top span { color: var(--ink-muted); white-space: nowrap; }
.cp-hit-txt { font-size: 13px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cp-hit-txt mark { background: var(--warning-soft); color: var(--ink); border-radius: 3px; padding: 0 1px; }
.msg-row.flash .bubble-msg { animation: msgFlash 1.6s ease; }
@keyframes msgFlash { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: none; } }
@media (max-width: 1100px) { .chat-panel { position: absolute; right: 0; top: 64px; bottom: 0; z-index: 4; box-shadow: var(--shadow-lg); } }
@media (max-width: 860px) {
  .call-split .cs-main { padding: 7px 8px 7px 12px; font-size: 12.5px; }
  .chat-tool { width: 32px; }
  .chat-panel { width: 100%; top: 58px; }
}

/* ---------- окно видеозвонка ---------- */
.call-win { position: fixed; inset: 0; z-index: 60; background: #0d1020; color: #fff; display: flex; flex-direction: column; }
.call-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.call-title { font-size: 15px; } .call-title b { font-weight: 600; } .call-timer { color: rgba(255,255,255,.65); font-variant-numeric: tabular-nums; }
.call-stage { flex: 1; min-height: 0; position: relative; padding: 0 16px; display: flex; }
.call-grid { flex: 1; min-height: 0; display: grid; gap: 10px; grid-template-columns: 1fr; grid-auto-rows: 1fr; }
.call-grid.n2 { grid-template-columns: 1fr 1fr; }
.call-grid.n3, .call-grid.n4 { grid-template-columns: 1fr 1fr; }
.call-grid.n5, .call-grid.n6 { grid-template-columns: 1fr 1fr 1fr; }
/* вдвоём — собеседник на весь экран, я в углу */
.call-grid.n2 { grid-template-columns: 1fr; }
.call-grid.n2 .call-tile.me { position: absolute; right: 28px; bottom: 12px; width: 240px; height: 150px; z-index: 2; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.call-tile { position: relative; border-radius: 14px; overflow: hidden; background: #1b2036; min-height: 0; }
.call-tile video { width: 100%; height: 100%; object-fit: cover; display: block; background: #1b2036; }
.call-tile.me video { transform: scaleX(-1); }
.call-tile.me.screen video, .call-tile.screen video { transform: none; object-fit: contain; background: #000; }
.call-ph { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; }
.call-ph .avatar { width: 96px; height: 96px; font-size: 32px; }
.call-tile.me .call-ph .avatar { width: 56px; height: 56px; font-size: 19px; }
.call-tile.novideo video { visibility: hidden; }
.call-tile.novideo .call-ph { display: flex; }
.call-name { position: absolute; left: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 8px; background: rgba(0,0,0,.5); font-size: 13px; font-weight: 500; }
.call-name svg { width: 14px; height: 14px; color: #ff8a80; }
.call-conn { position: absolute; top: 10px; left: 10px; padding: 4px 9px; border-radius: 8px; background: rgba(0,0,0,.5); font-size: 12.5px; }
.call-conn[hidden] { display: none; }
.call-status { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 16px; color: rgba(255,255,255,.75); pointer-events: none; }
.call-status[hidden] { display: none; }
.call-bar { display: flex; justify-content: center; gap: 12px; padding: 16px; flex-wrap: wrap; }
.call-ctl { all: unset; box-sizing: border-box; cursor: pointer; min-width: 64px; padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,.1); display: inline-flex; flex-direction: column; align-items: center; gap: 5px; font-size: 12px; color: #fff; }
.call-ctl svg { width: 22px; height: 22px; }
.call-ctl:hover { background: rgba(255,255,255,.18); }
.call-ctl:focus-visible { outline: 2px solid #8ab4f8; outline-offset: 2px; }
.call-ctl.off { background: rgba(255,255,255,.92); color: #10142b; }
.call-ctl.on { background: #3d5afe; }
.call-ctl.hang { background: #e03131; }
.call-ctl.hang:hover { background: #f03e3e; }
.call-ctl.ghost { min-width: 0; padding: 8px; background: transparent; }
.call-ctl.ghost svg { width: 18px; height: 18px; }
/* свёрнутый звонок — маленькое окно в углу, можно работать в CRM */
.call-win.mini { inset: auto 20px 20px auto; width: 340px; height: 260px; border-radius: 16px; box-shadow: 0 18px 50px rgba(0,0,0,.45); overflow: hidden; }
.call-win.mini .call-top { padding: 8px 10px; }
.call-win.mini .call-stage { padding: 0 8px; }
.call-win.mini .call-grid { gap: 4px; }
.call-win.mini .call-grid.n2 .call-tile.me { width: 96px; height: 64px; right: 14px; bottom: 6px; }
.call-win.mini .call-bar { padding: 8px; gap: 6px; }
.call-win.mini .call-ctl { min-width: 0; padding: 7px; }
.call-win.mini .call-ctl span { display: none; }
.call-win.mini .call-ctl svg { width: 18px; height: 18px; }
.call-win.mini .call-ph .avatar { width: 48px; height: 48px; font-size: 16px; }
.call-win.mini .call-name { font-size: 11px; padding: 2px 6px; left: 6px; bottom: 6px; }
@media (max-width: 860px) {
  .call-grid.n2 .call-tile.me { width: 110px; height: 150px; right: 22px; }
  .call-ctl { min-width: 54px; padding: 9px; }
  .call-win.mini { width: calc(100% - 24px); right: 12px; bottom: 76px; height: 220px; }
}

/* входящий звонок */
.call-incoming-box { position: fixed; right: 20px; top: 76px; z-index: 61; display: flex; flex-direction: column; gap: 10px; }
.call-incoming { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; border-radius: 16px; background: #10142b; color: #fff; box-shadow: 0 18px 50px rgba(0,0,0,.4); width: 360px; max-width: calc(100vw - 24px); animation: fade .2s; }
.ci-pulse { border-radius: 50%; animation: ringPulse 1.4s ease-out infinite; }
.ci-pulse .avatar { width: 44px; height: 44px; font-size: 15px; }
@keyframes ringPulse { 0% { box-shadow: 0 0 0 0 rgba(61,219,163,.55); } 100% { box-shadow: 0 0 0 14px rgba(61,219,163,0); } }
.ci-txt { flex: 1; min-width: 0; }
.ci-t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-s { font-size: 12.5px; color: rgba(255,255,255,.7); }
.call-btn { all: unset; box-sizing: border-box; cursor: pointer; width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.call-btn svg { width: 20px; height: 20px; }
.call-btn.accept { background: #17a673; } .call-btn.accept:hover { background: #1fbf86; }
.call-btn.decline { background: #e03131; } .call-btn.decline:hover { background: #f03e3e; }
.call-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media (max-width: 860px) { .call-incoming-box { left: 12px; right: 12px; top: 12px; } .call-incoming { width: auto; } }

/* ---------- панель «О чате» как в Битрикс24 (06.11) ---------- */
.chat-head-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.chat-head-title > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-seen { font-size: 12.5px; font-weight: 400; font-style: italic; color: var(--ink-muted); white-space: nowrap; }
.chat-seen.online { color: var(--good); font-style: normal; font-weight: 600; }
.chat-seen.online::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); margin-right: 5px; vertical-align: 1px; }
.cp-info { background: var(--surface-2); gap: 8px; padding: 10px; }
.chat-panel { width: 340px; }
.cp-card, .cp-block { background: var(--surface); border-radius: 14px; padding: 14px; }
.cp-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.cp-big-av { width: 96px; height: 96px; border-radius: 50%; background-size: cover; background-position: center; font-size: 30px; margin-bottom: 6px; flex: none; }
.cp-big-av.group { display: inline-flex; align-items: center; justify-content: center; background: var(--accent-mid); color: #fff; }
.cp-big-av.group svg { width: 44px; height: 44px; }
.cp-name { font-weight: 700; font-size: 16px; }
.cp-pos { font-size: 13px; color: var(--ink-muted); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-chip { border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; padding: 4px 11px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 12.5px; }
.cp-chip svg { width: 13px; height: 13px; }
.cp-chip:hover { filter: brightness(.97); }
.cp-chip.sm { margin: 0; }
.cp-toggle { align-self: stretch; display: flex; align-items: center; gap: 9px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--accent); font-weight: 600; cursor: pointer; }
.cp-toggle svg { width: 17px; height: 17px; }
.cp-toggle span { flex: 1; text-align: left; }
.switch { appearance: none; -webkit-appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; flex: none; margin: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(16px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cp-block { display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.cp-row, .cp-block-head { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 10px; color: var(--accent); font-weight: 600; }
.cp-row:hover, .cp-block-head:not(.static):hover { background: var(--surface-2); }
.cp-row > svg:first-child { width: 17px; height: 17px; }
.cp-row span { flex: 1; }
.cp-row > svg:last-child, .cp-block-head > svg:last-child { width: 14px; height: 14px; color: var(--ink-muted); }
.cp-block-head { color: var(--ink); justify-content: space-between; }
.cp-block-head b { flex: 1; }
.cp-block-head.static { cursor: default; }
.cp-row:focus-visible, .cp-block-head:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cp-count { min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-muted); font-size: 12px; text-align: center; font-weight: 600; }
.cp-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 4px 6px 6px; }
.cp-tile { all: unset; box-sizing: border-box; cursor: pointer; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cp-tile-pic { aspect-ratio: 4 / 3; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.cp-tile-pic img { width: 100%; height: 100%; object-fit: cover; }
.cp-tile-name { font-size: 11.5px; color: var(--ink-2); text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-all; }
.cp-tile:hover .cp-tile-pic { border-color: var(--accent); }
.cp-tile:focus-visible .cp-tile-pic { outline: 2px solid var(--accent); }
.cp-ext { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ink-muted); }
.cp-ext svg { width: 26px; height: 26px; }
.cp-ext i { font-style: normal; font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 4px; background: var(--ink-muted); color: #fff; }
.cp-ext.pdf i { background: #e03131; }
.cp-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px 14px; color: var(--ink-muted); font-size: 13px; text-align: center; }
.cp-empty svg { width: 22px; height: 22px; padding: 7px; box-sizing: content-box; border-radius: 50%; background: var(--surface-2); }
.cp-items { display: flex; flex-direction: column; gap: 2px; padding: 0 4px 4px; }
.cp-item { display: flex; align-items: flex-start; gap: 9px; padding: 7px 6px; border-radius: 10px; }
.cp-item:hover { background: var(--surface-2); }
.cp-item input { margin-top: 3px; accent-color: var(--accent); width: 15px; height: 15px; }
.cp-item-ic svg { width: 16px; height: 16px; color: var(--accent); margin-top: 2px; }
.cp-item-txt { flex: 1; min-width: 0; word-break: break-word; }
.cp-item.done .cp-item-txt > div:first-child { text-decoration: line-through; color: var(--ink-muted); }
.cp-back { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.cp-back svg { width: 18px; height: 18px; }
.cp-info > .cp-member, .cp-info > .cp-hit, .cp-info > .cp-link { background: var(--surface); }
.cp-info > .cp-member { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; background: var(--surface); }
.cp-info > .cp-member:hover, .cp-info > .cp-hit:hover { outline: 1px solid var(--accent); }
.cp-info > .cp-hit { border-radius: 12px; }
.cp-link { display: flex; flex-direction: column; gap: 3px; padding: 9px 10px; border-radius: 12px; min-width: 0; }
.cp-link a { color: var(--accent); word-break: break-all; font-size: 13px; }
.cp-link-meta { all: unset; cursor: pointer; font-size: 12px; color: var(--ink-muted); }
.cp-link-meta:hover { color: var(--ink); text-decoration: underline; }
.cp-tiles.all { background: var(--surface); border-radius: 14px; padding: 10px; }
.cp-info > .cp-empty { background: var(--surface); border-radius: 14px; }
.msg-star svg { width: 11px; height: 11px; fill: #f5b301; color: #f5b301; }
.qa.on svg { fill: #f5b301; color: #f5b301; }
.uc { padding: 4px 0 12px; }
.uc-box { display: flex; flex-direction: column; gap: 10px; }
.uc-line { display: flex; flex-direction: column; gap: 1px; }
.uc-line a { color: var(--accent); }
@media (max-width: 860px) { .chat-panel { width: 100%; } .chat-head-title { flex-direction: column; gap: 0; } }

/* автоудаление, «Мои дела» из чатов, последний вход */
.cp-ad { align-self: stretch; display: flex; flex-direction: column; }
.cp-ad .cp-toggle { margin-top: 10px; padding-top: 10px; }
.cp-ad-sub { all: unset; cursor: pointer; align-self: flex-start; margin-left: 26px; font-size: 12.5px; color: var(--ink-muted); }
.cp-ad-sub:not(:disabled):hover { color: var(--accent); text-decoration: underline; }
.cp-ad-sub:disabled { cursor: default; }
.cp-ad-hint { margin-left: 26px; text-align: left; font-size: 12px; }
.switch:disabled { opacity: .5; cursor: not-allowed; }
.chat-act input { margin-top: 4px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.chat-act-ic svg { width: 18px; height: 18px; color: var(--accent); margin-top: 2px; }
.chat-act .act-main { cursor: default; }
.chat-act-link { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--accent); }
.chat-act-link svg { width: 14px; height: 14px; }
.chat-act-link:hover { text-decoration: underline; }
.act-row.bad .chat-act-link { color: var(--critical); }
td.nowrap { white-space: nowrap; color: var(--ink-2); font-size: 13px; }
td.online-text { color: var(--good); font-weight: 600; }
.cp-m-txt .chat-seen { font-size: 11.5px; }

/* карточка сделки/лида (06.11): «О сделке» — узкая колонка слева, дела и история — широкая справа, как в Битрикс24 */
.drawer.wide .drawer-body { grid-template-columns: minmax(330px, 0.8fr) minmax(0, 1.45fr); }
.drawer.wide .drawer-body > :first-child .grid2 { gap: 10px; }
.drawer.wide .drawer-body > :first-child .field > span { font-size: 11.5px; }
.drawer.wide .drawer-body > :first-child .input { padding: 7px 10px; }
.drawer.wide .drawer-body > :first-child textarea.input { min-height: 56px; }
@media (max-width: 860px) { .drawer.wide .drawer-body { grid-template-columns: 1fr; } }

/* ---------- карточка сделки: «О сделке» как в Битрикс24 (06.11) ---------- */
.title-edit { display: block; width: 100%; margin-top: 2px; font: inherit; font-size: 20px; font-weight: 700; color: var(--ink); border: 1px solid transparent; border-radius: 8px; padding: 2px 6px; margin-left: -7px; background: transparent; }
.title-edit:hover { border-color: var(--border-strong); }
.title-edit:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.drawer-title h3 { flex: 1; min-width: 0; }
.deal-sec { display: flex; flex-direction: column; gap: 10px; }
.sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.sec-head h4 { margin: 0; }
.deal-sec.closed .sec-head { padding-bottom: 0; border-bottom: 0; }
.sec-toggle { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.sec-toggle svg { width: 15px; height: 15px; color: var(--ink-muted); }
.sec-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.linkbtn { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ink-muted); border-bottom: 1px dashed currentColor; line-height: 1.2; }
.linkbtn svg { width: 12px; height: 12px; }
.linkbtn:hover { color: var(--accent); }
.linkbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.vf { display: flex; flex-direction: column; gap: 3px; }
.vf-l { font-size: 12px; color: var(--ink-muted); }
.vf-v { font-size: 14.5px; word-break: break-word; }
.vf.pre .vf-v { white-space: pre-wrap; }
.vf-v.empty { color: var(--ink-muted); padding: 0; text-align: left; font-size: 13.5px; }
/* даты и тип продукта — правятся прямо в просмотре карточки */
.input.inline-in { width: auto; min-width: 170px; max-width: 260px; padding: 5px 9px; font-size: 14px; height: auto; }
.btn.attn { box-shadow: 0 0 0 3px var(--accent-soft); }
.pipe-link { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 3px; color: var(--accent); border-bottom: 1px dashed currentColor; }
.pipe-link svg { width: 11px; height: 11px; }
.pipe-link:disabled { cursor: default; color: inherit; border-bottom: 0; }
.pipe-link:disabled svg { display: none; }
.vf-amount { font-size: 28px; font-weight: 500; letter-spacing: -0.01em; }
.client-card { border: 1px solid var(--border); border-radius: 12px; padding: 4px 14px; background: var(--surface); }
.client-card .ci-sec { padding: 12px 0; display: flex; flex-direction: column; gap: 3px; }
.client-card .ci-sec + .ci-sec { border-top: 1px solid var(--border); }
.ci-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.ci-name { all: unset; cursor: pointer; font-size: 16px; font-weight: 500; color: var(--ink); word-break: break-word; }
.ci-name:hover { color: var(--accent); text-decoration: underline; }
.ci-name:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ci-name.plain { cursor: default; } .ci-name.plain:hover { color: var(--ink); text-decoration: none; }
.ci-acts { display: inline-flex; gap: 8px; flex: none; }
.ci-acts a { color: var(--accent); display: inline-flex; padding: 2px; border-radius: 6px; }
.ci-acts a:hover { background: var(--accent-soft); }
.ci-acts svg { width: 18px; height: 18px; }
.ci-sub { font-size: 13px; color: var(--ink-muted); }
.ci-line { font-size: 13px; font-weight: 600; color: var(--ink-2); word-break: break-word; }
.ci-line a { color: inherit; text-decoration: none; } .ci-line a:hover { color: var(--accent); text-decoration: underline; }
.ci-lines { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.ci-line .ci-k { font-weight: 400; color: var(--ink-muted); }
.ci-addr { font-size: 13px; color: var(--ink-2); word-break: break-word; }
.ci-addr b { font-weight: 600; }
.ci-addr a { color: inherit; text-decoration: none; } .ci-addr a:hover { color: var(--accent); text-decoration: underline; }
.client-card.edit .picked { margin-bottom: 6px; }
.client-card.edit .picked a span { white-space: normal; }
.inn-row { display: flex; gap: 8px; }
.inn-row .input { flex: 1; }
.inn-res:empty { display: none; }
.inn-res { margin-top: 8px; }
.inn-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); }
.inn-card .hint { margin-top: 3px; }
.resp-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.resp-card .avatar { width: 36px; height: 36px; }
.rc-name { font-weight: 500; color: var(--accent); }
.tz-now { color: var(--ink-muted); font-size: 13px; }
.sec-foot { display: flex; align-items: center; gap: 16px; padding-top: 10px; border-top: 1px solid var(--border); }
.pick-pop { display: flex; flex-direction: column; gap: 8px; width: 300px; max-width: calc(100vw - 32px); }
.pick-fields { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 2px; }
.pick-fields .check { align-items: flex-start; font-size: 13.5px; }
.pick-fields .check input { margin-top: 2px; flex: none; }
.more-filled { display: flex; flex-direction: column; gap: 12px; }
