/* outreach-ui v3 — дизайн-система кабинетов outreach / reputation (05.10.2026, отзыв Влада 23434).
   Ориентиры: Attio / Linear / HubSpot — боковая навигация, плотные таблицы с сортировкой и фильтрами,
   карточки записей (компания, человек, ящик, аккаунт) с лентой касаний. Две темы: тёмная — токены
   дизайн-системы v2 (specs/dashboard-design-system.md), светлая — та же сетка. Тема — по системе или
   переключателем (data-theme на <html>). */

:root {
  --sb-w: 244px; --top-h: 56px; --r: 12px; --r-sm: 8px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0e14; --bg-2: #0e121a; --sb: #0d1118; --surface: #12161f; --surface-2: #171c27; --surface-3: #1f2634;
  --line: rgba(255,255,255,.07); --line-2: rgba(255,255,255,.13);
  --text: #eef1f7; --text-2: #c9d0dd; --muted: #9aa4b8; --dim: #6b7488;
  --accent: #5cb3ff; --accent-2: #8b7cff; --accent-bg: rgba(92,179,255,.12); --accent-line: rgba(92,179,255,.35);
  --good: #3fd68a; --good-bg: rgba(63,214,138,.12); --warn: #f5b74a; --warn-bg: rgba(245,183,74,.13);
  --bad: #ff6b7a; --bad-bg: rgba(255,107,122,.13); --info-bg: rgba(139,124,255,.13);
  --row-hover: rgba(255,255,255,.035); --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.28);
  --chart-grid: rgba(255,255,255,.06);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7f9; --bg-2: #f1f3f6; --sb: #fbfbfc; --surface: #ffffff; --surface-2: #f7f8fa; --surface-3: #eef0f4;
  --line: #e7e9ee; --line-2: #d6dae2;
  --text: #111827; --text-2: #374151; --muted: #5b6475; --dim: #8a93a3;
  --accent: #2f6fe4; --accent-2: #6d5be6; --accent-bg: rgba(47,111,228,.09); --accent-line: rgba(47,111,228,.35);
  --good: #13945b; --good-bg: rgba(19,148,91,.10); --warn: #b9770e; --warn-bg: rgba(217,145,20,.13);
  --bad: #d43a4c; --bad-bg: rgba(212,58,76,.10); --info-bg: rgba(109,91,230,.10);
  --row-hover: #f6f8fb; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --chart-grid: rgba(17,24,39,.07);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #f6f7f9; --bg-2: #f1f3f6; --sb: #fbfbfc; --surface: #ffffff; --surface-2: #f7f8fa; --surface-3: #eef0f4;
    --line: #e7e9ee; --line-2: #d6dae2;
    --text: #111827; --text-2: #374151; --muted: #5b6475; --dim: #8a93a3;
    --accent: #2f6fe4; --accent-2: #6d5be6; --accent-bg: rgba(47,111,228,.09); --accent-line: rgba(47,111,228,.35);
    --good: #13945b; --good-bg: rgba(19,148,91,.10); --warn: #b9770e; --warn-bg: rgba(217,145,20,.13);
    --bad: #d43a4c; --bad-bg: rgba(212,58,76,.10); --info-bg: rgba(109,91,230,.10);
    --row-hover: #f6f8fb; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
    --chart-grid: rgba(17,24,39,.07);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { overflow-x: hidden; }
