/* Палитра и кнопки — как в интерфейсе Битрикс24 (общие с b24-focus и b24-crm-hygiene); компоновка — карточки, плитки, таблицы в рамке */
:root {
  --ground: #eef2f4;
  --surface: #fff;
  --ink: #333;
  --ink-2: #525c69;
  --muted: #6f7882;
  --line: #e4e8eb;
  --line-strong: #cfd5da;
  --chip-bg: #f5f7f8;
  --accent: #2fc6f6;
  --accent-dark: #11a9d9;
  --link: #2067b0;
  --cta: #bbed21;
  --cta-hover: #d2f95f;
  --danger: #ff5752;
  --ok-bg: #f1fbd0; --ok-ink: #4f7d00; --ok-mark: #7bb300;
  --err-bg: #ffe8e8; --err-ink: #d0312b; --err-mark: #ff5752;
  --info-bg: #e5f9ff; --info-ink: #0b8eb6;
  --warn-bg: #fff4d6; --warn-ink: #8a5a00; --warn-mark: #f5b400;
  --shadow: 0 1px 2px rgba(20, 24, 30, .06), 0 4px 14px rgba(20, 24, 30, .05);
  --radius: 12px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 15px/1.45 "Golos Text", "Open Sans", "Helvetica Neue", Arial, sans-serif;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--link); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.error { color: var(--err-ink); }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.pad { padding: 24px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 0; }

/* ---------- каркас ---------- */
.app { max-width: 1240px; margin: 0 auto; padding: 16px clamp(12px, 3vw, 28px) 40px; display: flex; flex-direction: column; gap: 20px; }
.topbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border-radius: 10px; padding: 3px; box-shadow: var(--shadow); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; color: var(--ink-2); padding: 7px 14px; border-radius: 8px; white-space: nowrap; font-size: 14px; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }

