/* Sales Vector — оформление, светлая тема: узкая тёмная панель с плитками, шапка из ячеек на всю ширину,
   поля карточки строками, результаты с клавишами. */
:root {
  --bg: #f7f8f6; --panel: #ffffff; --panel-2: #f1f4f1; --text: #142019; --muted: #56635b; --line: #dfe4e0; --line-soft: #edf0ee; --field: #c3cbc6;
  --accent: #0b7a68; --accent-soft: #e1f3ef; --accent-hover: #086353; --accent-cell: #c4dfdb; --key: #12493b;
  --danger: #bb2329; --danger-soft: #fbe9e9; --ok: #137236; --ok-soft: #e5f5ea; --amber: #a84d07; --amber-soft: #fdf1df;
  --side: #142019; --side-text: #b4c0b8; --side-hi: #5ad6bf; --side-muted: #8f9c94;
  --radius: 14px; --shadow: 0 1px 2px #1420190f, 0 1px 3px #1420191a; --focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px #0b7a68;
  --tb: 52px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 "PT Sans", Onest, "Segoe UI", system-ui, sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; cursor: pointer; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; margin: 0; text-wrap: balance; }
h2 { font-size: 16px; font-weight: 600; margin: 22px 0 10px; }
h3 { font-size: 12px; margin: 18px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
h3:first-child { margin-top: 0; }
kbd { font-family: "JetBrains Mono", ui-monospace, monospace; }
[hidden] { display: none !important; }
:focus-visible:not(input, select, textarea) { outline: 2px solid transparent; box-shadow: var(--focus-ring); }

/* ---------- элементы ---------- */
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--text); border-radius: 10px; padding: 7px 12px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; text-decoration: none !important; }
button:hover, .btn:hover { border-color: #7b8880; }
.btn svg, button svg { width: 15px; height: 15px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button.primary:disabled:hover { background: var(--accent); border-color: var(--accent); }
button.big { padding: 9px 16px; font-size: 15px; }
button.small { padding: 4px 9px; font-size: 12.5px; }
button.danger { color: var(--danger); }
button.icon { padding: 6px; border-color: transparent; background: none; color: var(--muted); }
button.icon:hover { background: var(--panel-2); border-color: transparent; }
button.icon svg { width: 18px; height: 18px; }
button:disabled { opacity: .5; cursor: default; }
button:disabled:hover { border-color: var(--line); }
input, select, textarea { font: inherit; color: var(--text); background: #fff; border: 1px solid var(--field); border-radius: 10px; padding: 7px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--muted); box-shadow: none; }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
textarea { resize: vertical; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.warn { color: var(--danger); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.nw { white-space: nowrap; }
.late { color: var(--danger); font-weight: 700; }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row > * { min-width: 0; }
.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 600; white-space: nowrap; }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.green { background: var(--ok-soft); color: var(--ok); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.gray { background: #eef1ee; color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; padding: 2px 6px 2px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.chip button { border: 0; background: none; padding: 0 2px; color: inherit; font-size: 15px; line-height: 1; }
.st-chip { --c: #94a3b8; background: color-mix(in srgb, var(--c) 12%, white); color: color-mix(in srgb, var(--c) 75%, black); font-weight: 600; font-size: 12px; padding: 1px 8px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.cards { display: grid; gap: 14px; align-content: start; min-width: 0; }
.empty { color: var(--muted); padding: 34px; text-align: center; }
.err { color: var(--danger); font-size: 13px; }
.err:not(:empty) { margin-top: 8px; }
.warn-box { background: #fff7e6; border: 1px solid #fde3a7; border-radius: 8px; padding: 8px 10px; font-size: 13px; margin-bottom: 12px; }
.hint { font-size: 12.5px; color: var(--muted); padding: 6px 0 2px; }
.tt3-k { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.tt3-title { font-size: 15px; }

/* ---------- каркас ---------- */
.app { display: flex; height: 100vh; }
.sidebar { width: 76px; flex: none; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; padding: 0 6px; }
.sidebar .brand { height: var(--tb); display: flex; align-items: center; justify-content: center; border-bottom: 1px solid #ffffff14; margin: 0 -6px 8px; }
.vc-mark { width: 36px; height: 36px; display: block; }
.vc-mark .vc-bg { fill: #2fc4a8; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a, .nav-end a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 88px; padding: 7px 2px; border-radius: 8px; color: var(--side-text); text-decoration: none; }
.nav a .ico, .nav-end a .ico { width: 30px; height: 30px; color: var(--side-muted); display: grid; place-items: center; }
.nav a .ico svg, .nav-end a .ico svg { width: 30px; height: 30px; }
.nav a .lbl, .nav-end a .lbl { font-size: 11.5px; line-height: 1.15; text-align: center; }
.nav a:hover, .nav-end a:hover { background: #ffffff0f; }
.nav a.active, .nav-end a.active { background: #2fc4a829; color: #fff; }
.nav a:hover .ico, .nav a.active .ico, .nav-end a:hover .ico, .nav-end a.active .ico { color: var(--side-hi); }
.nav a .badge { position: absolute; top: 6px; right: 6px; font-size: 10px; padding: 0 4px; line-height: 14.5px; }
.nav-end { margin-top: auto; display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 8px 0 12px; border-top: 1px solid #ffffff14; }
.me-btn { align-self: center; width: 40px; height: 40px; border-radius: 12px; justify-content: center; padding: 0; background: #2fc4a833; border: 0; color: #fff; font-weight: 700; font-size: 13px; }
.me-btn:hover { background: #2fc4a855; }
.pop { position: fixed; z-index: 60; background: var(--side); color: var(--side-text); border-radius: 12px; padding: 6px; min-width: 210px; box-shadow: 0 12px 30px rgba(0,0,0,.3); display: flex; flex-direction: column; }
.pop .pop-h { padding: 8px 10px 10px; color: #fff; font-weight: 600; border-bottom: 1px solid #ffffff14; margin-bottom: 4px; }
.pop .pop-h span { display: block; color: var(--side-muted); font-weight: 400; font-size: 12px; }
.pop button { background: none; border: 0; color: var(--side-text); justify-content: flex-start; padding: 8px 10px; border-radius: 8px; }
.pop button:hover { background: #ffffff0f; color: #fff; }
.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.page { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.demo-bar { background: var(--amber-soft); color: #7c2d12; padding: 6px 20px; font-size: 13px; border-bottom: 1px solid #fde3a7; }
.content { flex: 1; min-height: 0; overflow: auto; padding: 18px 20px; }

/* шапка: ячейки во всю высоту, разделены линиями; главное действие — ячейка справа */
.topbar { display: flex; align-items: stretch; height: var(--tb); flex: none; background: var(--panel); border-bottom: 1px solid var(--line); }
.tb-cell { display: flex; align-items: center; gap: 8px; padding: 0 18px; border-right: 1px solid var(--line); min-width: 0; }
.tb-title { font-size: 15px; font-weight: 600; min-width: 200px; }
.tb-hint { border-right: 0; color: var(--muted); font-size: 12.5px; }
.tb-pick { padding: 0 14px 0 8px; min-width: 250px; }
.tb-pick select { border: 0; background: none; font-size: 15px; font-weight: 600; padding: 6px 8px; flex: 1; cursor: pointer; }
.tb-n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.seg-cell { padding: 0 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; height: 32px; }
.seg button { border: 0; border-radius: 0; padding: 0 12px; background: #fff; height: 100%; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tb-search { flex: 1; display: flex; align-items: center; gap: 6px; padding: 0 16px 0 20px; color: var(--muted); min-width: 0; }
.tb-search > svg { width: 16px; height: 16px; flex: none; }
.tb-search input { border: 0; background: none; flex: 1; font-size: 15px; padding: 6px 4px; min-width: 60px; }
.tb-tot { font-size: 13px; color: var(--muted); white-space: nowrap; }
.tb-dates { gap: 6px; }
.tb-dates input { border-color: var(--line); padding: 4px 8px; }
.d-add { border: 0; border-left: 1px solid var(--line); border-radius: 0; background: var(--accent-cell); color: var(--accent); font-weight: 600; font-size: 14.5px; width: 240px; justify-content: center; }
.d-add:hover { background: #b3d6d0; border-color: var(--line); }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { border: 0; background: none; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 10px; color: var(--muted); }
.tabs button.on { color: var(--accent); border-color: var(--accent); font-weight: 600; }

/* ---------- таблицы ---------- */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--panel-2); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
td { font-size: 15px; }
th.num, td.num { text-align: right; }
tr:last-child td { border-bottom: none; }
tr.hov:hover td { background: #f1f7f4; }
tr.total td { font-weight: 700; background: var(--panel-2); }
tr.off td { color: var(--muted); }
td .sub { display: block; font-size: 12px; color: var(--muted); }
.d-lnk { color: var(--key); font-weight: 500; font-size: 14.5px; cursor: pointer; }
.d-lnk:hover { text-decoration: underline; }
td .take { visibility: hidden; }
tr:hover td .take, td .take:focus-visible { visibility: visible; }

/* ---------- поля строками, как в карточке ---------- */
.fields { display: block; }
.field { display: grid; grid-template-columns: 170px minmax(0, 1fr); align-items: center; gap: 12px; min-height: 36px; padding: 3px 0; border-bottom: 1px solid var(--line-soft); margin: 0; }
.field > span:first-child { color: var(--muted); font-size: 14px; }
.field.ro .v { padding: 4px 0; }
.field input, .field select, .field textarea { border-color: transparent; background: transparent; padding: 5px 8px; margin-left: -8px; width: calc(100% + 8px); }
.field input:hover, .field select:hover, .field textarea:hover { background: var(--panel-2); }
.field input:focus, .field select:focus, .field textarea:focus { background: #fff; border-color: var(--muted); }
.field input::placeholder, .field textarea::placeholder { color: #a5aea8; }
.field.need > span:first-child { color: var(--text); font-weight: 600; }
.field.need select, .field.need input { background: var(--amber-soft); }
.tgl { display: inline-flex; flex-wrap: wrap; gap: 2px; background: #eef1ee; border-radius: 10px; padding: 3px; justify-self: start; }
.tgl button { border: 0; background: none; padding: 4px 12px; border-radius: 8px; color: var(--muted); font-size: 13.5px; }
.tgl button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px #1420191f, 0 1px 3px #14201914; font-weight: 600; }
.rc { display: grid; gap: 6px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.quick button { padding: 3px 9px; font-size: 12.5px; border-radius: 8px; }

/* ---------- в работе ---------- */
.res-bar { position: sticky; top: -18px; z-index: 3; margin: -18px -20px 14px; padding: 10px 20px; background: #f7f8f6eb; backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.rb-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rb-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.rb-btns { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; min-width: 0; }
.rb-btn { --c: #94a3b8; height: 34px; padding: 0 12px 0 6px; border-radius: 9px; border: 2px solid color-mix(in srgb, var(--c) 45%, white); background: color-mix(in srgb, var(--c) 7%, white); color: color-mix(in srgb, var(--c) 80%, black); font-size: 13px; font-weight: 600; }
.rb-btn:hover { border-color: var(--c); }
.rb-btn kbd { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; background: #fff; border: 1px solid #dfe3ea; color: #687389; font-size: 11px; font-weight: 600; }
.rb-btn.on { background: var(--c); border-color: var(--c); color: #fff; }
.rb-btn.on kbd { background: #ffffff33; border-color: #ffffff59; color: #fff; }
.rb-btn:disabled:hover { border-color: color-mix(in srgb, var(--c) 45%, white); }
.rb-save { height: 38px; }
.rb-save kbd { font-size: 10px; padding: 1px 5px; border-radius: 4px; background: #ffffff33; border: 1px solid #ffffff59; }
.work-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 16px; align-items: start; }
.work-todo { border-left: 4px solid var(--accent); margin-bottom: 12px; padding: 12px 16px; }
.work-todo.late { border-left-color: #dc2626; background: #fef2f2; }
.work-todo.late .tt3-k { color: var(--danger); }
.am { padding: 18px 22px; }
.am-top { margin-bottom: 4px; }
.am-tf { display: flex; align-items: baseline; gap: 12px; }
.am-rn { font-size: 21px; font-weight: 600; flex: 1; min-width: 0; }
.am-rn .d-lnk { font-size: inherit; font-weight: inherit; color: var(--text); }
.am-no { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.am-no svg { width: 13px; height: 13px; }
.am-stage { display: flex; gap: 6px; align-items: baseline; padding: 2px 0; }
.am-stage i { color: var(--muted); font-style: normal; }
.am-k { font-size: 12px; color: var(--muted); }
.callbox { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 14px 0 10px; }
.phone-big { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .01em; user-select: all; }
.hist-wrap { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.hist { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 3px; }
.hist li span { color: var(--text); }
.list-card { padding: 12px 14px; }
.lc-h { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.lc-row { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.lc-main { flex: 1; min-width: 0; }
.lc-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.lc-empty { padding: 6px 0 2px; }

/* ---------- окна ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 20, 18, .35); z-index: 20; display: flex; justify-content: flex-end; }
.overlay.center { justify-content: center; align-items: center; padding: 16px; z-index: 30; }
.modal { background: var(--panel); border-radius: 12px; padding: 20px; width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.modal h2 { margin: 0 0 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.drawer { width: min(900px, 100%); height: 100%; background: var(--bg); display: flex; flex-direction: column; box-shadow: -10px 0 30px rgba(0,0,0,.15); }
.drawer.narrow { width: min(620px, 100%); }
.drawer-head { background: var(--panel); padding: 14px 20px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dh-t { min-width: 0; }
.drawer-body { flex: 1; overflow: auto; padding: 16px 20px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.drawer-body.one { grid-template-columns: minmax(0, 1fr); }
.drawer-foot { background: var(--panel); border-top: 1px solid var(--line); padding: 12px 20px; display: flex; gap: 8px; align-items: center; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; padding: 10px 16px; border-radius: 11px; z-index: 70; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast.e { background: var(--danger); }

/* ---------- вход ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(380px, 100%); padding: 26px; }
.login .brand { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; font-size: 18px; font-weight: 600; }
.login .brand .vc-mark { width: 30px; height: 30px; }
.login .brand .vc-mark .vc-bg { fill: var(--accent); }
.login .brand i { font-style: normal; color: var(--accent); font-weight: 400; font-size: 15px; }
.lf { display: block; margin-bottom: 10px; }
.lf > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.lf input { width: 100%; }
.demo-roles { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.demo-roles .muted { width: 100%; }

@media (max-width: 900px) {
  .app { flex-direction: column; height: auto; min-height: 100vh; }
  .sidebar { width: auto; flex-direction: row; align-items: center; padding: 0 max(6px, env(safe-area-inset-right, 0px)) 0 max(6px, env(safe-area-inset-left, 0px)); }
  .sidebar .brand { border: 0; margin: 0 6px 0 0; height: 52px; }
  .nav { flex-direction: row; }
  .nav a, .nav-end a { height: 52px; padding: 4px 10px; gap: 2px; }
  .nav a .ico, .nav a .ico svg, .nav-end a .ico, .nav-end a .ico svg { width: 22px; height: 22px; }
  .nav-end { margin: 0 0 0 auto; flex-direction: row; border: 0; padding: 0; align-items: center; }
  .main { overflow: visible; }
  .content { overflow: visible; padding: 14px max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px)); }
  .topbar { height: auto; flex-wrap: wrap; }
  .tb-cell, .tb-search { min-height: 48px; border-bottom: 1px solid var(--line); }
  .tb-title, .tb-pick { min-width: 0; }
  .tb-hint { display: none; }
  .d-add { width: 100%; min-height: 48px; border-left: 0; }
  .work-grid, .drawer-body { grid-template-columns: 1fr; }
  .field { grid-template-columns: 120px minmax(0, 1fr); }
  .res-bar { position: static; margin: -14px -16px 14px; }
}

/* ---------- v2: шаги работы, чат Авито, отчёты ---------- */
.step { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
button.linkish { border: 0; background: none; color: var(--muted); text-decoration: underline; padding: 4px 6px; }
.rb-hint { margin-top: 6px; }
.lead-row { margin-top: 10px; gap: 10px; align-items: center; }
.calls { margin-top: 10px; display: grid; gap: 6px; }
.call-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--line-soft); }
.call-row audio { height: 32px; max-width: 100%; flex: 1 1 260px; }
.about { padding: 12px 0; border-top: 1px solid var(--line-soft); }
.about p { margin: 6px 0 0; white-space: pre-wrap; }
.card.idle { text-align: center; padding: 48px 24px; display: grid; gap: 12px; justify-items: center; }
.idle-t { font-size: 20px; font-weight: 600; }
.tb-stat { gap: 6px; color: var(--muted); }
.tb-stat b { color: var(--text); }
.sh-online.on, .seg button.sh-online { background: var(--ok-soft); color: var(--ok); }
.seg button.sh-break { background: var(--amber-soft); color: var(--amber); }
.seg button.sh-training { background: #e8eefc; color: #2f4fb3; }
.me-btn.sh-online { box-shadow: 0 0 0 2px var(--side), 0 0 0 4px #2fc46b; }
.me-btn.sh-break { box-shadow: 0 0 0 2px var(--side), 0 0 0 4px #f5a524; }
.me-btn.sh-training { box-shadow: 0 0 0 2px var(--side), 0 0 0 4px #6d8cf0; }
.pop .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #8f9c94; }
.pop .dot.sh-online { background: #2fc46b; } .pop .dot.sh-break { background: #f5a524; } .pop .dot.sh-training { background: #6d8cf0; }
.pop button.on { color: #fff; font-weight: 600; }
.pop-sep { height: 1px; background: #ffffff14; margin: 4px 0; }

.chat { display: flex; flex-direction: column; gap: 8px; }
.work-grid #side .chat { position: sticky; top: 12px; }
.msgs { max-height: 46vh; min-height: 120px; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 8px; background: var(--panel-2); border-radius: 10px; }
.drawer .msgs { max-height: 55vh; }
.msg { display: flex; flex-direction: column; max-width: 86%; }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; align-items: flex-end; }
.msg .bubble { padding: 7px 11px; border-radius: 12px; background: #fff; border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.out .bubble { background: var(--accent-soft); border-color: var(--accent-cell); }
.msg.sys { align-self: center; align-items: center; max-width: 100%; }
.msg.sys .bubble { background: none; border: 1px dashed var(--line); color: var(--muted); font-size: 12.5px; }
.msg .mt { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.compose { display: grid; gap: 6px; }
.compose select, .compose textarea { width: 100%; }
.compose textarea { resize: vertical; }

.chat-list { padding: 0; overflow: hidden; }
.cl-row { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); cursor: pointer; align-items: center; }
.cl-row:hover { background: var(--panel-2); }
.cl-row.unread { background: #fff8ec; }
.cl-main { flex: 1; min-width: 0; }
.cl-main .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toast.click { cursor: pointer; bottom: 16px; left: auto; right: 16px; transform: none; background: var(--side); max-width: 380px; }

.sug { display: grid; gap: 4px; margin: 4px 0 8px; }
.sug button { justify-content: flex-start; }
.chk { display: grid; gap: 4px; max-height: 260px; overflow: auto; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.chk label { display: flex; gap: 8px; align-items: center; font-size: 13.5px; cursor: pointer; }
table.kpi th.vh { white-space: nowrap; font-size: 11.5px; }
table.kpi tr.total td { font-weight: 700; background: var(--panel-2); }
table.kpi td.num, table.kpi th.num { padding-left: 8px; padding-right: 8px; }
td.cm { max-width: 280px; }
.field .chk input[type=checkbox] { width: auto; margin: 0; padding: 0; }
.quick button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- v3: «Работа» как карточка сделки — слева резюме и действия, справа широкий чат ---------- */
.wk { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(380px, 460px) minmax(0, 1fr); gap: 16px; padding: 16px 20px; }
.wk.idle-wrap { grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); overflow: auto; align-items: start; }
.wk-left { min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 2px; }
.wk-right { min-height: 0; display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.wk-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 12px; flex: none; }
.wk-tabs button { border: 0; border-radius: 0; background: none; padding: 14px 10px 12px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; }
.wk-tabs button.on { color: var(--text); border-color: var(--accent); }
.wk-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.wk-pane[hidden] { display: none !important; }
.chat.bare { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 0; }
.chat.bare .msgs { flex: 1; max-height: none; border-radius: 0; padding: 16px 20px; background: var(--panel-2); }
.chat.bare .compose { padding: 12px 16px; border-top: 1px solid var(--line); background: var(--panel); }
.chat.bare .compose select { width: auto; max-width: 100%; }
.hist-box { padding: 16px 20px; overflow: auto; flex: 1; }

.wk-head { border-radius: var(--radius); padding: 12px 16px; color: #fff; display: flex; flex-direction: column; gap: 2px; }
.wk-head.k-new { background: var(--accent); }
.wk-head.k-ndz { background: #5b6472; }
.wk-head.k-recall { background: #b45309; }
.wk-head.k-again { background: #4338ca; }
.wk-kind { font-size: 18px; font-weight: 700; letter-spacing: .01em; }
.wk-kd { font-size: 13px; opacity: .9; }
.wk-card { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.wk-who { color: var(--muted); }
.wk-who b { color: var(--text); }
.timers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tm { border-radius: 10px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tm span { font-size: 12px; color: var(--muted); font-weight: 600; }
.tm .tmr, .tm .tm-fix { font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.tm .tm-fix { font-size: 16px; }
.tm i { font-style: normal; font-size: 11px; color: var(--muted); }
.tm[data-tone=ok] { background: var(--ok-soft); border-color: #b7e2c4; } .tm[data-tone=ok] .tmr { color: var(--ok); }
.tm[data-tone=warn] { background: var(--amber-soft); border-color: #f5d29b; } .tm[data-tone=warn] .tmr { color: var(--amber); }
.tm[data-tone=bad] { background: var(--danger-soft); border-color: #f2b8b8; } .tm[data-tone=bad] .tmr { color: var(--danger); }
.step-box, .res-box, .note-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.step-box { background: var(--panel-2); }
.res-box { border-color: var(--accent-cell); }
.res-box .rb-btns { flex: none; }
.note-box textarea { width: 100%; }
.rq { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.rq-l { font-size: 13px; font-weight: 600; }
.rq.need .rq-l { color: var(--amber); }
.res-det summary { cursor: pointer; font-weight: 600; color: var(--muted); padding: 4px 0; }
.res-det .field { grid-template-columns: 140px minmax(0, 1fr); }
.xph { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); padding-top: 8px; }
.xph-row { display: flex; gap: 8px; align-items: center; }
.xph-row b { font-variant-numeric: tabular-nums; }
.xph-add { display: flex; gap: 6px; }
.xph-add input { flex: 1; }
.tb-link { color: var(--muted); text-decoration: none !important; }
.tb-link:hover { background: var(--panel-2); }

/* очередь списком */
.fchip { display: inline-flex; align-items: center; gap: 2px; background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 2px 4px 2px 8px; font-size: 13px; white-space: nowrap; }
.fchip button { border: 0; background: none; padding: 0 4px; color: inherit; font-size: 15px; line-height: 1; }
.fsel { border: 0; background: none; color: var(--muted); font-size: 13px; padding: 4px; cursor: pointer; max-width: 120px; }
table.qt tr[data-open] { cursor: pointer; }
.wait { display: inline-block; border-radius: 6px; padding: 1px 8px; font-variant-numeric: tabular-nums; }
.wait[data-tone=ok] { background: var(--ok-soft); color: var(--ok); }
.wait[data-tone=warn] { background: var(--amber-soft); color: var(--amber); }
.wait[data-tone=bad] { background: var(--danger-soft); color: var(--danger); }

@media (max-width: 900px) {
  .wk, .wk.idle-wrap { grid-template-columns: 1fr; padding: 12px 16px; }
  .wk-left { overflow: visible; }
  .wk-right { min-height: 70vh; }
  .timers { grid-template-columns: 1fr 1fr 1fr; }
  .tm .tmr { font-size: 17px; }
}

/* v4: «Обработка» с вкладками */
.wtabs { display: flex; gap: 2px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; overflow-x: auto; }
.wtabs button { border: 0; border-radius: 0; background: none; padding: 11px 12px 9px; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; }
.wtabs button.on { color: var(--text); border-color: var(--accent); }
.wk-list { flex: 1; min-height: 0; overflow: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.topbar.sub { border: 1px solid var(--line); border-radius: var(--radius); height: 48px; overflow: hidden; }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--accent-cell); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 900px) { .wk-list { padding: 12px 16px; } .topbar.sub { height: auto; } }

/* v5: итоги и статусы без цветового шума — нейтральные кнопки, выбранная — акцентом */
.rb-btn, .rb-btn:disabled:hover { border: 1px solid var(--line); background: #fff; color: var(--text); font-weight: 500; }
.rb-btn:hover { border-color: #7b8880; }
.rb-btn kbd { background: var(--panel-2); border-color: var(--line); color: var(--muted); }
.rb-btn.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.st-chip { background: #eef1ee; color: #3f4a44; font-weight: 600; }
.cr-ok { color: var(--ok); }
table.qt td .take { visibility: visible; }

/* v6: итог списком, запись в Парк / Партнёрку, даты публикации */
.st-sel { width: 100%; font-size: 15px; padding: 10px 12px; border-radius: 8px; }
.st-sel.on { border-color: var(--accent, #16a34a); font-weight: 600; }
.wk-dates { margin-top: 2px; }
.reg-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line, #e5e7eb); }
.reg-box .reg-pair { display: inline-flex; gap: 4px; align-items: center; }
.reg-done { font-size: 13px; font-weight: 600; color: #15803d; }
.reg-done code { font-weight: 400; font-size: 12px; }
.views { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; font-size: 12px; color: var(--muted, #6b7280); vertical-align: middle; }
.views svg { width: 14px; height: 14px; }
table.qt .chip.small { margin-left: 6px; font-size: 11px; padding: 1px 6px; vertical-align: middle; }
table.qt .chip.new { background: #dcfce7; color: #166534; }
.sh-sel { font-weight: 600; padding: 7px 10px; border-radius: 8px; min-width: 140px; }
.sh-sel.sh-online { background: #dcfce7; color: #166534; border-color: #86efac; }
.sh-sel.sh-break, .sh-sel.sh-training { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
table.qt .chip.upd { background: #f1f5f9; color: #64748b; }


/* v8: компактные таймеры над названием, без плашки типа */
.wk-card .timers { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.wk-card .tm { flex-direction: row; align-items: baseline; gap: 6px; padding: 4px 10px; border-radius: 999px; }
.wk-card .tm span { font-size: 12px; font-weight: 500; }
.wk-card .tm .tmr { font-size: 15px; font-weight: 700; line-height: 1.3; }
.wk-card .tm .tm-fix { font-size: 13px; font-weight: 600; }
.wk-card .tm-k.k-recall { background: #fef3c7; border-color: #fcd34d; }
.wk-card .tm-k.k-ndz { background: #e2e8f0; border-color: #cbd5e1; }
.wk-card .tm-k.k-again { background: #e0e7ff; border-color: #c7d2fe; }

/* v9: лидовость из кабинета Яндекса */
.lead-chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.lead-chip.t-ok { background: #dcfce7; border-color: #86efac; color: #166534; }
.lead-chip.t-warn { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.lead-chip.t-bad { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.spin.sm { display: inline-block; width: 11px; height: 11px; border-width: 2px; vertical-align: -1px; margin-right: 3px; }
.lc-state { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.lc-nums { margin-bottom: 8px; }
.lc-code { display: grid; gap: 8px; margin: 8px 0 12px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.lc-code img { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.lc-bulk { display: grid; gap: 8px; }
.lc-bulk .bar { height: 10px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.lc-bulk .bar i { display: block; height: 100%; background: var(--accent); transition: width .4s; }