body {
  background: var(--bg); color: var(--text); font: 14px/1.5 var(--font);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.nowrap { white-space: nowrap; }
.ico { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.ico.sm { width: 14px; height: 14px; vertical-align: -2px; }
.ico.lg { width: 20px; height: 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── каркас: боковая панель + верхняя строка ── */
.app { display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr); min-height: 100vh; }
/* колонка сайдбара тянется на всю высоту страницы (фон и граница), сам сайдбар внутри — липкий */
.sb-col { background: var(--sb); border-right: 1px solid var(--line); min-height: 100vh; }
.sb {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--sb);
  display: flex; flex-direction: column; padding: 14px 12px;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; color: var(--text); font-weight: 650; }
.sb-brand:hover { text-decoration: none; }
.mark {
  width: 28px; height: 28px; border-radius: 8px; flex: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); font-size: 13px; font-weight: 700;
}
.sb-brand small { display: block; font-weight: 450; color: var(--dim); font-size: 11.5px; margin-top: -2px; }
.sb-group { margin: 10px 0 4px; padding: 0 10px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.sb a.nav {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--text-2);
  font-weight: 500; margin: 1px 0;
}
.sb a.nav:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.sb a.nav.active { background: var(--accent-bg); color: var(--accent); }
.sb a.nav .cnt { margin-left: auto; font-size: 11.5px; color: var(--dim); font-weight: 500; }
.sb a.nav .cnt.bad { color: var(--bad); }
.sb-foot { margin-top: auto; padding: 12px 8px 4px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: grid; gap: 6px; }
.fresh { display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); display: inline-block; flex: none; }
.dot.stale { background: var(--warn); }
.dot.dead { background: var(--bad); }

.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; gap: 12px;
  padding: 0 24px; background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; min-width: 0; white-space: nowrap; overflow: hidden; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--text); }
.crumbs .cur { color: var(--text); font-weight: 550; overflow: hidden; text-overflow: ellipsis; }
.gsearch { margin-left: auto; position: relative; width: min(420px, 38vw); }
.gsearch input {
  width: 100%; height: 34px; padding: 0 12px 0 34px; border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px;
}
.gsearch input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-bg); }
.gsearch .ico { position: absolute; left: 10px; top: 9px; color: var(--dim); }
.gsearch kbd { position: absolute; right: 8px; top: 7px; }
kbd { font: 11px var(--mono); color: var(--dim); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; background: var(--surface-2); }
.top-actions { display: flex; align-items: center; gap: 8px; }
.btn, .ibtn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text-2); font: inherit; font-size: 13px;
  font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover, .ibtn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn.primary:hover { filter: brightness(1.06); background: var(--accent); }
.ibtn { width: 32px; padding: 0; justify-content: center; }
.top form { margin: 0; }
.menu-btn { display: none; }