.page-head { display: flex; flex-direction: column; gap: 6px; }
.eyebrow { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
h1 { margin: 0; font-size: clamp(22px, 2.6vw, 30px); line-height: 1.15; font-weight: 600; text-wrap: balance; }
h2 { margin: 0; font-size: 18px; font-weight: 600; }
.thesis { margin: 0; max-width: 78ch; color: var(--ink-2); }
.back { align-self: flex-start; border: 0; background: none; padding: 0; color: var(--link); font-size: 14px; }
.back:hover { text-decoration: underline; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 12px; }
.section { display: flex; flex-direction: column; gap: 14px; }

/* ---------- кнопки и поля (ui-btn Битрикс24) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 18px; border-radius: 18px; border: 1px solid var(--line-strong);
  background: #fff; color: var(--ink-2); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em;
  white-space: nowrap;
}
.btn:hover { border-color: #a8adb4; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-cta { background: var(--cta); border-color: var(--cta); color: var(--ink-2); }
.btn-cta:hover:not(:disabled) { background: var(--cta-hover); border-color: var(--cta-hover); }
.btn-danger { color: var(--err-ink); border-color: #f3b7b5; }
.btn-l { height: 46px; border-radius: 23px; font-size: 13px; padding: 0 28px; }
.btn-s { height: 30px; padding: 0 12px; border-radius: 15px; font-size: 11px; }
.x { border: 0; background: var(--surface); color: var(--ink-2); border-radius: 50%; width: 28px; height: 28px; font-size: 16px; line-height: 1; flex: none; }
.x:hover { background: var(--ink-2); color: #fff; }

/* поддержка */
.support { display: flex; flex-direction: column; gap: 10px; border-left: 4px solid var(--accent); }
.support .card-head { margin-bottom: 0; }
.support-ctx { color: var(--ink-2); }
textarea.input { resize: vertical; }

.input {
  width: 100%; min-height: 38px; padding: 7px 10px; font: inherit; font-size: 14px; color: inherit;
  border: 1px solid var(--line-strong); border-radius: 8px; background: #fff;
}
.input:focus { outline: none; border-color: var(--accent); }
.input-s { min-height: 32px; padding: 5px 8px; }
select.input { width: auto; max-width: 100%; }
.num-input { width: 96px; }
.search { max-width: 320px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field-label { font-size: 13px; color: var(--ink-2); }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.check-line { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check-line input { accent-color: var(--accent); margin-top: 3px; flex: none; }

/* метки */
.pill { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 6px; white-space: nowrap; background: var(--chip-bg); color: var(--ink-2); }
.pill.info { background: var(--info-bg); color: var(--info-ink); }
.pill.ok { background: var(--ok-bg); color: var(--ok-ink); }
.pill.err { background: var(--err-bg); color: var(--err-ink); }
.pill.warn { background: var(--warn-bg); color: var(--warn-ink); }

.dashed { border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 16px 18px; color: var(--ink-2); background: var(--surface); }
.dashed b { color: var(--ink); font-weight: 600; }
.note { border-radius: 10px; padding: 12px 14px; font-size: 14px; display: flex; flex-direction: column; gap: 8px; }
.note.warn { background: var(--warn-bg); color: var(--warn-ink); }
.note.ok { background: var(--ok-bg); color: var(--ok-ink); }
.note.err { background: var(--err-bg); color: var(--err-ink); }
.note.info { background: var(--info-bg); color: var(--info-ink); }

.progress { height: 10px; background: var(--chip-bg); border-radius: 5px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 5px; transition: width .4s; }
/* ---------- фильтры и таблицы ---------- */
.toolbar { display: flex; gap: 8px 12px; flex-wrap: wrap; align-items: center; }
.toolbar .right { margin-left: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line-strong); background: #fff; border-radius: 14px; padding: 4px 11px; font-size: 13px; color: var(--ink-2); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .n { opacity: .75; margin-left: 4px; font-variant-numeric: tabular-nums; }

.tablewrap { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; border: 1px solid var(--line-strong); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 13px; font-weight: 600; background: var(--chip-bg); padding: 10px 12px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: top; }
td.title a { font-weight: 500; text-decoration: none; }
td.title a:hover { text-decoration: underline; }
th.num, td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; }
.wide { min-width: 720px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
/* ---------- настройки, справка, отчёты ---------- */
.settings { display: flex; flex-direction: column; gap: 14px; max-width: 820px; }
.settings .card { display: flex; flex-direction: column; gap: 10px; }
.settings .card-head { margin-bottom: 0; }
/* таблица полей в настройках — как в «Гигиене CRM» */
.notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.notes ul { margin: 10px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; font-size: 14px; color: var(--ink-2); }
.notes b { color: var(--ink); }

/* ---------- журнал изменений ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kpi { display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-value { font-size: 34px; font-weight: 600; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi-value.small { font-size: 18px; line-height: 1.3; }
.kpi .hint { margin-top: auto; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.ok { background: var(--ok-mark); }
.dot.warn { background: var(--warn-mark); }
.dot.err { background: var(--err-mark); }

.users-picked { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-x { border: 0; background: none; padding: 0 0 0 6px; color: var(--muted); }
textarea.input { min-height: 70px; font-family: inherit; }
@media (max-width: 560px) {
  .hit { grid-template-columns: 1fr; }
  .hit-actions { grid-row: auto; }
}
.save-status { font-size: 13px; }
.save-status.ok { color: var(--ok-ink); }
.save-status.err { color: var(--err-ink); }
details > summary { cursor: pointer; font-weight: 500; }
.search { max-width: 420px; flex: 1 1 260px; }

/* ---------- знакомство, поддержка (как в «Метках») ---------- */
.support { display: flex; flex-direction: column; gap: 10px; border-left: 4px solid var(--accent); }
.support .card-head { margin-bottom: 0; }
.support-ctx { color: var(--ink-2); }
.tour-tab { position: fixed; right: 0; top: 96px; z-index: 5; writing-mode: vertical-rl; transform: rotate(180deg); border: 0; border-radius: 0 8px 8px 0;
  background: var(--accent); color: #fff; padding: 12px 5px; font-size: 13px; box-shadow: var(--shadow); }
.tour-tab:hover { background: var(--accent-dark); }
@media (max-width: 700px) { .tour-tab { display: none; } }
.ob-overlay { position: fixed; inset: 0; background: rgba(20, 24, 30, .45); display: flex; justify-content: center; align-items: flex-start; padding: 24px 16px; overflow-y: auto; z-index: 100; }
.ob { position: relative; background: var(--surface); border-radius: 16px; box-shadow: 0 12px 40px rgba(20, 24, 30, .25); width: 100%; max-width: 760px; overflow: hidden; }
.ob-x { position: absolute; top: 10px; right: 10px; background: rgba(255, 255, 255, .9); z-index: 1; }
.ob-pic { background: var(--ground); border-bottom: 1px solid var(--line); height: 300px; overflow: hidden; display: flex; align-items: flex-start; justify-content: center; }
.ob-pic img { width: 100%; height: auto; display: block; }
.ob-pic.small { align-items: center; background: linear-gradient(135deg, #e6eaff, #f1e7fd); }
.ob-pic.fit { height: auto; padding: 16px 16px 0; }
.ob-pic.fit img { border-radius: 10px 10px 0 0; border: 1px solid var(--line-strong); border-bottom: 0; box-shadow: var(--shadow); }
.ob-pic.small img { width: 120px; border-radius: 26px; box-shadow: 0 8px 24px rgba(46, 68, 184, .25); }
.ob-body { padding: 18px 24px 20px; display: flex; flex-direction: column; gap: 8px; }
.ob-body h2 { font-size: 20px; }
.ob-body p { margin: 0; color: var(--ink-2); }
.ob-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 10px; }
.ob-dots { display: flex; gap: 6px; }
.ob-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.ob-dots i.on { background: var(--accent); width: 22px; border-radius: 4px; }
.ob-skip { border-color: transparent; color: var(--muted); }
.ob-tag { display: inline-block; background: var(--warn-bg); color: var(--warn-ink); border-radius: 6px; padding: 1px 8px; margin-right: 8px; letter-spacing: .04em; }
.ob-path { font-size: 14px; background: var(--chip-bg); border-radius: 8px; padding: 8px 12px; color: var(--ink); }
@media (max-width: 760px) {
  .kpis, .notes, .apps { grid-template-columns: minmax(0, 1fr); }
  .ob-pic { height: 180px; }
  .toolbar .right { margin-left: 0; }
  .card { padding: 16px; }
}


/* «Поможем настроить …» — компактная плашка с вопросом в чат поддержки (как в «Премиях» и «Особых полях», но меньше) */
.cta-chat { margin: 0; max-width: 820px; padding: 9px 12px 9px 10px; border-radius: 10px; color: #fff;
  background: linear-gradient(120deg, #4aa3ff 0%, #1269d3 100%); box-shadow: 0 3px 10px rgba(30, 136, 255, .2); }
.cta-main { display: flex; align-items: center; gap: 10px; }
.cta-ico { flex: none; width: 30px; height: 30px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 16px; line-height: 1; }
.cta-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 13px; color: rgba(255,255,255,.92); }
.cta-title { font-size: 14px; font-weight: 600; color: #fff; display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; }
.cta-free { font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; background: #ffe066; color: #5c4400; border-radius: 5px; padding: 1px 6px; }
.cta-act { flex: none; display: flex; align-items: center; }
.btn.cta-btn { height: 30px; padding: 0 14px; background: #fff; color: #1265c7; border: 0; font-weight: 700; text-decoration: none; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.btn.cta-btn:hover { background: #eef6ff; }
.btn.cta-btn:disabled { opacity: .7; cursor: default; }
.cta-link { border: 0; background: none; padding: 0; color: #fff; font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.cta-form { margin-top: 9px; display: flex; flex-direction: column; gap: 8px; }
.cta-form .input { border-color: transparent; color: #333; }
.cta-form-row { display: flex; align-items: center; gap: 14px; }
.cta-msg { margin-top: 6px; font-size: 13px; color: #fff; font-weight: 500; }
@media (max-width: 720px) { .cta-main { flex-wrap: wrap; } .cta-act { width: 100%; } }
.cta-chat [hidden] { display: none !important; }

/* ---------- справочники ---------- */
.btn-ghost { border-color: transparent; color: var(--muted); }
.btn-ghost:hover { border-color: var(--line-strong); }
.sets { display: flex; flex-direction: column; gap: 10px; }
.set { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
.set-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.set-name { font-size: 17px; font-weight: 600; }
.chain { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chain .arrow { color: var(--muted); }
.hero { display: flex; flex-direction: column; gap: 10px; border: 2px solid var(--accent); }
.hero h2 { font-size: 22px; }
.templates { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.tpl { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 14px; border: 1px solid var(--line-strong);
  border-radius: 10px; background: #fff; }
.tpl:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.tpl-ico { font-size: 22px; line-height: 1; }
.tpl-name { font-weight: 600; font-size: 15px; }
.tpl-chain { font-size: 13px; color: var(--ink-2); }

/* редактор */
.editor { display: flex; flex-direction: column; gap: 14px; }
.levels { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; align-items: start; }
.level { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 10px; background: var(--chip-bg); }
.level-n { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.level-act { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; align-self: center; }
.check-line.small { font-size: 13px; }
.cols { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(200px, 1fr); border: 1px solid var(--line-strong); border-radius: 10px; overflow-x: auto; }
.col { display: flex; flex-direction: column; min-width: 0; border-left: 1px solid var(--line); }
.col:first-child { border-left: 0; }
.col-head { display: flex; justify-content: space-between; gap: 8px; padding: 9px 12px; background: var(--chip-bg); border-bottom: 1px solid var(--line); font-size: 14px; }
.col-list { height: 300px; overflow-y: auto; padding: 4px 0; }
.col-empty { padding: 12px; font-size: 13px; color: var(--muted); }
.node { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 12px; font-size: 14px; cursor: pointer; }
.node:hover { background: #f3f6f8; }
.node.on { background: var(--info-bg); color: var(--ink); }
.node-v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-n { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.node.on .node-n::after, .node .node-n:not(:empty)::after { content: ' ›'; }
.node-act { display: none; gap: 2px; }
.node:hover .node-act, .node.on .node-act { display: inline-flex; }
.node-act button { border: 0; background: none; color: var(--muted); width: 22px; height: 22px; border-radius: 4px; padding: 0; font-size: 13px; }
.node-act button:hover { background: #fff; color: var(--ink); }
.col-add { padding: 8px; border-top: 1px solid var(--line); }
.import > summary { color: var(--link); font-size: 14px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.ents { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; }
.preview { display: flex; flex-direction: column; gap: 10px; }
.pv-lbl { font-size: 13px; color: #828b95; margin-bottom: 4px; }
.pv-ctl { width: 100%; height: 39px; border: 1px solid #c6cdd3; border-radius: 2px; padding: 0 8px; font: inherit; font-size: 15px; color: #333; background: #fff; }
.pv-ctl:disabled { background: #f5f7f8; color: #a8adb4; }
@media (max-width: 860px) {
  .templates { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two, .ents { grid-template-columns: minmax(0, 1fr); }
}

/* ветки: своё название поля в заголовке колонки */
.col-title { display: inline-flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.col-ren { border: 0; background: none; color: #a8adb4; cursor: pointer; padding: 0 2px; font-size: 13px; }
.col-ren:hover { color: #2067b0; }
.small-pill { font-size: 11px; padding: 1px 7px; }

/* ---------- правила ---------- */
.tab-badge { display: inline-block; margin-left: 6px; font-size: 11px; padding: 0 6px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-ink); }
.warn-badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); white-space: nowrap; }
.scope { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; padding: 14px 16px; }
.scope-name { flex: 1 1 260px; display: flex; flex-direction: column; gap: 4px; }
.rgrid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
@media (max-width: 860px) { .rgrid { grid-template-columns: 1fr; } }
.tree { padding: 14px 10px 16px; }
.rel { position: relative; }
.tree-head { display: flex; justify-content: space-between; align-items: baseline; padding: 0 10px 10px; gap: 8px; }
.tree-head b { font-size: 15px; }
.tree-head span { font-size: 12px; color: var(--muted); }
.tree .f { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.tree .f:hover { background: #f6f9fa; }
.tree .f.on { background: #eaf8fe; border-color: #b7e8fa; }
.ico { width: 28px; height: 28px; border-radius: 7px; background: var(--chip-bg); display: grid; place-items: center; font-size: 13px; color: var(--ink-2); flex: none; }
.tree .f .t { flex: 1; min-width: 0; }
.tree .f .name { font-size: 15px; color: var(--ink); }
.tree .f .meta { font-size: 12px; color: var(--muted); }
.branches { margin: 2px 0 6px 26px; border-left: 2px solid var(--line); padding-left: 14px; }
.when { display: flex; align-items: center; gap: 8px; margin: 10px 0 2px -24px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.when::before { content: ''; width: 18px; border-top: 2px solid var(--line); flex: none; }
.when b { background: #f0f4f6; border-radius: 12px; padding: 2px 10px; font-weight: 600; color: var(--ink); border: 1px solid transparent; }
.when.on b { background: #eaf8fe; border-color: #b7e8fa; }
.when.muted-when { color: var(--muted); font-size: 12px; cursor: default; }
/* действия в строках дерева: видны при наведении и у выбранной строки */
.tacts { display: inline-flex; gap: 2px; margin-left: auto; opacity: 0; transition: opacity .12s; }
.tree .f:hover .tacts, .tree .f.on .tacts { opacity: 1; }
.tact { border: 0; background: none; border-radius: 6px; padding: 2px 7px; font-size: 15px; line-height: 20px; color: var(--muted); cursor: pointer; }
.tact.txt { font-size: 12px; color: var(--link); }
.tact:hover { background: #e9eef1; color: var(--ink); }
.tact.del:hover { background: var(--err-bg); color: var(--err-ink); }
.when .tact { opacity: 0; margin-left: 2px; font-size: 14px; padding: 0 6px; }
.when:hover .tact, .when.on .tact { opacity: 1; }
.when.more-when { cursor: default; gap: 12px; flex-wrap: wrap; }
.tree .add.more { margin: 0; }
.muted-note { color: var(--muted); font-size: 12px; }
@media (hover: none) { .tacts, .when .tact { opacity: 1; } }
.tree .add { display: inline-flex; margin: 4px 0 2px 12px; font-size: 13px; color: var(--link); background: none; border: 0; padding: 4px 0; }
.picker { position: absolute; z-index: 5; width: min(440px, calc(100% - 20px)); background: #fff; border-radius: 10px; box-shadow: 0 10px 40px rgba(20,24,30,.18); padding: 12px; }
.picker .q { margin-bottom: 6px; }
.plist { max-height: 340px; overflow-y: auto; }
.picker .opt { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.picker .opt:hover { background: #f1f4f6; }
.picker .opt-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker .opt .ty { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.picker .opt.dis { color: #a8adb4; cursor: default; }
.picker .opt.dis:hover { background: none; }
.picker .opt.new { color: var(--link); font-weight: 600; border-bottom: 1px solid var(--line); border-radius: 0; margin-bottom: 4px; padding-bottom: 9px; }
.vbox { display: flex; flex-direction: column; gap: 6px; }
.vbox .k { font-size: 13px; color: var(--muted); }
.vrows { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.vrow { display: flex; align-items: center; gap: 4px; }
.vrow .input { flex: 1; }
.vbox .add { align-self: flex-start; background: none; border: 0; color: var(--link); font-size: 13px; padding: 2px 0; }
.new-form { display: flex; flex-direction: column; gap: 8px; }
.grp { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.panel { padding: 18px; position: relative; }
.panel h2 { font-size: 18px; margin: 0 0 4px; }
.panel .src { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.panel .prop { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.panel .prop.col { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.panel .prop .k { color: var(--muted); }
.panel .how { padding-left: 18px; margin: 8px 0 12px; font-size: 14px; line-height: 1.5; }
.box-warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 12px 14px; font-size: 13px; margin: 12px 0 10px; }
.box-warn b { display: block; font-size: 14px; margin-bottom: 2px; }
.btn.btn-full { display: flex; width: 100%; max-width: 100%; justify-content: center; white-space: normal; }
.panel { min-width: 0; overflow: hidden; }
.lnk { display: block; margin: 14px auto 0; font-size: 13px; color: var(--muted); background: none; border: 0; text-decoration: underline; }
.link-row { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 5px 0; color: var(--link); font-size: 14px; }
.vals { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow-y: auto; margin-top: 8px; }
.tg-in { width: 18px; height: 18px; }
.chk { border-top: 1px solid var(--line); padding: 10px 0; }
.chk summary { cursor: pointer; font-size: 14px; }
.chk-list { padding: 6px 0 0 14px; }
.pill-cond { cursor: pointer; }
.pill-cond:hover { border-color: #b7e8fa !important; background: #eaf8fe !important; }
.cond-pop { width: min(360px, calc(100% - 20px)); }
.cond-pop .vals { margin-top: 6px; }
.draft-edit { background: #f7fbfd; border-radius: 8px; padding: 10px !important; border-top: 0 !important; margin-bottom: 6px; }

/* предпросмотр поля «как в карточке» — подписи и поля как у штатной формы Битрикс24 */
.pv-box { background: #f5f7f8; border-radius: 10px; padding: 10px 12px 12px; margin: 4px 0 10px; }
.pv-box .k { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 6px; }
.pvf { background: #fff; border-radius: 6px; padding: 8px 10px 10px; }
.pvl { font-size: 13px; color: #a8adb4; margin-bottom: 5px; }
.pvreq { color: #ff5752; margin-left: 2px; }
.pvc { display: block; width: 100%; height: 39px; padding: 0 11px; border: 1px solid #c6cdd3; border-radius: 2px; background: #fff; color: #333; font: inherit; font-size: 15px; }
.pvc-wrap { position: relative; }
.pvc-wrap .pvc { padding-right: 32px; }
.pvc-suffix { position: absolute; right: 12px; top: 10px; color: #a8adb4; }
.pvc-text { font-size: 14px; color: var(--muted); padding: 4px 0; }
.pvhint { font-size: 12px; color: #80868e; margin-top: 4px; }
.rule-pv { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
.rule-pv-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.rule-pv .pvr + .pvr .pvf { border-top: 1px solid #f0f2f4; }
.rule-pv .pvf { padding: 6px 0 8px; }
.when-field { color: var(--muted); }
.when { flex-wrap: wrap; row-gap: 4px; }
.rcol { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pv-card { padding: 16px 18px; }
.pv-card .rule-pv-head { margin-bottom: 10px; }
.pv-card .pvf { padding: 6px 0 8px; }
.pv-card .pvr + .pvr .pvf { border-top: 1px solid #f0f2f4; }

/* ---------- дерево правила: условия вкладками ---------- */
.req-star { color: #ff5752; margin-left: 3px; font-weight: 600; }
.cond-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 2px 0 6px 50px; }
.cond-lbl { font-size: 13px; color: var(--muted); margin-right: 2px; }
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 14px; padding: 3px 11px; background: #f0f4f6; border: 1px solid transparent;
  font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; line-height: 18px; }
.chip:hover { border-color: #b7e8fa; }
.chip.on { background: #2fc6f6; color: #fff; }
.chip.on:hover { background: #11a9d9; }
.chip-x { border: 0; background: none; color: inherit; opacity: .8; font-size: 14px; padding: 0 0 0 2px; cursor: pointer; line-height: 1; }
.chip-x:hover { opacity: 1; }
.chip-add { background: none; border: 1px dashed var(--line-strong); color: var(--link); padding: 2px 10px; font-weight: 600; }
.cond-note { font-size: 12px; color: var(--muted); }
.branch-body { margin: 0 0 8px 50px; border-left: 2px solid #b7e8fa; padding: 2px 0 2px 12px; }
.branch-body .add { margin-left: 12px; }
.branch-empty { padding: 4px 12px 2px; }
.panel .where { font-size: 13px; color: var(--ink-2); background: #f5f7f8; border-radius: 8px; padding: 8px 10px; margin: 2px 0 8px; }
