[hidden] { display: none !important; }
:root {
  --bg: #EDF0F4; --surface: #FFFFFF; --ink: #172033; --muted: #5D6679; --line: #D6DCE4; --line-2: #E6EAF0;
  --accent: #0E6E8A; --accent-ink: #0A5569; --accent-soft: #E1F0F4;
  --danger: #C43D2E; --warn: #A26F00; --warn-soft: #FFF3D6; --ok: #2F9E55;
  --r: 8px; --font: "Onest", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 15px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent-ink); }
h1 { font-size: 24px; line-height: 1.2; margin: 0 0 12px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
code { font-size: 13px; background: var(--line-2); padding: 1px 5px; border-radius: 4px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Шапка ---- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 20px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 20px 10px; background: var(--ink); color: #fff; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; letter-spacing: .02em; }
.brand span, .auth-brand span { color: #7CC7DB; font-weight: 500; margin-left: 5px; }
.nav { display: flex; gap: 4px; flex: 1; align-items: center; }
.nav a { color: #C9D1DE; text-decoration: none; padding: 7px 12px; border-radius: 6px; white-space: nowrap; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.nav a.on { color: #fff; background: rgba(255,255,255,.14); }
.me { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #2B3A55; color: #fff;
  text-decoration: none; font-size: 13px; font-weight: 600; flex: none; }
.main { padding: 20px; max-width: 1280px; margin: 0 auto; }
.main.pg-board { max-width: none; padding-right: 0; }

/* ---- Кнопки и поля ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 500;
  padding: 8px 14px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #B8C1CE; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-new { padding: 7px 12px; }
.btn-wide { width: 100%; padding: 11px; }
.btn-link { border: 0; background: none; color: var(--accent-ink); padding: 6px 0; }
.btn-danger { color: var(--danger); }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 10px; width: 100%; min-width: 0; }
textarea { resize: vertical; }
input[type=color] { padding: 2px; height: 36px; width: 48px; }
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.fld { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.fld > span { font-size: 13px; color: var(--muted); }
.fld .links { display: flex; gap: 12px; font-size: 13px; }
.chk { display: flex; gap: 8px; align-items: center; margin: 6px 0 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 16px; }
.span2 { grid-column: 1 / -1; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline select { flex: 1; }

.panel { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); padding: 18px 20px; margin-bottom: 16px; }
.panel > h2 ~ h2 { margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.narrow { max-width: 760px; }
.cols2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; background: #E3F4E8; color: #1D5B33; }
.flash-err, .err { background: #FBE6E3; color: #8A2A1F; padding: 10px 14px; border-radius: 6px; }

/* ---- Метки ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 999px; font-weight: 600; font-size: 14px;
  background: color-mix(in srgb, var(--c) 13%, white); color: color-mix(in srgb, var(--c) 75%, black); }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.pill-sm { font-size: 12px; font-weight: 500; padding: 2px 8px 2px 6px; white-space: nowrap; }
.b { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 4px; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.b-today { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.b-over { background: #FBE6E3; color: #8A2A1F; font-weight: 600; }
.b-stuck { background: var(--warn-soft); color: var(--warn); }
.tag-warn { color: var(--warn); }

/* ---- Воронка ---- */
.bar { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 14px; padding-right: 20px; }
.bar .muted { margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input[type=search] { width: 260px; }
.filters select, .filters input[type=date] { width: auto; }
.board { display: flex; gap: 12px; overflow-x: auto; padding: 0 20px 20px 0; align-items: flex-start;
  min-height: calc(100vh - 150px); scroll-snap-type: x proximity; }
.col { flex: 0 0 272px; background: #E3E7ED; border-radius: var(--r); display: flex; flex-direction: column;
  max-height: calc(100vh - 150px); scroll-snap-align: start; border-top: 3px solid var(--c); }
.col-h { padding: 10px 12px 8px; }
.col-h h2 { font-size: 14px; margin: 0; line-height: 1.3; }
.col-h p { margin: 2px 0 0; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.col-body { padding: 0 8px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.col.drop-on { background: color-mix(in srgb, var(--c) 16%, #E3E7ED); }
.col-won, .col-lost, .col-excluded { flex-basis: 232px; }
.col-empty { font-size: 13px; color: #8A93A3; text-align: center; margin: 14px 0; }
.card { display: flex; flex-direction: column; gap: 3px; background: var(--surface); border-radius: 6px; padding: 10px 11px;
  text-decoration: none; color: var(--ink); border: 1px solid transparent; box-shadow: 0 1px 0 rgba(23,32,51,.06); cursor: grab; }
.card:hover { border-color: #B8C1CE; }
.card.is-stuck { border-left: 3px solid var(--warn); }
.card.dragging { opacity: .45; }
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.card-top b { font-weight: 600; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.card-sub { font-size: 13px; color: var(--muted); }
.card-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; margin-top: 2px; }
.amt { font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.av { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent-ink); }
.av-free { background: var(--line-2); color: #8A93A3; }

/* ---- Карточка заявки ---- */
.lead-head { margin-bottom: 14px; }
.lead-head h1 { margin: 6px 0 2px; }
.lead-head p { margin: 0; }
.back { font-size: 14px; text-decoration: none; }

.track { list-style: none; display: flex; margin: 0 0 14px; padding: 0; overflow-x: auto; }
.track li { flex: 1 1 0; min-width: 88px; position: relative; padding: 9px 10px 9px 20px; font-size: 12px; line-height: 1.25;
  background: #DDE2E9; color: var(--muted); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); margin-right: -6px; }
.track li:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); padding-left: 12px; border-radius: 6px 0 0 6px; }
.track li span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.track li.done { background: color-mix(in srgb, var(--c) 22%, white); color: color-mix(in srgb, var(--c) 70%, black); }
.track li.cur { background: var(--c); color: #fff; font-weight: 600; }
.track-off li { opacity: .55; }

.stage-move { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.move { display: flex; gap: 8px; margin-left: auto; }
.move select { width: auto; max-width: 260px; }
.lead-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.note-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.note-form .btn { align-self: flex-start; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--line-2); }
.ev { position: relative; padding: 0 0 14px 4px; }
.ev::before { content: ""; position: absolute; left: -21px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); border: 2px solid var(--surface); }
.ev-stage::before { background: var(--accent); }
.ev-note::before, .ev-repeat::before { background: var(--warn); }
.ev-h { font-size: 14px; }
.ev-text { margin: 4px 0 0; padding: 8px 10px; background: #F5F7FA; border-radius: 6px; font-size: 14px; white-space: normal; overflow-wrap: anywhere; }
.ev-note .ev-text { background: var(--warn-soft); }
.ev-data { display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; margin: 4px 0 0; font-size: 13px; }
.ev-data dt { color: var(--muted); }
.ev-data dd { margin: 0; overflow-wrap: anywhere; }
.ev-meta { font-size: 12px; color: #8A93A3; margin-top: 3px; }
.danger-zone { display: flex; justify-content: space-between; gap: 10px; padding: 0 4px; }

/* ---- Таблицы ---- */
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--r); border: 1px solid var(--line-2); }
.panel .table-wrap { border: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; color: var(--muted); font-size: 13px; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: #F6F8FA; }
.tbl tr.off { opacity: .55; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .empty { text-align: center; color: var(--muted); padding: 28px; cursor: default; }
.stages-tbl tbody tr { cursor: default; }
.stages-tbl tbody tr:hover { background: none; }
.stages-tbl td { vertical-align: middle; }
.stages-tbl small { display: block; margin-top: 3px; }
.w-num { width: 70px; }
.stages-tbl td:nth-child(2) input { min-width: 230px; }
.fields-pick { display: grid; gap: 4px; padding: 8px 0; min-width: 320px; }
.fields-pick label { display: grid; grid-template-columns: 1fr 140px; gap: 8px; align-items: center; font-size: 13px; }
.fields-pick select { padding: 4px 6px; }
details summary { cursor: pointer; font-size: 13px; color: var(--accent-ink); }
.new-row td { background: #F6F8FA; }
.pager { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; }
.pager a, .pager b { padding: 4px 10px; border-radius: 6px; background: var(--surface); text-decoration: none; }
.pager b { background: var(--accent); color: #fff; }

/* ---- Вход ---- */
.auth { max-width: 380px; margin: 12vh auto 0; background: var(--surface); padding: 28px; border-radius: 12px; border: 1px solid var(--line-2); }
.auth-brand { font-weight: 700; font-size: 22px; margin-bottom: 18px; color: var(--ink); }
.auth-brand span { color: var(--accent); }

/* ---- Диалог перехода ---- */
.dlg { border: 0; border-radius: 12px; padding: 0; width: min(460px, calc(100vw - 24px)); box-shadow: 0 20px 60px rgba(23,32,51,.25); }
.dlg::backdrop { background: rgba(23,32,51,.45); }
.dlg form { padding: 22px; }
.dlg h2 { font-size: 18px; margin-bottom: 16px; }
.dlg .req::after { content: " *"; color: var(--danger); }
.dlg .fld small { color: var(--danger); font-size: 12px; }
.dlg-err { color: var(--danger); font-size: 14px; min-height: 0; margin: 0 0 10px; }
.dlg-err:empty { display: none; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: 10px 16px; border-radius: 8px; z-index: 50; font-size: 14px; max-width: calc(100vw - 32px); }

@media (max-width: 900px) {
  .lead-grid, .cols2 { grid-template-columns: 1fr; }
  .grid3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .main { padding: 14px 12px; }
  .main.pg-board { padding-right: 0; }
  .grid2 { grid-template-columns: 1fr; }
  .filters input[type=search] { width: 100%; }
  .col { flex-basis: 84vw; }
  .move { margin-left: 0; width: 100%; }
  .move select { flex: 1; max-width: none; }
  .panel { padding: 16px 14px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---- Счётчики и пиксели ---- */
.narrow-p { max-width: 760px; }
.trk-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.trk { border-left: 3px solid var(--line); }
.trk-on { border-left-color: var(--ok); }
.trk-wide { grid-column: 1 / -1; }
.trk-h { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.trk-h h2 { margin: 0; }
.switch { display: inline-flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.switch input { width: 18px; height: 18px; accent-color: var(--ok); }
.trk .err { font-size: 14px; margin: 0 0 10px; }
.trk details { margin-top: 6px; }
.trk .help { padding: 8px 0 0; line-height: 1.5; color: var(--ink); }
.trk-status { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.trk-status p { margin: 4px 0 0; }
.err-text { color: var(--danger); }
.mono, pre.code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 13px; }
pre.code { background: #F5F7FA; border: 1px solid var(--line-2); padding: 10px 12px; border-radius: 6px; overflow-x: auto; }
.sticky-actions { position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(transparent, var(--bg) 35%); margin-bottom: 8px; }
@media (max-width: 900px) { .trk-grid { grid-template-columns: 1fr; } }

/* ---- Переписка из соцсетей (бот) ---- */
.chat { display: flex; flex-direction: column; gap: 6px; max-height: 440px; overflow-y: auto; padding: 2px 2px 8px; }
.bubble { max-width: 86%; padding: 8px 11px; border-radius: 12px; background: #F1F3F6; overflow-wrap: anywhere; font-size: 15px; line-height: 1.4; }
.bubble.out { align-self: flex-end; background: var(--accent-soft); }
.bubble small { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.chat-reply { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.chat-reply textarea { flex: 1; min-width: 0; }
@media (max-width: 640px) { .chat { max-height: 55vh; } .chat-reply { position: sticky; bottom: 0; background: var(--surface); padding-bottom: env(safe-area-inset-bottom, 0px); } }

/* ---- v2: склад, аналитика, реклама ---- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.page-head h1 { margin: 0; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 8px 0 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.chip { display: inline-block; padding: 5px 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; font-size: 13px; }
.chip:hover { border-color: #B8C1CE; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.period { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 14px; }
.period input[type=date] { width: auto; }
.period .presets { display: flex; gap: 6px; flex-wrap: wrap; }
.filters .grow, .grow { flex: 1; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi > span { font-size: 13px; color: var(--muted); }
.kpi > b { font-size: 22px; font-variant-numeric: tabular-nums; }
.kpi > small { font-size: 12px; color: var(--muted); }
.kpi.good > b, .tbl td.ok, b.ok, .ok { color: var(--ok); }
.kpi.bad > b, .tbl td.warn, b.warn { color: var(--danger); }
.tbl td.warn { font-weight: 600; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-t { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; }
.bar-t i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.bar-v { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); }
.chart svg { width: 100%; height: 220px; display: block; }
.chart .axis { stroke: var(--line); }
.chart .tick { font-size: 11px; fill: var(--muted); text-anchor: middle; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; margin-top: 6px; }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.heat { border-collapse: collapse; font-size: 11px; }
.heat th { font-weight: 500; color: var(--muted); padding: 2px 4px; }
.heat td { width: 26px; height: 24px; text-align: center; background: rgba(14, 110, 138, var(--a, 0)); color: var(--ink); border: 1px solid #fff; }
.funnel { display: flex; flex-direction: column; gap: 6px; }
.fn-row { display: grid; grid-template-columns: minmax(110px, 26%) 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.fn-bar { height: 22px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.fn-bar i { display: block; height: 100%; background: var(--accent); }
.fn-n { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.hl-panel { background: var(--accent-soft); border-color: #BFDDE6; }
.an-tbl td, .an-tbl th { white-space: nowrap; }
.tbl tbody tr.nolink, .an-tbl tbody tr, .wh-tbl tbody tr { cursor: default; }
.wh-tbl .thumb { width: 52px; padding: 4px 8px; }
.wh-tbl .thumb img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; display: block; }
.noimg { display: inline-grid; place-items: center; width: 44px; height: 44px; background: var(--line-2); border-radius: 6px; color: var(--muted); }
.imgs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.imgs figure { margin: 0; text-align: center; font-size: 12px; }
.imgs img { width: 96px; height: 96px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line-2); display: block; margin-bottom: 4px; }
.checks { display: flex; gap: 6px 16px; flex-wrap: wrap; margin: 4px 0 12px; }
.checks label { display: flex; gap: 6px; align-items: center; }
.bc-box { background: #fff; padding: 6px; border: 1px solid var(--line-2); border-radius: 6px; margin-bottom: 8px; max-width: 280px; }
.bc-box svg { width: 100%; height: 80px; display: block; }
.copy { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; background: #F6F8FA; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; background: var(--line-2); color: var(--muted); }
.tag-ok { background: #E3F4E8; color: #1F7A3E; }
.brand-co { font-weight: 500; color: #9FB3C8; font-size: 14px; margin-left: 6px; }
.li-panel .tbl input { padding: 5px 7px; }
.w-mid { max-width: 140px; }
.right, .r { text-align: right; }
.nowrap { white-space: nowrap; }
@media (max-width: 900px) { .cols3 { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .kpis { grid-template-columns: 1fr 1fr; } .kpi > b { font-size: 18px; } .bar-row, .fn-row { grid-template-columns: 1fr auto; } .bar-row .bar-t, .fn-row .fn-bar { grid-column: 1 / -1; grid-row: 2; } }
@media print { .noprint { display: none !important; } }

/* ---- тарифы, регистрация, компании ---- */
.auth-wide { max-width: 560px; margin-top: 6vh; }
.auth h2 { font-size: 18px; margin: 0 0 6px; }
.flash-warn, .bill-banner { background: var(--warn-soft); color: #6B4A00; padding: 10px 14px; border-radius: 6px; margin-bottom: 12px; }
.bill-banner a { color: inherit; margin-left: 6px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 14px; }
.plan-card { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 10px; padding: 14px; cursor: pointer; position: relative; }
.plan-card input { position: absolute; top: 14px; right: 14px; width: auto; }
.plan-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.plan-card b { font-size: 16px; }
.plan-price { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.big { font-size: 18px; }
a.kpi { text-decoration: none; color: inherit; }
a.kpi.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.companies td { vertical-align: top; }
.owner-edit { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; min-width: 220px; }
.invoice { max-width: 820px; }
.inv-req th { width: 140px; }
@media print { .invoice { border: 0; padding: 0; } }
@media print { header.top, .bill-banner, .flash { display: none !important; } main.main { padding: 0; } }

/* ---- диалоги: единая переписка, соцсети клиента, раздел «Диалоги» ---- */
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn.is-off { color: var(--muted); background: var(--line-2); cursor: default; }
.dlg-fields .dlg-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.dlg-row { display: flex; gap: 6px; align-items: center; }
.dlg-row select { flex: 0 0 170px; }
.dlg-row input { flex: 1; min-width: 0; }
.dlg-fields > .btn { align-self: flex-start; }
.dlg-fields small { display: block; margin-top: 6px; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.chat-head h2 { margin: 0; }
.chat-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.chat-tabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 3px 10px; font-size: 13px; cursor: pointer; color: var(--ink); }
.chat-tabs button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-ink); }
.chat-day { align-self: center; font-size: 12px; color: var(--muted); background: var(--line-2); border-radius: 999px; padding: 1px 10px; margin: 6px 0 2px; }
.ch-tag { font-weight: 600; }
.chat-ch { flex: 0 0 auto; max-width: 210px; }
.chat-links { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chat-manual { margin-top: 10px; }
.chat-manual summary { cursor: pointer; color: var(--accent-ink); }
.chat-manual form { margin-top: 8px; }
.span3 { grid-column: 1 / -1; }
.nav-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }
.dlg-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.dlg-bar .tabs { margin: 0; border: 0; }
.dlg-bar input[name=s] { min-width: 220px; }
.dlg-list { display: flex; flex-direction: column; gap: 6px; }
.dlg-item { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 14px; text-decoration: none; color: inherit; }
.dlg-item:hover { border-color: var(--accent); }
.dlg-item.is-wait { border-left: 3px solid var(--accent); }
.dlg-ic { display: flex; flex-direction: column; gap: 2px; font-size: 16px; min-width: 22px; text-align: center; }
.dlg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.dlg-text { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.dlg-item.is-wait .dlg-text { color: var(--ink); }
.dlg-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; flex: 0 0 auto; }
@media (max-width: 640px) { .dlg-row { flex-wrap: wrap; } .dlg-row select { flex: 1 1 100%; } .dlg-item { flex-wrap: wrap; } .dlg-meta { flex-direction: row; flex-wrap: wrap; align-items: center; } }

/* Интеграции с сайтами */
details.integ { border: 1px solid var(--line-2); border-radius: 8px; margin: 6px 0; background: #fff; }
details.integ > summary { padding: 10px 14px; font-size: 15px; color: var(--ink); }
details.integ[open] > summary { border-bottom: 1px solid var(--line-2); }
.integ-body { padding: 10px 14px 14px; font-size: 14px; }
.integ-body ol { padding-left: 1.3em; margin: 6px 0; }
.integ-body pre.code { max-height: 340px; white-space: pre; }
details.inline { display: inline-block; }
/* меню «Управление» в шапке */
.nav-admin { position: relative; flex: none; }
.nav-admin > summary { list-style: none; cursor: pointer; color: #C9D1DE; padding: 7px 10px; border-radius: 6px; white-space: nowrap; font-size: 14px; }
.nav-admin > summary::-webkit-details-marker { display: none; }
.nav-admin > summary:hover, .nav-admin[open] > summary { color: #fff; background: rgba(255,255,255,.08); }
.nav-admin.on > summary { color: #fff; background: rgba(255,255,255,.14); }
.nav-admin-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: #1E2A40; border-radius: 10px; padding: 6px; box-shadow: 0 12px 32px rgba(0,0,0,.3); display: flex; flex-direction: column; z-index: 30; }
.nav-admin-menu a { color: #DDE3EC; text-decoration: none; padding: 9px 12px; border-radius: 6px; }
.nav-admin-menu a:hover, .nav-admin-menu a.on { background: rgba(255,255,255,.1); color: #fff; }

/* Склад → Интеграции (синхронизация 1С, сайтов, маркетплейсов) */
.tag-err { background: #FBE6E3; color: #8A2A1F; }
.sync-intro p { margin: 6px 0; }
.sync-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-bottom: 16px; }
.sync-card { display: flex; flex-direction: column; gap: 6px; margin: 0; color: inherit; text-decoration: none; transition: border-color .15s; }
.sync-card:hover { border-color: var(--accent); }
.sync-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sync-nums { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.sync-group { margin: 14px 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.sync-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.sync-type { margin: 0; }
.sync-type-btn { width: 100%; height: 100%; text-align: left; display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line-2);
  border-radius: var(--r); background: var(--surface); font: inherit; cursor: pointer; min-height: 44px; }
.sync-type-btn:hover { border-color: var(--accent); background: #F7FAFF; }
.sync-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sync-actions form { margin: 0; }
.sync-howto ol, .sync-howto ul { padding-left: 20px; margin: 6px 0; }
.sync-howto li { margin: 6px 0; }
.sync-howto input.copy { width: min(520px, 100%); }
.sync-more { margin: 10px 0; }
.sync-more summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
@media (max-width: 720px) {
  .sync-actions .btn { width: 100%; }
  .sync-actions form { width: 100%; }
  .sync-howto input.copy { width: 100%; }
}
.sync-card-top .tag, .page-head .tag { white-space: nowrap; flex-shrink: 0; }
/* Меню с группами (11.10) */
.nav { overflow: visible; flex-wrap: nowrap; }
.nav-dd { position: relative; flex: none; }
.nav-dd > summary { list-style: none; cursor: pointer; color: #C9D1DE; padding: 7px 12px; border-radius: 6px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.nav-dd > summary::-webkit-details-marker { display: none; }
.nav-dd > summary::after { content: ""; width: 6px; height: 6px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: .7; }
.nav-dd[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.nav-dd > summary:hover, .nav-dd[open] > summary { color: #fff; background: rgba(255,255,255,.08); }
.nav-dd.on > summary { color: #fff; background: rgba(255,255,255,.14); }
.nav-dd-menu { position: absolute; left: 0; top: calc(100% + 6px); min-width: 230px; background: #1E2A40; border-radius: 10px; padding: 6px; box-shadow: 0 12px 32px rgba(0,0,0,.3); display: flex; flex-direction: column; z-index: 30; }
.nav-dd-menu a { color: #DDE3EC; text-decoration: none; padding: 9px 12px; border-radius: 6px; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.nav-dd-menu a:hover, .nav-dd-menu a.on { background: rgba(255,255,255,.1); color: #fff; }
.nav-dd-h { color: #8E9AB0; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 10px 12px 4px; }
.nav-dd-h:first-child { padding-top: 4px; }
.plan-chip { flex: none; display: flex; flex-direction: column; line-height: 1.15; text-decoration: none; color: #DDE3EC; padding: 5px 10px; border-radius: 8px; border: 1px solid rgba(255,255,255,.16); font-size: 12px; }
.plan-chip b { color: #fff; font-size: 13px; }
.plan-chip .plan-bal { color: #9FE3C1; }
.plan-chip:hover { background: rgba(255,255,255,.08); }
.plan-chip.plan-grace, .plan-chip.plan-expired { border-color: #E0A100; }
.plan-chip.plan-grace span:not(.plan-bal), .plan-chip.plan-expired span:not(.plan-bal) { color: #FFD166; }
@media (max-width: 900px) {
  .nav-dd > summary, .nav > a { padding: 8px 10px; }
  .nav-dd-menu a { padding: 12px; }
}
input[type=radio] { width: auto; flex: none; padding: 0; }
.chk input[type=radio], .chk input[type=checkbox] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.opt-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.opt-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line-2, var(--line)); border-radius: 10px; cursor: pointer; background: #fff; }
.opt-card:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.opt-card input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--accent); }
.opt-card b { display: block; margin-bottom: 2px; }
.opt-card small { color: var(--muted); }
/* Две CRM: переключатель «Торговля / Услуги» (11.10) */
.mode-sw { display: inline-flex; flex: none; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 10px; padding: 3px; gap: 2px; }
.mode-sw a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 7px; color: #C9D3E0; text-decoration: none; font-size: 14px; min-height: 36px; white-space: nowrap; }
.mode-sw a b { font-weight: 600; }
.mode-sw a:hover { background: rgba(255,255,255,.08); color: #fff; }
.mode-sw a.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.mode-sw a.locked { opacity: .7; }
.mode-sw a.add { color: #9FE3C1; font-size: 13px; }
.mode-sw a.add b { font-weight: 500; }
.bill-lead { max-width: 900px; }
.bill-prods { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 12px; }
.bill-prod.focus { box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); }
.bill-prod.off .plans { opacity: .9; }
.bill-prod-h { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 6px; }
.bill-prod-h h2 { margin: 0; }
.bill-prod-h p { margin: 2px 0 0; }
.bill-prod-h .bill-st { margin-left: auto; }
.prod-ic { font-size: 30px; line-height: 1; flex: none; }
.bill-st { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: #EEF1F4; color: var(--muted); white-space: nowrap; }
.bill-st.st-active, .bill-st.st-comp, .bill-st.st-ad { background: #DCF2E3; color: #166534; }
.bill-st.st-trial { background: var(--accent-soft); color: var(--accent-ink); }
.bill-st.st-grace, .bill-st.st-expired { background: #FDECD2; color: #92400E; }
.bill-try { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 14px; padding: 12px; background: var(--accent-soft); border-radius: 10px; }
.plan-feat { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.plan-feat li { margin: 2px 0; }
.plan-card .plan-price { font-size: 20px; font-weight: 700; }
.bill-total { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line-2); padding-top: 12px; margin-top: 6px; font-size: 16px; }
.bill-total b { font-size: 22px; }
.prod-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.prod-opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.prod-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.prod-opt input { margin-top: 4px; width: auto; flex: none; }
.prod-opt > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.prod-opt small { font-size: 12px; }
@media (max-width: 640px) { .prod-pick { grid-template-columns: 1fr; } }
.owner-prod { border: 1px solid var(--line-2); border-radius: 8px; padding: 4px 8px 8px; margin: 6px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.owner-prod legend { padding: 0 4px; }
.sync-type-btn.locked { opacity: .6; }

/* Источники заявок → торговля / услуги */
.lr-tbl td{vertical-align:middle}
.lr-tbl td.lr-c{white-space:nowrap}
.lr-tbl .chk{min-height:44px;display:inline-flex;align-items:center;gap:6px}
.lr-res{display:inline-block;font-size:13px;padding:3px 8px;border-radius:999px;background:#EEF2F6;color:#3B4556}
.lr-res.lr-trade{background:#FFF3E0;color:#8A4B00}
.lr-res.lr-svc{background:#F3E8FF;color:#6B21A8}
@media (max-width:640px){.lr-tbl thead{display:none}.lr-tbl tr{display:grid;grid-template-columns:1fr 1fr;gap:2px 10px;padding:10px 0;border-bottom:1px solid #E6EAF0}.lr-tbl td{border:0;padding:0}.lr-tbl td:first-child,.lr-tbl td:last-child{grid-column:1/-1}}

/* «Первые шаги» — чек-лист запуска */
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.onb{position:fixed;left:16px;bottom:16px;z-index:60;font-size:14px}
.onb-pill{display:flex;align-items:center;gap:10px;min-height:48px;padding:6px 16px 6px 6px;border-radius:999px;border:1px solid var(--line);background:var(--surface);color:var(--ink);font:inherit;cursor:pointer;box-shadow:0 6px 20px rgba(23,32,51,.14)}
.onb-pill small{display:block;color:var(--muted);font-size:12px;text-align:left}.onb-pill>span:last-child{text-align:left;font-weight:600;line-height:1.2}
.onb-ring{width:36px;height:36px;border-radius:50%;flex:none;display:grid;place-items:center;background:conic-gradient(var(--ok) calc(var(--p)*1%),var(--line-2) 0)}
.onb-ring b{width:28px;height:28px;border-radius:50%;background:var(--surface);display:grid;place-items:center;font-size:13px}
.onb.open>.onb-pill{display:none}
.onb-panel{display:none;width:300px;max-height:calc(100vh - 110px);overflow:auto;background:#1E2738;color:#E9EDF3;border-radius:14px;box-shadow:0 12px 40px rgba(10,16,28,.35);padding:14px 10px 10px}
.onb.open .onb-panel{display:block}
.onb-h{display:flex;justify-content:space-between;align-items:flex-start;gap:8px;padding:0 6px}.onb-h b{font-size:16px;display:block}.onb-h small{color:#A9B3C4;font-size:12px}
.onb-x{width:36px;height:36px;border-radius:8px;border:0;background:rgba(255,255,255,.08);color:#fff;font-size:20px;cursor:pointer;line-height:1}
.onb-bar{height:6px;border-radius:999px;background:rgba(255,255,255,.12);margin:10px 6px 8px;overflow:hidden}.onb-bar i{display:block;height:100%;background:#3FC07A;border-radius:999px;transition:width .4s}
.onb-list{list-style:none;margin:0;padding:0}
.onb-i{position:relative;border-radius:10px}.onb-i a{display:flex;gap:10px;align-items:flex-start;padding:8px 6px;color:inherit;text-decoration:none;border-radius:10px;min-height:40px}
.onb-i a:hover,.onb-i a:focus-visible{background:rgba(255,255,255,.07);outline:none}.onb-i a:focus-visible{box-shadow:0 0 0 2px #7FB8C9}
.onb-ic{width:24px;height:24px;flex:none;border-radius:50%;display:grid;place-items:center;font-size:12px;font-weight:700;border:1.5px solid #5B6678;color:#A9B3C4;margin-top:1px}
.onb-t{min-width:0}.onb-t b{font-weight:500;display:block;line-height:1.3}.onb-t small{display:block;color:#A9B3C4;font-size:12px;line-height:1.35;margin-top:2px}
.onb-i.st-ok .onb-ic{background:#2F9E55;border-color:#2F9E55;color:#fff}.onb-i.st-ok .onb-t b{color:#C9D2DF}
.onb-i.st-warn .onb-ic{background:#E0A100;border-color:#E0A100;color:#1E2738}.onb-i.st-warn .onb-hint{color:#F3C96A}
.onb-i.st-skip .onb-ic{border-style:dashed}.onb-i.st-skip .onb-t b{color:#8792A5;text-decoration:line-through}
.onb-i.next{background:rgba(63,192,122,.12);box-shadow:inset 3px 0 0 #3FC07A}.onb-i.next .onb-ic{border-color:#3FC07A;color:#fff}
.onb-i.here a{background:rgba(255,255,255,.1)}
.onb-skip{position:absolute;right:6px;top:8px}.onb-skip .btn-link{color:#8FA0B8;font-size:11px;padding:2px 4px;min-height:0}
.onb-i:has(.onb-skip) .onb-t{padding-right:64px}
.onb-f{display:flex;justify-content:space-between;align-items:center;gap:8px;border-top:1px solid rgba(255,255,255,.1);margin-top:6px;padding:8px 6px 0}
.onb-f .muted{color:#8FA0B8}.onb-f .btn-link{color:#C9D2DF}
@media (max-width:640px){.onb{left:12px;bottom:12px}.onb.open{left:0;right:0;bottom:0}.onb-panel{width:100%;border-radius:16px 16px 0 0;max-height:80vh;padding-bottom:calc(10px + env(safe-area-inset-bottom))}.onb-pill{padding-right:12px}}
@media print{.onb{display:none}}
.onb-t b small{display:inline;color:#8FA0B8;font-size:12px;margin:0}
.onb-f{flex-wrap:wrap}.onb-f .muted{white-space:nowrap}.onb-f .btn-link{white-space:nowrap}
.u-prods{border:1px solid var(--line-2);border-radius:var(--r);padding:8px 12px 10px;margin:0 0 12px}.u-prods legend{font-size:13px;color:var(--muted);padding:0 4px}
.u-prods .chk{min-height:40px}.u-prod{display:inline-block;padding:1px 7px;border-radius:999px;background:var(--accent-soft);font-size:12px;margin:1px 2px 1px 0}
.u-prods .chk{margin:0}
body:has(.svc-sticky, .sticky-actions, .chat-reply, .svc-bulk:not([hidden])) .onb:not(.open){bottom:84px}   /* не закрываем кнопки «Сохранить» внизу страницы */

/* Мессенджеры и чат-бот */
.msg-sub{font-size:15px;margin:18px 0 8px;color:var(--muted)}
.msg-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:12px}
.msg-c{background:var(--surface);border:1px solid var(--line-2);border-radius:12px;padding:14px;display:flex;flex-direction:column;gap:8px}
.msg-c.on{border-color:#BFE3CB}.msg-c p{margin:0;flex:1}.msg-c .btn{align-self:flex-start;min-height:40px}
.msg-h{display:flex;gap:10px;align-items:center}.msg-h b{display:block}.msg-h small{display:block;font-size:13px}.msg-h small.ok{color:var(--ok)}
.msg-ic{width:40px;height:40px;border-radius:10px;background:var(--accent-soft);display:grid;place-items:center;font-size:20px;flex:none}
/* Аналитика: продажи и прибыль */
.an-sc { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.an-sc .chip { min-height: 36px; display: inline-flex; align-items: center; gap: 6px; }
.an-sc .chip small { opacity: .7; font-size: 12px; }
.an-warn { border-color: #F5C26B; background: #FFFBEB; }
.an-warn ul { margin: 6px 0 0; padding-left: 18px; }
.an-total td { font-weight: 600; border-top: 2px solid var(--line-2); }
.an-cost { width: 100px; text-align: right; }
.an-cost.an-need { border-color: #DC2626; background: #FEF2F2; }
.an-cfg summary { cursor: pointer; min-height: 32px; }
.an-cfg .span2 { grid-column: span 2; }
.an-cfg .span3 { grid-column: 1 / -1; }
@media (max-width: 720px) { .an-cfg .span2 { grid-column: auto; } .an-sc .chip { min-height: 44px; } }
@media (min-width: 721px) { .an-sales-tbl th, .an-sales-tbl td { padding-left: 6px; padding-right: 6px; font-size: 13.5px; white-space: nowrap; } }
/* Воронка: этапы прямо на доске */
.col-h h2 { display: flex; align-items: flex-start; gap: 4px; }
.col-edit { margin-left: auto; flex: 0 0 auto; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: #8A93A3; cursor: pointer; font-size: 15px; line-height: 1; opacity: .55; }
.col:hover .col-edit, .col-edit:focus-visible { opacity: 1; }
.col-edit:hover { background: rgba(0, 0, 0, .06); color: var(--ink, #172033); }
.col-add { flex: 0 0 150px; }
.col-add-b { width: 100%; min-height: 64px; border: 2px dashed #C6CDD8; border-radius: var(--r); background: transparent; color: #5B6577; font: inherit; font-weight: 600; cursor: pointer; }
.col-add-b:hover { border-color: var(--accent, #0E6E8A); color: var(--accent, #0E6E8A); background: #F4F8FB; }
.st-dlg { border: 0; border-radius: 14px; padding: 18px; width: min(460px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(23, 32, 51, .25); }
.st-dlg::backdrop { background: rgba(23, 32, 51, .45); }
.st-dlg h3 { margin: 0 0 12px; }
.st-dlg .fld { margin-bottom: 12px; }
.st-dlg textarea { width: 100%; }
.st-dlg .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.st-dlg .actions a { margin-left: auto; }
@media (max-width: 720px) { .col-edit { opacity: 1; width: 36px; height: 36px; } .col-add { flex-basis: 60vw; } .st-dlg .btn { min-height: 44px; } }
/* Раздел «AI-агент» */
.ai-hub-h { font-size: 17px; margin: 22px 0 10px; }
.ai-hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ai-hub-c { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.ai-hub-c h3 { margin: 0; font-size: 15px; }
.ai-hub-c p { margin: 0; font-size: 14px; color: var(--muted); flex: 1; }
.ai-hub-a { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ai-hub-wide { grid-column: 1 / -1; }
.ai-hub-st { margin: 4px 0 0; padding-left: 20px; columns: 2; column-gap: 24px; }
.ai-hub-st li { break-inside: avoid; margin-bottom: 3px; }
@media (max-width: 720px) { .ai-hub-st { columns: 1; } .ai-hub-a .btn { flex: 1 1 100%; min-height: 44px; } }
/* Диалоги: каналы */
.dlg-chs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.dlg-ch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface, #fff); color: inherit; text-decoration: none; font-size: 14px; }
.dlg-ch span small { display: block; font-size: 11px; color: var(--muted); line-height: 1.1; }
.dlg-ch:hover { border-color: var(--accent, #0E6E8A); }
.dlg-ch.on { border-color: var(--accent, #0E6E8A); background: #EEF6FA; font-weight: 600; }
.dlg-ch.off { opacity: .6; }
.dlg-dot { width: 8px; height: 8px; border-radius: 50%; background: #16A34A; flex: 0 0 auto; }
.dlg-ch.off .dlg-dot { background: #A3A8B0; }
.dlg-ch .nav-badge { margin-left: 2px; }
.dlg-off { margin: -2px 0 10px; }
@media (max-width: 720px) { .dlg-chs { gap: 6px; } .dlg-ch { flex: 1 1 calc(50% - 6px); min-width: 0; padding: 6px 8px; font-size: 13px; } .dlg-ch span { min-width: 0; overflow-wrap: anywhere; } }
@media (max-width: 640px) { .dlg-meta { flex: 1 1 100%; justify-content: flex-start; text-align: left; min-width: 0; } .dlg-main { min-width: 0; flex: 1 1 0; } }
.dlg-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dlg-bar .tabs { margin: 0 8px 0 0; }
.dlg-bar input[name=s] { flex: 1 1 220px; max-width: 420px; width: auto; }

/* Заявки: сортировка по колонкам и источник заказа (#claude-1910-6) */
.th-sort { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; min-height: 28px; }
.th-sort:hover { color: var(--ink, #1a1a1a); }
.th-arr { font-size: 10px; opacity: .45; }
.th-on .th-arr { opacity: 1; color: var(--accent, #2563eb); }
.th-on .th-sort { color: var(--ink, #1a1a1a); font-weight: 600; }
.tbl th.r .th-sort { justify-content: flex-end; }
.tbl-list .tbl-what { max-width: 320px; }
.src { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--line-2); color: #3a3f47; white-space: nowrap; }
.src-kaspi { background: #FDE7E7; color: #B3261E; }
.src-wb { background: #F3E5F8; color: #7B1FA2; }
.src-ozon { background: #E3EDFD; color: #1B4FBF; }
.src-ym { background: #FFF6D6; color: #7A5B00; }
.src-site { background: #E3F4E8; color: #1F7A3E; }
.src-whatsapp { background: #DFF6E6; color: #136C34; }
.src-instagram { background: #FCE4F0; color: #A1195B; }
.src-facebook { background: #E4ECFB; color: #234C9E; }
.src-tiktok { background: #E8E8EA; color: #111; }
.src-telegram { background: #E1F1FB; color: #1A6A99; }
/* Сверка остатков на странице «Интеграции» */
.stk-chk-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stk-chk-h h2 { margin: 0; }
.stk-t { font-weight: 600; margin: 12px 0 4px; }
.stk-l { margin: 0 0 8px; padding-left: 20px; }
.stk-l li { margin: 2px 0; }
.stk-bad li::marker { color: #B3261E; }
.stk-fix li::marker { color: #1F7A3E; }
@media (max-width: 720px) {
  .tbl-list .tbl-what { max-width: 180px; }
  .stk-chk-h .btn { width: 100%; min-height: 44px; }
}

/* Аналитика · Специалисты (#claude-2010-4) */
.an-staff tbody tr { cursor: pointer; }
.an-staff tr.an-on td { background: var(--accent-soft); }
.an-staff-one h2 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.an-staff-one h3 { margin: 12px 0 6px; font-size: 15px; }
.an-staff-f { margin: 0 0 12px; }
.an-staff-one .cols2 > div { min-width: 0; }

/* Доска «Услуг»: авто-этапы (#claude-2110-1) */
.board-auto { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.board-auto .chk { margin: 0; min-height: 44px; display: inline-flex; align-items: center; gap: 6px; }
/* Переписка: фото, голосовые, видео, комментарии, вложения в ответе */
.chat-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.chat-img img { display: block; max-width: min(260px, 100%); max-height: 320px; border-radius: 10px; object-fit: cover; }
.chat-audio { width: min(280px, 100%); height: 40px; }
.chat-video { max-width: min(300px, 100%); max-height: 340px; border-radius: 10px; background: #000; }
.chat-file { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line-2); text-decoration: none; }
.bubble.is-c { border: 1px dashed var(--line-2); }
.bubble.is-del { opacity: .62; }
.bubble.is-del .bubble-t { text-decoration: line-through; }
.ch-tag.ch-c { color: #7C3AED; }
.ch-tag.ch-del { color: #B91C1C; }
.chat-act { margin-top: 2px; }
.chat-act .btn-link { min-height: 32px; color: #B91C1C; }
.chat-block { display: inline-flex; gap: 6px; align-items: center; margin-left: auto; }
.chat-attach { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0 10px; }
.chat-fname { font-size: 12px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* «Диалоги»: список слева, переписка справа */
.dlg-split { display: grid; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); gap: 14px; align-items: start; }
.dlg-split .dlg-list { max-height: calc(100vh - 220px); overflow-y: auto; padding-right: 4px; }
.dlg-split .dlg-item { flex-wrap: wrap; }
.dlg-item.is-open { border-color: var(--accent); background: var(--accent-soft); }
.dlg-pane { position: sticky; top: 12px; min-width: 0; }
.dlg-pane .chat { max-height: calc(100vh - 380px); min-height: 260px; }
.dlg-pane-h { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.dlg-pane-h b { font-size: 17px; }
.dlg-pane-h .btn:last-child { margin-left: auto; }
.dlgn > summary { list-style: none; cursor: pointer; }
.dlgn > summary::-webkit-details-marker { display: none; }
.dlgn[open] { flex-basis: 100%; order: 10; }
.dlgn[open] > summary { display: none; }
.dlgn-f { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--surface); }
.dlgn-f input[name=name] { flex: 1 1 200px; min-width: 0; }
.dlgn-f small { flex-basis: 100%; }
.dlg-pane-empty { min-height: 200px; display: flex; align-items: center; justify-content: center; text-align: center; }
.dlg-back { display: none; }
@media (max-width: 900px) {
  .dlg-split { grid-template-columns: minmax(0, 1fr); }
  .dlg-split > * { min-width: 0; }
  .dlg-split .dlg-list { max-height: none; overflow: visible; }
  .dlg-split.has-open .dlg-list, .dlg-split:not(.has-open) .dlg-pane { display: none; }
  .dlg-pane { position: static; }
  .dlg-pane .chat { max-height: 60vh; }
  .dlg-back { display: inline-flex; }
}

/* ---- Воронка: фильтр «Статусы» (несколько этапов + удалённые) и рассылка по выбранным ---- */
.st-flt { position: relative; }
.st-flt > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); white-space: nowrap; max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
.st-flt > summary::-webkit-details-marker { display: none; }
.st-flt > summary::after { content: "▾"; color: var(--muted); }
.st-flt.on > summary { border-color: var(--accent); background: var(--accent-soft); }
.st-flt-m { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 260px; max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 24, 40, .16); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.st-flt-m .chk { display: flex; align-items: center; gap: 8px; padding: 5px 8px; margin: 0; border-radius: 6px; cursor: pointer; min-height: 34px; line-height: 1.25; }
.st-flt-m .chk:hover { background: var(--line-2); }
.st-flt-m .chk i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.st-flt-m .st-del { border-top: 1px solid var(--line-2); margin-top: 4px; padding-top: 10px; }
.st-flt-a { display: flex; gap: 6px; padding: 8px 4px 2px; border-top: 1px solid var(--line-2); margin-top: 4px; }
.st-bc { display: inline; margin: 0; }
.col-deleted { opacity: .95; }
.col-deleted .col-h { background: #F1F5F9; }
.card.is-deleted { background: #F8FAFC; border-style: dashed; }
.b.b-del { background: #F1F5F9; color: #64748B; }
.lead-trash { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 10px 0 0; padding: 10px 14px; border-radius: 8px; background: #FEF3C7; border: 1px solid #FCD34D; font-size: 14px; }
.lead-trash form { margin: 0; }
@media (max-width: 640px) { .st-flt-m { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; max-height: 70vh; } }

.chat-read { display:flex; align-items:center; gap:10px; margin-left:auto; flex-wrap:wrap; }
.chat-read .btn { min-height:44px; white-space:nowrap; }
.chat-read small { color:var(--muted); }
@media(max-width:760px) { .chat-read { width:100%; margin:0 0 8px; } .chat-read .btn { flex:1; } }

/* Диалоги: «Прочитано» внизу у поля ответа и свайп в «Ждут ответа» */
.chat-reply:has(.chat-read-btn) { flex-wrap: wrap; }
.chat-reply .chat-read-btn { flex: 1 0 100%; order: 5; min-height: 44px; border-color: #30B060; color: #1F7A3E; background: rgba(48,176,96,.08); font-weight: 600; }
.chat-reply .chat-read-btn small { font-weight: 400; color: inherit; opacity: .75; }
.chat-read .chat-read-btn small { font-weight: 400; color: var(--muted); }
.dlg-sw { position: relative; overflow: hidden; border-radius: 8px; flex: none; }
.dlg-sw-bg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; padding-right: 22px; background: #30B060; color: #fff; font-weight: 700; border-radius: inherit; opacity: .55; transition: opacity .15s; }
.dlg-sw.is-ready .dlg-sw-bg { opacity: 1; }
.dlg-sw .dlg-item { position: relative; touch-action: pan-y; transition: transform .2s ease, height .25s ease, padding .25s ease; background: var(--surface, #fff); }
.dlg-sw .dlg-item.is-drag { transition: none; }
.dlg-sw .dlg-item.is-busy { opacity: .7; }
.dlg-swipe-hint { margin: 0 0 6px; }
.dlg-swipe-hint.bad { color: var(--danger, #dc2626); }
@media (hover: hover) and (pointer: fine) { .dlg-swipe-hint { display: none; } }
@media (max-width: 760px) { .dlg-split.has-open ~ .dlg-pager { display: none; } }   /* открыт диалог — «Ещё» от списка не показываем */

/* «Первые шаги»: на компьютере — маленькая кнопка в шапке, список открывается под ней (#claude-1111-3) */
.dsk-top>.onb-pill{min-height:40px;height:40px;padding:3px 12px 3px 4px;gap:8px;box-shadow:none;border-radius:10px;font-size:13px;white-space:nowrap}
.dsk-top>.onb-pill small{display:inline;margin-left:4px;font-weight:400}
.dsk-top>.onb-pill .onb-ring{width:30px;height:30px}.dsk-top>.onb-pill .onb-ring b{width:23px;height:23px;font-size:12px}
.dsk-top>.onb-pill[aria-expanded="true"]{background:var(--surface-2)}
.onb.onb-top{left:auto !important;right:20px;top:72px !important;bottom:auto !important}
.onb.onb-top .onb-panel{max-height:calc(100vh - 96px)}
@media (max-width:1500px){.dsk-top>.onb-pill>span:last-child{font-size:0}.dsk-top>.onb-pill small{font-size:12px;margin:0}}
.pg-h1{display:none}.dsk .pg-h1{display:block;margin:0 0 14px}.pg-h1 h1{margin:0}