.page { padding: 22px 24px 48px; display: grid; gap: 18px; max-width: 2800px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.page-head .lead { color: var(--muted); margin-top: 2px; max-width: 900px; }
.page-head .acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ── карточки ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; flex-wrap: wrap; }
.card-h h2 { margin: 0; font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card-h .desc { color: var(--muted); font-size: 12.5px; flex-basis: 100%; margin-top: 2px; }
.card-h .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-b { padding: 14px 16px 16px; }
.card-b.flush { padding: 10px 0 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.grid-side { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 18px; align-items: start; }

/* ── KPI ── */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; min-width: 0; color: inherit; position: relative;
}
a.kpi:hover { border-color: var(--accent-line); text-decoration: none; }
.kpi .k-l { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kpi .k-v { font-size: 26px; font-weight: 650; letter-spacing: -.02em; line-height: 1.25; }
.kpi .k-s { color: var(--muted); font-size: 12px; }
.kpi .k-spark { display: block; width: 100%; height: 26px; margin-top: 8px; opacity: .9; }
.delta { font-size: 12px; font-weight: 600; border-radius: 6px; padding: 0 6px; margin-left: 6px; }
.delta.up { color: var(--good); background: var(--good-bg); }
.delta.down { color: var(--bad); background: var(--bad-bg); }
.delta.flat { color: var(--muted); background: var(--surface-3); }

/* ── значки ── */
.pill {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px;
  font-weight: 550; line-height: 20px; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
  border: 1px solid transparent; vertical-align: middle;
}
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.acc { background: var(--accent-bg); color: var(--accent); }
.pill.info { background: var(--info-bg); color: var(--accent-2); }
.pill.ghost { background: transparent; border-color: var(--line-2); color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: 4px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 650;
  font-size: 12.5px; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.avatar.sq { border-radius: 8px; }
.avatar.lg { width: 48px; height: 48px; font-size: 17px; }
.avatar.c1 { background: linear-gradient(135deg, #5cb3ff, #3a7bd5); }
.avatar.c2 { background: linear-gradient(135deg, #8b7cff, #5b45e0); }
.avatar.c3 { background: linear-gradient(135deg, #3fd68a, #189a5c); }
.avatar.c4 { background: linear-gradient(135deg, #f5b74a, #d1840c); }
.avatar.c5 { background: linear-gradient(135deg, #ff6b7a, #d43a4c); }
.avatar.c6 { background: linear-gradient(135deg, #4fd1c5, #2c8c84); }
.ent { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ent > div { min-width: 0; }
.ent .t { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
a.ent:hover { text-decoration: none; }
a.ent:hover .t { color: var(--accent); }
.ent .s { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

/* ── таблицы ── */
.tbl-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 16px 10px; }
.tbl-tools input[type=search] {
  height: 32px; min-width: 240px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px;
}
.tbl-tools .count { color: var(--muted); font-size: 12.5px; margin-left: auto; }
.tbl-wrap { overflow-x: auto; }
@media (min-width: 1100px) { .tbl-wrap { overflow: visible; } }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th {
  position: sticky; top: var(--top-h); z-index: 5; background: var(--surface); text-align: left; font-weight: 550;
  color: var(--muted); font-size: 12px; padding: 9px 8px; border-bottom: 1px solid var(--line); white-space: normal;
  vertical-align: bottom; line-height: 1.3;
}
.tbl .pill { white-space: normal; line-height: 1.35; padding-top: 2px; padding-bottom: 2px; }
.tbl th:first-child, .tbl td:first-child { padding-left: 16px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 16px; }
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th a { color: inherit; }
.tbl th .si { opacity: .5; margin-left: 3px; font-size: 10px; display: none; }
.tbl th.sortable:hover .si, .tbl th a:hover .si { display: inline; }
.tbl th.sorted { color: var(--text); }
.tbl th.sorted .si { opacity: 1; color: var(--accent); display: inline; }
.tbl th .tip { cursor: help; border-bottom: 1px dotted var(--dim); }
.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--row-hover); }
.tbl tr[data-href] { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; }
.tbl td b { color: var(--text); font-weight: 600; }
.tbl tr.muted td { opacity: .62; }
.tbl tr.hidden { display: none; }
.tbl .email { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.cell-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 460px; }
.clamp.c1 { -webkit-line-clamp: 1; }
.tbl-foot { display: flex; align-items: center; gap: 12px; padding: 10px 16px 14px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.tbl-foot .count { color: var(--muted); font-size: 12.5px; }

/* пагинация */
.pager { display: flex; gap: 4px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 32px; height: 32px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 8px;
  border: 1px solid var(--line-2); color: var(--text-2); font-size: 13px; background: var(--surface);
}
.pager a:hover { background: var(--surface-2); text-decoration: none; }
.pager .cur { background: var(--accent); color: #fff; border-color: transparent; font-weight: 600; }
.pager .gap { border: 0; background: none; min-width: 16px; }
.pager .off { opacity: .4; }

/* фильтры */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 0 16px 12px; margin: 0; }
.filters label { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.filters input, .filters select {
  height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface);
  color: var(--text); font: inherit; font-size: 13px; max-width: 260px;
}
.filters input[type=search] { min-width: 260px; }
.filters input:focus, .filters select:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-bg); }
.filters .reset { font-size: 12.5px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 9px; padding: 2px; background: var(--surface-2); flex-wrap: wrap; gap: 2px; }
.seg a { padding: 4px 10px; border-radius: 7px; color: var(--muted); font-size: 12.5px; font-weight: 550; white-space: nowrap; }
.seg a:hover { color: var(--text); text-decoration: none; }
.seg a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg a .n { color: var(--dim); font-weight: 500; margin-left: 4px; }

/* ── запись: шапка карточки компании / человека / ящика ── */
.rec { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.rec h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.01em; overflow-wrap: anywhere; }
.rec .facts { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; color: var(--muted); font-size: 13px; }
.rec .facts span { display: inline-flex; align-items: center; gap: 5px; }
.rec .acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; font-size: 13px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }

/* ── лента касаний ── */
.tl { display: grid; }
.tl-item { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.tl-item:first-child { border-top: 0; }
.tl-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.tl-ic.in { background: var(--good-bg); color: var(--good); }
.tl-ic.li { background: rgba(10,102,194,.14); color: #3d8fe0; }
.tl-ic.bad { background: var(--bad-bg); color: var(--bad); }
.tl-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; font-size: 13px; }
.tl-head .what { font-weight: 600; color: var(--text); }
.tl-head .when { color: var(--dim); font-size: 12px; margin-left: auto; white-space: nowrap; }
.tl-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tl-meta a { color: var(--text-2); }
.tl-meta a:hover { color: var(--accent); }
.tl-subj { margin-top: 6px; font-weight: 550; color: var(--text); }
.tl-text { margin-top: 4px; color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
details.more { margin-top: 6px; }
details.more summary { cursor: pointer; color: var(--accent); font-size: 12.5px; list-style: none; }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] summary { margin-bottom: 4px; }
.body-text { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--text-2); font-size: 13px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; max-height: 420px; overflow: auto; }
mark { background: rgba(245,183,74,.35); color: inherit; border-radius: 3px; padding: 0 2px; }

/* ── флаги «требует внимания» ── */
.alerts { display: grid; }
a.alert, .alert { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 11px 16px;
  border-top: 1px solid var(--line); color: inherit; }
.alert:first-child { border-top: 0; }
a.alert:hover { background: var(--row-hover); text-decoration: none; }
.alert .a-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
.alert .a-ic.bad { background: var(--bad-bg); color: var(--bad); }
.alert .a-ic.warn { background: var(--warn-bg); color: var(--warn); }
.alert .a-t { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.alert .a-s { color: var(--muted); font-size: 12.5px; }
.alert .go { color: var(--accent); font-size: 12.5px; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }

/* ── графики ── */
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 180px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.chart-cap { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* шкала остатка */
.meter { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 6px; max-width: 220px; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--good); }
.meter.warn > span { background: var(--warn); }
.meter.bad > span { background: var(--bad); }
.spark-cell { display: flex; align-items: flex-end; gap: 2px; height: 26px; }
.spark-cell span { width: 5px; border-radius: 2px 2px 0 0; background: var(--accent); opacity: .75; min-height: 2px; }
.spark-cell span:hover { opacity: 1; }

/* ── карточки аккаунтов LinkedIn / Reddit ── */
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
a.acc-card, .acc-card { display: grid; gap: 10px; padding: 16px; color: inherit; }
a.acc-card:hover { border-color: var(--accent-line); text-decoration: none; }
.acc-card .stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.acc-card .stat b { display: block; font-size: 17px; color: var(--text); font-weight: 650; }
.acc-card .stat span { color: var(--muted); font-size: 11.5px; }
.acc-card .tech { color: var(--dim); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 12px; border-top: 1px dashed var(--line); padding-top: 8px; }

/* подсказки по наведению: data-tip */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: 0; top: calc(100% + 6px); z-index: 50; width: max-content; max-width: 340px;
  white-space: normal; background: var(--surface-3); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 7px 10px; font-size: 12px; font-weight: 450; line-height: 1.45; box-shadow: var(--shadow); text-transform: none; letter-spacing: 0;
}
th[data-tip]:hover::after { top: calc(100% + 2px); }

.empty { color: var(--muted); padding: 22px 16px; text-align: center; font-size: 13px; }
.empty .ico { width: 22px; height: 22px; display: block; margin: 0 auto 6px; color: var(--dim); }
.note { color: var(--muted); font-size: 12.5px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); }
.note.warn { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.copy { background: none; border: 0; padding: 0 2px; color: var(--dim); cursor: pointer; }
.copy:hover { color: var(--accent); }
.err-box { font-family: var(--mono); font-size: 12px; color: var(--bad); }

/* вход */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: min(380px, 100%); display: grid; gap: 12px; padding: 26px; }
.login .sb-brand { padding: 0 0 6px; }
.login input { height: 40px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font: inherit; }
.login .btn { height: 40px; justify-content: center; }
.login .err { color: var(--bad); font-size: 13px; }

/* ── узкие экраны ── */
@media (max-width: 1280px) { .grid-side { grid-template-columns: minmax(0, 1fr); } .grid-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sb-col { display: contents; }
  .sb { position: fixed; z-index: 40; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .18s; box-shadow: var(--shadow); border-right: 1px solid var(--line); }
  body.sb-open .sb { transform: none; }
  body.sb-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }
  .menu-btn { display: inline-flex; }
  .top { padding: 0 12px; gap: 8px; }
  .gsearch { width: auto; flex: 1; }
  .gsearch kbd, .hide-sm { display: none !important; }
  .page { padding: 16px 12px 40px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters input[type=search], .tbl-tools input[type=search] { min-width: 0; width: 100%; }
  .acc-grid { grid-template-columns: minmax(0, 1fr); }
  .tl-item { grid-template-columns: 28px minmax(0, 1fr); padding: 12px; gap: 10px; }
  .tl-ic { width: 28px; height: 28px; }
  .tl-head .when { margin-left: 0; }
  .rec .acts { margin-left: 0; }
  .tbl th { position: static; }
}

/* пояснения внизу страницы — как details.note на CRM-борде (Влад 23439) */
details.gloss { padding: 0; }
details.gloss > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  color: var(--accent); font-size: 13px; font-weight: 550; }
details.gloss > summary::-webkit-details-marker { display: none; }
details.gloss[open] > summary { color: var(--text); border-bottom: 1px solid var(--line); }
details.gloss .dl { padding: 14px 16px 16px; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); }
details.gloss .dl dd { color: var(--muted); line-height: 1.55; }
.sb-foot a.nav { padding: 6px 8px; font-size: 12.5px; }
.sb-foot .btn { height: 30px; font-size: 12.5px; }
.tbl td.num .cell-sub { white-space: normal; }

.alert.funnel-row { grid-template-columns: minmax(150px, 240px) minmax(0, 1fr) 76px; }
@media (max-width: 1099px) { table.tbl { min-width: 980px; } .tbl td:first-child, .tbl th:first-child { min-width: 200px; } .ent .t, .ent .s { overflow-wrap: break-word; } }
@media (max-width: 860px) { .alert.funnel-row { grid-template-columns: minmax(0, 1fr) 70px; } .alert.funnel-row .meter { grid-column: 1 / -1; grid-row: 2; } }

details.quote { margin-top: 10px; }
details.quote .quote-text { white-space: pre-wrap; color: var(--dim); border-left: 2px solid var(--line-2); padding-left: 10px; margin-top: 6px; font-size: 12.5px; }

/* ── TG-лидген: находка и черновик на одобрение (08.10) ── */
.tg-item { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; gap: 8px; min-width: 0; }
.tg-item:first-child { padding-top: 0; }
.tg-item:last-child { border-bottom: 0; padding-bottom: 0; }
.tg-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-width: 0; }
.tg-meta .cell-sub { overflow-wrap: anywhere; }
.tg-meta .go { margin-left: auto; font-size: 12.5px; display: inline-flex; align-items: center; gap: 2px; }
.tg-draft { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--accent-line); border-radius: var(--r-sm);
  background: var(--surface-2); min-width: 0; }
.tg-edit { width: 100%; min-height: 96px; resize: vertical; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px; line-height: 1.45; box-sizing: border-box; }
.tg-edit:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-bg); }
.tg-acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* TG · Диалоги (борд в реальном времени, 08.10) */
.tg-thread { display: grid; gap: 6px; max-height: 420px; overflow-y: auto; padding: 4px 2px; }
.tg-msg { max-width: 82%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); white-space: pre-wrap;
  overflow-wrap: anywhere; font-size: 14px; line-height: 1.45; }
.tg-msg.in { justify-self: start; background: var(--bg-2, transparent); }
.tg-msg.out { justify-self: end; background: var(--accent-bg); border-color: var(--accent-line); }
.tg-stop { margin-left: auto; }
.tg-instruct { display: grid; gap: 6px; }
.tg-instruct .tg-edit { min-height: 52px; }
@media (max-width: 640px) { .tg-msg { max-width: 100%; } .tg-stop { margin-left: 0; } }

/* ── Кабинет 09.10.2026: заголовок раздела в сводке, страница «Доступы» ── */
.page-head.sub { margin-top: 18px; }
.page-head.sub h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
form.inline { display: inline; margin: 0; }
.acts-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.access-add { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.access-add label { display: inline-flex; gap: 6px; align-items: center; }
.access-add input[type=text] { min-width: 180px; }
.access-add input[type=text], .access-add select, .tbl td select, .tbl td input[type=text] {
  font: inherit; font-size: 13px; color: var(--text); background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 5px 8px; }
.tbl td input[type=text] { width: 150px; margin-top: 4px; }
.access-add input:focus, .access-add select:focus, .tbl td select:focus, .tbl td input:focus {
  outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-bg); }
.pw-once { display: grid; gap: 10px; }
.pw-once code { font-family: var(--mono); font-size: 15px; padding: 2px 6px; border-radius: 6px; background: var(--bg-2, rgba(127,127,127,.12)); }

/* ── TG: одна страница-борд (Влад 24584–24589): шапка с цифрами, вкладки, список + разговор, липкий композер ── */
.tgp { display: grid; gap: 14px; min-width: 0; }
.tgh { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: flex-end; justify-content: space-between; }
.tgh-title h1 { margin: 0; font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
.tgh-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 6px; font-size: 12.5px; }
.tgh-stats { display: flex; flex-wrap: wrap; gap: 8px; }
.tgs { display: grid; gap: 1px; min-width: 104px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); }
a.tgs:hover { text-decoration: none; border-color: var(--accent-line); }
.tgs-v { font-size: 20px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.tgs-v.warn { color: var(--warn); }
.tgs-l { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tg-lead { margin: 0; }

/* 12.10 (Nova 3614): над бордом — «Твои действия» и воронка клиента одной строкой; строка прокручивается сама в себе */
.tgf { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; min-width: 0; max-width: 100%; }
.tgf-acts, .tgf-row { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow-x: auto; min-width: 0;
  scrollbar-width: thin; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
.tgf-lbl { flex: 0 0 auto; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; margin-right: 2px; }
.tgf .tgl-seg { flex: 0 0 auto; }
.tgf .tgl-seg.act { font-size: 12px; padding: 3px 9px; }
.tgf .tgl-seg.stage { font-size: 13px; padding: 6px 12px; background: var(--surface); }
.tgf .tgl-seg.stage.on { background: var(--accent-bg); }
.tgf .tgl-seg.closed { color: var(--muted); }
.tgf-arr { flex: 0 0 auto; color: var(--muted); font-size: 14px; }
.tgf-sep { flex: 0 0 1px; align-self: stretch; background: var(--line-2); margin: 3px 6px; }
.tgf-push { flex: 1 1 auto; min-width: 8px; }
/* 12.10: на десктопе строки не режем прокруткой — всё на виду (на 1 280 «Закрыты» переносятся); «Находки» — таблица
   прокручивается внутри, страница не шире экрана (scrollWidth был 1 536 на 1 440) */
@media (min-width: 1100px) {
  .tgp .tbl-wrap { overflow-x: auto; }
  .tgf-row, .tgf-acts { flex-wrap: wrap; overflow-x: visible; gap: 4px 5px; }
  .tgf .tgl-seg.stage { font-size: 12.5px; padding: 5px 9px; }
  .tgf-sep { margin: 3px 3px; }
}
.tgb { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow); height: calc(100vh - 340px); min-height: 520px; overflow: hidden; }
.tgb-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.tgl-segs { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; border-bottom: 1px solid var(--line); }
.tgl-seg { padding: 4px 9px; border-radius: 999px; font-size: 12.5px; color: var(--text-2); border: 1px solid var(--line-2); white-space: nowrap; }
.tgl-seg b { font-weight: 650; color: var(--muted); margin-left: 2px; }
.tgl-seg:hover { text-decoration: none; background: var(--surface-2); }
.tgl-seg.on { background: var(--accent-bg); border-color: var(--accent-line); color: var(--accent); }
.tgl-seg.on b { color: var(--accent); }
.tgl-list { overflow-y: auto; min-height: 0; flex: 1; }
.tgl-row { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line);
  color: var(--text); border-left: 3px solid transparent; }
.tgl-row:hover { background: var(--surface-2); text-decoration: none; }
.tgl-row.sel { background: var(--accent-bg); border-left-color: var(--accent); }
.tgl-main { min-width: 0; display: grid; gap: 2px; }
.tgl-top { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.tgl-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 13.5px; }
.tgl-wait { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.tgl-wait.warn { color: var(--warn); font-weight: 600; }
.tgl-chat { font-size: 11.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tgl-snip { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tgl-row .pills { margin-top: 3px; }
/* непрочитанное, как в Telegram (Влад 24727): кружок с числом, имя жирнее */
.tgl-unread { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; font-style: normal; line-height: 1; }
.tgl-row .pills .tgl-unread { margin-left: auto; }
.tgl-seg .tgl-unread { margin-left: 4px; min-width: 16px; height: 16px; font-size: 10px; }
.tgl-row.unread .tgl-name { font-weight: 750; }
.tgl-row.unread .tgl-snip { color: var(--text); }
.tgl-row .pill { font-size: 11px; line-height: 17px; padding: 0 6px; }

.tg-fresh { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; border: 0; border-radius: 999px;
  padding: 10px 18px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; font-size: 13.5px; box-shadow: var(--shadow); cursor: pointer; }
.tgb-conv { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.tgc-none { display: grid; place-items: center; align-content: center; gap: 12px; height: 100%; padding: 24px; }
.tgc-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); min-width: 0; }
.tgc-back { display: none; align-items: center; gap: 2px; font-size: 13px; white-space: nowrap; }
.tgc-who { min-width: 0; flex: 1; display: grid; gap: 3px; }
.tgc-name { font-weight: 650; font-size: 15px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tgc-sub { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; min-width: 0; }
.tgc-stop { margin: 0; flex: none; }
.tgc-acts { display: flex; gap: 6px; align-items: center; flex: none; }
details.tgc-ctx { border-bottom: 1px solid var(--line); }
details.tgc-ctx > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; padding: 8px 16px;
  font-size: 12.5px; color: var(--accent); font-weight: 550; }
details.tgc-ctx > summary::-webkit-details-marker { display: none; }
.tgc-ctx-b { padding: 4px 16px 12px; display: grid; gap: 8px; font-size: 13px; max-height: 260px; overflow-y: auto; }
.tgc-q { padding: 8px 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.tgc-around { display: grid; gap: 2px; }
.tgc-feed { flex: 1; min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 8px; padding: 14px 16px; }
.tg-sys { justify-self: center; display: inline-flex; gap: 6px; align-items: flex-start; max-width: 92%; font-size: 12px;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.tg-sys.warn { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.tg-sys.bad { color: var(--bad); background: var(--bad-bg); border-color: transparent; }
.tgc-composer { flex: none; border-top: 1px solid var(--line); padding: 10px 16px 12px; display: grid; gap: 8px;
  background: var(--surface); }
.tgc-composer.state, .tgc-composer.done { color: var(--muted); font-size: 13px; }
.tgc-composer.ro .body-text { max-height: 160px; overflow-y: auto; padding: 8px 10px; border: 1px dashed var(--line-2); border-radius: 10px; }
.tgc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tgc-chip { display: inline-flex; gap: 5px; align-items: center; font-size: 12px; padding: 2px 9px; border-radius: 999px;
  background: var(--warn-bg); color: var(--warn); }
.tgc-form { display: grid; gap: 8px; margin: 0; }
.tgc-text { min-height: 84px; max-height: 32vh; }
.tgc-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tgc-hint { font-size: 12px; color: var(--dim); margin-left: auto; }
.tgc-hint code { font-family: var(--mono); font-size: 11.5px; }
details.tgc-say > summary { list-style: none; width: max-content; }
details.tgc-say > summary::-webkit-details-marker { display: none; }
.tgc-say-f { display: grid; gap: 6px; margin-top: 8px; }
.tgc-say-f .tg-edit { min-height: 52px; }
.tgc-say-f .btn { width: max-content; }

details.tg-ab-d { margin-top: 12px; border-top: 1px solid var(--line); }
details.tg-ab-d > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 4px; padding: 10px 0 4px;
  color: var(--accent); font-size: 13px; font-weight: 550; }
details.tg-ab-d > summary::-webkit-details-marker { display: none; }
details.tg-ab-d[open] > summary .ico { transform: rotate(90deg); }
table.tg-ab { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.tg-ab th, .tg-ab td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tg-ab thead th { color: var(--muted); font-weight: 550; font-size: 12px; }
.tg-ab tbody th { font-weight: 500; color: var(--text-2); }

@media (max-width: 1099px) {
  .tgf.has-sel { display: none; }
  .tgb { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .tgb-list { border-right: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
  .tgl-list { overflow: visible; }
  .tgb.none-sel .tgb-conv { display: none; }
  .tgb.has-sel .tgb-list { display: none; }
  .tgb.has-sel ~ * { display: none; }
  .tgp-talk.picked .tgh { display: none; }
  .tgb-conv { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
  .tgc-back { display: inline-flex; }
  .tgc-feed { overflow: visible; }
  .tgc-composer { position: sticky; bottom: 0; z-index: 5; border-radius: 0 0 var(--r) var(--r); box-shadow: 0 -6px 16px rgba(0,0,0,.12); }
  .tgc-hint { margin-left: 0; width: 100%; }
  .tgc-keys { display: none; }
  .tgb.none-sel .tgl-row.sel { background: transparent; border-left-color: transparent; }
  .tg-msg { max-width: 92%; }
}
@media (max-width: 640px) {
  .tgs { min-width: 0; flex: 1 1 30%; padding: 6px 8px; }
  .tgs-v { font-size: 17px; }
  .tgs-l { white-space: normal; }
  .tg-ab th, .tg-ab td { padding: 6px 4px; font-size: 12px; }
  .tgc-head { padding: 10px 12px; flex-wrap: wrap; row-gap: 8px; }
  .tgc-head > .avatar { display: none; }
  .tgc-stop, .tgc-acts { order: 1; margin-left: auto; }
  .tgc-who { order: 2; flex: 1 1 100%; }
  .tgc-feed { padding: 12px; }
  .tgc-composer { padding: 10px 12px; }
}
