/* CRM копицентра «Си» — логика и раскладка в духе amoCRM, фирменные цвета чёрный + жёлтый */
:root {
  --brand: #FFD21F;
  --brand-2: #FFE266;
  --brand-ink: #141414;
  --ink: #1f2326;
  --ink-2: #4a5157;
  --muted: #60686f;
  --line: #e1e4e6;
  --line-2: #eef0f1;
  --bg: #eef0f2;
  --surface: #ffffff;
  --side: #141414;
  --side-2: #1f1f1f;
  --side-ink: #a3a3a3;
  --side-hover: #fff;
  --red: #cf2f2a;
  --red-bg: var(--red-bg);
  --green: #23863a;
  --green-bg: #e8f6eb;
  --orange: #a85a00;
  --blue: #1f6ad1;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --surface-2: #fafbfb;
  --tint: #fffbe6;
  --tint-2: #fffdf0;
  --tint-line: #f1df8f;
  --line-strong: #c9ced2;
  --red-line: #f6caca;
  --green-line: #c6e9cd;
  --input-bg: #fff;
  --sidebar-w: 76px;
  color-scheme: light;
  --tabbar-h: 60px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 600; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
code { font: 12px/1 ui-monospace, Menlo, Consolas, monospace; background: var(--line-2); padding: 2px 5px; border-radius: 4px; }
small { font-size: 12px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.debt { color: var(--red); font-weight: 600; }
.paid { color: var(--green); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.tag { display: inline-block; font-size: 11px; line-height: 18px; padding: 0 7px; border-radius: 9px; background: var(--line-2); color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.count { font-weight: 500; color: var(--muted); font-size: 13px; margin-left: 4px; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Каркас ---------- */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; align-items: stretch;
}
.brand { display: flex; justify-content: center; padding: 14px 0 12px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 10px; background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 17px; letter-spacing: -.02em;
}
.brand-mark.big { width: 56px; height: 56px; font-size: 22px; border-radius: 13px; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; flex: 1; overflow-y: auto; }
.nav a, .nav-exit {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 2px; color: var(--side-ink); font-size: 10.5px; line-height: 1.15; text-align: center;
  border-left: 3px solid transparent; border-right: 3px solid transparent;
}
.nav a .ic { width: 24px; height: 24px; stroke-width: 1.6; }
.nav a:hover, .nav-exit:hover { color: var(--side-hover, #fff); background: var(--side-2); text-decoration: none; }
.nav a.is-active { color: var(--brand); border-left-color: var(--brand); background: var(--side-2); }
.nav-badge {
  position: absolute; top: 5px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--brand); color: var(--brand-ink); font: 700 11px/18px var(--font); font-style: normal;
}
.nav-badge.hot { background: var(--red); color: #fff; }
.sidebar-foot { border-top: 1px solid #2a2a2a; padding: 8px 0; }
.me { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--side-ink); font-size: 10.5px; padding: 6px 2px; }
.me:hover { color: var(--side-hover, #fff); text-decoration: none; }
.me-name { max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #333; color: var(--brand); display: inline-grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 12px; background: var(--brand); color: var(--brand-ink); margin-right: 8px; vertical-align: middle; }
.nav-exit .ic { width: 20px; height: 20px; }

.main { margin-left: var(--sidebar-w); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 56px; display: flex; align-items: center; gap: 12px;
  padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.search { position: relative; flex: 1; max-width: 520px; }
.search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 18px; height: 18px; }
.search input { width: 100%; height: 36px; padding: 0 12px 0 36px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg); font: inherit; }
.search input:focus { outline: none; border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px rgba(255,210,31,.25); }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }
.content { padding: 20px; max-width: 1600px; }
.only-mobile { display: none !important; }

/* ---------- Кнопки и формы ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
  font: 500 14px/1 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none !important;
}
.btn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.btn .ic { width: 18px; height: 18px; }
.btn-accent { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn-accent:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-ghost { background: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: var(--radius); background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn.sm { width: 26px; height: 26px; }
.icon-btn.sm .ic { width: 16px; height: 16px; }
.link { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.link.danger { color: var(--red); }
.link .ic { width: 16px; height: 16px; }

input, select, textarea { font: inherit; color: inherit; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea, .filters input, .filters select, .pay-form input, .pay-form select,
.composer textarea, .composer select, .composer input, .task-done input, .quick-add input, .visit-note input, .composer-inline textarea, .composer-inline select, .composer-inline input, .pipeline-more select,
.stage-main > input, .stage-add input:not([type=color]), .stage-del select, .doc-send select {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
}
.field textarea, .composer textarea, .composer-inline textarea { height: auto; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #c9a400 !important; box-shadow: 0 0 0 3px rgba(255,210,31,.25); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field.inline input { width: 80px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid.three { grid-template-columns: 2fr 1.5fr 1fr; }
.form-grid h3 { margin: 6px 0 -4px; }
.span-2 { grid-column: span 2; }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { flex: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.form-actions.sticky { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 18px 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip-btn { height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); font: inherit; font-size: 13px; cursor: pointer; }
.chip-btn:hover { border-color: var(--brand); background: var(--tint); }
.chip-btn:active { background: var(--brand); }

/* Сегментированный переключатель */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg > a, .seg > label > span { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; color: var(--ink-2); font-weight: 500; cursor: pointer; white-space: nowrap; }
.seg > a + a, .seg > label + label > span { border-left: 1px solid var(--line); }
.seg > a:hover { text-decoration: none; background: var(--line-2); }
.seg > a.is-active, .seg input:checked + span { background: var(--brand-ink); color: var(--brand); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { position: relative; display: flex; }
.seg .ic { width: 17px; height: 17px; }
.seg-wide { display: flex; flex-wrap: wrap; margin-bottom: 14px; }
.seg-wide label { flex: 1; }
.seg-wide label > span { flex: 1; justify-content: center; }

/* ---------- Заголовки страниц ---------- */
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.page-title h1 { overflow-wrap: anywhere; }
.page-title .sub { margin: 2px 0 0; color: var(--muted); }
.page-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.back { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--ink-2); }
.back:hover { background: var(--line-2); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters.inline { margin: 0; flex: 1; min-width: 260px; }
.filters input[type=search] { flex: 1; min-width: 180px; max-width: 340px; }
.filters select { width: auto; max-width: 200px; }
.inline-form select { height: 34px; border: 1px solid var(--line); border-radius: var(--radius); padding: 0 8px; }

/* ---------- Карточки и уведомления ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card > h3:first-child { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-head h2 { display: flex; align-items: center; gap: 6px; }
.card-head h2 .ic { width: 18px; height: 18px; color: var(--muted); }
.card.narrow { max-width: 720px; }
.flash { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-weight: 500; border: 1px solid transparent; }
.flash-ok { background: var(--green-bg); color: #1d6b2d; border-color: var(--green-line); }
.flash-error { background: var(--red-bg); color: #a92521; border-color: var(--red-line); }
.flash-warn { background: var(--tint); color: #7a5a00; border-color: var(--tint-line); }
.flash-x { margin-left: auto; border: 0; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: inherit; opacity: .6; }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty h2 { color: var(--ink); font-size: 18px; margin-bottom: 6px; }
.empty .btn { margin-top: 12px; }
.empty-line { margin: 4px 0; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px; align-items: start; }
.grid-2 > .card { margin: 0; }

.badge {
  display: inline-block; padding: 0 8px; line-height: 20px; border-radius: 3px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--st, #e2e2e2); color: #222;
}
.deadline { white-space: nowrap; }
.deadline.is-overdue, .due.is-overdue { color: var(--red); font-weight: 600; }
.deadline.is-today, .due.is-today { color: var(--orange); font-weight: 600; }

/* ---------- Рабочий стол ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--side); color: #fff; border-radius: var(--radius); text-decoration: none !important; min-height: 92px; }
.stat:hover { background: #222; }
.stat-label { font-size: 12px; color: #a3a3a3; text-transform: uppercase; letter-spacing: .04em; }
.stat b { font-size: 30px; font-weight: 700; color: var(--brand); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat b.debt { color: #ff7b75; }
.stat small { color: #a3a3a3; }
.stat.is-hot { background: #3a1210; }
.stat.is-hot b { color: #ff7b75; }
.visit-card .card-head { margin-bottom: 10px; }
.visit-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.visit-note { display: flex; gap: 8px; margin-top: 12px; }
.olist { list-style: none; margin: 0; padding: 0; }
.olist li + li { border-top: 1px solid var(--line-2); }
.olist a { display: flex; align-items: center; gap: 12px; padding: 9px 4px; color: var(--ink); text-decoration: none; }
.olist a:hover { background: var(--surface-2); }
.olist-no { font-weight: 600; color: var(--muted); white-space: nowrap; min-width: 48px; font-variant-numeric: tabular-nums; }
.olist-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.olist-main b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.olist-main small { color: var(--muted); }
.olist-side { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
.quick-actions .qa { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border-radius: var(--radius); color: var(--ink); }
.quick-actions .qa:hover { background: var(--tint); text-decoration: none; }
.quick-actions .qa .ic { width: 22px; height: 22px; padding: 6px; box-sizing: content-box; background: var(--brand); border-radius: 8px; color: var(--brand-ink); }
.quick-actions .qa span { display: flex; flex-direction: column; }
.quick-actions .qa small { color: var(--muted); }

/* ---------- Таблицы ---------- */
.table-card { padding: 0; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr[data-href] { cursor: pointer; }
.table tbody tr:hover td { background: var(--tint-2); }
.table tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--red); }
.table tr.is-muted td { opacity: .55; }
.table .t-title a { color: var(--ink); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.table .t-title small { display: block; color: var(--muted); }
.table.compact td, .table.compact th { padding: 7px 10px; }
.cl-ic .ic { width: 16px; height: 16px; color: var(--muted); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs a { padding: 8px 12px; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; font-weight: 500; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.is-active { border-bottom-color: var(--brand); color: var(--ink); }
.tabs-sep { width: 1px; background: var(--line); margin: 6px 6px; }
.scroll-x { overflow-x: auto; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
.list-sum { margin: -4px 0 12px; color: var(--muted); }
.pager { display: flex; gap: 4px; justify-content: center; margin: 16px 0; }
.pager a, .pager span { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: var(--radius); }
.pager a { background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.pager .is-current { background: var(--brand-ink); color: var(--brand); font-weight: 700; }

/* ---------- Воронка ---------- */
.content:has(.board) { max-width: none; padding-right: 0; }
.content:has(.board) .page-head { padding-right: 20px; }
.board { display: flex; gap: 0; overflow-x: auto; padding-bottom: 16px; align-items: flex-start; min-height: calc(100vh - 160px); }
.board-col { flex: 0 0 236px; display: flex; flex-direction: column; border-right: 1px solid var(--line); padding: 0 8px; min-height: calc(100vh - 170px); }
.board-col:first-child { padding-left: 0; }
.board-col.is-closed { flex-basis: 240px; }
.board-head { padding: 4px 4px 10px; border-bottom: 3px solid var(--st); margin-bottom: 10px; text-align: center; }
.board-head b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.board-head small { color: var(--muted); }
.board-list { display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 120px; border-radius: var(--radius); transition: background .15s; }
.board-list.is-over { background: rgba(255,210,31,.18); outline: 2px dashed #e3b800; outline-offset: 2px; }
.bcard {
  display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 4px; color: var(--ink); text-decoration: none !important; cursor: grab; box-shadow: 0 1px 1px rgba(0,0,0,.03);
}
.bcard:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.bcard.is-dragging { opacity: .5; }
.avatar.xs { width: 18px; height: 18px; font-size: 10px; background: var(--brand); color: var(--brand-ink); }
.task-dot { color: var(--green); }
.task-dot.is-today { color: var(--orange); }
.task-dot.is-overdue { color: var(--red); }
.task-dot.is-overdue .ic, .task-dot.is-today .ic { color: inherit; }
.task-dot.is-none { color: var(--orange); }
.quick-add { margin-bottom: 4px; }
.quick-add summary { list-style: none; cursor: pointer; text-align: center; padding: 8px; border: 1px dashed var(--line-strong); border-radius: 4px; color: var(--muted); font-size: 13px; }
.quick-add summary::-webkit-details-marker { display: none; }
.quick-add summary:hover { border-color: #e3b800; color: var(--ink); }
.quick-add form { display: flex; flex-direction: column; gap: 6px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 4px 4px; }
.quick-add input { height: 32px; }

/* ---------- Карточка заказа / клиента (amo: поля слева, лента справа) ---------- */
.content:has(.deal) { padding: 0; max-width: none; }
.deal { display: grid; grid-template-columns: 400px minmax(0,1fr); min-height: calc(100vh - 56px); }
.deal-side { background: var(--surface); border-right: 1px solid var(--line); padding: 0 0 24px; overflow-y: auto; }
.deal-top { display: flex; align-items: flex-start; gap: 6px; padding: 16px 16px 14px; background: var(--side); color: #fff; }
.deal-top .back { color: #bbb; flex: none; }
.deal-top .back:hover { background: #2a2a2a; }
.deal-top .icon-btn { color: #bbb; }
.deal-top .icon-btn:hover { background: #2a2a2a; color: var(--brand); }
.deal-title { flex: 1; min-width: 0; padding-top: 4px; }
.deal-title h1 { font-size: 18px; color: #fff; word-wrap: break-word; }
.deal-title small { color: #9a9a9a !important; }

.pipeline { background: var(--side); padding: 0 16px 16px; }
.pipeline-current { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.pipeline-current::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--st); }
.pipeline-bar { display: flex; gap: 3px; }
.pipeline-bar button { flex: 1; height: 8px; padding: 0; border: 0; border-radius: 2px; background: #3a3a3a; cursor: pointer; position: relative; }
.pipeline-bar button span { position: absolute; left: -9999px; }
.pipeline-bar button.is-done { background: var(--brand); }
.pipeline-bar button.is-current { background: var(--brand); box-shadow: 0 0 0 2px #fff; cursor: default; }
.pipeline-bar button:not(:disabled):hover { background: var(--brand-2); }
.pipeline-more { display: flex; gap: 8px; margin-top: 12px; }
.pipeline-more select { background: #2a2a2a; border-color: #3a3a3a; color: #ddd; height: 30px; flex: 1; }

.fields { margin: 0; padding: 14px 16px 6px; }
.fields > div { display: grid; grid-template-columns: 110px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line-2); }
.fields dt { color: var(--muted); font-size: 13px; }
.fields dd { margin: 0; min-width: 0; word-wrap: break-word; }
.fields.compact { padding: 0; }
.fields.compact > div { grid-template-columns: 70px 1fr; }
.big-sum { font-size: 18px; font-variant-numeric: tabular-nums; }
.side-block { padding: 14px 16px; border-top: 1px solid var(--line-2); }
.side-block h3 .ic { width: 16px; height: 16px; }
.contact-name { font-size: 15px; font-weight: 600; }
.contact-lines { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.contact-lines > div { display: flex; gap: 6px; align-items: center; }
.contact-lines .ic { width: 15px; height: 15px; color: var(--muted); }
.phone { white-space: nowrap; font-variant-numeric: tabular-nums; }
.items-table { width: 100%; border-collapse: collapse; }
.items-table td { padding: 6px 0; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.items-table td small { display: block; color: var(--muted); }
.desc { white-space: normal; color: var(--ink-2); margin: 10px 0 0; padding: 0 16px; }
.side-block .desc { padding: 0; }
.pay-row, .file-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 0; }
.file-row a { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .ic { width: 15px; height: 15px; }
.pay-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-top: 8px; }
.pay-form input, .pay-form select { height: 32px; }
.upload { margin-top: 8px; }
.upload label { cursor: pointer; }
.danger-zone { padding: 14px 16px 0; display: flex; gap: 16px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--side); padding: 0 16px 14px; gap: 8px; }
.mini-stats div { display: flex; flex-direction: column; }
.mini-stats small { color: #9a9a9a; }
.mini-stats b { color: var(--brand); font-size: 16px; font-variant-numeric: tabular-nums; }
.mini-stats b.debt { color: #ff7b75; }
.person { position: relative; padding: 8px 30px 8px 0; border-bottom: 1px solid var(--line-2); }
.person form { position: absolute; right: 0; top: 6px; }
.add-inline summary { cursor: pointer; color: var(--blue); display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; list-style: none; }
.add-inline summary::-webkit-details-marker { display: none; }
.add-inline summary .ic { width: 16px; height: 16px; }
.add-inline form { margin-top: 10px; }

.feed { display: flex; flex-direction: column; background: var(--surface-2); min-width: 0; }
.feed-orders { margin: 16px 20px 0; }
.feed-list { flex: 1; padding: 16px 20px; display: flex; flex-direction: column; gap: 8px; }
.feed-day { text-align: center; margin: 8px 0 2px; }
.feed-day span { display: inline-block; font-size: 12px; color: var(--muted); background: var(--line); padding: 2px 10px; border-radius: 10px; }
.feed-item { max-width: 760px; }
.feed-item.sys { color: var(--ink-2); font-size: 13px; padding: 2px 0; }
.feed-item.sys small { color: var(--muted); margin-right: 4px; }
.feed-item.sys .badge { font-size: 11px; line-height: 18px; }
.feed-item.note, .feed-item.task { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; }
.feed-item.note { border-left: 3px solid var(--brand); }
.fi-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.fi-head b { display: inline-flex; align-items: center; gap: 4px; }
.fi-head .ic { width: 16px; height: 16px; }
.fi-head small { color: var(--muted); }
.fi-del { margin-left: auto; }
.fi-body { white-space: normal; word-wrap: break-word; }
.fi-result { color: var(--muted); margin-top: 4px; font-size: 13px; }
.feed-item.task.done { border-left: 3px solid var(--green); }
.feed-item.task.done .fi-head b { color: var(--green); }
.feed-item.task.open { border-left: 3px solid var(--orange); background: var(--tint-2); }
.feed-item.task.open.is-overdue { border-left-color: var(--red); background: var(--red-bg); }
.task-done { display: flex; gap: 6px; margin-top: 8px; }
.task-done input { height: 30px; flex: 1; }
.feed-item.no-task { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px dashed var(--tint-line); border-radius: var(--radius); color: #8a5300; background: var(--tint-2); font-size: 13px; }
.feed-item.no-task .ic { width: 18px; height: 18px; }

.composer { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 0 20px 14px; }
.composer-tabs { display: flex; gap: 16px; }
.composer-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 0 8px; font: 600 13px var(--font); color: var(--muted); cursor: pointer; }
.composer-tabs button.is-active { color: var(--ink); border-bottom-color: var(--brand); }
.composer form { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; }
.composer-actions { display: flex; justify-content: flex-end; }
.task-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.task-line select, .task-line input { width: auto !important; height: 32px !important; }
.task-line span { color: var(--muted); }
.composer-inline { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; align-items: flex-start; }
.composer-inline textarea { width: 100%; }

/* ---------- Форма заказа ---------- */
.order-form, .client-form { max-width: 920px; }
.radio-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.radio-cards label { position: relative; cursor: pointer; }
.radio-cards input { position: absolute; opacity: 0; }
.radio-cards span { display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.radio-cards small { color: var(--muted); font-size: 11.5px; }
.radio-cards input:checked + span { border-color: var(--brand-ink); box-shadow: inset 0 0 0 1px var(--brand-ink); background: var(--tint); }
.client-picker { position: relative; display: flex; flex-direction: column; gap: 10px; }
.picked { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--tint); border: 1px solid var(--tint-line); border-radius: var(--radius); }
.picked span { font-weight: 600; }
.picked .link { margin-left: auto; }
.suggest { position: absolute; z-index: 20; left: 0; right: 0; top: 64px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 300px; overflow-y: auto; }
.suggest button { display: flex; width: 100%; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 0; background: none; text-align: left; font: inherit; cursor: pointer; }
.suggest button:hover, .suggest button.is-active { background: var(--tint); }
.suggest small { color: var(--muted); }
.suggest .none { padding: 10px 12px; color: var(--muted); }
.items-head, .item-row { display: grid; grid-template-columns: 1fr 80px 80px 110px 110px 34px; gap: 6px; align-items: center; }
.items-head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 0 0 6px; }
.item-row { margin-bottom: 6px; }
.item-row input { height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); width: 100%; min-width: 0; }
.i-sum { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.totals { display: flex; align-items: center; justify-content: flex-end; gap: 24px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.totals-sum { display: flex; align-items: baseline; gap: 10px; }
.totals-sum b { font-size: 22px; font-variant-numeric: tabular-nums; }
.quick-form { max-width: 640px; }
.quick-form > .field, .quick-form > .form-grid { margin-bottom: 14px; }
.quick-total { display: flex; justify-content: flex-end; align-items: baseline; gap: 10px; margin: 0 0 16px; font-size: 15px; }
.quick-total b { font-size: 28px; font-variant-numeric: tabular-nums; }
.more summary { cursor: pointer; color: var(--blue); margin-bottom: 12px; }

/* ---------- Задачи и визиты ---------- */
.add-task summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 600; list-style: none; }
.add-task summary::-webkit-details-marker { display: none; }
.task-group h2 { margin: 18px 0 8px; }
.task-group.is-overdue h2 { color: var(--red); }
.task-list { padding: 0; }
.task-row { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.task-row:last-child { border-bottom: 0; }
.check-btn { width: 26px; height: 26px; border: 2px solid var(--line-strong); border-radius: 50%; background: var(--surface); display: grid; place-items: center; cursor: pointer; color: transparent; padding: 0; flex: none; }
.check-btn .ic { width: 15px; height: 15px; stroke-width: 2.6; }
.check-btn:hover { border-color: var(--green); color: var(--green); }
.check-btn.is-done { background: var(--green); border-color: var(--green); color: #fff; cursor: default; }
.task-main { flex: 1; min-width: 0; }
.task-meta { font-size: 13px; }
.task-text { margin: 2px 0; }
.task-links { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; }
.visit-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.visit-row > span:nth-child(3) { flex: 1; }
.roles-help td:not(:first-child), .roles-help th:not(:first-child) { text-align: center; }

/* ---------- Вход ---------- */
.login-page { background: var(--side); min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-box { width: 100%; max-width: 380px; }
.login-box.wide { max-width: 560px; }
.login-brand { display: flex; align-items: center; gap: 14px; color: #fff; margin-bottom: 20px; }
.login-brand b { display: block; font-size: 22px; }
.login-brand small { color: #a3a3a3; font-size: 14px; }
.login-card { padding: 24px; }
.login-card h1 { margin-bottom: 16px; }
.login-card .field { margin-bottom: 14px; }
.login-card p { margin: 0 0 12px; }

/* ---------- Нижнее меню (телефон) ---------- */
.tabbar { display: none; }
.sidebar-overlay { display: none; }

@media (max-width: 1100px) {
  .deal { grid-template-columns: 340px minmax(0,1fr); }
  .grid-2 { grid-template-columns: minmax(0,1fr); }
}

@media (max-width: 860px) {
  body { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .sidebar { transform: translateX(-100%); transition: transform .2s; width: 88px; }
  .sidebar.is-open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .sidebar-overlay.is-open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .main { margin-left: 0; }
  .only-mobile { display: inline-grid !important; }
  .hide-mobile { display: none !important; }
  .topbar { padding: 0 8px; gap: 6px; }
  .topbar .btn-accent { width: 40px; padding: 0; }
  .content { padding: 14px 12px; }
  h1 { font-size: 20px; }
  .page-head { gap: 10px; }
  .page-actions { margin-left: 0; width: 100%; }
  .page-head .filters.inline { order: 3; min-width: 100%; }
  .filters input[type=search] { max-width: none; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .radio-cards { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { min-height: 80px; }
  .stat b { font-size: 24px; }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom); background: var(--side); border-top: 1px solid #2a2a2a;
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--side-ink); font-size: 10.5px; text-decoration: none; }
  .tabbar a.is-active { color: var(--brand); }
  .tabbar .ic { width: 22px; height: 22px; }
  .tabbar .tab-main .ic { width: 26px; height: 26px; padding: 10px; box-sizing: content-box; background: var(--brand); color: var(--brand-ink); border-radius: 50%; margin-top: -18px; box-shadow: 0 2px 10px rgba(0,0,0,.35); }

  /* Таблицы превращаются в карточки */
  .table-card { background: transparent; border: 0; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; padding: 10px 12px; }
  .table td { padding: 2px 0; border: 0; text-align: left; }
  .table td.num { text-align: left; }
  .table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12px; }
  .table tr.is-overdue { border-left: 3px solid var(--red); }
  .table tr.is-overdue td:first-child { box-shadow: none; }
  .roles-help .table tr { display: table-row; }
  .roles-help .table, .roles-help .table tbody { display: table; }
  .roles-help .table td { display: table-cell; }

  .content:has(.board) { padding-right: 0; }
  .board { scroll-snap-type: x mandatory; min-height: auto; }
  .board-col { flex-basis: 84vw; scroll-snap-align: start; min-height: 60vh; }

  .deal { grid-template-columns: minmax(0,1fr); }
  .deal.is-chat .feed { order: -1; min-height: 60vh; }
  .deal.is-chat .deal-side { border-top: 1px solid var(--line); }
  .content:has(.board) .page-head { padding-right: 12px; }
  .deal-side { border-right: 0; }
  .feed-list { padding: 12px; }
  .feed-orders { margin: 12px 12px 0; }
  .composer { padding: 0 12px 12px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .items-head { display: none; }
  .item-row { grid-template-columns: 1fr 1fr 1fr 34px; background: var(--line-2); padding: 8px; border-radius: var(--radius); }
  .item-row .i-name { grid-column: 1 / -1; }
  .item-row .i-sum { grid-column: 1 / -2; text-align: left; }
  .totals { flex-direction: column; align-items: stretch; gap: 10px; }
  .form-actions.sticky { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1; }
  .visit-buttons .chip-btn { flex: 1 1 45%; }
  .visit-row { flex-wrap: wrap; }
}

/* ---------- Каналы связи и переписка ---------- */
.ch-ic { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--ch); color: #fff; flex: none; }
.ch-ic .ic { width: 15px; height: 15px; stroke-width: 2; }
.card-head h2 .ch-ic .ic { width: 15px; height: 15px; color: #fff; }
.tab-badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--red); color: #fff; font: 700 10px/16px var(--font); font-style: normal; }
.tabbar a { position: relative; }
.tag-new { background: var(--tint); color: #7a5a00; }

.inbox-list { padding: 0; overflow: hidden; }
.inbox-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); color: var(--ink); text-decoration: none !important; }
.inbox-row:last-child { border-bottom: 0; }
.inbox-row:hover { background: var(--tint-2); }
.inbox-row .ch-ic { width: 38px; height: 38px; }
.inbox-row .ch-ic .ic { width: 19px; height: 19px; }
.inbox-row.is-unread { background: var(--tint); }
.inbox-row.is-unread b { font-weight: 700; }
.inbox-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.inbox-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.inbox-top b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-top small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-snippet { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.inbox-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.unread-dot { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font: 700 11px/20px var(--font); font-style: normal; text-align: center; }

.feed-item.msg { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 13px; max-width: min(620px, 92%); }
.feed-item.msg.is-out { align-self: flex-end; background: var(--tint); border-color: var(--tint-line); }
.feed-item.msg .fi-head .ch-ic { width: 20px; height: 20px; }
.feed-item.msg .fi-head .ch-ic .ic { width: 12px; height: 12px; }
.msg-img { display: block; margin-top: 8px; }
.msg-img img { max-width: 260px; max-height: 260px; border-radius: 6px; display: block; border: 1px solid var(--line); }
.msg-file { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.msg-file .ic { width: 16px; height: 16px; }
.feed-item.call { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: var(--radius); padding: 9px 13px; max-width: 620px; }
.feed-item.call.is-missed { border-left-color: var(--red); background: var(--red-bg); }
.feed-item.call.is-missed .fi-head b { color: var(--red); }
.feed-item.call .ch-ic { width: 22px; height: 22px; }
.feed-item.call .ch-ic .ic { width: 13px; height: 13px; }
.feed-item.call audio, .rec-row audio { width: 100%; height: 36px; margin-top: 6px; display: block; }
.rec-dl { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; margin-top: 4px; }
.rec-dl .ic { width: 14px; height: 14px; }
.rec-row { padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.rec-row:last-child { border-bottom: 0; }
.rec-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.rec-row.is-missed .rec-meta span { color: var(--red); }
.ident-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; color: var(--ink); }
.ident-row > span:not(.ch-ic) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ident-row .ch-ic { width: 22px; height: 22px; }
.ident-row .ch-ic .ic { width: 13px; height: 13px; }
.deal-top .ch-ic { margin-top: 4px; }
.unsorted-block { background: var(--tint); }
.form-grid.one { grid-template-columns: 1fr; gap: 10px; }
.bind-existing { position: relative; }
.bind-existing .suggest { top: 42px; }

/* Интеграции */
.integr { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.integr .card { margin: 0; }
.integr-card .card-head h2 { gap: 8px; }
.integr-card > .hint { margin: -4px 0 14px; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 12px; background: var(--line-2); color: var(--muted); white-space: nowrap; }
.pill.is-on { background: var(--green-bg); color: var(--green); }
.pill .ic { width: 14px; height: 14px; stroke-width: 2.4; }
.form-actions.left { justify-content: flex-start; margin-top: 0; flex-wrap: wrap; }
.more summary { margin: 12px 0 8px; }
.steps { margin: 0 0 10px; padding-left: 20px; }
.steps li { margin-bottom: 4px; }
.copy-line { display: flex; gap: 8px; align-items: center; margin: 6px 0; }
.copy-line code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; padding: 8px 10px; font-size: 12px; line-height: 1.3; display: block; }
pre.code { background: #1b1b1b; color: #f3f3f3; padding: 12px; border-radius: 6px; font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; overflow-x: auto; white-space: pre; margin: 6px 0 10px; }
.notify-box, .cron-box { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.notify-box .hint { margin: 6px 0; display: flex; align-items: center; gap: 4px; }
.log-row { border-bottom: 1px solid var(--line-2); padding: 6px 0; }
.log-row summary { cursor: pointer; display: flex; align-items: center; gap: 8px; list-style: none; font-size: 13px; }
.log-row summary::-webkit-details-marker { display: none; }
.log-row .ch-ic { width: 20px; height: 20px; }
.log-row .ch-ic .ic { width: 12px; height: 12px; }
.log-row.lv-error summary { color: var(--red); }

@media (max-width: 1100px) { .integr { grid-template-columns: minmax(0,1fr); } }
@media (max-width: 860px) {
  .feed-item.msg { max-width: 94%; }
  .msg-img img { max-width: 100%; }
  .inbox-row { padding: 10px 12px; }
  .copy-line { flex-direction: column; align-items: stretch; }
}
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top)); }
}

/* ---------- Калькулятор ---------- */
.pos-head { margin-bottom: 12px; }
.pos-last { margin: 0 0 0 auto; display: flex; align-items: center; gap: 6px; color: var(--green); font-weight: 500; }
.pos-last .ic { width: 18px; height: 18px; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 16px; align-items: start; }
.pos-card .pos { grid-template-columns: minmax(0, 1fr) 380px; }
.pos-pick { min-width: 0; scroll-margin-top: 70px; }
.pos-search { position: relative; margin-bottom: 10px; }
.pos-search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.pos-search input { width: 100%; height: 46px; padding: 0 14px 0 40px; font-size: 16px; border: 2px solid var(--line); border-radius: 8px; background: var(--surface); }
.pos-search input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(255,210,31,.25); }
.pos-cats { display: flex; gap: 6px; margin-bottom: 10px; padding-bottom: 2px; }
.pos-cats button { flex: none; height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line); background: var(--surface); font: 500 13px var(--font); cursor: pointer; white-space: nowrap; color: var(--ink-2); }
.pos-cats button.is-active { background: var(--brand-ink); color: var(--brand); border-color: var(--brand-ink); }
.pos-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tile { display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-height: 76px; padding: 10px 12px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font: inherit; color: var(--ink); transition: transform .06s, border-color .1s; }
.tile b { font-weight: 600; font-size: 14px; line-height: 1.25; }
.tile small { color: var(--muted); font-variant-numeric: tabular-nums; }
.tile:hover { border-color: #e3b800; background: var(--tint-2); }
.tile:active { transform: scale(.97); background: var(--brand); }
.tile.is-first { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.pos-none { color: var(--muted); grid-column: 1 / -1; }
.pos-cart { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px; position: sticky; top: 70px; max-height: calc(100vh - 90px); display: flex; flex-direction: column; }
.pos-card .pos-cart { position: static; max-height: none; border: 0; padding: 0; }
.pos-cart-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.pos-lines { overflow-y: auto; flex: 1 1 auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.pos-add { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 42px; margin: 8px 0 4px; flex: none;
  border: 1.5px dashed var(--line-strong); border-radius: 8px; background: transparent; color: var(--ink); font: 600 14px var(--font); cursor: pointer;
  transition: border-color .2s var(--ease), background .2s var(--ease); }
.pos-add:hover { border-color: var(--brand); background: var(--tint-2); }
.pos-add .ic { width: 16px; height: 16px; }
.pos-tiles.is-hint .tile { animation: tilehint .9s var(--ease); }
@keyframes tilehint { 0%, 100% { box-shadow: none; } 35% { box-shadow: 0 0 0 3px var(--brand); } }
.pos-empty { color: var(--muted); font-size: 13px; padding: 18px 0; text-align: center; margin: 0; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.line.is-flash { animation: lineflash .8s; }
@keyframes lineflash { from { background: var(--tint); } to { background: transparent; } }
.line-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.line-main b { font-weight: 600; font-size: 14px; }
.line-main select { height: 28px; padding: 0 6px; border: 1px solid var(--line); border-radius: 5px; font-size: 12.5px; max-width: 100%; background: var(--surface-2); }
.line-main .l-custom { height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: 5px; }
.tier-hint { color: var(--green); font-size: 11.5px; }
.line-qty { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.line-qty button { width: 32px; height: 34px; border: 0; background: var(--surface-2); font-size: 18px; cursor: pointer; color: var(--ink); }
.line-qty button:active { background: var(--brand); }
.line-qty input { width: 52px; height: 34px; border: 0; text-align: center; font: 600 15px var(--font); font-variant-numeric: tabular-nums; }
.line-qty input:focus { outline: none; background: var(--tint); box-shadow: none; }
.line-sum { display: flex; flex-direction: column; align-items: flex-end; min-width: 78px; }
.line-sum b { font-variant-numeric: tabular-nums; }
.l-price { border: 0; background: none; padding: 0; color: var(--muted); font-size: 11.5px; cursor: pointer; white-space: nowrap; text-decoration: underline dotted; }
.l-price.is-manual { color: var(--orange); }
.pos-bar { display: none; }
.pos-total { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 12px 0 10px; border-top: 2px solid var(--ink); margin-top: 6px; }
.pos-total span { font-weight: 600; }
.pos-total b { font-size: 30px; font-variant-numeric: tabular-nums; }
.pos-total.small { justify-content: flex-end; gap: 16px; }
.pos-total.small b { font-size: 22px; }
.pos-more summary { cursor: pointer; color: var(--blue); font-size: 13px; margin-bottom: 8px; }
.pos-more .form-grid { margin-bottom: 10px; }
.pos-pay { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.btn-pay { height: 52px; font-size: 15px; font-weight: 700; }
.btn-pay:not(.btn-accent) { background: var(--brand-ink); color: #fff; border-color: var(--brand-ink); }
.btn-pay:not(.btn-accent):hover { background: #2a2a2a; }
.btn-pay:disabled, .pos-pay-2 .btn:disabled { opacity: .35; cursor: not-allowed; }
.pos-pay-2 { display: flex; flex-wrap: wrap; gap: 6px; justify-content: space-between; margin-top: 8px; }

@media (max-width: 1100px) { .pos, .pos-card .pos { grid-template-columns: minmax(0, 1fr); } .pos-cart { position: static; max-height: none; } }
@media (max-width: 860px) {
  .pos-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { min-height: 64px; padding: 8px 10px; }
  .pos-search input { font-size: 16px; height: 44px; }
  .line { grid-template-columns: minmax(0, 1fr) auto auto; }
  .line-sum { grid-column: 1 / 3; flex-direction: row; justify-content: space-between; align-items: baseline; }
  .pos-pay { grid-template-columns: repeat(3, 1fr); }
  .btn-pay { height: 50px; font-size: 14px; }
  .pos-form .pos-cart { scroll-margin-top: 70px; }
  .pos-bar { position: fixed; left: 10px; right: 10px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 8px); z-index: 25;
    display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 16px; border: 0; border-radius: 12px;
    background: var(--brand); color: var(--brand-ink); font: 600 15px var(--font); box-shadow: 0 6px 20px rgba(0,0,0,.25); }
  .pos-bar b { font-size: 19px; font-variant-numeric: tabular-nums; }
  .pos-bar em { margin-left: auto; font-style: normal; }
  .pos-bar.is-hidden-view { display: none; }
}
.seg-sm > a { height: 28px; padding: 0 10px; font-size: 12.5px; }
.svc-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(60px, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.svc-row:last-child { border-bottom: 0; }
.svc-name { min-width: 0; display: flex; flex-direction: column; }
.svc-name small { color: var(--muted); }
.svc-bar { height: 8px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.svc-bar i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.svc-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.star { border: 0; background: none; font-size: 18px; color: #d5d8db; cursor: pointer; padding: 0; }
.star.is-on { color: #f2b600; }
.price-vars { font-size: 13px; }
.price-edit { background: var(--tint-2); }
.price-form { padding: 6px 0; }
textarea.mono { font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; }
.sync-card { padding: 14px 18px; }
.sync-row { display: flex; align-items: center; gap: 12px; }
.sync-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--line-2); color: var(--muted); flex: none; }
.sync-ic.is-on { background: var(--green-bg); color: var(--green); }
.sync-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.price-ro { background: var(--line-2); padding: 10px 12px; border-radius: 6px; font: 12.5px/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; margin: 0; max-height: 260px; overflow: auto; }
@media (max-width: 860px) { .sync-row { flex-wrap: wrap; } }

/* ---------- Тёмная тема ---------- */
:root[data-theme="dark"] {
  --bg: #0f1012; --surface: #18191b; --surface-2: #1f2124; --ink: #e8e9ea; --ink-2: #b9bdc1; --muted: #8b9298;
  --line: #2d3033; --line-2: #24262a; --line-strong: #3b3f44; --tint: rgba(255,210,31,.10); --tint-2: rgba(255,210,31,.06);
  --tint-line: rgba(255,210,31,.35); --red-bg: rgba(229,64,59,.15); --red-line: rgba(229,64,59,.35); --green-bg: rgba(47,158,68,.16);
  --green-line: rgba(47,158,68,.35); --blue: #62a8ff; --red: #ff6b66; --green: #4cc463; --orange: #f0a23a; --input-bg: #141517;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.3); color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1012; --surface: #18191b; --surface-2: #1f2124; --ink: #e8e9ea; --ink-2: #b9bdc1; --muted: #8b9298;
    --line: #2d3033; --line-2: #24262a; --line-strong: #3b3f44; --tint: rgba(255,210,31,.10); --tint-2: rgba(255,210,31,.06);
    --tint-line: rgba(255,210,31,.35); --red-bg: rgba(229,64,59,.15); --red-line: rgba(229,64,59,.35); --green-bg: rgba(47,158,68,.16);
    --green-line: rgba(47,158,68,.35); --blue: #62a8ff; --red: #ff6b66; --green: #4cc463; --orange: #f0a23a; --input-bg: #141517;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 2px 8px rgba(0,0,0,.3); color-scheme: dark;
  }
}
:root[data-theme="dark"] .flash-ok, :root[data-theme="dark"] .flash-error, :root[data-theme="dark"] .flash-warn { color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .flash-ok, :root:not([data-theme="light"]) .flash-error, :root:not([data-theme="light"]) .flash-warn { color: var(--ink); } }
input, select, textarea { background-color: var(--input-bg); color: var(--ink); }
.btn { background: var(--surface); color: var(--ink); }
.btn-accent { background: var(--brand); color: var(--brand-ink); }
.btn-ghost { background: transparent; }
.badge { color: #1b1b1b; }
img.avatar { object-fit: cover; padding: 0; background: var(--line-2); }
.theme-choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-choice label { position: relative; cursor: pointer; }
.theme-choice input { position: absolute; opacity: 0; }
.theme-choice span { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; font-weight: 500; }
.theme-choice i { width: 100%; height: 44px; border-radius: 6px; border: 1px solid var(--line); display: block; }
.theme-choice .t-light i { background: linear-gradient(90deg, #141414 18%, #eef0f2 18%); }
.theme-choice .t-dark i { background: linear-gradient(90deg, #0a0a0a 18%, #18191b 18%); }
.theme-choice .t-auto i { background: linear-gradient(135deg, #eef0f2 50%, #18191b 50%); }
.theme-choice input:checked + span { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); background: var(--tint); }
.avatar-edit { display: flex; align-items: center; gap: 16px; }
.avatar.xl { width: 84px; height: 84px; font-size: 32px; }
.color-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.color-row input[type=color] { width: 52px; height: 40px; padding: 2px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.color-preview { display: flex; height: 64px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); margin-top: 6px; }
.color-preview .cp-side { width: 54px; display: grid; place-items: center; }
.color-preview .cp-main { flex: 1; background: var(--bg); display: flex; align-items: center; gap: 10px; padding: 0 14px; }
.perm-table td, .perm-table th { text-align: center; }
.perm-table td:first-child, .perm-table th:first-child { text-align: left; }
.perm-table .grp td { background: var(--surface-2); font-weight: 600; color: var(--ink-2); text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }
.perm-table input[type=checkbox] { vertical-align: middle; }
.perm-table .role-name { width: 140px; height: 32px; border: 1px solid var(--line); border-radius: 6px; padding: 0 8px; font-weight: 600; text-align: center; }

/* =====================================================================
   Фирменные анимации (как на сайте si-print): кривая --ease, скос −14°,
   заливка «слева направо», подъём на 2 px, жёлтая рамка у чипов.
   ===================================================================== */
:root { --ease: cubic-bezier(.2, .7, .2, 1); --sweep: #141414; --sweep-ink: var(--brand); }
:root[data-theme="dark"] { --sweep: #ffffff; --sweep-ink: #000; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --sweep: #ffffff; --sweep-ink: #000; } }

/* Обычные кнопки: подъём и жёлтая рамка */
.btn { transition: background .2s, color .2s, border-color .2s, transform .2s var(--ease), box-shadow .3s var(--ease); }
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:not(.btn-accent):not(.btn-pay):not(.btn-ghost):not(.btn-danger):not(.btn-dark):not(.btn-stage):hover:not(:disabled) { border-color: var(--brand); background: var(--surface); }
.btn-ghost:hover:not(:disabled) { border-color: var(--brand); }
.btn-pay:not(.btn-accent):hover:not(:disabled) { background: #2a2a2a; box-shadow: 0 12px 22px -16px #000; }
.btn:active:not(:disabled) { transform: translateY(1px); transition-duration: .08s; }

/* Акцентная кнопка: заливка проезжает слева направо */
.btn-accent { position: relative; isolation: isolate; overflow: hidden; box-shadow: 0 10px 22px -16px var(--brand); }
.btn-accent::after { content: ""; position: absolute; inset: 0 -12px; z-index: -1; background: var(--sweep);
  transform: skewX(-14deg) scaleX(0); transform-origin: left center; transition: transform .45s var(--ease); }
.btn-accent:hover:not(:disabled) { background: var(--brand); border-color: var(--brand); color: var(--sweep-ink); box-shadow: 0 16px 28px -16px var(--brand); }
.btn-accent:hover:not(:disabled)::after, .btn-accent:focus-visible::after { transform: skewX(-14deg) scaleX(1); }
.btn-accent:focus-visible:not(:disabled) { color: var(--sweep-ink); }

/* Главные кнопки — фирменный параллелограмм, как «Рассчитать» на сайте */
.btn-cta { border: 0 !important; background: transparent !important; box-shadow: none !important; overflow: visible; padding: 0 20px; margin: 0 4px; }
.btn-cta::before { content: ""; position: absolute; inset: 0; z-index: -2; background: var(--brand); transform: skewX(-14deg);
  border-radius: 3px; box-shadow: 0 14px 28px -16px var(--brand); transition: box-shadow .4s var(--ease); }
.btn-cta::after { inset: 0; border-radius: 3px; }
.btn-cta:hover:not(:disabled)::before { box-shadow: 0 18px 34px -14px var(--brand); }
.btn-cta:focus-visible { outline: none; }
.btn-cta:focus-visible::before { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--brand); }

/* «Магнитный» сдвиг за курсором */
.mag { transition-property: transform, translate, background-color, color, box-shadow; transition-duration: .3s, .4s, .2s, .2s, .3s; transition-timing-function: var(--ease); }

/* Чипы — скошенная рамка, как на сайте */
.chip-btn, .pos-cats button { position: relative; isolation: isolate; border: 0 !important; background: transparent !important; border-radius: 0;
  transition: transform .3s var(--ease), color .2s; margin: 0 3px; }
.chip-btn::before, .pos-cats button::before { content: ""; position: absolute; inset: 0; z-index: -1; border: 1px solid var(--line-strong);
  border-radius: 3px; background: var(--surface); transform: skewX(-14deg); transition: border-color .3s var(--ease), background .3s var(--ease); }
.chip-btn:hover, .pos-cats button:hover { transform: translateY(-2px); }
.chip-btn:hover::before, .pos-cats button:hover::before { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 12%, var(--surface)); }
.chip-btn:active { transform: translateY(1px); }
.chip-btn:active::before { background: var(--brand); }
.pos-cats button.is-active { color: var(--brand); }
.pos-cats button.is-active::before { background: var(--side); border-color: var(--side); }
.pos-cats { padding: 2px 4px 4px; }

/* Плитки услуг: жёлтая планка вырастает слева, лёгкий подъём */
.tile { position: relative; overflow: hidden; transition: transform .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease), background .2s; }
.tile::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; background: var(--brand);
  transform: scaleY(0); transform-origin: center bottom; transition: transform .35s var(--ease); }
.tile:hover { transform: translateY(-2px); border-color: var(--brand); background: var(--surface); box-shadow: 0 12px 24px -18px rgba(0,0,0,.45); }
.tile:hover::before, .tile.is-first::before { transform: scaleY(1); }
.tile:active { transform: translateY(1px) scale(.98); background: color-mix(in srgb, var(--brand) 18%, var(--surface)); transition-duration: .08s; }

/* Карточки воронки, строки списков, быстрые действия */
.bcard { transition: transform .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease); }
.bcard:hover { transform: translateY(-2px); }
.stat { transition: transform .3s var(--ease), background .2s; }
.stat:hover { transform: translateY(-2px); }
.olist a, .inbox-row { transition: background .2s, padding-left .35s var(--ease); }
.olist a:hover { padding-left: 10px; }
.quick-actions .qa { transition: background .2s, transform .3s var(--ease); }
.quick-actions .qa:hover { transform: translateX(4px); }

/* Меню: жёлтая полоса активного пункта выезжает, иконка чуть приподнимается */
.nav a { transition: color .25s var(--ease), background .25s var(--ease), border-color .3s var(--ease); }
.nav a .ic { transition: transform .4s var(--ease); }
.nav a:hover .ic { transform: translateY(-2px); }
.tabbar a .ic { transition: transform .3s var(--ease); }
.tabbar a:active .ic { transform: scale(.9); }
.tabbar .tab-main .ic { transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.tabbar .tab-main:active .ic { transform: scale(.92); }

/* Мелкие детали */
.back .ic { transition: transform .35s var(--ease); }
.back:hover .ic { transform: translateX(-3px); }
.link { position: relative; }
.icon-btn { transition: background .2s, color .2s, transform .3s var(--ease); }
.icon-btn:active { transform: scale(.92); }
.check-btn { transition: border-color .2s, color .2s, background .2s, transform .3s var(--ease); }
.check-btn:hover { transform: scale(1.08); }
.line-qty button { transition: background .15s, transform .15s var(--ease); }
.line-qty button:active { transform: scale(.9); }
.seg > a, .seg > label > span { transition: background .25s var(--ease), color .25s var(--ease); }
.pipeline-bar button { transition: background .3s var(--ease), transform .3s var(--ease); }
.pipeline-bar button:not(:disabled):hover { transform: scaleY(1.5); }
.flash { animation: flashIn .45s var(--ease); }
@keyframes flashIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.card, .stats, .board, .deal, .pos { animation: fadeUp .5s var(--ease) backwards; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.line.is-flash { animation: lineflash .8s var(--ease); }

/* Тем, кто отключил анимацию в системе — без движения */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
  .btn:hover, .tile:hover, .chip-btn:hover, .bcard:hover, .stat:hover { transform: none !important; }
}

/* ---------- Выпадающие списки (как на сайте: .cf-dd) ---------- */
.dd { position: relative; min-width: 0; display: inline-block; vertical-align: middle; }
.dd.dd-full { display: block; width: 100%; }
.dd-native { position: absolute !important; inset: 0; width: 100% !important; height: 100% !important; opacity: 0; pointer-events: none; }
.dd-btn { width: 100%; height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left;
  font: 500 14px/1.3 var(--font); color: var(--ink); background: var(--dd-bg); border: 1px solid var(--line); border-radius: 3px;
  padding: 0 10px 0 12px; cursor: pointer; transition: border-color .25s var(--ease), background .25s var(--ease), box-shadow .25s var(--ease); }
.dd-sm .dd-btn { height: 30px; font-size: 13px; padding: 0 8px 0 10px; }
.dd-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-btn svg { flex: 0 0 auto; width: 15px; height: 15px; fill: none; stroke: var(--dd-arrow); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--ease); }
.dd-btn:hover:not(:disabled), .dd.open .dd-btn { border-color: var(--brand); }
.dd.open .dd-btn { background: var(--surface); }
.dd.open .dd-btn svg { transform: rotate(180deg); }
.dd-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.dd-btn:disabled { opacity: .55; cursor: not-allowed; }
.dd-list { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 6px); margin: 0; padding: 6px; list-style: none; max-height: 300px;
  overflow-y: auto; overscroll-behavior: contain; background: var(--surface); border: 1px solid var(--brand); border-radius: 3px;
  box-shadow: var(--dd-shadow); opacity: 0; transform: translateY(-6px); visibility: hidden;
  transition: opacity .2s var(--ease), transform .25s var(--ease), visibility 0s .25s; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.dd.open .dd-list { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
.dd.up .dd-list { top: auto; bottom: calc(100% + 6px); transform: translateY(6px); }
.dd.up.open .dd-list { transform: none; }
.dd-list.dd-float { position: fixed; right: auto; top: auto; z-index: 1000; }
.dd-list.dd-float.up { transform: translateY(6px); }
.dd-list.dd-float.on { opacity: 1; transform: none; visibility: visible; transition-delay: 0s; }
.dd-list li { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 12px 9px 24px; font-size: 14px; line-height: 1.3;
  color: var(--ink-2); border-radius: 2px; cursor: pointer; transition: background .15s, color .15s; white-space: normal; }
.dd-list li::before { content: ""; position: absolute; left: 9px; top: 50%; width: 5px; height: 15px; margin-top: -7.5px; background: var(--brand);
  transform: skewX(-14deg) scaleY(0); transition: transform .2s var(--ease); }
.dd-list li.act { background: var(--dd-act); color: var(--ink); }
.dd-list li[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.dd-list li[aria-selected="true"]::before, .dd-list li.act::before { transform: skewX(-14deg) scaleY(1); }
.dd-list li[aria-selected="true"]::after { content: ""; flex: none; margin-left: auto; width: 11px; height: 6px; border-left: 2px solid var(--brand-dark, var(--brand));
  border-bottom: 2px solid var(--brand-dark, var(--brand)); transform: rotate(-45deg) translateY(-2px); }
.dd-list li[aria-disabled="true"] { opacity: .4; cursor: default; }
:root { --dd-bg: #fbfaf6; --dd-act: #f4f1ea; --dd-arrow: #141414; --dd-shadow: 0 18px 40px rgba(60,45,0,.22); --brand-dark: #c9a400; }
:root[data-theme="dark"] { --dd-bg: #0c0d0e; --dd-act: #232528; --dd-arrow: var(--brand); --dd-shadow: 0 18px 44px rgba(0,0,0,.7), 0 0 0 1px rgba(253,194,25,.08); --brand-dark: var(--brand); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --dd-bg: #0c0d0e; --dd-act: #232528; --dd-arrow: var(--brand); --dd-shadow: 0 18px 44px rgba(0,0,0,.7), 0 0 0 1px rgba(253,194,25,.08); --brand-dark: var(--brand); } }
/* Тёмная панель этапов в карточке заказа */
.pipeline-more .dd { flex: 1; }
.pipeline-more .dd-btn { background: #2a2a2a; border-color: #3a3a3a; color: #ddd; }
.pipeline-more .dd-btn svg { stroke: var(--brand); }
.filters .dd { width: auto; max-width: 220px; }
.task-line .dd, .pay-form .dd { width: auto; }
.pay-form .dd { display: block; }

/* ---------- Выбор дня и времени задачи ---------- */
.due-picker { display: flex; flex-direction: column; gap: 6px; padding: 2px 0; }
.due-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.due-lbl { width: 54px; font-size: 12px; color: var(--muted); flex: none; }
.due-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 1; min-width: 0; }
.due-chip { position: relative; isolation: isolate; height: 30px; padding: 0 11px; border: 0; background: transparent; font: 500 12.5px var(--font); color: var(--ink-2);
  cursor: pointer; display: inline-flex; align-items: center; gap: 5px; margin: 0 2px; transition: transform .3s var(--ease), color .2s; }
.due-chip::before { content: ""; position: absolute; inset: 0; z-index: -1; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--surface);
  transform: skewX(-14deg); transition: border-color .3s var(--ease), background .3s var(--ease); }
.due-chip:hover { transform: translateY(-1px); color: var(--ink); }
.due-chip:hover::before { border-color: var(--brand); }
.due-chip.is-on { color: var(--brand-ink); font-weight: 600; }
.due-chip.is-on::before { background: var(--brand); border-color: var(--brand); }
.due-chip .ic { width: 14px; height: 14px; }
.due-cal input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.due-cal input::-webkit-calendar-picker-indicator { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.due-time-input { height: 30px !important; width: 92px !important; padding: 0 8px !important; border: 1px solid var(--line-strong) !important; border-radius: 3px; font-size: 13px; }
.due-summary { margin: 2px 0 0 62px; font-size: 13px; font-weight: 600; color: var(--ink); }
.due-summary::before { content: "⏰ "; }
.due-summary.is-past { color: var(--red); }
.composer .due-picker, .composer-inline .due-picker { width: 100%; }

/* ---------- Всплывающие уведомления ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 24px)); }
.toast { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: 6px; box-shadow: 0 18px 44px rgba(0,0,0,.28);
  padding: 12px 14px; opacity: 0; transform: translateY(14px) scale(.98); transition: opacity .35s var(--ease), transform .45s var(--ease); }
.toast.in { opacity: 1; transform: none; }
.toast-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.toast-head b { color: var(--red); }
.toast-x { border: 0; background: none; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; }
.toast-body { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.toast-body small { color: var(--muted); }
.toast-actions { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 860px) { .toasts { right: 12px; left: 12px; width: auto; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); } .due-summary { margin-left: 0; } .due-lbl { width: 100%; } }

/* ===== Документы (v1.6) ===== */
.doc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.doc-paper { padding: 0; overflow: hidden; }
.doc-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.doc-frame { display: block; width: 100%; height: 78vh; min-height: 560px; border: 0; background: #e9e9e6; }
.doc-side { display: grid; gap: 12px; position: sticky; top: 12px; }
.doc-side .card { margin: 0; }
.doc-side .flash { margin: 0; }
.doc-side .flash .link { font-weight: 600; }
.doc-meta { display: grid; grid-template-columns: 90px 1fr auto; gap: 8px; align-items: end; margin-top: 10px; }
.doc-meta .field { margin: 0; }
.doc-send { display: grid; gap: 8px; }
.doc-send textarea { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--input-bg); color: var(--ink); resize: vertical; }
.doc-sbis { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.doc-sbis .hint { margin: 0 0 6px; }
.doc-more { display: grid; gap: 6px; justify-items: start; }
.doc-buttons { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.doc-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.doc-row:last-of-type { border-bottom: 0; }
.doc-row a { display: inline-flex; gap: 5px; align-items: center; min-width: 0; }
.doc-row .ic { width: 15px; height: 15px; color: var(--muted); flex: none; }
.doc-row .sent { color: var(--green, #2f9e44); font-size: 11px; }
.req-grid h3 { margin: 14px 0 2px; }
.brand-img { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.brand-img img { height: 64px; max-width: 160px; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
@media (max-width: 980px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-side { position: static; order: -1; }
  .doc-frame { height: 70vh; min-height: 420px; }
}
/* Минимальный тираж */
.tile .tile-min { color: var(--muted); font-size: 11px; }
.tier-hint.is-bump { animation: minBump .5s cubic-bezier(.2,.7,.2,1); color: var(--red); }
@keyframes minBump { 0%, 100% { transform: none; } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }

/* ===== Этапы воронки ===== */
.stage-list { display: grid; gap: 8px; margin: 12px 0 4px; }
.stage-row { display: grid; grid-template-columns: 64px 40px 1fr auto; gap: 10px; align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); border-left: 4px solid var(--st); transition: transform .25s cubic-bezier(.2,.7,.2,1); }
.stage-row.is-system { background: var(--surface-2); }
.stage-move { display: flex; gap: 2px; padding-top: 4px; }
.stage-lock { font-size: 14px; opacity: .55; padding: 6px 0 0 6px; cursor: help; }
.stage-color { width: 40px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--input-bg); cursor: pointer; }
.stage-main { display: grid; gap: 4px; min-width: 0; }
.stage-main > input { font-weight: 600; }
.stage-types { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.chip-check { display: inline-flex; cursor: pointer; position: relative; }
.chip-check input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.chip-check span { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); transition: background .2s, color .2s, border-color .2s; }
.chip-check input:checked + span { background: var(--tint); border-color: var(--tint-line); color: var(--ink); }
.chip-check input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }
.stage-add { display: grid; grid-template-columns: 40px 1fr auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.stage-del { border: 1px solid var(--red-line); }
.stage-del select { max-width: 320px; margin-bottom: 6px; }
.icon-btn.danger:hover { color: var(--red); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover, .btn-danger:hover:not(:disabled) { background: #cf3631; border-color: #cf3631; color: #fff; filter: none; box-shadow: 0 10px 22px -14px var(--red); }
.stage-row input:not([type=color]), .stage-add input:not([type=color]) { width: 100%; }
@media (max-width: 600px) {
  .stage-row { grid-template-columns: 40px 1fr auto; }
  .stage-move { grid-column: 1 / -1; order: 5; justify-content: flex-end; padding: 0; }
  .stage-lock { display: none; }
}

/* ===== Прайс сайта (v1.7) ===== */
.tabs-sub { border-bottom: 0; gap: 6px; margin: -4px 0 14px; }
.tabs-sub a { border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 13px; margin-bottom: 0; }
.tabs-sub a.is-active { background: var(--tint); border-color: var(--tint-line); color: var(--ink); }
.tabs-sub a.is-active::after { display: none; }
.pub-card { border-left: 4px solid var(--green); }
.pub-card.has-draft { border-left-color: var(--brand); }
.pub-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.pub-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); flex: none; }
.pub-card.has-draft .pub-ic { background: var(--tint); }
.pub-text { flex: 1; min-width: 220px; display: grid; gap: 2px; }
.pub-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pub-diff { margin-top: 12px; }
.pub-diff summary { cursor: pointer; font-weight: 600; }
.pub-diff ul, .ver-row ul { margin: 8px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.55; max-height: 320px; overflow: auto; }
.pl-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.pl-chip { position: relative; font: inherit; font-size: 13px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); cursor: pointer; transition: border-color .2s, background .2s; }
.pl-chip:hover { border-color: var(--brand); }
.pl-chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.pl-chip.mod::after { content: ""; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%; background: var(--orange, #e8890c); border: 2px solid var(--surface); }
.pl-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin: 6px 0 8px; }
.pl-head .field { margin: 0; }
.pl-head input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.pl-tbl { margin: 14px 0 6px; }
.pl-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.pl-scroll table { border-collapse: separate; border-spacing: 0; min-width: 100%; }
.pl-scroll th, .pl-scroll td { padding: 3px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); text-align: left; vertical-align: middle; font-weight: 400; }
.pl-scroll thead th { background: var(--surface-2); color: var(--muted); font-size: 12px; position: sticky; top: 0; }
.pl-scroll thead th.g { color: var(--ink); font-weight: 600; text-align: center; }
.pl-scroll input { width: 100%; height: 32px; padding: 0 7px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--ink); font: inherit; font-size: 13px; }
.pl-scroll input:hover { border-color: var(--line); }
.pl-scroll input:focus { border-color: var(--brand); background: var(--input-bg); outline: none; }
.pl-scroll td input { width: 78px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 500; }
.pl-scroll thead input { min-width: 78px; text-align: center; font-size: 12px; }
.pl-scroll td.lab, .pl-scroll th.lab { position: sticky; left: 0; z-index: 1; background: var(--surface); min-width: 200px; }
.pl-scroll thead th.lab { z-index: 2; background: var(--surface-2); }
.pl-scroll td.lab input { width: 100%; text-align: left; }
.pl-scroll td.lab .desc input { font-size: 12px; color: var(--muted); }
.pl-scroll tr.grp td { background: var(--surface-2); font-weight: 600; }
.pl-scroll tr.grp td input { text-align: left; font-weight: 600; }
.pl-scroll td.act { white-space: nowrap; width: 1%; padding: 3px 6px; }
.pl-ic { width: 26px; height: 28px; margin-left: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted); cursor: pointer; font-weight: 600; }
.pl-ic:hover { color: var(--ink); border-color: var(--brand); }
.pl-ic.del:hover { color: var(--red); border-color: var(--red); }
.pl-scroll input.chg, .pp-row input.chg { background: var(--tint); border-color: var(--tint-line); }
.pl-scroll input.bad { background: var(--red-bg); border-color: var(--red); }
.pl-add { margin-top: 8px; }
.is-ro .pl-scroll input { pointer-events: none; }
.pl-savebar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 -6px 18px rgba(0,0,0,.06); }
.pl-savebar .hint { margin: 0 auto 0 0; }
.pp-list { padding: 4px 16px; }
.pp-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); }
.pp-row:last-of-type { border-bottom: 0; }
.pp-name { display: grid; gap: 2px; min-width: 0; }
.pp-name code { font-size: 11px; color: var(--muted); }
.pp-val { display: flex; gap: 6px; align-items: center; flex: none; }
.pp-val input { height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg); color: var(--ink); }
.pp-val .pp-amt { width: 80px; text-align: right; }
.pp-auto { font-weight: 600; }
.chg-note { color: var(--orange, #e8890c); font-size: 12px; }
.ver-row { display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.ver-row:last-child { border-bottom: 0; }
.ver-main { display: grid; gap: 2px; }
.ver-main summary { cursor: pointer; font-size: 13px; color: var(--muted); }
@media (max-width: 640px) {
  .pp-row { flex-direction: column; align-items: stretch; }
  .pl-savebar { justify-content: stretch; } .pl-savebar .btn { flex: 1; }
}
@media (max-width: 860px) {
  .pl-savebar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 8px); }
}

/* Сотрудник онлайн */
.online { display: inline-flex; align-items: center; gap: 6px; color: var(--green); font-weight: 600; }
.online i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(47,158,68,.5); animation: onlinePulse 2s cubic-bezier(.2,.7,.2,1) infinite; }
@keyframes onlinePulse { 0% { box-shadow: 0 0 0 0 rgba(47,158,68,.45); } 70%, 100% { box-shadow: 0 0 0 6px rgba(47,158,68,0); } }
.av-wrap { position: relative; display: inline-flex; }
.av-wrap.is-online::after { content: ""; position: absolute; right: 7px; bottom: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); border: 2px solid var(--surface); }
@media (prefers-reduced-motion: reduce) { .online i { animation: none; } }

/* Звонок по клику */
a.phone[data-call] { cursor: pointer; }
a.phone.is-calling { opacity: .6; }
.toast-call.is-ok { border-left-color: var(--green); }
.toast-call.is-ok .toast-head b { color: var(--green); }
.toast-call.is-wait { border-left-color: var(--brand); }
.toast-call.is-wait .toast-head b { color: var(--ink); }

/* Номера клиента */
.phones { display: grid; gap: 4px; }
.ph-row { position: relative; }
.ph-row .ph-view { display: flex; align-items: center; gap: 6px; min-height: 28px; white-space: nowrap; }
.ph-row .ph-view small { font-size: 11px; }
.ph-tools { position: absolute; right: 0; top: 0; display: inline-flex; gap: 2px; padding-left: 8px; background: linear-gradient(90deg, transparent, var(--surface) 8px); opacity: 0; transition: opacity .2s; }
.ph-tools form { display: inline; margin: 0; }
.ph-row:hover .ph-tools, .ph-row:focus-within .ph-tools { opacity: 1; }
@media (hover: none) { .ph-tools { opacity: 1; } }
.ph-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 2px 0; }
.ph-form input { width: 170px; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg); color: var(--ink); }
.ph-form select { height: 32px; }
.ph-add-btn { justify-self: start; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.ph-add-btn .ic { width: 14px; height: 14px; }
.ph-note { font-size: 12px; color: var(--ink-2); margin: -2px 0 4px; padding-left: 8px; border-left: 2px solid var(--tint-line); white-space: pre-wrap; word-break: break-word; }
.ph-form .ph-comment { width: 100%; flex-basis: 100%; }
.ph-form input[type=email], .ph-form input[name=value] { width: 220px; }

/* Источники */
.source-note { margin-top: 6px; }
.src-list { display: grid; gap: 6px; margin: 10px 0; }
.src-row { display: grid; grid-template-columns: 60px 28px 1fr 190px 80px 32px; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.src-row.is-off { opacity: .55; }
.src-row .src-name, .src-add input { width: 100%; height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg); color: var(--ink); }
.src-on input { vertical-align: middle; }
.src-used { font-size: 12px; text-align: right; }
.src-add { grid-template-columns: 1fr 200px auto; }
@media (max-width: 640px) {
  .src-row { grid-template-columns: 28px 1fr 32px; }
  .src-row .stage-move { grid-column: 1 / -1; order: 9; justify-content: flex-end; }
  .src-row select { grid-column: 2 / 3; } .src-used { display: none; }
  .src-add { grid-template-columns: 1fr; }
}
.ok-line { display: flex; gap: 8px; align-items: flex-start; color: var(--ink); background: var(--green-bg); border: 1px solid var(--green-line); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; }
.ok-line .ic { color: var(--green); flex: none; margin-top: 2px; }

/* ===== Уведомления клиентам ===== */
.switch-row { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; margin-bottom: 10px; }
.switch-row.is-on { border-color: var(--green-line); background: var(--green-bg); }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch-row > span:last-child { display: grid; gap: 2px; }
.switch { position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--line-strong, #c9c9c9); flex: none; transition: background .25s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .25s cubic-bezier(.2,.7,.2,1); }
.switch-row.is-on .switch { background: var(--green); }
.switch-row.is-on .switch::after { transform: translateX(18px); }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--brand); outline-offset: 2px; }
.ntf-list { display: grid; gap: 8px; margin: 8px 0 16px; }
.ntf-row { border: 1px solid var(--line); border-left: 4px solid var(--st); border-radius: 10px; padding: 10px 12px; display: grid; gap: 8px; opacity: .65; transition: opacity .2s; }
.ntf-row.is-on { opacity: 1; }
.ntf-row textarea, .card textarea[name=remind_text] { width: 100%; font: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--input-bg); color: var(--ink); resize: vertical; }
.ntf-row:not(.is-on) textarea, .ntf-row:not(.is-on) .ntf-preview { display: none; }
.ntf-preview { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.ntf-preview div { margin-top: 3px; white-space: pre-wrap; word-break: break-word; }
.ntf-test { display: flex; gap: 8px; flex-wrap: wrap; } .ntf-test select { flex: 1; min-width: 220px; }
.ntf-log { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.ntf-log:last-child { border: 0; }
.ntf-body { color: var(--ink-2); font-size: 13px; margin-top: 2px; word-break: break-word; }
.ntf-st { flex: none; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); height: fit-content; white-space: nowrap; }
.ntf-st.is-sent { background: var(--green-bg); color: var(--green); }
.ntf-st.is-failed { background: var(--red-bg); color: var(--red); }
.ntf-st.is-pending, .ntf-st.is-sending { background: var(--tint); color: var(--ink); }
.ntf-order { display: grid; gap: 6px; }
.ntf-order .link-row { display: flex; gap: 6px; align-items: center; }
.ntf-order .link-row input { flex: 1; min-width: 0; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--input-bg); color: var(--ink); font-size: 12px; }
.ntf-actions { display: grid; gap: 6px; justify-items: start; margin-top: 4px; }
.ntf-actions .check { font-size: 13px; }
[data-copy-link].is-copied { color: var(--green); border-color: var(--green); }

/* Всплывающие уведомления о звонках, сообщениях и заявках */
.toast-live { border-left-color: var(--blue, #1e88e5); }
.toast-live .toast-head b { color: var(--ink); }
.toast-live.is-missed { border-left-color: var(--red); }
.toast-live.is-missed .toast-head b { color: var(--red); }
.toast-live.is-call { border-left-color: var(--green); }
.toast-live.is-lead { border-left-color: var(--brand); }
.toast-live.ch-telegram { border-left-color: #229ED9; }
.toast-live.ch-max { border-left-color: #6a4cff; }
.toast-live.ch-email { border-left-color: #e8890c; }
.toast-live .toast-body small { word-break: break-word; }
.toasts { max-height: calc(100vh - 36px); overflow-y: auto; overscroll-behavior: contain; padding: 2px; scrollbar-width: thin; }
@media (max-width: 860px) { .toasts { max-height: calc(100vh - var(--tabbar-h) - 90px); } }
.toast-more .toast-head { margin-bottom: 8px; }

/* Этапы в карточке заказа — цветами этапов */
.pipeline-bar button { background: color-mix(in srgb, var(--st) 22%, #2a2a2a); }
.pipeline-bar button.is-done { background: var(--st); }
.pipeline-bar button.is-current { background: var(--st); box-shadow: 0 0 0 2px #fff; }
.pipeline-bar button:not(:disabled):hover { background: var(--st); }
.btn-stage { background: var(--st); border-color: var(--st); color: var(--st-ink, #141414); font-weight: 600; }
.btn-stage:hover { background: color-mix(in srgb, var(--st) 85%, #fff); border-color: color-mix(in srgb, var(--st) 85%, #fff); color: var(--st-ink, #141414); }
/* На телефоне всплывающих окошек не больше двух — чтобы не закрывали работу */
@media (max-width: 860px) { .toasts .toast:not(:nth-last-child(-n+1)) { display: none; } .toast { padding: 10px 12px; } .toast-body { margin-bottom: 8px; } }

.line-acts { display: inline-flex; flex-direction: column; gap: 2px; }
/* В калькуляторе и форме заказа окошки слева — чтобы не закрывали итог и кнопки оплаты */
@media (min-width: 861px) {
  body[data-page="order_quick"] .toasts, body[data-page="order_edit"] .toasts { right: auto; left: calc(var(--sidebar-w) + 18px); }
}

/* Калькулятор: подсказки клиентов */
.cl-pick { position: relative; min-width: 0; }
.cl-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.cl-sug { position: absolute; z-index: 70; left: 0; right: 0; top: calc(100% + 6px); padding: 6px; background: var(--surface); border: 1px solid var(--brand);
  border-radius: 8px; box-shadow: var(--dd-shadow); max-height: 340px; overflow-y: auto; animation: clsug .22s var(--ease); }
@keyframes clsug { from { opacity: 0; transform: translateY(-6px); } }
.cl-sug-head { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 4px 8px 6px; }
.cl-sug button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: 6px; background: none; text-align: left; font: inherit; color: var(--ink); cursor: pointer; }
.cl-sug button.is-active, .cl-sug button:hover { background: var(--dd-act); }
.cl-sug mark { background: rgba(255,210,31,.55); color: inherit; border-radius: 2px; padding: 0 1px; }
.cl-sug .cl-sug-new { justify-content: center; margin-top: 4px; border-top: 1px solid var(--line-2); border-radius: 0 0 6px 6px; color: var(--blue); font-weight: 600; padding: 10px; }
.cl-av { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-weight: 700; font-size: 15px; }
.cl-main { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; flex: 1; }
.cl-main b { font-weight: 600; font-size: 14.5px; }
.cl-main small { flex-basis: 100%; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-main .t { font-style: normal; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 9px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.cl-main .t-ok { background: var(--green-bg); color: var(--green); border-color: var(--green-line); }
.cl-main .t-bad { background: rgba(229,64,59,.1); color: var(--red); border-color: var(--red-line); }
.cl-hint { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.cl-hint .ic { width: 14px; height: 14px; color: var(--green); }
.cl-card { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--brand); border-radius: 8px; background: var(--tint-2); animation: clsug .25s var(--ease); }
.cl-card a { color: var(--blue); }
.cl-x { flex: none; align-self: flex-start; width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; }
.cl-x:hover { background: var(--surface-2); color: var(--ink); }
@media (max-width: 560px) { .cl-fields { grid-template-columns: 1fr; } }
.pos-client { margin: 2px 0 10px; }
.pos-client .field input { height: 40px; }

/* ---------- Деньги: касса ---------- */
.cash-closed { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--red-line); border-radius: 8px; background: rgba(229,64,59,.07); font-size: 13px; line-height: 1.35; }
.cash-closed .ic { flex: none; width: 20px; height: 20px; color: var(--red); }
.cash-closed span { flex: 1; }
.btn-pay[data-cash-closed] { opacity: .3; cursor: not-allowed; }
.cash-closed-hint { margin-top: 6px; color: var(--red); }
.cash-shift.is-open { border-color: var(--brand); box-shadow: inset 4px 0 0 var(--brand); }
.cash-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 14px; }
.cash-head h2 { margin: 4px 0 4px; }
.cash-head p { margin: 0; font-size: 13px; }
.cash-state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.cash-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.cash-big { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.cash-big small { color: var(--muted); font-size: 12px; }
.cash-big b { font-size: 34px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cash-diff { font-weight: 600; font-size: 13px; padding: 2px 8px; border-radius: 10px; }
.cash-diff.ok, .cash-diff-live.ok { color: var(--green); background: var(--green-bg); }
.cash-diff.bad, .cash-diff-live.bad { color: var(--red); background: rgba(229,64,59,.1); }
.cash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; margin-bottom: 10px; }
.cash-grid > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.cash-grid small { color: var(--muted); font-size: 12px; }
.cash-grid b { font-size: 19px; font-variant-numeric: tabular-nums; }
.cash-grid span { font-size: 12px; }
.cash-calc { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 10px 12px; border-radius: 8px; background: var(--tint-2); border: 1px dashed var(--line-strong); font-size: 13px; color: var(--ink-2); }
.cash-calc b { color: var(--ink); font-variant-numeric: tabular-nums; }
.cash-calc .eq { margin-left: auto; }
.cash-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; align-items: flex-start; }
.cash-act > summary { list-style: none; }
.cash-act > summary::-webkit-details-marker { display: none; }
.cash-act[open] > summary { background: var(--brand-ink); color: var(--brand); border-color: var(--brand-ink); }
.cash-act { flex: 0 1 auto; }
.cash-act[open] { flex: 1 1 100%; order: 9; }
.cash-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); animation: clsug .25s var(--ease); }
.cash-form > input { height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg, var(--surface)); color: var(--ink); }
.cash-form > input[name=amount] { width: 140px; }
.cash-form > input[name=comment] { flex: 1 1 260px; }
.cash-form .field { flex: 1 1 260px; }
.cash-close .cash-form { flex-direction: column; align-items: stretch; max-width: 420px; }
.cash-diff-live { margin: 0; font-weight: 600; padding: 6px 10px; border-radius: 6px; }
.cash-diff-live:empty { display: none; }
.btn-dark { background: var(--brand-ink); color: #fff; border-color: var(--brand-ink); }
.btn-dark:hover { background: #2a2a2a; }
.cash-open { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 12px 0 8px; }
.cash-open .field { width: 260px; }
.cash-log { list-style: none; margin: 0; padding: 0; }
.cash-log li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line-2); }
.cash-log li:last-child { border-bottom: 0; }
.cl-time { flex: none; width: 44px; color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.cl-what { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.cl-what small { color: var(--muted); font-size: 12px; }
.cl-sum { flex: none; font-variant-numeric: tabular-nums; }
.cl-sum.plus { color: var(--green); }
.cl-sum.minus { color: var(--red); }
.cash-log form { flex: none; }
.sec-title { margin: 22px 0 10px; }
.table tr.is-current td { background: var(--tint-2); }
.radio-card { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px; cursor: pointer; transition: border-color .2s var(--ease); }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--tint-2); }
.radio-card input { margin-top: 3px; accent-color: var(--brand-ink); }
.radio-card span { display: flex; flex-direction: column; gap: 2px; }
.radio-card small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.stat b.stat-off { color: #8a8a8a; font-size: 24px; }

/* ---------- Деньги: расходы ---------- */
.exp-grid { display: grid; grid-template-columns: 140px 1.2fr 1fr 150px; gap: 12px; align-items: end; margin-bottom: 10px; }
.exp-grid .exp-comment { grid-column: 1 / 4; }
.exp-btn { height: 38px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 220px) 1fr auto; gap: 12px; align-items: center; padding: 6px 0; font-size: 14px; }
.bar-row i { display: block; height: 10px; border-radius: 5px; background: var(--line-2); position: relative; overflow: hidden; }
.bar-row i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--brand); border-radius: 5px; animation: barin .7s var(--ease); }
.bar-row.exp i::after { background: #ff8a65; }
.bar-row b { font-variant-numeric: tabular-nums; min-width: 90px; text-align: right; }
@keyframes barin { from { width: 0; } }

/* ---------- Деньги: отчёты ---------- */
.rep-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.rep-periods { flex-wrap: wrap; }
.rep-custom { display: flex; gap: 6px; align-items: center; }
.rep-custom input { height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); }
.rep-xls { margin-left: auto; }
.rep-period { margin-top: -4px; }
.rep-kpi .stat { min-height: 104px; }
.stat .delta { font-size: 12px; color: #a3a3a3; }
.stat .delta.up { color: #6fdc8c; }
.stat .delta.down { color: #ff7b75; }
.rep-chart { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 3px; align-items: end; height: 220px; padding-top: 22px; }
.rc-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: stretch; height: 100%; min-width: 0; }
.rc-col i { position: relative; display: block; min-height: 2px; background: var(--brand); border-radius: 3px 3px 0 0; transform-origin: bottom; animation: colin .6s var(--ease) both; }
.rc-col.we i { background: #f0c400; opacity: .75; }
.rc-col:hover i { background: var(--brand-ink); }
.rc-col i em { position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); font-style: normal; font-size: 11px; font-weight: 600; white-space: nowrap; color: var(--ink); }
.rc-col span { text-align: center; font-size: 10.5px; color: var(--muted); margin-top: 4px; overflow: hidden; }
@keyframes colin { from { transform: scaleY(0); } }
.rep-two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rep-share { min-width: 140px; }
.rep-share i { display: inline-block; vertical-align: middle; width: 90px; height: 8px; border-radius: 4px; background: var(--line-2); position: relative; overflow: hidden; margin-right: 8px; }
.rep-share i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--brand); }
.rep-share span { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.table tfoot td { padding: 10px 12px; border-top: 2px solid var(--ink); font-weight: 600; }
@media (max-width: 860px) {
  .exp-grid { grid-template-columns: 1fr 1fr; }
  .exp-grid .exp-comment { grid-column: 1 / -1; }
  .exp-btn { grid-column: 1 / -1; }
  .rep-two { grid-template-columns: 1fr; }
  .rep-xls { margin-left: 0; }
  .rep-chart { gap: 1px; height: 180px; }
  .rc-col span { font-size: 9px; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-row i { grid-column: 1 / -1; order: 3; }
  .cash-big { align-items: flex-start; text-align: left; }
  .cash-calc .eq { margin-left: 0; }
}

/* ---------- Склад ---------- */
.notice-line { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; background: var(--tint-2); border: 1px solid var(--line); font-size: 13px; }
.notice-line .ic { flex: none; width: 18px; height: 18px; color: var(--orange); }
.stock-head { padding: 14px 16px 0; }
.stock-head h2 { margin: 0; }
.stock-head > span { display: flex; gap: 6px; }
.tag-red { background: rgba(229,64,59,.12); color: var(--red); }
.stock-table tr.is-low td { background: rgba(240,162,58,.07); }
.stock-table tr.is-neg td { background: rgba(229,64,59,.07); }
.inv-input { width: 90px; height: 32px; padding: 0 8px; border: 1.5px solid var(--brand); border-radius: 6px; text-align: right; background: var(--input-bg); color: var(--ink); font: 600 14px var(--font); }
.stock-inv-hint { padding: 10px 16px 14px; }
.order-margin { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); }

.si-lines { display: flex; flex-direction: column; gap: 8px; }
.si-head, .si-line { display: grid; grid-template-columns: minmax(200px, 1.6fr) 1fr 1fr 1fr 32px; gap: 8px; align-items: center; }
.si-head span { font-size: 12px; color: var(--muted); }
.si-line select, .si-in input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg); color: var(--ink); }
.si-in { position: relative; display: block; }
.si-in input { padding-right: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.si-in small { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; pointer-events: none; }
.si-hint { grid-column: 1 / -1; margin-top: -4px; font-size: 12px; }
.si-hint:empty { display: none; }
.si-add { margin: 10px 0 4px; display: inline-flex; align-items: center; gap: 4px; }
.si-total { text-align: right; font-size: 15px; padding: 10px 0; border-top: 1px solid var(--line); margin-top: 8px; }
.si-total b { font-size: 22px; font-variant-numeric: tabular-nums; }
.si-opts { display: grid; grid-template-columns: 180px 1fr 1fr; gap: 12px; margin: 10px 0; }
.si-opts .si-comment { grid-column: span 2; }
.stock-in .check { margin: 8px 0 4px; }

.so-grid { display: grid; grid-template-columns: 1.4fr 110px auto 1fr; gap: 12px; align-items: end; }
.so-grid .so-comment { grid-column: 1 / 4; }
.so-btn { height: 38px; }
.so-grid .seg { height: 38px; }
.so-grid .seg > label > span { height: 36px; }

.mv-in { background: var(--green-bg); color: var(--green); }
.mv-use { background: var(--line-2); }
.mv-writeoff { background: rgba(229,64,59,.12); color: var(--red); }
.mv-adjust { background: var(--tint); color: #7a5a00; }

.mat-hint { padding: 8px 16px 0; line-height: 1.5; }
.mat-list { display: flex; flex-direction: column; padding: 8px 12px; gap: 6px; }
.mat-row { display: grid; grid-template-columns: 60px 28px minmax(180px, 2fr) 100px 90px 100px 90px 100px 32px; gap: 8px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line-2); }
.mat-row-head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); }
.mat-row.is-off { opacity: .5; }
.mat-row input:not([type=checkbox]) { width: 100%; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg); color: var(--ink); }
.mat-name { display: flex; flex-direction: column; gap: 2px; }
.mat-name small { font-size: 11px; }
.mat-actions { padding: 0 16px 14px; }
.mat-add-grid { display: grid; grid-template-columns: 2fr repeat(6, minmax(80px, 1fr)) auto; gap: 10px; align-items: end; }
.ma-btn { height: 38px; }

.norms { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.norms-nav { position: sticky; top: 70px; max-height: calc(100vh - 90px); overflow-y: auto; padding: 10px; }
.norms-search { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; background: var(--input-bg); color: var(--ink); }
.nn-cat { margin-bottom: 8px; }
.nn-cat > b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px 8px 2px; }
.nn-cat a { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 6px 8px; border-radius: 6px; color: var(--ink); font-size: 13.5px; text-decoration: none; }
.nn-cat a:hover { background: var(--surface-2); }
.nn-cat a.is-active { background: var(--brand-ink); color: var(--brand); }
.nn-ok .ic { width: 14px; height: 14px; color: var(--green); }
.nn-cat a.is-active .nn-ok .ic { color: var(--brand); }
.norms-card .hint { margin: 8px 0 12px; }
.norm-add { margin-bottom: 10px; max-width: 420px; }
.norm-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.norm-table th[data-col] { min-width: 120px; white-space: normal; text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--ink); }
.norm-table th small { display: block; font-weight: 400; color: var(--muted); margin-top: 2px; }
.norm-table th .link { font-size: 11px; }
.norm-table th .danger { color: var(--red); }
.norm-table td[data-col] input { width: 90px; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: 6px; text-align: right; background: var(--input-bg); color: var(--ink); }
.norm-table tr.norm-all td { background: var(--tint-2); }
.norm-copy { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 13px; }
.norm-copy select { min-width: 220px; }
@media (max-width: 960px) {
  .norms { grid-template-columns: 1fr; }
  .norms-nav { position: static; max-height: 260px; }
  .si-head { display: none; }
  .si-line { grid-template-columns: 1fr 1fr 32px; }
  .si-line select { grid-column: 1 / -1; }
  .si-opts, .so-grid, .mat-add-grid { grid-template-columns: 1fr 1fr; }
  .si-opts .si-comment, .so-grid .so-comment, .ma-name { grid-column: 1 / -1; }
  .mat-row { grid-template-columns: 28px 1fr 1fr; }
  .mat-row-head { display: none; }
  .mat-row .stage-move { display: none; }
  .mat-row .mat-name { grid-column: 2 / -1; }
}

/* Открытый выпадающий список — поверх соседних блоков (у карточек анимация появления создаёт свой слой) */
:is(.card, .stats, .board, .deal, .pos, .filters, form):has(.dd.open, .cl-sug:not(.hidden)) { position: relative; z-index: 40; }
.si-in input[data-qty] { padding-right: 84px; }
.si-in small { max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-f { display: block; min-width: 0; }
.mr-f small { display: none; font-size: 11px; color: var(--muted); margin-bottom: 2px; }
@media (max-width: 960px) {
  .mat-row { grid-template-columns: 28px 1fr 1fr; row-gap: 6px; padding: 10px 4px; }
  .mr-f small { display: block; }
  .mat-row > .icon-btn { grid-column: 3; justify-self: end; }
}
@media (max-width: 960px) {
  .mat-row { grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: end; }
  .mat-row .src-on { grid-column: span 1; align-self: center; }
  .mat-row .mat-name { grid-column: span 5; }
  .mat-row .mr-f { grid-column: span 2; }
  .mat-row > .icon-btn { grid-column: span 2; justify-self: end; }
}

/* Карточка заказа: «Добавить» в составе и окно с калькулятором */
.side-block h3.sb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-block h3.sb-head > span { display: inline-flex; align-items: center; gap: 6px; }
.sb-add { text-transform: none; letter-spacing: 0; font-weight: 600; }
.sb-add .ic { width: 15px !important; height: 15px !important; }
body.modal-open { overflow: hidden; }
.items-modal { position: fixed; inset: 0; z-index: 900; background: rgba(15,15,15,.55); display: flex; align-items: flex-start; justify-content: center; padding: 24px 16px; overflow-y: auto; animation: imFade .2s var(--ease); }
.items-modal.hidden { display: none; }
.items-sheet { width: 100%; max-width: 1240px; background: var(--bg, #f3f3f1); border-radius: 12px; padding: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.35); animation: imUp .3s var(--ease); }
.im-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.im-head h2 { margin: 0; }
.items-sheet .pos-cart { top: 0; max-height: calc(100vh - 140px); }
.im-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.im-actions .btn { height: 44px; padding: 0 18px; }
@keyframes imFade { from { opacity: 0; } }
@keyframes imUp { from { opacity: 0; transform: translateY(16px); } }
@media (max-width: 860px) {
  .items-modal { padding: 0; }
  .items-sheet { border-radius: 0; min-height: 100%; padding: 12px; }
  .items-sheet .pos-cart { max-height: none; }
}

/* Карточка заказа: заметный блок оплаты */
.pay-block { position: relative; }
.pay-block.is-debt { background: linear-gradient(180deg, rgba(255,210,31,.16), rgba(255,210,31,.05)); box-shadow: inset 4px 0 0 var(--brand); }
.pay-block.is-paid { background: var(--green-bg); box-shadow: inset 4px 0 0 var(--green); }
.pay-sum { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 4px 0 8px; }
.pay-sum span { font-weight: 600; font-size: 14px; }
.pay-sum b { font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.is-debt .pay-sum b { color: var(--ink); }
.pay-ok { display: inline-flex; align-items: center; gap: 6px; color: var(--green); }
.pay-ok .ic { width: 18px; height: 18px; }
.pay-progress { height: 8px; border-radius: 4px; background: rgba(0,0,0,.08); overflow: hidden; }
.pay-progress i { display: block; height: 100%; background: var(--green); border-radius: 4px; transition: width .6s var(--ease); }
.is-debt .pay-progress i { background: var(--brand-ink); }
.pay-sub { margin: 6px 0 12px; font-size: 12.5px; color: var(--muted); }
.pay-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); gap: 6px; margin-bottom: 8px; }
.pay-methods label { position: relative; cursor: pointer; }
.pay-methods input { position: absolute; opacity: 0; pointer-events: none; }
.pay-methods span { display: flex; align-items: center; justify-content: center; height: 36px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); font-weight: 600; font-size: 13px; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.pay-methods input:checked + span { background: var(--brand-ink); border-color: var(--brand-ink); color: var(--brand); }
.pay-methods input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.pay-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.pay-amount { position: relative; display: block; }
.pay-amount input { width: 100%; height: 46px; padding: 0 30px 0 12px; border: 2px solid var(--line-strong); border-radius: 8px; font: 700 18px var(--font); font-variant-numeric: tabular-nums; background: var(--input-bg); color: var(--ink); }
.pay-amount input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px rgba(255,210,31,.3); }
.pay-amount small { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.pay-btn { height: 46px; padding: 0 16px; font-weight: 700; white-space: nowrap; }
.pay-btn .ic { width: 17px; height: 17px; }
.pay-more > summary { cursor: pointer; color: var(--blue); font-size: 13px; margin-bottom: 8px; list-style: none; }
.pay-more > summary::-webkit-details-marker { display: none; }
.pay-history { margin-top: 12px; padding-top: 8px; border-top: 1px dashed var(--line-strong); }
.pay-block.is-off { opacity: .7; }

/* ---------- Финансы: поступления ---------- */
.inc-bar { align-items: center; }
.inc-nav { display: flex; align-items: center; gap: 4px; }
.inc-nav .icon-btn { font-size: 20px; width: 34px; height: 34px; border: 1px solid var(--line); background: var(--surface); }
.inc-date input { height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font-weight: 600; }
.inc-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.inc-filter a { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 15px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font-size: 13px; font-weight: 500; text-decoration: none; }
.inc-filter a.is-active { background: var(--brand-ink); color: var(--brand); border-color: var(--brand-ink); }
.inc-day { margin-bottom: 18px; }
.inc-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px 10px; background: var(--brand-ink); color: #fff; }
.inc-title h2 { margin: 0; font-size: 17px; color: #fff; }
.inc-title h2::first-letter { text-transform: uppercase; }
.inc-title small { color: #a3a3a3; font-size: 12px; }
.inc-sum b { font-size: 28px; color: var(--brand); font-variant-numeric: tabular-nums; }
.inc-methods { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.inc-methods > div, .inc-cash { display: flex; flex-direction: column; gap: 1px; min-width: 120px; padding: 8px 12px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--pm, var(--line-strong)); text-decoration: none !important; color: var(--ink); }
.inc-methods span { font-size: 12px; color: var(--muted); }
.inc-methods b { font-size: 17px; font-variant-numeric: tabular-nums; }
.inc-methods small { font-size: 11.5px; color: var(--muted); }
.inc-cash { margin-left: auto; --pm: var(--brand-ink); }
.inc-cash small.paid { color: var(--green); }
.inc-cash small.debt { color: var(--red); }
.pm-cash { --pm: #f2b705; --pm-bg: rgba(255,210,31,.22); --pm-ink: #6b5200; }
.pm-card { --pm: #3aa856; --pm-bg: rgba(58,168,86,.16); --pm-ink: #1f6d35; }
.pm-sbp { --pm: #4a7fe0; --pm-bg: rgba(74,127,224,.15); --pm-ink: #23509f; }
.pm-invoice { --pm: #8a8f96; --pm-bg: rgba(138,143,150,.16); --pm-ink: #4b5057; }
:root[data-theme="dark"] .pm-chip { --pm-ink: #e8e9ea; }
.pm-chip { display: inline-block; padding: 2px 10px; border-radius: 10px; background: var(--pm-bg); color: var(--pm-ink); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.inc-filter a.pm-cash:not(.is-active), .inc-filter a.pm-card:not(.is-active), .inc-filter a.pm-sbp:not(.is-active), .inc-filter a.pm-invoice:not(.is-active) { box-shadow: inset 3px 0 0 var(--pm); }
.inc-table td { vertical-align: middle; }
.inc-what { max-width: 420px; }
.inc-no { font-weight: 600; margin-right: 4px; white-space: nowrap; }
.inc-tag { margin-left: 4px; }
.inc-table tbody tr:nth-child(even) td { background: rgba(0,0,0,.015); }
.inc-total { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; }
.inc-total-main { display: flex; flex-direction: column; }
.inc-total-main span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.inc-total-main b { font-size: 32px; font-variant-numeric: tabular-nums; }
.inc-total-main small { color: var(--muted); }
.inc-total .inc-methods { padding: 0; border: 0; background: none; }
@media (max-width: 860px) {
  .inc-cash { margin-left: 0; }
  .inc-methods > div, .inc-cash { min-width: 0; flex: 1 1 40%; }
  .inc-sum b { font-size: 22px; }
}

/* Заголовки числовых колонок — по правому краю, ровно над суммами */
.table th.num { text-align: right; }
.exp-add.is-edit { border-color: var(--brand); box-shadow: inset 4px 0 0 var(--brand); }
.exp-btns { display: flex; gap: 8px; }
.exp-btns .btn { height: 38px; }
.exp-acts { display: inline-flex; gap: 2px; }
.exp-acts form { display: inline; }
.is-edit .exp-grid .exp-comment { grid-column: 1 / 3; }
.exp-btns { grid-column: 3 / 5; justify-content: flex-end; }
@media (max-width: 860px) { .is-edit .exp-grid .exp-comment, .exp-btns { grid-column: 1 / -1; } }

/* ---------- Финансы: транзакции ---------- */
.pm-beznal { --pm: #8a8f96; --pm-bg: rgba(138,143,150,.16); --pm-ink: #4b5057; }
.tx-types { display: inline-flex; gap: 6px; }
.inc-sep { width: 1px; background: var(--line); margin: 0 4px; }
.inc-filter a.tx-in:not(.is-active) { color: var(--green); }
.inc-filter a.tx-out:not(.is-active) { color: var(--red); }
.tx-plus { color: var(--ink); }
.tx-minus { color: var(--red); }
.inc-head .tx-minus { color: #ff8a85; }
.tx-day-sums { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; justify-content: flex-end; }
.tx-mini { color: #a3a3a3; font-size: 13px; }
.tx-mini b { color: #fff; font-variant-numeric: tabular-nums; margin-left: 4px; }
.tx-net { display: flex; flex-direction: column; align-items: flex-end; }
.tx-net small { color: #a3a3a3; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.tx-net b { font-size: 28px; color: var(--brand); font-variant-numeric: tabular-nums; line-height: 1.1; }
.tx-dot { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 12px; font-weight: 700; margin-right: 4px; background: var(--green-bg); color: var(--green); }
.tx-out .tx-dot { background: rgba(229,64,59,.12); color: var(--red); }
.inc-table tr.tx-out td { background: rgba(229,64,59,.035); }
.tx-tag-out { background: rgba(229,64,59,.12); color: var(--red); }
.tx-out-sum { font-style: normal; color: var(--red); }
.tx-totals { display: flex; gap: 28px; flex-wrap: wrap; }
.tx-totals > div { display: flex; flex-direction: column; }
.tx-totals span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tx-totals b { font-size: 28px; font-variant-numeric: tabular-nums; }
.tx-totals small { color: var(--muted); }
.inc-table tfoot tr.tx-foot-sub td { border-top: 0; font-weight: 500; color: var(--ink-2); padding-top: 6px; padding-bottom: 2px; }
.inc-table tfoot tr.tx-foot-sub:first-child td { border-top: 2px solid var(--ink); padding-top: 10px; }
.inc-table tfoot tr.tx-foot-sub + tr:not(.tx-foot-sub) td { border-top: 1px solid var(--line); }
@media (max-width: 860px) { .tx-day-sums { gap: 10px; } .tx-net b { font-size: 22px; } .inc-sep { display: none; } }
.table tr.exp-edit-row td { background: var(--tint-2); border-left: 4px solid var(--brand); padding: 14px 16px; }
.exp-inline-title { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.exp-inline-title .ic { width: 16px; height: 16px; }
.exp-inline .exp-grid .exp-comment { grid-column: 1 / 3; }
.exp-inline .hint { margin-top: 6px; }
@media (max-width: 860px) { .table tr.exp-edit-row td::before { display: none; } .exp-inline .exp-grid .exp-comment { grid-column: 1 / -1; } }

/* ---------- Окна подтверждения ---------- */
body.dlg-open { overflow: hidden; }
.dlg-wrap { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(12,12,12,.0); backdrop-filter: blur(0); transition: background .2s var(--ease), backdrop-filter .2s var(--ease); }
.dlg-wrap.on { background: rgba(12,12,12,.5); backdrop-filter: blur(3px); }
.dlg-wrap.off { background: rgba(12,12,12,0); }
.dlg { position: relative; width: 100%; max-width: 440px; background: var(--surface); color: var(--ink); border-radius: 14px; padding: 22px 22px 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,.35), 0 0 0 1px rgba(0,0,0,.04); display: grid; grid-template-columns: 44px 1fr; gap: 4px 14px;
  opacity: 0; transform: translateY(14px) scale(.97); transition: opacity .2s var(--ease), transform .25s var(--ease); }
.dlg-wrap.on .dlg { opacity: 1; transform: none; }
.dlg-wrap.off .dlg { opacity: 0; transform: translateY(8px) scale(.98); }
.dlg::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px; border-radius: 14px 14px 0 0; background: var(--brand); }
.dlg-danger::before { background: var(--red); }
.dlg-ic { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--tint); color: var(--brand-ink); }
.dlg-ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dlg-danger .dlg-ic { background: rgba(229,64,59,.12); color: var(--red); }
.dlg-warn .dlg-ic { background: rgba(240,162,58,.16); color: var(--orange); }
.dlg-body { min-width: 0; }
.dlg-body h3 { margin: 2px 0 6px; font-size: 17px; line-height: 1.3; text-transform: none; letter-spacing: 0; color: var(--ink); }
.dlg-body p { margin: 0; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.dlg-field { display: flex; flex-direction: column; gap: 5px; margin-top: 12px; }
.dlg-field span { font-size: 12px; color: var(--muted); }
.dlg-field span:empty { display: none; }
.dlg-field input { height: 42px; padding: 0 12px; border: 2px solid var(--line-strong); border-radius: 8px; font: 600 16px var(--font); background: var(--input-bg); color: var(--ink); }
.dlg-field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255,210,31,.3); }
.dlg-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.dlg-actions .btn { height: 42px; padding: 0 18px; font-weight: 600; min-width: 96px; }
@media (max-width: 520px) {
  .dlg-wrap { align-items: flex-end; padding: 0; }
  .dlg { max-width: none; border-radius: 16px 16px 0 0; padding-bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateY(40px); }
  .dlg::before { border-radius: 16px 16px 0 0; }
  .dlg-actions .btn { flex: 1; height: 48px; }
}
.inc-table tfoot tr.tx-foot-net td { background: var(--brand-ink); color: #fff; border-top: 0; padding-top: 14px; padding-bottom: 14px; font-size: 15px; font-weight: 700; }
.inc-table tfoot tr.tx-foot-net td b { color: var(--brand); font-size: 22px; }
.inc-table tfoot tr.tx-foot-cash td { background: var(--surface-2); color: var(--ink-2); border-top: 1px solid var(--line); padding-top: 9px; padding-bottom: 9px; font-weight: 500; font-size: 13px; }
.inc-table tfoot tr.tx-foot-cash td b { color: var(--ink-2); font-size: 14px; font-weight: 600; }
.inc-table tfoot tr.tx-foot-cash .ic { width: 16px; height: 16px; color: var(--muted); vertical-align: middle; }
.inc-table tfoot tr.tx-foot-cash small { display: inline-block; margin-left: 8px; font-weight: 400; font-size: 12px; color: var(--muted); }
.inc-table tfoot tr.tx-foot-cash small.paid { color: var(--green); }
.inc-table tfoot tr.tx-foot-cash small.debt { color: var(--red); }

/* Касса: «Внести / изъять» — заметная форма с анимацией */
.cash-form.cm-pop { animation: cmPop .45s cubic-bezier(.2,.7,.2,1); transform-origin: top left; }
@keyframes cmPop { 0% { opacity: 0; transform: translateY(-10px) scale(.98); box-shadow: 0 0 0 0 rgba(255,210,31,.0); }
  60% { opacity: 1; transform: none; box-shadow: 0 0 0 6px rgba(255,210,31,.35); } 100% { box-shadow: 0 0 0 0 rgba(255,210,31,0); } }
.cash-act[open] > .cash-form { border: 2px solid var(--brand); background: var(--surface); padding: 14px; }
.cash-move { flex-direction: column; align-items: stretch !important; gap: 12px !important; }
.cm-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cm-kinds label { position: relative; cursor: pointer; }
.cm-kinds input { position: absolute; opacity: 0; pointer-events: none; }
.cm-kinds span { display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 12px 14px; border: 2px solid var(--line-strong); border-radius: 10px; background: var(--surface-2); transition: border-color .2s, background .2s, box-shadow .2s, transform .15s; }
.cm-kinds i { grid-row: 1 / 3; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 20px; font-weight: 700; background: var(--line-2); color: var(--muted); transition: background .2s, color .2s; }
.cm-kinds b { font-size: 15px; }
.cm-kinds small { color: var(--muted); font-size: 12px; }
.cm-kinds label:hover span { transform: translateY(-1px); }
.cm-in input:checked + span { border-color: var(--green); background: var(--green-bg); box-shadow: 0 0 0 3px rgba(47,158,68,.15); }
.cm-in input:checked + span i { background: var(--green); color: #fff; }
.cm-out input:checked + span { border-color: var(--red); background: rgba(229,64,59,.08); box-shadow: 0 0 0 3px rgba(229,64,59,.12); }
.cm-out input:checked + span i { background: var(--red); color: #fff; }
.cm-line { display: grid; grid-template-columns: 170px 1fr auto; gap: 8px; }
.cm-line > input { height: 46px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--input-bg); color: var(--ink); }
.cm-btn { height: 46px; padding: 0 18px; font-weight: 700; }
.cash-move.is-out .cm-btn { background: var(--red); border-color: var(--red); color: #fff; }
@media (max-width: 700px) { .cm-kinds, .cm-line { grid-template-columns: 1fr; } }
.cash-panel { margin-top: 12px; padding: 16px; border: 2px solid var(--brand); border-radius: 12px; background: var(--surface); position: relative; }
.cash-panel::before { content: ""; position: absolute; top: -9px; left: var(--ax, 34px); width: 16px; height: 16px; background: var(--surface); border-left: 2px solid var(--brand); border-top: 2px solid var(--brand); transform: rotate(45deg); }
.cash-panel .cash-form { margin: 0; padding: 0; border: 0; background: none; }
.cash-panel.cm-pop { animation: cmPop .45s cubic-bezier(.2,.7,.2,1); transform-origin: top left; }
.cash-actions .btn.is-on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); box-shadow: 0 6px 16px rgba(255,210,31,.35); }
.cash-panel[data-panel-box="close"] .cash-form { max-width: 460px; }
@media (max-width: 700px) { .cash-panel::before { display: none; } }
.cash-actions .btn.btn-dark.is-on { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.cash-panel[data-panel-box="close"] .cash-form { flex-direction: column; align-items: stretch; }
.cash-panel[data-panel-box="close"] .cash-form > input, .cash-panel[data-panel-box="close"] .cash-form .field input { width: 100%; height: 44px; }
.cash-panel[data-panel-box="close"] .cash-form > .btn { height: 44px; }

/* ---------- Финансы: зарплата ---------- */
.pr-due { color: var(--ink); background: var(--tint); padding: 1px 6px; border-radius: 6px; }
.pr-card { margin-top: 16px; }
.pr-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; background: var(--brand-ink); color: #fff; flex-wrap: wrap; }
.pr-head h2 { margin: 0; color: #fff; font-size: 18px; }
.pr-head small { color: #a3a3a3; }
.pr-head-sum { display: flex; flex-direction: column; align-items: flex-end; }
.pr-head-sum span { font-size: 11px; color: #a3a3a3; text-transform: uppercase; letter-spacing: .04em; }
.pr-head-sum b { font-size: 26px; color: var(--brand); font-variant-numeric: tabular-nums; }
.pr-head-sum small b { font-size: 13px; color: var(--brand-ink); }
.pr-empty { padding: 14px 16px; }
.pr-days tr.pr-off td { opacity: .55; }
.pr-yes { color: var(--green); display: inline-flex; align-items: center; gap: 3px; font-size: 13px; }
.pr-yes .ic { width: 14px; height: 14px; }
.pr-inline { display: inline; }
.pr-act { font-size: 12px; margin-left: 6px; }
.pr-adj { display: inline-flex; align-items: center; gap: 4px; margin-left: 4px; font-weight: 600; }
.pr-adj.plus { color: var(--green); }
.pr-adj.minus { color: var(--red); }
.pr-adj small { font-weight: 400; color: var(--muted); }
.pr-foot td { font-weight: 600; }
.pr-payouts { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 13px; }
.pr-payout { display: inline-flex; gap: 6px; align-items: center; padding: 4px 10px; border-radius: 8px; background: var(--green-bg); }
.pr-tools { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); }
.pr-tool > summary { list-style: none; }
.pr-tool > summary::-webkit-details-marker { display: none; }
.pr-adj-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.pr-adj-form input { height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg); color: var(--ink); }
.pr-adj-form input[name=amount] { width: 110px; }
.pr-pay { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.pr-pay .pay-amount { width: 150px; }
.pr-pay .pay-amount input { height: 42px; font-size: 16px; }
.pr-pay select { height: 42px; }
.pr-pay .btn { height: 42px; }
.pr-scheme { margin-top: 18px; }
.pr-scheme-list { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.pr-scheme-row { display: grid; grid-template-columns: 32px minmax(140px, 1.4fr) 1fr 1fr 1fr; gap: 10px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line-2); }
.pr-scheme-row.is-off { opacity: .55; }
.pr-scheme-head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pr-scheme-row input:not([type=checkbox]) { width: 100%; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg); color: var(--ink); }
.pr-split { display: grid; gap: 8px; margin-top: 10px; max-width: 640px; }
.pr-from { display: grid; gap: 8px; margin: 14px 0 4px; padding: 14px 16px; border-radius: 12px; background: var(--brand-soft, rgba(255,214,0,.12)); border: 1px solid var(--line); }
.pr-from-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pr-from input[type=date] { height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg); color: var(--ink); font: inherit; }
.pr-planned { display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 9px; background: var(--brand); color: var(--brand-ink); font-size: 11px; font-weight: 600; vertical-align: 1px; }
.pr-hist { margin-top: 18px; }
.pr-hist-user { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.pr-hist-user:last-child { border-bottom: 0; }
.pr-hist-user > b { display: block; margin-bottom: 6px; }
.pr-hist-row { display: grid; grid-template-columns: 240px 1fr 32px; gap: 10px; align-items: center; padding: 4px 0; font-size: 13.5px; color: var(--ink-2); }
.pr-hist-row:first-of-type { color: var(--ink); font-weight: 500; }
.pr-hist-d { color: var(--muted); font-variant-numeric: tabular-nums; }
.pr-hist-d em { font-style: normal; margin-left: 6px; padding: 1px 6px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); font-size: 11px; }
.pr-hist-row.is-plan { color: var(--ink); }
@media (max-width: 600px) { .pr-hist-row { grid-template-columns: 1fr 32px; } .pr-hist-row > span:nth-child(2) { grid-column: 1; } .pr-hist-row .icon-btn { grid-row: 1 / span 2; grid-column: 2; } .pr-from .seg { flex-wrap: wrap; } }
@media (max-width: 860px) {
  .pr-scheme-row { grid-template-columns: 32px 1fr; }
  .pr-scheme-row .mr-f { grid-column: 2; }
  .pr-scheme-row .mr-f small { display: block; }
  .pr-scheme-head { display: none; }
  .pr-pay { margin-left: 0; flex-wrap: wrap; }
}

/* ---------- Производство ---------- */
.pq-stats { display: flex; gap: 18px; flex-wrap: wrap; margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.pq-stats b { color: var(--ink); font-size: 16px; }
.pq-stats .debt b { color: var(--red); }
.pq-board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; scroll-snap-type: x proximity; }
.pq-lane { flex: 0 0 300px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; scroll-snap-align: start; max-height: calc(100vh - 230px); display: flex; flex-direction: column; }
.pq-lane > header { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface); border-radius: 12px 12px 0 0; box-shadow: inset 0 3px 0 var(--brand); }
.pq-lane > header b { font-size: 13.5px; line-height: 1.3; }
.pq-none > header { box-shadow: inset 0 3px 0 var(--line-strong); }
.pq-n { flex: none; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--brand-ink); color: var(--brand); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.pq-cards { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.pq-empty { text-align: center; color: var(--muted); font-size: 13px; padding: 18px 0; margin: 0; }
.pc { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; transition: box-shadow .2s, transform .15s; }
.pc:hover { box-shadow: 0 6px 18px rgba(0,0,0,.08); }
.pc.is-over { border-color: var(--red-line); box-shadow: inset 3px 0 0 var(--red); }
.pc.is-taken { box-shadow: inset 3px 0 0 var(--green); }
.pc.is-over.is-taken { box-shadow: inset 3px 0 0 var(--red); }
.pc-top { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.pc-no { font-weight: 700; font-size: 13px; }
.pc-title { color: var(--ink); font-weight: 600; font-size: 14px; line-height: 1.3; text-decoration: none; }
.pc-items { list-style: none; margin: 0; padding: 0; font-size: 12.5px; color: var(--ink-2); }
.pc-items li { display: flex; justify-content: space-between; gap: 6px; padding: 1px 0; }
.pc-items b { white-space: nowrap; font-weight: 600; }
.pc-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.pc-meta span { display: inline-flex; align-items: center; gap: 4px; }
.pc-meta .ic { width: 13px; height: 13px; }
.pc-actions { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; border-top: 1px dashed var(--line); }
.pc-actions select { width: 100%; height: 30px; font-size: 12.5px; }
.pc-btns { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.pc-f { display: inline-flex; }
.pc-who { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--green); }
.pc-who .ic { width: 14px; height: 14px; }
.pc-rel { color: var(--muted); font-size: 16px; margin-left: -4px; }
.pc-done { margin-left: auto; }
.pc-btns > .pc-f:last-child { margin-left: auto; }
.eq-list { display: flex; flex-direction: column; padding: 8px 12px; gap: 4px; }
.eq-row { display: grid; grid-template-columns: 60px 28px minmax(200px, 2fr) 130px 100px 110px 150px minmax(120px, 1fr) 32px; gap: 8px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line-2); }
.eq-head { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.eq-row.is-off { opacity: .5; }
.eq-row input:not([type=checkbox]), .eq-row select { width: 100%; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg); color: var(--ink); }
.eq-queue { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; cursor: pointer; }
.eq-due { border-color: var(--red) !important; color: var(--red) !important; }
.eq-add { grid-template-columns: 1fr 140px auto auto; }
@media (max-width: 960px) {
  .eq-row { grid-template-columns: 28px 1fr 1fr; }
  .eq-row .stage-move, .eq-head { display: none; }
  .eq-row .eq-name { grid-column: 2 / -1; }
  .eq-row .mr-f small { display: block; }
  .pq-lane { flex-basis: 86vw; max-height: none; }
  .eq-add { grid-template-columns: 1fr 1fr; }
}

/* Левое меню шире — названия разделов целиком */
:root { --sidebar-w: 100px; }
.nav a, .nav-exit { font-size: 11px; padding: 10px 4px; }
.nav a span, .nav-exit span { white-space: nowrap; }
.me-name { max-width: 90px; }
@media (max-width: 860px) { .sidebar { width: 104px; } }

/* Левое меню: скользящая плашка (вариант 1) */
.nav { position: relative; }
.nav-ind { position: absolute; left: 6px; right: 6px; top: 0; height: 0; border-radius: 12px; background: var(--side-2); box-shadow: inset 0 0 0 1px rgba(255,210,31,.22);
  pointer-events: none; z-index: 0; opacity: 0; transition: transform .5s cubic-bezier(.34,1.56,.64,1), height .5s cubic-bezier(.34,1.56,.64,1), opacity .2s; }
.nav-ind::before { content: ""; position: absolute; left: -6px; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.nav.has-ind .nav-ind { opacity: 1; }
.nav a { z-index: 1; }
.nav.has-ind a.is-active { background: transparent; border-left-color: transparent; }
.nav.has-ind a:hover:not(.is-active) { background: rgba(255,255,255,.04); }
.nav a.is-active .ic { transform: scale(1.12); }
.nav a.nav-arrive .ic { animation: navPop .55s cubic-bezier(.34,1.56,.64,1); }
@keyframes navPop { 0% { transform: scale(1); } 45% { transform: scale(1.22); } 100% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .nav-ind { transition: none; } .nav a.nav-arrive .ic { animation: none; } }
.pr-week-nav { gap: 6px; }
.pr-week-label { min-width: 150px; text-align: center; font-weight: 700; font-size: 14px; padding: 0 4px; }
.pr-unpaid { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; padding: 10px 12px; border: 1px solid rgba(240,162,58,.45); background: rgba(240,162,58,.08); border-radius: 10px; font-size: 13px; }
.pr-unpaid > b { display: inline-flex; align-items: center; gap: 6px; }
.pr-unpaid > b .ic { width: 16px; height: 16px; color: var(--orange); }
.pr-unpaid a { display: inline-flex; flex-direction: column; padding: 6px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; line-height: 1.25; }
.pr-unpaid a:hover, .pr-unpaid a.is-on { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(255,210,31,.35); }
.pr-unpaid a span { font-weight: 600; }
.pr-unpaid a small { color: var(--muted); }
.pr-settings-link { display: flex; align-items: center; gap: 8px; margin: 16px 0 0; color: var(--muted); font-size: 13px; }
.pr-settings-link .ic { width: 16px; height: 16px; }
.card.narrow-wide { max-width: 980px; }
.pr-scheme-row { grid-template-columns: 32px minmax(140px, 1.3fr) 1fr 1fr 1fr 1fr; }
.pr-pct { position: relative; }
.pr-pct i { position: absolute; right: 10px; bottom: 9px; font-style: normal; color: var(--muted); font-size: 13px; pointer-events: none; }
@media (max-width: 860px) { .pr-scheme-row { grid-template-columns: 32px 1fr; } }
/* Настройки зарплаты: выбор вида премии */
.pr-scheme-row { grid-template-columns: 32px minmax(130px, 1fr) 130px minmax(360px, 2.4fr); align-items: start; padding: 10px 4px; }
.pr-scheme-row > b, .pr-scheme-row > .src-on { padding-top: 8px; }
.pr-inp { position: relative; display: inline-block; }
.pr-inp input { padding-right: 26px !important; }
.pr-inp i { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 13px; pointer-events: none; }
label.pr-inp i { top: auto; bottom: 9px; transform: none; }
.pr-bonus { display: flex; flex-direction: column; gap: 8px; }
.pr-mode { align-self: flex-start; }
.pr-mode > label > span { height: 32px; font-size: 13px; }
.pr-bonus-fields { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 13px; color: var(--ink-2); }
.pr-bonus-fields .pb-fix, .pr-bonus-fields .pb-pct { display: inline-flex; align-items: center; gap: 6px; }
.pr-bonus-fields .pr-inp input { width: 100px; height: 34px; }
.pr-bonus-fields .pr-inp-s input { width: 70px; }
[data-mode="none"] .pb-fix, [data-mode="none"] .pb-pct, [data-mode="fix"] .pb-pct, [data-mode="pct"] .pb-fix { display: none; }
.pb-none { display: none; }
[data-mode="none"] .pb-none { display: inline; }
[data-mode="both"] .pb-pct::before { content: "+"; font-weight: 700; margin-right: 2px; color: var(--muted); }
@media (max-width: 860px) { .pr-scheme-row { grid-template-columns: 32px 1fr; } .pr-scheme-row .pr-bonus, .pr-scheme-row > .pr-inp { grid-column: 2; } }

/* Статьи расходов: добавление строкой */
.cat-add-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 8px; height: 44px; border: 1.5px dashed var(--line-strong, var(--line)); border-radius: 8px; background: transparent; color: var(--ink-2); font: inherit; font-weight: 600; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
.cat-add-btn:hover { border-color: var(--brand); background: rgba(255,214,0,.08); color: var(--ink); }
.cat-add-btn .ic { width: 18px; height: 18px; }
.exp-cat-row.is-new { border-color: var(--brand); animation: catIn .25s ease-out; }
@keyframes catIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Вкладки: полоска-«резинка» ---------- */
.tabs.has-ind { position: relative; }
.tabs.has-ind a.is-active { border-bottom-color: transparent; }
.tab-ind { position: absolute; left: 0; bottom: 0; width: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--brand); pointer-events: none; z-index: 1; }
.tab-arrive { animation: tabArrive .35s cubic-bezier(.2,.7,.2,1) both; }
@keyframes tabArrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tab-arrive { animation: none; } }

.composer-warn { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 8px; padding: 9px 12px; border-radius: 8px; background: #fff4d1; color: #6b5200; font-size: 13px; line-height: 1.4; }
.composer-warn .ic { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.composer-warn-dark-unused { background: rgba(255,210,31,.12); color: #f1d98a; }
.biz-box { margin-top: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2, #f7f8f9); }
.biz-box h3 { margin: 0 0 6px; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.biz-box .steps { margin: 8px 0 0; }
.biz-state { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.biz-box h3 .pill { text-transform: none; letter-spacing: 0; font-weight: 600; }

.raw-json { max-height: 260px; overflow: auto; margin: 8px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--surface-2, #f4f5f7); font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-all; }

/* ---------- Интеграции: магазин приложений ---------- */
.apps-top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 4px 0 6px; }
.apps-top b { font-size: 15px; }
.apps-cat { margin: 18px 0 10px; font-size: 12px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.app-tile { position: relative; display: flex; gap: 14px; align-items: flex-start; padding: 16px 40px 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; color: var(--ink); text-decoration: none; transition: transform .18s cubic-bezier(.2,.7,.2,1), box-shadow .18s, border-color .18s; }
.app-tile:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,.08); border-color: var(--line-strong, var(--line)); }
.app-tile:active { transform: translateY(0) scale(.99); }
.app-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.app-body b { font-size: 15px; line-height: 1.25; }
.app-body small { color: var(--ink-2); font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.app-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; min-width: 0; }
.app-foot em { font-style: normal; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-go { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); transition: transform .18s, color .18s; }
.app-go .ic { width: 18px; height: 18px; }
.app-tile:hover .app-go { color: var(--ink); transform: translate(3px, -50%); }
.app-ic { position: relative; flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; color: #fff; background: linear-gradient(145deg, var(--a1), var(--a2)); box-shadow: 0 4px 12px color-mix(in srgb, var(--a2) 35%, transparent), inset 0 1px 0 rgba(255,255,255,.25); }
.app-ic > .ic { width: 26px; height: 26px; stroke-width: 1.9; }
.app-ic.lg { width: 72px; height: 72px; border-radius: 20px; }
.app-ic.lg > .ic { width: 36px; height: 36px; }
.app-badge { position: absolute; right: -5px; bottom: -5px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); border: 2px solid var(--surface); }
.app-badge .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.app-ic.lg .app-badge { width: 28px; height: 28px; }
.app-ic.lg .app-badge .ic { width: 15px; height: 15px; }
.pill.is-warn { background: #fff1d6; color: #9a6400; }
.apps-log { margin-top: 22px; }

.app-detail-head { margin-bottom: 16px; animation: tabArrive .35s cubic-bezier(.2,.7,.2,1) both; }
.app-back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-weight: 500; margin-bottom: 12px; }
.app-back:hover { color: var(--ink); text-decoration: none; }
.app-back .ic { width: 16px; height: 16px; }
.app-hero { display: flex; align-items: center; gap: 18px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; flex-wrap: wrap; }
.app-hero h2 { margin: 0 0 4px; font-size: 22px; }
.app-hero p { margin: 0; max-width: 560px; }
.app-hero > div:nth-child(2) { flex: 1 1 260px; min-width: 0; }
.app-hero-st { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; margin-left: auto; }
.integr-one { grid-template-columns: minmax(0, 860px); animation: tabArrive .4s .05s cubic-bezier(.2,.7,.2,1) both; }
.integr-one .integr-card > .card-head { display: none; }
.integr-one .integr-card > .hint:first-of-type { margin-top: 0; }
.integr-log { max-width: 860px; }
@media (max-width: 600px) {
  .apps-grid { grid-template-columns: 1fr; }
  .app-ic { width: 46px; height: 46px; border-radius: 13px; }
  .app-hero { padding: 16px; gap: 14px; }
  .app-ic.lg { width: 60px; height: 60px; border-radius: 17px; }
  .app-hero-st { align-items: flex-start; margin-left: 0; }
}

.apps-log-d > summary { cursor: pointer; list-style: none; margin: 0; }
.apps-log-d > summary::-webkit-details-marker { display: none; }
.apps-log-d > summary h2::before { content: '▸'; display: inline-block; margin-right: 8px; color: var(--muted); transition: transform .2s; }
.apps-log-d[open] > summary h2::before { transform: rotate(90deg); }
.apps-log-d[open] > summary { margin-bottom: 12px; }
.app-detail-head { max-width: 860px; }

/* ---------- Сообщения во «Входящих»: оформление ---------- */
.feed-item.msg .fi-body { line-height: 1.5; }
.fi-body a { word-break: break-all; }
.fi-body a.phone { word-break: normal; white-space: nowrap; }
.fi-body.is-long { max-height: 15em; overflow: hidden; position: relative; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.fi-body.is-long.is-open { max-height: none; -webkit-mask-image: none; mask-image: none; }
.msg-more { margin-top: 4px; font-size: 13px; }
.msg-subj { font-weight: 700; margin: 2px 0 6px; font-size: 14.5px; }
.feed-item.msg.is-mail { max-width: min(700px, 96%); }
.msg-quote { margin-top: 8px; font-size: 13px; }
.msg-quote summary { cursor: pointer; color: var(--muted); }
.msg-quote > div { margin-top: 6px; padding: 6px 0 6px 12px; border-left: 3px solid var(--line); color: var(--ink-2); }
.msg-chip { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 6px 10px; border-radius: 8px; background: var(--green-bg); color: var(--green); font-size: 13px; font-weight: 500; }
.msg-chip .ic { width: 15px; height: 15px; }
.msg-chip a { font-weight: 700; }
.msg-sys { display: flex; align-items: center; gap: 8px; align-self: center; color: var(--muted); font-size: 12.5px; padding: 2px 10px; }
.msg-sys .ch-ic { width: 18px; height: 18px; }
.msg-sys .ch-ic .ic { width: 11px; height: 11px; }
.msg-imgs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg-imgs .msg-img { margin: 0; }
.msg-imgs .msg-img img { width: 150px; height: 150px; max-width: none; object-fit: cover; border-radius: 10px; transition: transform .15s; }
.msg-imgs .msg-img:only-child img { width: auto; height: auto; max-width: 280px; max-height: 280px; }
.msg-imgs .msg-img:hover img { transform: scale(1.02); }
.msg-docs { display: grid; gap: 6px; margin-top: 8px; }
.msg-doc { display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); max-width: 420px; transition: border-color .15s, background .15s; }
.msg-doc:hover { text-decoration: none; border-color: var(--line-strong, #c9cdd2); background: var(--surface-2, #f7f8f9); }
.msg-doc > .ic { width: 16px; height: 16px; color: var(--muted); flex: none; margin-left: auto; }
.md-ext { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; background: #868e96; color: #fff; font-size: 10.5px; font-weight: 800; letter-spacing: .02em; }
.msg-doc.k-pdf .md-ext { background: #e03131; }
.msg-doc.k-doc .md-ext { background: #1971c2; }
.msg-doc.k-xls .md-ext { background: #2f9e44; }
.msg-doc.k-art .md-ext { background: #ae3ec9; }
.msg-doc.k-zip .md-ext { background: #e8890c; }
.md-name { display: flex; flex-direction: column; min-width: 0; }
.md-name b { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.md-name small { color: var(--muted); font-size: 12px; }
.feed-item.msg.is-out .msg-doc { background: rgba(255,255,255,.6); }

/* Заявка с сайта — компактно */
.lead-card { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--brand); border-radius: 10px; padding: 7px 12px 8px; max-width: min(620px, 92%); font-size: 13.5px; line-height: 1.45; }
.lead-head { display: flex; align-items: center; gap: 7px; min-width: 0; }
.lead-head .ch-ic { width: 18px; height: 18px; }
.lead-head .ch-ic .ic { width: 11px; height: 11px; }
.lead-head b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.lead-head b span { font-weight: 400; color: var(--ink-2); }
.lead-head small { color: var(--muted); flex: none; }
.lead-order { margin-left: auto; flex: none; display: inline-flex; align-items: center; padding: 1px 3px 1px 8px; border-radius: 999px; background: var(--brand); color: var(--brand-ink); font-weight: 600; font-size: 12px; }
.lead-order:hover { text-decoration: none; filter: brightness(.96); }
.lead-order .ic { width: 13px; height: 13px; }
.lead-fields { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 3px; }
.lead-fields span { min-width: 0; overflow-wrap: anywhere; }
.lead-fields i { font-style: normal; color: var(--muted); }
.lead-msg { margin-top: 3px; }
.lead-foot { margin-top: 3px; color: var(--muted); font-size: 12px; }
.lead-card .msg-imgs .msg-img img { width: 72px; height: 72px; border-radius: 6px; }
.lead-card .msg-imgs .msg-img:only-child img { width: 72px; height: 72px; max-width: none; }
.lead-card .msg-docs { margin-top: 5px; gap: 4px; }
.lead-card .msg-doc { padding: 4px 10px 4px 4px; gap: 8px; border-radius: 7px; max-width: 340px; }
.lead-card .md-ext { width: 28px; height: 28px; border-radius: 5px; font-size: 8.5px; }
.lead-card .md-name b { font-size: 12.5px; }
.lead-card .md-name small { font-size: 11px; }

/* Заказ и переписка на компьютере: левая панель и лента прокручиваются отдельно, страница не прыгает */
@media (min-width: 861px) {
  .deal { height: calc(100vh - 56px); height: calc(100dvh - 56px); min-height: 0; }
  .deal-side { overflow-y: auto; overscroll-behavior: contain; }
  .deal > .feed { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
}
.lead-card .msg-docs { display: flex; flex-wrap: wrap; }
.lead-card .msg-doc { max-width: 260px; }
.lead-card .msg-doc > .ic { display: none; }
.lead-card .msg-imgs { margin-top: 5px; }

/* Срок заказа — правка в карточке */
.dl-wrap { position: relative; }
.dl-btn { display: inline-flex; align-items: center; gap: 6px; padding: 2px 6px; margin: -2px -6px; border: 0; border-radius: 6px; background: none; font: inherit; color: inherit; cursor: pointer; }
.dl-btn > .ic { width: 14px; height: 14px; color: var(--muted); opacity: .6; transition: opacity .15s; }
.dl-btn:hover { background: var(--line-2); }
.dl-btn:hover > .ic, .dl-wrap.is-open .dl-btn > .ic { opacity: 1; }
.fields > div:has(.dl-wrap) { position: relative; }
.dl-wrap { position: static; }
.dl-pop { position: absolute; z-index: 40; top: calc(100% - 2px); left: 0; right: 0; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.14); display: grid; gap: 10px; animation: tabArrive .2s cubic-bezier(.2,.7,.2,1); }
.dl-pop[hidden] { display: none; }
.dl-pop > b { font-size: 13px; }
.dl-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.dl-q { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); text-align: left; font: inherit; font-weight: 600; font-size: 13px; cursor: pointer; transition: border-color .15s, background .15s; }
.dl-q:hover { border-color: var(--brand); background: var(--tint); }
.dl-q small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.dl-custom { display: flex; gap: 6px; }
.dl-custom input { flex: 1; min-width: 0; height: 32px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg); color: var(--ink); font: inherit; font-size: 13px; }
.dl-clear { justify-self: start; font-size: 13px; }

.dl-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.dl-chip { padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; transition: border-color .15s, background .15s; }
.dl-chip:hover { border-color: var(--brand); background: var(--tint); }
.dl-chip.is-cur { background: var(--brand-ink); color: var(--brand); border-color: var(--brand-ink); }
.dl-grp { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: -5px; }
.dl-pop-src { max-height: min(440px, 70vh); overflow-y: auto; }

/* ---------- Ответ клиенту: шаблоны и файлы ---------- */
.rt-bar { display: flex; gap: 6px; align-items: center; overflow-x: auto; scrollbar-width: none; padding: 2px 0 8px; }
.rt-bar::-webkit-scrollbar { display: none; }
.rt-attach { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border: 1px dashed var(--line-strong, #c9cdd2); border-radius: 999px; color: var(--ink-2); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s; }
.rt-attach:hover { border-color: var(--brand); background: var(--tint); color: var(--ink); }
.rt-attach .ic { width: 14px; height: 14px; }
.rt-bar.has-files .rt-attach { border-style: solid; border-color: var(--brand); background: var(--tint); }
.rt-chip { flex: none; height: 28px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap; transition: border-color .15s, background .15s, color .15s, transform .15s; }
.rt-chip:hover { border-color: var(--brand); color: var(--ink); }
.rt-chip.is-used { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); transform: scale(.96); }
.rt-edit { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--muted); }
.rt-edit:hover { background: var(--line-2); color: var(--ink); }
.rt-edit .ic { width: 15px; height: 15px; }
.rt-files { display: flex; flex-wrap: wrap; gap: 6px; }
.rt-files:not(:empty) { margin-bottom: 8px; }
.rt-file { display: inline-flex; align-items: center; gap: 6px; max-width: 280px; padding: 4px 4px 4px 10px; border-radius: 8px; background: var(--surface-2, #f4f5f7); border: 1px solid var(--line); font-size: 12.5px; animation: tabArrive .2s ease-out; }
.rt-file b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.rt-file small { color: var(--muted); flex: none; }
.rt-file button { flex: none; width: 20px; height: 20px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
.rt-file button:hover { background: var(--red-bg); color: var(--red); }
textarea.shake { animation: rtShake .35s; border-color: var(--red) !important; }
@keyframes rtShake { 25% { transform: translateX(-4px); } 50% { transform: translateX(4px); } 75% { transform: translateX(-2px); } }

/* Шаблоны ответов — настройка */
.rtpl-form code[data-ins] { cursor: pointer; }
.rtpl-form code[data-ins]:hover { background: var(--tint); }
.rtpl-list { display: grid; gap: 8px; margin: 12px 0 4px; }
.rtpl-row { display: grid; grid-template-columns: 60px 1fr 32px; gap: 8px; align-items: start; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.rtpl-row.is-new { border-color: var(--brand); animation: catIn .25s ease-out; }
.rtpl-fields { display: grid; gap: 6px; min-width: 0; }
.rtpl-fields input, .rtpl-fields textarea { width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg); color: var(--ink); font: inherit; }
.rtpl-title { font-weight: 600; max-width: 260px; }
@media (max-width: 600px) { .rtpl-row { grid-template-columns: 1fr 32px; } .rtpl-row .stage-move { display: none; } }

/* ---------- «Таблетки»: скользящая подложка ---------- */
.tabs-sub.has-pill { position: relative; }
.tabs-sub.has-pill a { position: relative; z-index: 1; transition: color .25s; }
.tabs-sub.has-pill a.is-active { background: transparent; border-color: transparent; }
.pill-ind { position: absolute; left: 0; top: 0; z-index: 0; border-radius: 999px; background: var(--tint); border: 1px solid var(--tint-line); box-sizing: border-box; pointer-events: none; transition: transform .38s cubic-bezier(.2,.7,.2,1), width .38s cubic-bezier(.2,.7,.2,1), height .38s cubic-bezier(.2,.7,.2,1); }

/* ---------- Система: проверка, копии, памятка ---------- */
.bk-top, .sys-sum { display: flex; align-items: center; gap: 14px; padding: 16px 18px; flex-wrap: wrap; border-left: 4px solid var(--green); }
.bk-top.is-bad, .sys-sum.is-bad { border-left-color: var(--red); }
.sys-sum.is-warn { border-left-color: var(--orange, #e8890c); }
.bk-top > div, .sys-sum > div { display: flex; flex-direction: column; gap: 2px; flex: 1 1 260px; min-width: 0; }
.bk-top b, .sys-sum b { font-size: 16px; }
.bk-ic { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--green-bg); color: var(--green); }
.is-bad .bk-ic { background: var(--red-bg); color: var(--red); }
.is-warn .bk-ic { background: #fff1d6; color: #9a6400; }
.bk-ic .ic { width: 22px; height: 22px; stroke-width: 2.2; }
.bk-make { margin-left: auto; }
.bk-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 16px; align-items: start; margin-top: 16px; }
.bk-side { display: grid; gap: 16px; }
.bk-side .card { margin: 0; }
.bk-side .check { display: flex; margin: 8px 0; }
.bk-kind { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #e7f0ff; color: #1c5fbf; }
.bk-kind.k-files { background: #f3e8ff; color: #7a35b0; }
.bk-act { display: flex; gap: 6px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.bk-act form { margin: 0; }
.bk-help { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; font-size: 13.5px; color: var(--ink-2); line-height: 1.45; }
.bk-warn { display: flex; gap: 6px; color: #8a5300; }
.bk-warn .ic { flex: none; width: 16px; height: 16px; margin-top: 2px; }
.bk-upload { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.sys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 16px; align-items: start; margin-top: 16px; }
.sys-group { margin: 0; }
.sys-group h3 { margin-bottom: 6px; }
.sys-live { margin-top: 16px; border-left: 4px solid var(--brand); }
.sys-row { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line-2); }
.sys-row:last-child { border-bottom: 0; }
.sys-ic { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; margin-top: 1px; background: var(--green-bg); color: var(--green); }
.sys-ic .ic { width: 13px; height: 13px; stroke-width: 2.6; }
.st-warn .sys-ic { background: #fff1d6; color: #9a6400; }
.st-bad .sys-ic { background: var(--red-bg); color: var(--red); }
.st-off .sys-ic { background: var(--line-2); color: var(--muted); }
.sys-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; font-size: 13.5px; }
.sys-txt b { font-weight: 600; }
.sys-txt span { color: var(--ink-2); overflow-wrap: anywhere; }
.sys-txt small { color: #8a5300; margin-top: 2px; line-height: 1.4; }
.st-bad .sys-txt small { color: var(--red); }
.st-off .sys-txt span, .st-off .sys-txt b { color: var(--muted); }
.guide { display: grid; gap: 12px; max-width: 860px; }
.guide .card { margin: 0; }
.guide-lead { display: flex; flex-direction: column; gap: 4px; border-left: 4px solid var(--brand); }
.guide-lead b { font-size: 17px; }
.guide-step h3 { display: flex; align-items: center; gap: 10px; text-transform: none; letter-spacing: 0; font-size: 16px; color: var(--ink); }
.guide-n { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: var(--brand-ink); font-weight: 800; font-size: 14px; }
.guide-step ul { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; line-height: 1.5; }
@media (max-width: 900px) { .bk-grid { grid-template-columns: 1fr; } .sys-grid { grid-template-columns: 1fr; } .bk-make { margin-left: 0; } }
@media print {
  .sidebar, .topbar, .tabs, .page-actions, .mnav, .bottom-nav { display: none !important; }
  .guide .card { break-inside: avoid; box-shadow: none; border: 1px solid #ccc; }
  .content { padding: 0 !important; margin: 0 !important; }
}
.bk-grid .table-card > .card-head { padding: 14px 18px 10px; margin: 0; }

/* ---------- Юзабилити 2.6: телефон ---------- */
@media (max-width: 860px) {
  /* iPhone не приближает страницу при вводе, если шрифт поля не меньше 16px */
  input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea, .dd-btn { font-size: 16px !important; }
  /* Пальцем удобно попадать: 44px */
  .topbar .icon-btn, .topbar .btn, .topbar .btn-accent, .burger { min-height: 44px; min-width: 44px; }
  .search input { height: 44px; }
  .tabs a { padding-top: 12px; padding-bottom: 12px; }
  .tabs-sub a, .chip-btn, .pos-cats button, .seg > a, .seg > label > span, .rt-chip, .rt-attach, .dl-chip { min-height: 44px; display: inline-flex; align-items: center; }
  .btn, .btn-sm { min-height: 44px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  .filters select, .filters input, .page-head select, .page-head input { min-height: 44px; }
}

/* Смена этапа: крупнее полоски и «Отменить» */
.pipeline-bar { gap: 4px; }
.pipeline-bar button { height: 14px; border-radius: 4px; }
.pipeline-bar button.is-current { box-shadow: 0 0 0 2px #fff; }
@media (max-width: 860px) { .pipeline-bar button { height: 22px; } }
.stage-undo { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 16px; background: #2a2a2a; color: #eee; border-top: 1px solid #3a3a3a; animation: flashIn .35s var(--ease); }
.stage-undo > span { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.stage-undo small { color: #bbb; width: 100%; }
.stage-undo .btn { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }

/* Верхний поиск: подсказки */
.search { position: relative; }
.gs-key { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--muted); font: 600 11px/1 var(--font); pointer-events: none; }
.search input:focus ~ .gs-key, .search input:not(:placeholder-shown) ~ .gs-key { display: none; }
.gs-drop { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(0,0,0,.14); padding: 6px; max-height: 70vh; overflow-y: auto; animation: clsug .18s var(--ease); }
.gs-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); }
.gs-item:hover, .gs-item.is-act { background: var(--tint); text-decoration: none; }
.gs-item i { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--line-2); color: var(--ink-2); font-style: normal; font-weight: 700; font-size: 13px; }
.gs-item.k-order i { border-radius: 8px; background: var(--brand); color: var(--brand-ink); }
.gs-item span { display: flex; flex-direction: column; min-width: 0; }
.gs-item b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-all { display: block; padding: 8px 10px; font-weight: 600; font-size: 13px; border-top: 1px solid var(--line-2); margin-top: 4px; }
.gs-empty { padding: 12px; color: var(--muted); text-align: center; }
@media (max-width: 860px) { .gs-drop { position: fixed; left: 8px; right: 8px; top: 60px; } }

/* Переписка на телефоне: сначала шапка (с кем говорим), потом сообщения, потом карточка */
@media (max-width: 860px) {
  .deal.is-chat .deal-side { display: contents; }
  .deal.is-chat .deal-top { order: -2; position: sticky; top: 56px; z-index: 20; }
  .deal.is-chat .feed { order: -1; min-height: 50vh; }
  .deal.is-chat .deal-side > :not(.deal-top) { background: var(--surface); }
  .deal.is-chat .deal-side > .fields { border-top: 1px solid var(--line); }
  .chat-mk { display: inline-flex !important; align-items: center; gap: 4px; margin-left: 6px; background: var(--brand); color: var(--brand-ink); border-color: var(--brand); white-space: nowrap; }
  .deal.is-chat .deal-top .deal-title h1 { font-size: 17px; }
}

/* Сдача */
.change-calc { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 8px 0; padding: 8px 10px; border: 1px dashed var(--line-strong, #c9ced2); border-radius: 10px; font-size: 13.5px; }
.change-calc[hidden] { display: none; }
.change-calc label { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.change-calc label .ic { width: 16px; height: 16px; color: var(--muted); }
.change-calc input { width: 96px; height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--input-bg); text-align: right; font-weight: 600; }
.change-calc i { font-style: normal; color: var(--muted); }
.change-calc output { font-size: 14px; }
.change-calc.is-ok { border-style: solid; border-color: var(--green-line, #c6e9cd); background: var(--green-bg); }
.change-calc.is-ok output b { color: var(--green); font-size: 18px; }
.change-calc.is-short { border-style: solid; border-color: var(--red-line, #f6caca); background: var(--red-bg); }
.change-calc.is-short output b { color: var(--red); }

/* Рабочий стол: главное — заметнее, остальное — спокойнее */
.stats { grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); }
.stat { background: var(--surface); color: var(--ink); border: 1px solid var(--line); min-width: 0; }
.stat-label { color: var(--muted); }
.stat b { color: var(--ink); font-size: clamp(18px, 1.55vw, 28px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat small { color: var(--muted); }
.stat b.debt { color: var(--red); }
.stat b.stat-off { color: var(--muted); }
.stat:hover { border-color: var(--line-strong, #c9ced2); background: var(--line-2); }
.stat.is-key:hover { background: #262626; border-color: #262626; }
.stat.is-hot:hover { background: #4a1714; border-color: #4a1714; }
.stat.is-key { background: var(--side); border-color: var(--side); }
.stat.is-key .stat-label, .stat.is-key small { color: #a3a3a3; }
.stat.is-key b { color: var(--brand); }
.stat.is-hot { background: #3a1210; border-color: #3a1210; }
.stat.is-hot .stat-label, .stat.is-hot small { color: #e7b5b2; }
.stat.is-hot b, .stat.is-hot b.debt { color: #ff8a84; }
:root[data-theme="dark"] .stat { background: var(--surface); }

/* Переключатель вкл/выкл (сохраняется без перезагрузки) */
.tgl { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; min-height: 44px; user-select: none; position: relative; }
.tgl input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tgl-track { position: relative; width: 40px; height: 24px; border-radius: 999px; background: var(--line-strong, #c9c9c9); flex: none; transition: background .25s; }
.tgl-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .25s cubic-bezier(.2,.7,.2,1); }
.tgl input:checked + .tgl-track { background: var(--green); }
.tgl input:checked + .tgl-track::after { transform: translateX(16px); }
.tgl input:focus-visible + .tgl-track { outline: 2px solid var(--brand); outline-offset: 2px; }
.tgl.is-busy { opacity: .6; pointer-events: none; }
.tgl-done { font-size: 12px; color: var(--green); opacity: 0; transition: opacity .3s; }
.tgl-done.is-shown { opacity: 1; }
.tgl-done.is-err { color: var(--red); }
form[data-ajax-toggle] { margin: 0; }

/* Все галочки в CRM выглядят как переключатели */
input[type=checkbox]:not(.tgl input):not(.chip-check input):not(.switch-row input) {
  -webkit-appearance: none; appearance: none; margin: 0; flex: none; cursor: pointer;
  position: relative; width: 36px; height: 22px; border-radius: 999px; border: 0;
  background: var(--line-strong, #c9c9c9); transition: background .25s; vertical-align: middle;
}
input[type=checkbox]:not(.tgl input):not(.chip-check input):not(.switch-row input)::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .25s cubic-bezier(.2,.7,.2,1);
}
input[type=checkbox]:not(.tgl input):not(.chip-check input):not(.switch-row input):checked { background: var(--green); }
input[type=checkbox]:not(.tgl input):not(.chip-check input):not(.switch-row input):checked::after { transform: translateX(14px); }
input[type=checkbox]:not(.tgl input):not(.chip-check input):not(.switch-row input):focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
input[type=checkbox]:not(.tgl input):not(.chip-check input):not(.switch-row input):disabled { opacity: .5; cursor: default; }
.check { gap: 10px; }

/* ===== Аналитика ===== */
.an-title { margin: 4px 0 14px; font-weight: 600; font-size: 15px; }
.an-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.an-tile { display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.an-tile > span { font-size: 13px; color: var(--muted); }
.an-tile b { font-size: clamp(20px, 1.75vw, 26px); line-height: 1.2; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-tile b.neg { color: var(--red); }
.an-tile small { font-size: 12px; color: var(--muted); }
.an-tile.is-main { background: var(--side); border-color: var(--side); color: #fff; }
.an-tile.is-main > span { color: #b5b5b5; }
.an-tile.is-main b { color: var(--brand); }
.an-delta { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.an-delta.up { color: var(--green); }
.an-delta.down { color: var(--red); }
.an-tile.is-main .an-delta.up { color: #6fdc8c; }
.an-tile.is-main .an-delta.down { color: #ff8f8a; }
.an-now-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.an-now-grid > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 8px; background: var(--tint-2, #f6f4ee); border: 1px solid var(--line); }
.an-now-grid b { font-size: 20px; font-variant-numeric: tabular-nums; }
.an-now-grid span { font-size: 12.5px; color: var(--muted); }
.an-now-grid .is-bad b { color: var(--red); }
.an-now-grid .is-warn b { color: var(--orange); }
.an-staff { display: grid; gap: 8px; }
.an-staff > div { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 14px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line-2, var(--line)); font-size: 14px; }
.an-staff > div:last-child { border-bottom: 0; }
.an-staff span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.an-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 150px; align-items: end; }
.an-week > div { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.an-week i { display: block; width: 100%; max-width: 54px; height: var(--h); min-height: 2px; background: var(--brand); border-radius: 4px 4px 0 0; animation: colin .6s var(--ease) both; transform-origin: bottom; }
.an-week b { font-size: 12px; }
.an-week span { font-size: 12px; color: var(--muted); }
@media (max-width: 720px) {
  .an-kpi { grid-template-columns: 1fr 1fr; gap: 8px; }
  .an-tile { padding: 12px; }
  .an-tile b { font-size: 21px; }
  .an-tile.is-main, .an-tile:last-child { grid-column: 1 / -1; }
  .an-tile.is-main b { font-size: 30px; }
  .an-now-grid { grid-template-columns: 1fr 1fr; }
  .an-staff > div { grid-template-columns: 1fr; }
}
/* Страница по ссылке из мессенджера */
.an-public { background: var(--bg); margin: 0; }
.an-top { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--side); color: #fff; position: sticky; top: 0; z-index: 5; }
.an-top .brand-mark { width: 36px; height: 36px; font-size: 14px; }
.an-top > div { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.an-top small { color: #b5b5b5; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.an-top .btn { margin-left: auto; flex: none; }
.an-main { max-width: 1100px; margin: 0 auto; padding: 16px; }
/* Настройки → Аналитика */
.an-wrap { max-width: 820px; }
.an-help { margin: 0 0 14px; }
.an-rcp.is-off { opacity: .7; }
.an-rcp-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.an-rcp-head h3 { margin: 0; }
.an-rcp-status { margin: 4px 0 12px; font-size: 13px; }
.an-rcp-status .ic { width: 15px; height: 15px; vertical-align: -2px; }
.an-ch { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 14px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.an-ch > .check { min-height: 32px; }
.an-ch-body { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-width: 0; }
.an-ch-body .copy-row, .an-ch-body .an-phone { align-self: stretch; }
.an-ch-body .paid .ic { width: 16px; height: 16px; vertical-align: -3px; }
.an-phone { max-width: 260px; }
.copy-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.copy-row input { flex: 1 1 220px; min-width: 0; font-size: 13px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; font: inherit; text-decoration: underline; }
.an-when { border-top: 1px solid var(--line); padding-top: 12px; }
.an-rcp-actions { flex-wrap: wrap; justify-content: flex-start; }
@media (max-width: 720px) { .an-ch { grid-template-columns: 1fr; } .an-rcp-actions .btn { flex: 1 1 auto; } }
.an-days[hidden] { display: none; }
.an-days .chips { margin-top: 2px; }
.an-days .chip-check span { font-size: 14px; padding: 7px 14px; min-width: 46px; text-align: center; }
.an-days .chip-check input:checked + span { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }

/* ===== Настройки: меню разделов слева + поиск ===== */
.set-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
.set-body { min-width: 0; }
.set-nav { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; overscroll-behavior: contain; }
.set-nav .set-group h4 { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 12px 10px 4px; font-weight: 700; }
.set-nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink); font-size: 14px; text-decoration: none !important; position: relative; transition: background .2s; }
.set-nav a .ic { width: 18px; height: 18px; color: var(--muted); flex: none; }
.set-nav a:hover { background: var(--line-2); }
.set-nav a.is-active { background: var(--tint, #fff7d1); font-weight: 600; }
.set-nav a.is-active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 3px 3px 0; background: var(--brand); }
.set-nav a.is-active .ic { color: var(--ink); }
.set-search { position: relative; }
.set-search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.set-search input { width: 100%; height: 36px; padding: 0 10px 0 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-size: 14px; }
.set-search.big { max-width: 560px; margin: 0 0 22px; }
.set-search.big input { height: 46px; padding-left: 42px; font-size: 15px; border-radius: 10px; background: var(--surface); }
.set-search.big .ic { left: 14px; width: 20px; height: 20px; }
.set-nav .set-search { margin-bottom: 4px; }
.set-nav .set-empty { padding: 8px 10px; font-size: 13px; margin: 0; }
.set-back { display: none; }
.set-hit { background: var(--tint, #fff7d1); }
/* Главная страница настроек */
.set-home-title { margin: 0 0 14px; font-size: 26px; }
.set-home-groups { columns: 2 360px; column-gap: 20px; max-width: 1100px; }
.set-home .set-group { break-inside: avoid; margin-bottom: 18px; }
.set-home .set-group h4 { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 4px 8px; font-weight: 700; }
.set-list { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.set-list a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line); color: var(--ink); text-decoration: none !important; transition: background .2s; }
.set-list a:first-child { border-top: 0; }
.set-list a:hover { background: var(--line-2); }
.set-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; flex: none; }
.set-ico .ic { width: 19px; height: 19px; color: var(--brand-ink); }
.set-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.set-txt b { font-size: 15px; font-weight: 600; }
.set-txt small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.set-chev { width: 16px; height: 16px; color: var(--muted); flex: none; }
.set-home .set-empty { margin: 8px 4px; }
[data-words][hidden], .set-group[hidden] { display: none !important; }
@media (max-width: 900px) {
  .set-layout { display: block; }
  .set-nav { display: none; }
  .set-back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; margin: 0 0 6px; min-height: 36px; }
  .set-back .ic { width: 18px; height: 18px; }
  .set-home-groups { columns: 1; }
}

/* ===== Настройки → Оборудование: карточки по группам ===== */
.eq-sum { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 20px; }
.eq-sum > div { display: flex; align-items: baseline; gap: 8px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.eq-sum b { font-size: 20px; font-variant-numeric: tabular-nums; }
.eq-sum span { font-size: 13px; color: var(--muted); }
.eq-sum .is-warn b { color: var(--orange); }
.eq-sum .is-muted b { color: var(--muted); }
.eq-group { margin-bottom: 26px; }
.eq-gh { display: flex; align-items: center; gap: 10px; font-size: 16px; margin: 0 0 12px; }
.eq-gh small { font-size: 13px; color: var(--muted); font-weight: 500; }
.eq-gi { width: 30px; height: 30px; border-radius: 8px; background: var(--brand); display: grid; place-items: center; }
.eq-gi .ic { width: 17px; height: 17px; color: var(--brand-ink); }
.eq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; align-items: start; }
.eq-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; transition: opacity .25s, border-color .25s, box-shadow .25s; scroll-margin-top: 80px; }
.eq-card:hover { border-color: var(--line-strong, #d5d2c8); }
.eq-card:target { box-shadow: 0 0 0 2px var(--brand); }
.eq-card.is-off { opacity: .55; }
.eq-card.is-bad { border-left: 4px solid var(--red); }
.eq-card.is-warn { border-left: 4px solid var(--orange); }
.eq-top { display: flex; align-items: flex-start; gap: 10px; }
.eq-ico { width: 38px; height: 38px; flex: none; border-radius: 10px; background: var(--tint-2, #f6f4ee); border: 1px solid var(--line); display: grid; place-items: center; }
.eq-ico .ic { width: 20px; height: 20px; color: var(--ink-2); }
.eq-name { flex: 1; min-width: 0; margin: 0; font-size: 15px; font-weight: 600; line-height: 1.3; text-transform: none; letter-spacing: 0; color: var(--ink); padding-top: 2px; word-break: break-word; }
.eq-top form { flex: none; }
.eq-top .tgl { min-height: 32px; }
.eq-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.eq-meta form { margin: 0; }
.eq-q { min-height: 30px; font-size: 13px; }
.eq-q .tgl-track { width: 34px; height: 20px; }
.eq-q .tgl-track::after { width: 14px; height: 14px; }
.eq-q input:checked + .tgl-track::after { transform: translateX(14px); }
.eq-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); padding: 3px 9px; border-radius: 999px; background: var(--tint-2, #f6f4ee); border: 1px solid var(--line); }
.eq-chip .ic { width: 14px; height: 14px; }
.eq-chip.is-bad { color: var(--red); border-color: rgba(207,47,42,.3); background: rgba(207,47,42,.07); }
.eq-chip.is-warn { color: var(--orange); border-color: rgba(168,90,0,.3); background: rgba(168,90,0,.07); }
.eq-note { margin: 0; font-size: 13px; color: var(--muted); }
.eq-edit { border-top: 1px dashed var(--line); padding-top: 8px; }
.eq-edit > summary, .eq-new > summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; color: var(--ink-2); padding: 4px 0; user-select: none; }
.eq-edit > summary::-webkit-details-marker, .eq-new > summary::-webkit-details-marker { display: none; }
.eq-edit > summary .ic, .eq-new > summary .ic { width: 15px; height: 15px; }
.eq-edit > summary:hover { color: var(--ink); }
.eq-edit[open] > summary { color: var(--ink); font-weight: 600; }
.eq-form { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.eq-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.eq-seg { display: flex; flex-wrap: wrap; width: 100%; }
.eq-seg label { flex: 1 1 auto; }
.eq-seg label > span { justify-content: center; width: 100%; height: 32px; font-size: 13px; padding: 0 8px; }
.eq-actions { display: flex; align-items: center; gap: 6px; }
.eq-move { display: inline-flex; gap: 2px; margin-left: auto; }
.eq-move .icon-btn:disabled { opacity: .3; cursor: default; }
.eq-new { border-style: dashed; background: transparent; justify-content: center; min-height: 64px; }
.eq-new > summary { justify-content: center; width: 100%; color: var(--muted); font-weight: 500; }
.eq-new[open] { background: var(--surface); border-style: solid; }
.eq-new[open] > summary { justify-content: flex-start; color: var(--ink); font-weight: 600; }
@media (max-width: 720px) {
  .eq-grid { grid-template-columns: 1fr; }
  .eq-two { grid-template-columns: 1fr; }
  .eq-sum > div { flex: 1 1 40%; }
}
/* Оборудование: «Изменить» подсвечивается как кнопки, плитка «Добавить» — в рост карточки */
.eq-edit > summary { padding: 6px 10px; margin-left: -10px; border-radius: var(--radius); transition: background .2s, color .2s; }
.eq-edit > summary:hover { background: var(--line-2); color: var(--ink); }
.eq-new { align-self: stretch; min-height: 150px; transition: background .2s, border-color .2s; }
.eq-new:not([open]) { padding: 0; }
.eq-new:not([open]) > summary { height: 100%; min-height: 148px; padding: 14px; border-radius: 12px; }
.eq-new:not([open]):hover { background: var(--line-2); border-color: var(--line-strong, #d5d2c8); }
.eq-new:not([open]):hover > summary { color: var(--ink); }

/* ===== Текстовые действия (ссылки-кнопки «Изменить», «Добавить», «← Назад», «Ещё»…) — везде одинаковая серая подсветка при наведении ===== */
:where(.link, .link-btn) { border-radius: 6px; padding: 3px 8px; margin: -3px -8px; }
:where(.app-back, .set-back) { border-radius: 6px; padding: 4px 8px; margin-left: -8px; }
:where(.add-inline, .more, .add-task, .pos-more, .pay-more, .ver-main, .pub-diff) > summary {
  width: fit-content; border-radius: 6px; padding: 3px 8px; margin-left: -8px;
}
.link, .link-btn, .app-back, .set-back, .add-inline > summary, .more > summary, .add-task > summary, .pos-more > summary, .pay-more > summary, .ver-main > summary, .pub-diff > summary, .eq-edit > summary {
  text-decoration: none !important; transition: background .2s, color .2s;
}
.link:hover, .link-btn:hover, .app-back:hover, .set-back:hover,
.add-inline > summary:hover, .more > summary:hover, .add-task > summary:hover, .pos-more > summary:hover, .pay-more > summary:hover, .ver-main > summary:hover, .pub-diff > summary:hover, .eq-edit > summary:hover {
  background: var(--line-2); text-decoration: none !important;
}
.link.danger:hover { color: var(--red); }
.link:disabled, .link-btn:disabled { background: none; cursor: default; }

/* Канал сообщения подписан словами: «Telegram», «MAX», «Почта»… */
.ch-name { font-size: 11px; font-weight: 600; letter-spacing: .02em; padding: 1px 7px; border-radius: 999px; color: var(--ch); background: color-mix(in srgb, var(--ch) 13%, transparent); white-space: nowrap; }
/* Новое сообщение «выплывает» в ленту и пару секунд подсвечено */
@keyframes feed-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes feed-glow { 0% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 70%, transparent); } 100% { box-shadow: 0 0 0 3px transparent; } }
.feed-item.is-new { animation: feed-in .45s cubic-bezier(.2,.7,.2,1) both, feed-glow 3s ease-out .45s; border-radius: var(--radius); }

/* Заявка с сайта: телефон и почта — кнопки с меню действий */
.lead-contact { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 2px 6px; margin: -2px -6px; border-radius: 6px; color: var(--blue); font: inherit; cursor: pointer; transition: background .2s; }
.lead-contact .ic { width: 14px; height: 14px; }
.lead-contact:hover { background: var(--line-2); }
.lc-pop { position: fixed; z-index: 120; min-width: 240px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: 6px; display: flex; flex-direction: column; animation: feed-in .18s ease-out both; }
.lc-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 7px; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; }
.lc-item:hover { background: var(--line-2); }
@keyframes form-flash { 0% { box-shadow: 0 0 0 3px var(--brand); } 100% { box-shadow: 0 0 0 3px transparent; } }
form.is-flash { animation: form-flash 1.6s ease-out; border-radius: var(--radius); }
.lc-item small { color: var(--muted); font-size: 12px; margin-left: 4px; }
.mz-hooks { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--tint-2, #f6f4ee); display: grid; gap: 6px; justify-items: start; }
.mz-hooks.is-ok { background: color-mix(in srgb, var(--green) 7%, transparent); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.mz-hooks > b { display: inline-flex; align-items: center; gap: 6px; }
.mz-hooks > b .ic { width: 16px; height: 16px; }
.mz-hooks .hint { margin: 0; }
.mz-admin { width: 100%; }
.mz-admin > summary { cursor: pointer; font-size: 13px; color: var(--blue); list-style: none; width: fit-content; border-radius: 6px; padding: 3px 8px; margin-left: -8px; transition: background .2s; }
.mz-admin > summary::-webkit-details-marker { display: none; }
.mz-admin > summary:hover { background: var(--line-2); }
.mz-admin .form-grid { margin-top: 8px; }
.mz-diag { border: 1px dashed var(--line-strong, var(--line)); border-radius: 10px; padding: 10px 14px; display: grid; gap: 8px; }
.mz-diag > summary { cursor: pointer; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; list-style: none; }
.mz-diag > summary::-webkit-details-marker { display: none; }
.mz-diag > summary .ic { width: 16px; height: 16px; color: var(--orange); }
.mz-diag-res { display: grid; grid-template-columns: minmax(160px, 240px) 1fr; gap: 6px 14px; margin: 6px 0 0; font-size: 13px; }
.mz-diag-res dt { font-weight: 600; }
.mz-diag-res dd { margin: 0; min-width: 0; }
.mz-diag-res code { white-space: pre-wrap; word-break: break-word; font-size: 12px; }
@media (max-width: 720px) { .mz-diag-res { grid-template-columns: 1fr; } }
/* Неразобранное: пояснение отделено от формы */
.unsorted-note { margin: 0 0 14px; padding: 10px 12px; border-radius: 8px; background: color-mix(in srgb, var(--orange) 9%, var(--surface)); border-left: 3px solid var(--orange); font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.unsorted-form { padding-top: 12px; border-top: 1px dashed var(--line-strong, var(--line)); }

/* ===== Пояснения (p.hint) везде — отдельной плашкой с полоской слева, чтобы не сливались с полями и заголовками ===== */
p.hint {
  margin: 4px 0 12px; padding: 9px 12px; border-radius: 8px; font-size: 13px; line-height: 1.45; color: var(--ink-2);
  background: color-mix(in srgb, var(--blue) 6%, var(--surface)); border-left: 3px solid color-mix(in srgb, var(--blue) 55%, transparent);
}
p.hint:last-child { margin-bottom: 0; }
p.hint .ic { width: 15px; height: 15px; vertical-align: -3px; }
p.hint a { font-weight: 500; }
/* Предупреждения — оранжевым, как в «Неразобранном» */
p.hint.bk-warn, p.hint.is-warn, .unsorted-note { background: color-mix(in srgb, var(--orange) 9%, var(--surface)); border-left-color: var(--orange); }
/* Внутри всплывающих окошек и узких мест — без плашки */
.dl-pop p.hint, .lc-pop p.hint, .toast p.hint, .empty p.hint, .tgl p.hint { background: none; border: 0; padding: 0; margin: 0; font-size: 12px; color: var(--muted); }
/* Заполненные поля интеграций — серые и неактивные, пока по ним не нажмут */
input[data-unlock][readonly] { background: var(--line-2); color: var(--ink-2); cursor: pointer; border-color: var(--line); box-shadow: none; }
input[data-unlock][readonly]:focus { outline: none; box-shadow: none; border-color: var(--line-strong, var(--line)); }

/* ===== Карточка заказа в воронке: номер и срок → клиент → состав → деньги и исполнитель ===== */
.bcard { gap: 5px; padding: 10px 12px 10px 13px; border-radius: 8px; border-left: 4px solid var(--line); }
.bcard.pay-unpaid { border-left-color: var(--red); }
.bcard.pay-part { border-left-color: var(--orange, #f0a23a); }
.bcard.pay-paid { border-left-color: #2ea05a; }
.bcard-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; min-height: 20px; }
.bcard-no { font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.bcard-dl { font-size: 11.5px; font-weight: 600; padding: 3px 7px; border-radius: 6px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.bcard-dl.is-today { background: rgba(240,162,58,.18); color: #a86400; }
.bcard-dl.is-late { background: rgba(229,64,59,.12); color: var(--red); }
.bcard-client { font-weight: 650; font-size: 15px; line-height: 1.25; color: var(--ink); overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bcard-client.is-none { color: var(--muted); font-weight: 500; font-style: italic; }
.bcard-items { font-size: 13px; color: var(--ink-2); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bcard > .task-dot { font-size: 12px; display: inline-flex; align-items: center; gap: 3px; }
.bcard > .task-dot .ic { width: 13px; height: 13px; }
.bcard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 3px; padding-top: 7px; border-top: 1px solid var(--line-2); font-size: 12px; }
.bcard-sum { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.bcard-sum b { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bcard-foot > .bcard-user { margin-left: auto; flex: none; display: inline-flex; align-items: center; }
.bcard-user.is-none { color: var(--muted); font-style: italic; }
.pay-pill { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; line-height: 1; padding: 4px 8px; border-radius: 999px; white-space: nowrap; }
.pay-pill .ic { width: 12px; height: 12px; }
.pay-pill.is-paid { color: #1f8a4c; background: rgba(46,160,90,.13); }
.pay-pill.is-unpaid { color: var(--red); background: rgba(229,64,59,.12); }
.pay-pill.is-part { color: #b8670e; background: rgba(240,162,58,.18); }
:root[data-theme="dark"] .pay-pill.is-paid { color: #5fd38d; }
:root[data-theme="dark"] .bcard-dl.is-today, :root[data-theme="dark"] .pay-pill.is-part { color: #f3b35c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pay-pill.is-paid { color: #5fd38d; } :root:not([data-theme="light"]) .bcard-dl.is-today, :root:not([data-theme="light"]) .pay-pill.is-part { color: #f3b35c; } }
.bcard-dl { display: inline-flex; align-items: center; gap: 3px; }
.bcard-dl .ic { width: 12px; height: 12px; flex: none; }
.bcard-user .avatar { width: 24px; height: 24px; font-size: 11px; line-height: 24px; }

/* ===== Визитка ответственного в воронке ===== */
.bcard-user[data-ucard] { border-radius: 50%; transition: box-shadow .2s; }
.bcard-user[data-ucard]:hover .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--brand); }
.ucard-pop { position: fixed; z-index: 1500; width: 270px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  box-shadow: 0 18px 40px -14px rgba(0,0,0,.3); pointer-events: none; opacity: 0; transform: translateY(-4px); transition: opacity .16s, transform .16s; font-size: 13px; }
.ucard-pop.on { opacity: 1; transform: none; }
.ucard-pop.is-up { transform: translateY(4px); } .ucard-pop.is-up.on { transform: none; }
.ucard-pop::before { content: ""; position: absolute; left: var(--arrow, 20px); top: -6px; width: 10px; height: 10px; transform: rotate(45deg); background: var(--surface); border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.ucard-pop.is-up::before { top: auto; bottom: -6px; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ucard-pop.is-busy { opacity: .6; pointer-events: none; }
.uc-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.uc-head b, .uc-row b { display: block; font-weight: 650; }
.uc-head small, .uc-row small { color: var(--muted); font-size: 12px; }
.avatar.av-lg { width: 40px; height: 40px; font-size: 16px; background: var(--brand); color: var(--brand-ink); }
.uc-stats { display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.uc-stats span { background: var(--line-2); border-radius: 6px; padding: 3px 8px; color: var(--ink-2); }
.uc-stats .is-late { background: rgba(229,64,59,.12); color: var(--red); }
.uc-stats .is-ok { background: rgba(46,160,90,.12); color: #1f8a4c; }
.uc-act { display: flex; gap: 6px; }
.uc-btn { flex: 1; display: inline-flex; align-items: center; justify-content: center; height: 32px; padding: 0 10px; border: 0; border-radius: 8px; background: var(--line-2); color: var(--ink);
  font: 600 12.5px var(--font); cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .15s; }
.uc-btn:hover { background: var(--line); }
.uc-btn.is-main { background: var(--brand); color: var(--brand-ink); }
.uc-empty { color: var(--muted); }
.uc-title { display: flex; align-items: center; gap: 6px; font-weight: 650; margin: -2px 0 8px; }
.uc-back { width: 26px; height: 26px; border: 0; border-radius: 6px; background: none; font-size: 20px; line-height: 1; cursor: pointer; color: var(--ink-2); }
.uc-back:hover { background: var(--line-2); }
.uc-list { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow: auto; margin: 0 -6px; }
.uc-row { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px; border: 0; border-radius: 8px; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.uc-row:hover:not(:disabled) { background: var(--line-2); }
.uc-row .avatar { width: 30px; height: 30px; font-size: 13px; }
.uc-row > span:not(.avatar) { flex: 1; min-width: 0; }
.uc-row .avatar, .uc-head .avatar { flex: none; }
.uc-row i { font-style: normal; color: var(--muted); font-weight: 400; }
.uc-row em { font-style: normal; font-size: 11px; color: var(--muted); }
.uc-row.is-cur { cursor: default; opacity: .7; }
.uc-row.is-clear b { color: var(--red); font-weight: 500; }
.bcard.is-flash { animation: bcardFlash 1.2s var(--ease); }
@keyframes bcardFlash { 0% { box-shadow: 0 0 0 3px var(--brand); } 100% { box-shadow: 0 0 0 3px transparent; } }

/* ===== Подсказки при наведении — вместо системных ===== */
.crm-tip { position: fixed; z-index: 3000; max-width: 280px; padding: 6px 10px; border-radius: 8px; background: #1b1b1b; color: #fff; font-size: 12.5px; line-height: 1.35;
  pointer-events: none; opacity: 0; transform: translateY(-3px); transition: opacity .14s, transform .14s; box-shadow: 0 8px 20px -8px rgba(0,0,0,.45); }
.crm-tip.on { opacity: 1; transform: none; }
.crm-tip.is-up { transform: translateY(3px); } .crm-tip.is-up.on { transform: none; }
.crm-tip::before { content: ""; position: absolute; left: var(--arrow, 10px); top: -4px; width: 9px; height: 9px; transform: rotate(45deg); background: inherit; border-radius: 1px; }
.crm-tip.is-up::before { top: auto; bottom: -4px; }
.crm-tip small { display: block; color: #a9a9a9; font-size: 11.5px; }
:root[data-theme="dark"] .crm-tip { background: #f2f2f2; color: #141414; } :root[data-theme="dark"] .crm-tip small { color: #666; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .crm-tip { background: #f2f2f2; color: #141414; } :root:not([data-theme="light"]) .crm-tip small { color: #666; } }

/* «Выдано за неделю»: оплаченные — бледнее, должники — в полную силу */
.board-col.is-closed .bcard.pay-paid, .board-col.is-closed .bcard:not([class*="pay-"]) { opacity: .62; transition: opacity .2s, transform .3s var(--ease), box-shadow .3s var(--ease); }
.board-col.is-closed .bcard.pay-paid:hover, .board-col.is-closed .bcard:not([class*="pay-"]):hover { opacity: 1; }
.board-debt { display: inline-block; margin-top: 4px; font-size: 11.5px; font-weight: 600; color: var(--red); background: rgba(229,64,59,.1); padding: 2px 8px; border-radius: 99px; }

/* ===== Фильтры: выбранное значение — жёлтым, крестик внутри вместо «Сбросить» ===== */
.dd-x { display: none; position: absolute; right: 7px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border: 0; border-radius: 50%; padding: 0;
  background: rgba(0,0,0,.08); color: var(--brand-ink); cursor: pointer; place-items: center; transition: background .15s; z-index: 1; }
.dd-x svg, .srch-x svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.dd-x:hover { background: rgba(0,0,0,.18); }
.dd.is-set .dd-x { display: grid; }
.dd.is-set .dd-btn { background: color-mix(in srgb, var(--brand) 22%, var(--surface)); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; padding-right: 36px; }
.dd.is-set .dd-btn svg { display: none; }
:root[data-theme="dark"] .dd.is-set .dd-btn { color: var(--ink); } :root[data-theme="dark"] .dd-x { background: rgba(255,255,255,.14); color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dd.is-set .dd-btn { color: var(--ink); } :root:not([data-theme="light"]) .dd-x { background: rgba(255,255,255,.14); color: var(--ink); } }
.srch { position: relative; display: flex; min-width: 180px; }
.srch input[type=search] { flex: 1; width: 100%; max-width: none !important; min-width: 0 !important; padding-right: 34px; }
.srch input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.srch-x { display: none; position: absolute; right: 7px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border: 0; border-radius: 50%; padding: 0;
  background: var(--line-2); color: var(--ink-2); cursor: pointer; place-items: center; }
.srch-x:hover { background: var(--line); color: var(--ink); }
.srch.has-val .srch-x { display: grid; }
.srch.is-set input[type=search] { background: color-mix(in srgb, var(--brand) 22%, var(--surface)); border-color: var(--brand); font-weight: 600; }
.srch.is-set .srch-x { background: rgba(0,0,0,.08); color: var(--brand-ink); }

/* Логотип «СИ» в меню и на входе */
.brand-logo { display: block; width: 56px; height: 56px; object-fit: contain; transition: transform .3s var(--ease); }
.brand:hover .brand-logo { transform: scale(1.05); }
.brand-tile { width: 60px; height: 60px; border-radius: 14px; background: #141414; display: grid; place-items: center; flex: none; }
.brand-tile img { width: 50px; height: 50px; }

/* Логотип в «Реквизитах» */
.logo-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 10px; }
.logo-slot { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.logo-prev { width: 84px; height: 84px; flex: none; border-radius: 10px; display: grid; place-items: center; padding: 8px; font-size: 11px; text-align: center; }
.logo-prev.is-dark { background: #141414; }
.logo-prev.is-light { background: #fff; border: 1px solid var(--line); }
.logo-prev img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.logo-info small { font-size: 12px; }
.logo-info .row { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 5px; }

/* Профиль → Левое меню */
.nav-toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 18px; margin-top: 10px; }
.nav-toggles form { margin: 0; }
.nav-toggles .tgl-text { display: inline-flex; align-items: center; gap: 7px; }
.nav-toggles .tgl-text .ic { width: 17px; height: 17px; color: var(--muted); }
.nav a.nav-off { display: none !important; }

/* ===== Переписка как в мессенджере: компактные «пузыри», лента не растягивается на весь широкий экран ===== */
.feed-list { width: 100%; max-width: 940px; margin: 0 auto; box-sizing: border-box; }
.feed-item.msg { width: fit-content; min-width: 140px; max-width: min(560px, 82%); align-self: flex-start; padding: 7px 12px 8px; border-radius: 14px 14px 14px 4px; }
.feed-item.msg.is-out { align-self: flex-end; border-radius: 14px 14px 4px 14px; }
.feed-item.msg.is-mail { max-width: min(680px, 92%); }
.feed-item.msg .fi-head { gap: 6px; margin-bottom: 2px; font-size: 12.5px; }
.feed-item.msg .fi-head b { font-size: 13px; }
.feed-item.msg .fi-head .ch-name { font-size: 10.5px; padding: 0 6px; }
.feed-item.msg .fi-head small { font-size: 11.5px; }
.feed-item.msg .fi-body { font-size: 14.5px; line-height: 1.42; }
/* Продолжение — без шапки, вплотную к предыдущему, время мелко справа внизу */
.feed-item.msg.is-cont { margin-top: -5px; padding-top: 6px; }
.feed-item.msg.is-cont .fi-head { display: none; }
.feed-item.msg.is-cont::after { content: attr(data-t); display: block; text-align: right; font-size: 10.5px; color: var(--muted); margin: 1px -2px -3px 0; }
.feed-item.msg.is-in.has-next { border-bottom-left-radius: 14px; }
.feed-item.msg.is-in.is-cont { border-top-left-radius: 4px; }
.feed-item.msg.is-out.has-next { border-bottom-right-radius: 14px; }
.feed-item.msg.is-out.is-cont { border-top-right-radius: 4px; }
.feed-item.call { max-width: min(560px, 82%); }
@media (max-width: 700px) { .feed-item.msg { max-width: 90%; } }

/* ===== Входящие: шапка в одну строку + кнопки каналов ===== */
.ib-head { display: flex; align-items: center; gap: 14px 18px; flex-wrap: wrap; margin-bottom: 12px; }
.ib-head h1 { margin: 0; font-size: 26px; }
.ib-head .ib-search { margin-left: auto; flex: 0 1 340px; min-width: 220px; }
.ib-search .srch, .ib-search input[type=search] { width: 100%; max-width: none; }
/* Вкладки-переключатель: белая «таблетка» скользит под выбранную вкладку */
.tabs.tabs-pill { position: relative; display: inline-flex; gap: 0; margin: 0; padding: 3px; border: 0; border-radius: 10px; background: var(--line-2); overflow: visible; }
.tabs.tabs-pill a { position: relative; z-index: 2; display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--ink-2); text-decoration: none !important; white-space: nowrap; border: 0; margin: 0; }
.tabs.tabs-pill a.is-active { color: var(--ink); }
.tabs.tabs-pill a:not(.is-active):hover { color: var(--ink); }
.tabs.tabs-pill a::after { display: none !important; }
.tabs.tabs-pill .tab-ind { top: 3px; bottom: 3px; height: auto; border-radius: 8px; background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.12); z-index: 1; }
.tabs.tabs-pill:not(.has-ind) a.is-active { background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.pill-n { font-style: normal; font-size: 11.5px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--red); color: #fff; line-height: 1; }
/* Кнопки каналов */
.ib-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.ib-chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 500; font-size: 13.5px; text-decoration: none !important; transition: background .15s, border-color .15s, color .15s; }
.ib-chip:first-child { padding-left: 14px; }
.ib-chip:hover { border-color: var(--line-strong, #cfcfcf); background: var(--line-2); }
.ib-chip small { color: var(--muted); font-weight: 600; font-size: 12px; }
.ib-chip .ch-ic { width: 20px; height: 20px; }
.ib-chip .ch-ic .ic { width: 12px; height: 12px; }
.ib-chip.is-on { background: var(--brand-ink, #141414); border-color: var(--brand-ink, #141414); color: #fff; }
.ib-chip.is-on small { color: rgba(255,255,255,.6); }
:root[data-theme="dark"] .ib-chip.is-on { background: var(--brand); border-color: var(--brand); color: #141414; } :root[data-theme="dark"] .ib-chip.is-on small { color: rgba(0,0,0,.55); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ib-chip.is-on { background: var(--brand); border-color: var(--brand); color: #141414; } :root:not([data-theme="light"]) .ib-chip.is-on small { color: rgba(0,0,0,.55); } }
@media (max-width: 700px) {
  .ib-head h1 { font-size: 22px; width: 100%; }
  .ib-head .ib-search { order: 3; flex: 1 1 100%; margin-left: 0; }
  .tabs.tabs-pill a { padding: 7px 10px; font-size: 13.5px; }
  .tabs.tabs-pill { max-width: 100%; overflow-x: auto; }
  .ib-chips { flex-wrap: nowrap; overflow-x: auto; margin-right: -12px; padding-right: 12px; }
  .ib-chip { flex: none; }
}

/* Образец кнопки в «Настройки → Цвета» — только для просмотра: без заливки при наведении, текст всегда виден */
.color-preview [data-prev-btn] { pointer-events: none; }
.color-preview [data-prev-btn]::after { display: none !important; }

/* ===== «Входящие» как мессенджер ===== */
.ib-app { display: block; }
.ib-pane { display: none; }
@media (min-width: 1100px) {
  .ib-app { display: grid; grid-template-columns: minmax(330px, 400px) minmax(0, 1fr); gap: 14px; height: calc(100vh - 205px); min-height: 520px; }
  .ib-app .inbox-list { overflow-y: auto; margin: 0; overscroll-behavior: contain; }
  .ib-app .inbox-row .inbox-top small { display: none; }
  .ib-app .inbox-row.is-open, .ib-app .inbox-row.is-open:hover { background: color-mix(in srgb, var(--brand) 38%, var(--surface)); box-shadow: inset 4px 0 0 var(--brand-ink, #141414); }
  .ib-pane { display: block; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
  .ib-pane iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--surface-2); }
  .ib-pane iframe[hidden] { display: none; }
  .ib-app.is-loading .ib-pane::after { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, transparent, var(--brand), transparent); background-size: 50% 100%; animation: ib-load 1s linear infinite; }
}
@keyframes ib-load { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.ib-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 20px; }
.ib-empty[hidden] { display: none; }
.ib-empty .ic { width: 42px; height: 42px; color: var(--muted); opacity: .5; margin-bottom: 4px; }
.ib-empty b { font-size: 16px; }

/* Окно переписки внутри «Входящих» (embed) */
html:has(body.is-embed), body.is-embed { height: 100%; overflow: hidden; }
body.is-embed .sidebar, body.is-embed .sidebar-overlay, body.is-embed .topbar, body.is-embed .tabbar { display: none !important; }
body.is-embed .app { display: block; height: 100%; }
body.is-embed .main { margin: 0 !important; padding: 0 !important; height: 100%; display: flex; flex-direction: column; }
body.is-embed .content { flex: 1; min-height: 0; padding: 0 !important; max-width: none; display: flex; flex-direction: column; }
body.is-embed .content > .flash { margin: 8px 14px 0; }
body.is-embed .deal { flex: 1; min-height: 0; display: block; position: relative; }
body.is-embed .feed { height: 100%; overflow-y: auto; }
body.is-embed .feed-list { padding: 14px 18px; }
body.is-embed .composer { padding: 0 16px 12px; }
body.is-embed .deal-side { position: absolute; z-index: 30; top: 0; right: 0; bottom: 0; width: 380px; max-width: 92%; transform: translateX(105%); transition: transform .28s var(--ease); box-shadow: -18px 0 40px -20px rgba(0,0,0,.35); border-left: 1px solid var(--line); }
body.is-embed.cw-side-open .deal-side { transform: none; }
body.is-embed .deal-top .back { display: none; }
.cw-side-x { position: absolute; top: 10px; right: 10px; z-index: 2; color: #fff !important; font-size: 22px; line-height: 1; }
.cw-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--line); flex: none; }
.cw-av { position: relative; width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--ch); color: #fff; font-weight: 700; font-size: 14px; }
.cw-av .ch-ic { position: absolute; right: -3px; bottom: -3px; width: 18px; height: 18px; box-shadow: 0 0 0 2px var(--surface); }
.cw-av .ch-ic .ic { width: 10px; height: 10px; }
.cw-who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cw-who b { font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-who b a { color: inherit; }
.cw-who small { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-acts { display: flex; align-items: center; gap: 6px; flex: none; }
.cw-phone { font-size: 13.5px; margin-right: 4px; white-space: nowrap; }
.cw-orders, .cw-unsorted { display: flex; align-items: center; gap: 6px; padding: 7px 14px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: 12.5px; overflow-x: auto; white-space: nowrap; flex: none; }
.cw-ord { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); text-decoration: none !important; transition: background .15s; }
.cw-ord:hover { background: var(--line-2); }
.cw-ord i { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong, #bbb); flex: none; }
.cw-ord i.is-debt { background: var(--red); } .cw-ord i.is-paid { background: #2ea05a; }
.cw-unsorted { background: color-mix(in srgb, var(--orange, #f0a23a) 12%, var(--surface)); color: var(--ink); }
.cw-unsorted .ic { width: 16px; height: 16px; color: var(--orange, #f0a23a); flex: none; }
.cw-unsorted span { flex: 1; }
body.is-embed .deal-top > .ch-ic { display: none; }
body.is-embed .deal-top { padding-right: 48px; }

/* ===== Блок ответа клиенту: единая рамка (шаблоны · текст · полоска с каналом и «Отправить») ===== */
.composer:has(.cmp) { padding-top: 12px; }
.composer form:has(.cmp) { padding-top: 0; }
.cmp { border: 1px solid var(--line-strong, #d6d6d6); border-radius: 12px; background: var(--surface); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.cmp.is-focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.cmp-chips { display: flex; gap: 6px; align-items: center; padding: 8px 10px 0; overflow-x: auto; scrollbar-width: none; }
.cmp-chips::-webkit-scrollbar { display: none; }
.cmp-chips .rt-chip { height: 26px; padding: 0 10px; font-size: 12px; background: var(--surface-2); }
.cmp-chips .rt-edit { width: 26px; height: 26px; }
.cmp .rt-files { padding: 0 10px; }
.cmp .rt-files:not(:empty) { margin: 8px 0 0; }
.cmp textarea.cmp-ta { display: block; width: 100%; min-height: 54px; max-height: 260px; border: 0 !important; outline: 0; box-shadow: none !important; background: transparent; padding: 9px 12px 6px; resize: none; font: inherit; font-size: 14.5px; line-height: 1.45; color: var(--ink); }
.cmp-bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-top: 1px solid var(--line-2); background: var(--surface-2); }
.cmp-attach { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 8px; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s; }
.cmp-attach:hover { background: var(--line-2); color: var(--ink); }
.cmp-attach.has-files { color: var(--brand-ink); background: color-mix(in srgb, var(--brand) 35%, transparent); }
.cmp-attach .ic { width: 18px; height: 18px; }
.cmp-via { position: relative; display: inline-flex; align-items: center; gap: 6px; min-width: 0; height: 32px; padding: 0 8px; border-radius: 8px; font-size: 13px; color: var(--ink); transition: background .15s; }
.cmp-via:has(select):hover { background: var(--line-2); }
.cmp-via b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-via select { appearance: none; -webkit-appearance: none; border: 0 !important; background: transparent !important; box-shadow: none !important; font: 600 13px var(--font); color: var(--ink); padding: 0 18px 0 0 !important; margin-right: -20px; height: 32px !important; min-height: 0 !important; cursor: pointer; max-width: 320px; min-width: 0; text-overflow: ellipsis; }
.cmp-via select:focus { outline: none; }
.cmp-via > .ic { width: 13px; height: 13px; transform: rotate(90deg); color: var(--muted); pointer-events: none; flex: none; }
.cmp-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ch); flex: none; }
.cmp-sp { flex: 1; }
.cmp-key { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.cmp-send { height: 34px; padding: 0 14px; gap: 7px; flex: none; }
.cmp-send .ic { width: 16px; height: 16px; }
@media (max-width: 700px) {
  .cmp-via .muted { display: none; }
  .cmp-via select { max-width: 150px; }
  .cmp-send span { display: none; }
  .cmp-send { width: 40px; padding: 0; justify-content: center; border-radius: 50%; }
}
/* Скрепка «как в Telegram»: при наведении — светло-жёлтая подложка, с файлами — счётчик */
.cmp-attach { position: relative; color: var(--muted); }
.cmp-attach .ic { width: 21px; height: 21px; }
.cmp-attach:hover { background: color-mix(in srgb, var(--brand) 32%, transparent); color: var(--ink); }
.cmp-attach.has-files { background: color-mix(in srgb, var(--brand) 32%, transparent); color: var(--ink); }
.cmp-n { position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--brand-ink, #141414); color: #fff; font: 700 10.5px/17px var(--font); font-style: normal; text-align: center; box-shadow: 0 0 0 2px var(--surface-2); }
.cmp-n[hidden] { display: none; }
:root[data-theme="dark"] .cmp-n { background: var(--brand); color: #141414; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cmp-n { background: var(--brand); color: #141414; } }

/* ===== Галочки у исходящих: ✓ отправлено · ✓✓ доставлено · синие ✓✓ прочитано ===== */
.dst { display: inline-flex; align-items: center; flex: none; color: var(--muted); }
.dst svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dst.is-sent svg { width: 14px; height: 14px; }
.dst.is-read { color: #2a9de0; }
.dst.is-pop { animation: dst-pop .6s var(--ease); }
@keyframes dst-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.feed-item.msg .fi-head .dst { margin-left: -2px; }
/* Склеенные сообщения: время и галочки мелко справа внизу */
.feed-item.msg.is-cont { display: flex; flex-direction: column; }
.feed-item.msg.is-cont::after { content: none; }
.feed-item.msg.is-cont .fi-head { display: flex; order: 9; justify-content: flex-end; gap: 3px; margin: 1px -2px -3px 0; }
.feed-item.msg.is-cont .fi-head > :not(small):not(.dst) { display: none; }
.feed-item.msg.is-cont .fi-head small { font-size: 10.5px; }
.feed-item.msg.is-cont .fi-head .dst svg { width: 14px; height: 14px; }
/* В списке «Входящих»: галочка перед «Вы:» */
.inbox-snippet .dst { vertical-align: -3px; margin-right: 3px; }
.inbox-snippet .dst svg { width: 15px; height: 15px; }

/* Файл из канала не загрузился — плашка вместо пустого сообщения */
.msg-miss { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 8px 10px; border-radius: 10px; border: 1px dashed var(--line-strong, #cfcfcf); background: var(--surface-2); min-width: 240px; }
.msg-miss > .ic { width: 22px; height: 22px; color: var(--muted); flex: none; }
.msg-miss span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.msg-miss b { font-size: 13.5px; }
.msg-miss small { font-size: 12px; color: var(--muted); }
.msg-miss.is-wait small::after { content: ""; display: inline-block; width: 10px; height: 10px; margin-left: 6px; border: 2px solid var(--line-strong, #ccc); border-top-color: var(--brand); border-radius: 50%; vertical-align: -1px; animation: spin .8s linear infinite; }
.msg-miss .btn { flex: none; }
.feed-item.msg .fi-head + .msg-miss { margin-top: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Аудит юзабилити: аккуратность и удобство ===== */
/* Подписи каналов в переписке — крупнее и темнее (контраст ≥ 4.5) */
.ch-name, .feed-item.msg .fi-head .ch-name { font-size: 11.5px; padding: 1px 7px; color: color-mix(in srgb, var(--ch) 62%, #000); background: color-mix(in srgb, var(--ch) 14%, var(--surface)); }
:root[data-theme="dark"] .ch-name, :root[data-theme="dark"] .feed-item.msg .fi-head .ch-name { color: color-mix(in srgb, var(--ch) 60%, #fff); background: color-mix(in srgb, var(--ch) 22%, var(--surface)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ch-name, :root:not([data-theme="light"]) .feed-item.msg .fi-head .ch-name { color: color-mix(in srgb, var(--ch) 60%, #fff); background: color-mix(in srgb, var(--ch) 22%, var(--surface)); } }
/* Проценты к прошлому периоду на светлых плитках — читаемые цвета */
.stat:not(.is-hot) .delta.down { color: #c62d28; }
.stat:not(.is-hot) .delta.up { color: #1d7a43; }
.stat:not(.is-hot) .delta { color: var(--ink-2); }
/* «Производство»: строка обслуживания не разваливается на столбцы */
.notice-line > span { flex: 1; min-width: 0; line-height: 1.45; }
/* Быстрое добавление на доске: маленькие подписи над полями */
.quick-add form { gap: 8px; }
.qa-f { display: flex; flex-direction: column; gap: 3px; }
.qa-f span { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.qa-f input { width: 100%; }
/* Карточка клиента: кнопка «⋯» у номера видна только на сенсорных экранах */
.ph-more { display: none; }
@media (hover: none) {
  .ph-more { display: inline-grid; margin-left: auto; }
  .ph-row .ph-view { flex-wrap: wrap; white-space: normal; }
  .ph-tools { position: static; opacity: 1; display: none; background: none; padding: 0; width: 100%; gap: 6px; }
  .ph-row.is-tools .ph-tools { display: flex; }
}

/* Телефон: всё, на что нажимают пальцем, — не меньше 44 px (по правилам доступности) */
@media (max-width: 760px), (pointer: coarse) {
  .back, .icon-btn, .check-btn, .swatch, .rt-edit, .cmp-attach { min-width: 44px; min-height: 44px; }
  .due-chip, .ib-chip, .tabs-pill a, .composer-tabs button, .set-back, .dl-btn, .dd-btn, .tgl, .uc-btn { min-height: 44px; }
  .tabs a { min-height: 44px; display: inline-flex; align-items: center; }
  .add-inline > summary, .quick-add > summary, .card > summary, .pos-more > summary, .eq-edit > summary, .log-row > summary, details > summary.card-head { min-height: 44px; display: flex; align-items: center; }
  /* Текстовые ссылки: область нажатия больше, а вёрстка не сдвигается */
  a.phone, .contact-name, .pc-no, .pc-title, .rec-dl, .task-links a, .file-row a, .cl-what a, .ph-view a, .feed-item a:not(.msg-img):not(.msg-doc), .card-head a.link, .feed-orders a.link,
  button.link, a.link, .ph-add-btn, .ident-row { padding-block: 11px; margin-block: -11px; }
  .ident-row { padding-block: 6px; margin-block: 0; min-height: 44px; }
  .pipeline-bar button { height: 14px; }
  .pipeline-bar { padding-block: 10px; margin-block: -6px; }
}
.pill.is-on { color: #17733f; }
:root[data-theme="dark"] .pill.is-on { color: #5fd38d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pill.is-on { color: #5fd38d; } }
.deal-top .debt, .deal-top small.debt { color: #ff8a84; }
/* Полоса этапов на телефоне: невидимая область нажатия выше полоски */
@media (max-width: 760px), (pointer: coarse) { .pipeline-bar button::after { content: ""; position: absolute; left: 0; right: 0; top: -15px; bottom: -15px; } }
@media (hover: none) {
  .ph-row .ph-view > a.phone { order: 1; }
  .ph-row .ph-view > .ph-more { order: 2; margin-left: auto; }
  .ph-row .ph-view > small { order: 3; width: 100%; margin-top: -4px; }
  .ph-row .ph-view > .ph-tools { order: 4; }
}

/* ===== Файлы в переписке: «Сохранить к заказу» ===== */
.msg-att { position: relative; display: inline-flex; max-width: 100%; }
.msg-docs .msg-att { display: flex; }
.msg-docs .msg-att .msg-doc { flex: 1; min-width: 0; }
.msg-pin { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; border-radius: 8px; border: 0; display: grid; place-items: center; cursor: pointer;
  background: rgba(20,20,20,.62); color: #fff; opacity: 0; transition: opacity .15s, background .15s; z-index: 2; }
.msg-pin .ic { width: 15px; height: 15px; }
.msg-att:hover .msg-pin, .msg-pin:focus-visible, .msg-pin.is-kept { opacity: 1; }
.msg-pin:hover { background: rgba(20,20,20,.85); }
.msg-pin.is-kept { background: #2ea05a; }
.msg-pin.is-busy { opacity: .6; pointer-events: none; }
.msg-docs .msg-pin { top: 50%; transform: translateY(-50%); right: 44px; background: var(--line-2); color: var(--ink-2); }
.msg-docs .msg-pin:hover { background: var(--line); color: var(--ink); }
.msg-docs .msg-pin.is-kept { background: rgba(46,160,90,.15); color: #1f8a4c; }
@media (hover: none) { .msg-pin { opacity: 1; } }
.pin-menu { position: fixed; z-index: 1600; width: 290px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 18px 40px -14px rgba(0,0,0,.3); display: flex; flex-direction: column; gap: 2px; }
.pin-h { font-size: 12.5px; padding: 6px 8px 4px; color: var(--muted); font-weight: 600; }
.pin-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; text-align: left; border: 0; background: none; padding: 8px 9px; border-radius: 8px; cursor: pointer; font: inherit; color: var(--ink); min-height: 44px; }
.pin-menu button span { font-weight: 600; font-size: 13.5px; }
.pin-menu button small { font-size: 12px; color: var(--muted); }
.pin-menu button:hover { background: var(--line-2); }
.pin-menu button.is-cur span::after { content: " ✓"; color: #1f8a4c; }
.pin-note { font-size: 12px; color: var(--muted); margin: 2px 9px 6px; }
.pin-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #141414; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 3000; opacity: 0; transition: opacity .25s, transform .25s; }
.pin-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ===== Настройки → Хранилище файлов ===== */
.st-bars { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.st-total { flex: 1 1 160px; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.st-total b { font-size: 22px; }
.st-total span { font-size: 12.5px; color: var(--muted); }
.st-total.is-cloud b { color: #2a7fd0; }
.st-line { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--line-2); margin-bottom: 8px; }
.st-line i { display: block; background: var(--c); min-width: 0; }
.st-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); }
.st-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 6px; vertical-align: 0; }
.st-modes { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 12px; }
.st-mode { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; transition: border-color .15s, background .15s; }
.st-mode:hover { border-color: var(--line-strong, #ccc); }
.st-mode:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.st-mode input { margin-top: 3px; accent-color: var(--brand-ink, #141414); width: 18px; height: 18px; flex: none; }
.st-mode span { display: flex; flex-direction: column; gap: 3px; }
.st-mode b { font-size: 14.5px; }
.st-mode small { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.st-mode select { font: inherit; font-weight: 700; padding: 2px 6px; border-radius: 6px; border: 1px solid var(--line-strong, #ccc); background: var(--surface); }
.st-rec { font-style: normal; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: color-mix(in srgb, var(--brand) 35%, transparent); color: var(--brand-ink); vertical-align: 1px; }
.st-clean { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.st-clean select { font: inherit; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line-strong, #ccc); background: var(--surface); }
.st-out { margin-top: 10px; font-size: 13.5px; }
.st-out.is-ok { color: #1f8a4c; } .st-out.is-err { color: var(--red); }

/* ===== Спам ===== */
.spam-block { border-top: 1px dashed var(--line); }
.spam-block form { margin: 6px 0 0; }
.spam-btn { color: var(--red) !important; border-color: color-mix(in srgb, var(--red) 35%, var(--line)) !important; }
.spam-btn:hover { background: color-mix(in srgb, var(--red) 8%, var(--surface)) !important; }
.spam-btn .ic { width: 15px; height: 15px; }
.spam-block.is-flash { animation: spamFlash 1.4s var(--ease); }
@keyframes spamFlash { 0%, 40% { background: color-mix(in srgb, var(--red) 12%, var(--surface)); } 100% { background: transparent; } }
.cw-unsorted .spam-btn { margin-left: 4px; }
.spam-add { display: flex; gap: 8px; }
.spam-add input { flex: 1; min-width: 0; }
.spam-rows { display: flex; flex-direction: column; }
.spam-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.spam-row:first-child { border-top: 0; }
.spam-kind { flex: none; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); min-width: 78px; text-align: center; }
.spam-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.spam-main b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spam-main small { font-size: 12px; }

/* Хранилище: по каналам, лишние картинки из писем, большие файлы */
.st-chs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-bottom: 12px; }
.st-ch { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; }
.st-ch > span:not(.ch-ic) { flex: 1; display: flex; flex-direction: column; }
.st-ch small { font-size: 12px; color: var(--muted); }
.st-ch em { font-style: normal; font-weight: 700; }
.st-junk { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 10px; background: color-mix(in srgb, var(--brand) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 45%, var(--line)); margin-bottom: 12px; }
.st-junk div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.st-junk small { font-size: 12.5px; color: var(--ink-2); }
.st-big > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.st-big-list { display: flex; flex-direction: column; margin-top: 6px; }
.st-big-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line-2); }
.st-big-name { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--ink); text-decoration: none !important; }
.st-big-name b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.st-big-name small { font-size: 12px; }
.st-big-row em { font-style: normal; font-weight: 600; white-space: nowrap; }
@media (max-width: 700px) { .st-junk { flex-direction: column; align-items: stretch; } }
.st-ch .ch-ic, .st-big-row .ch-ic { flex: none; }

/* S3: аккуратная форма */
.s3-help { margin: 4px 0 16px; border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; }
.s3-help > summary { cursor: pointer; padding: 11px 0; font-weight: 600; font-size: 14px; color: var(--ink-2); list-style: none; display: flex; align-items: center; gap: 8px; }
.s3-help > summary::-webkit-details-marker { display: none; }
.s3-help > summary::before { content: ''; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .15s; margin-right: 2px; }
.s3-help[open] > summary::before { transform: rotate(45deg); }
.s3-help > summary:hover { color: var(--ink); }
.s3-help ol { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.45; }
.s3-grid { row-gap: 14px; }
.s3-switch { display: flex; align-items: center; gap: 16px; margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.s3-switch:hover { background: var(--line-2); }
.s3-switch > span:first-child { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.s3-switch small { font-size: 13px; color: var(--muted); line-height: 1.4; }
.s3-switch .check { flex: none; margin: 0; }
.s3-foot { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-2); }
.s3-foot + .st-out { margin-top: 10px; }
@media (max-width: 600px) { .s3-foot .btn { flex: 1 1 100%; } }

/* Облегчённое фото: ссылка на оригинал */
.msg-orig { position: absolute; left: 6px; bottom: 6px; display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px; border-radius: 7px;
  background: rgba(20,20,20,.62); color: #fff !important; font-size: 12px; font-weight: 600; text-decoration: none !important; opacity: 0; transition: opacity .15s, background .15s; z-index: 2; }
.msg-orig .ic { width: 13px; height: 13px; }
.msg-att:hover .msg-orig, .msg-orig:focus-visible { opacity: 1; }
.msg-orig:hover { background: rgba(20,20,20,.85); }
@media (hover: none) { .msg-orig { opacity: 1; } }
.st-opt .st-opt-out { color: var(--ink); font-weight: 600; margin-top: 4px; }

/* ===== Помощь, знакомство, пустые экраны, срок, вкладки воронки ===== */
.help-btn { color: var(--muted); }
.help-btn:hover { color: var(--ink); }
.help-btn .ic { width: 21px; height: 21px; }
.help-card { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; }
.help-card > .row { grid-column: 1 / -1; }
.help-card h3 { margin: 0 0 2px; }
.help-card p { margin: 0; font-size: 14px; }
.help-card-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 22%, var(--surface)); color: var(--ink); }
.help-card-ic .ic { width: 22px; height: 22px; }
.guide-lead .btn { align-self: flex-start; margin-top: 8px; }

/* Знакомство */
.tour-dim { position: fixed; inset: 0; z-index: 2400; background: transparent; }
.tour-dim.is-solid { background: rgba(10,10,10,.55); }
.tour-spot { position: fixed; z-index: 2401; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(10,10,10,.55), 0 0 0 3px var(--brand); pointer-events: none;
  transition: left .3s var(--ease), top .3s var(--ease), width .3s var(--ease), height .3s var(--ease); }
.tour-pop { position: fixed; z-index: 2402; background: var(--surface); color: var(--ink); border-radius: 16px; padding: 18px 18px 14px; box-shadow: 0 24px 60px -20px rgba(0,0,0,.5);
  transition: left .3s var(--ease), top .3s var(--ease); animation: fadeUp .3s var(--ease); }
.tour-pop:empty { display: none; }
.tour-pop h3 { margin: 6px 0 6px; font-size: 18px; text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 700; }
.tour-pop p { margin: 0 0 14px; font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }
.tour-prog { display: flex; align-items: center; gap: 5px; }
.tour-prog i { width: 7px; height: 7px; border-radius: 99px; background: var(--line); transition: width .2s, background .2s; }
.tour-prog i.is-done { background: color-mix(in srgb, var(--brand) 55%, var(--line)); }
.tour-prog i.is-on { width: 20px; background: var(--brand); }
.tour-prog span { margin-left: auto; font-size: 12px; color: var(--muted); }
.tour-btns { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tour-btns > span { display: flex; gap: 8px; }
.tour-skip { color: var(--muted); font-size: 13.5px; min-height: 40px; }
.tour-btns .btn { min-height: 40px; }
@media (prefers-reduced-motion: reduce) { .tour-spot, .tour-pop { transition: none; animation: none; } }

/* Пустые экраны с подсказкой */
.empty-act .deny-ic, .deny .deny-ic { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 12px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.empty-act .deny-ic .ic, .deny .deny-ic .ic { width: 26px; height: 26px; }
.empty-act p, .deny p { max-width: 520px; margin-left: auto; margin-right: auto; line-height: 1.5; }
.empty-act .row, .deny .row { margin-top: 14px; }
.empty-tip { display: flex; flex-direction: column; gap: 4px; }
.empty-tip small { color: var(--muted); font-size: 13px; line-height: 1.45; }
.no-link { color: inherit; }
.board-empty { margin: 4px 2px; padding: 14px 12px; border: 1.5px dashed var(--line); border-radius: 10px; font-size: 12.5px; line-height: 1.45; color: var(--muted); text-align: center; }
.board-list:has(.bcard) .board-empty { display: none; }

/* Быстрый выбор срока */
.due-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.due-q { display: inline-flex; align-items: baseline; gap: 5px; min-height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.due-q small { font-weight: 500; color: var(--muted); font-size: 12px; }
.due-q:hover { background: var(--line-2); }
.due-q.is-on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.due-q.is-on small { color: inherit; opacity: .7; }
.field > label { font-size: 12px; color: var(--muted); }
@media (max-width: 860px) { .due-q { min-height: 40px; } }

/* Вкладки этапов — только на телефоне */
.board-tabs { display: none; }
@media (max-width: 860px) {
  .board-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; position: sticky; top: 56px; z-index: 6; margin: 0 -12px 10px 0; padding: 4px 12px 8px 0; background: var(--bg); }
  .board-tabs::-webkit-scrollbar { display: none; }
  .board-tabs button { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink-2); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
  .board-tabs button::before { content: ''; width: 8px; height: 8px; border-radius: 99px; background: var(--st); }
  .board-tabs em { font-style: normal; font-size: 12px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--line-2); display: grid; place-items: center; color: var(--muted); }
  .board-tabs button.is-on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
  .board-tabs button.is-on em { background: rgba(255,255,255,.18); color: inherit; }
  .board-col { flex-basis: calc(100vw - 24px); }
}
.act-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.empty .act-row .btn { margin-top: 0; }
.due-q { font-size: 12.5px; padding: 0 10px; }

/* Подсказки «i» */
.hint-i { position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 99px; border: 1.5px solid currentColor; font: italic 700 10.5px/1 Georgia, serif; color: var(--muted); cursor: help; vertical-align: 2px; margin-left: 3px; text-transform: none; letter-spacing: 0; opacity: .8; }
.hint-i:hover, .hint-i:focus-visible { opacity: 1; color: var(--ink); outline: none; }
.hint-i::after { content: attr(data-hint); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) translateY(4px); width: max-content; max-width: 260px; padding: 9px 11px; border-radius: 10px;
  background: #1c1c1c; color: #fff; font: 400 13px/1.45 var(--font, system-ui), sans-serif; font-style: normal; text-align: left; white-space: normal; box-shadow: 0 14px 30px -12px rgba(0,0,0,.45);
  opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 80; }
.hint-i:hover::after, .hint-i:focus::after { opacity: 1; transform: translateX(-50%) translateY(0); }
.deal-side .hint-i::after, .hint-i.is-left::after { left: 0; transform: translateY(4px); }
.deal-side .hint-i:hover::after, .deal-side .hint-i:focus::after { transform: translateY(0); }
@media (max-width: 860px) { .hint-i { width: 20px; height: 20px; font-size: 12px; } .hint-i::after { max-width: 230px; } }

/* Учебный заказ */
.train-bar { display: flex; align-items: center; gap: 14px; padding: 12px 16px; margin-bottom: 14px; border-radius: 12px; background: color-mix(in srgb, #3b82f6 12%, var(--surface)); border: 1px solid color-mix(in srgb, #3b82f6 40%, var(--line)); }
.train-bar > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.train-bar small { color: var(--ink-2); font-size: 13px; line-height: 1.4; }
.train-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: #3b82f6; color: #fff; flex: none; }
.train-pill { font-style: normal; font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 99px; background: #3b82f6; color: #fff; vertical-align: 1px; margin-left: 4px; text-transform: lowercase; }
@media (max-width: 700px) { .train-bar { flex-wrap: wrap; } .train-bar form { width: 100%; } .train-bar .btn { width: 100%; } }

/* Воронка: стрелки и тень у края */
.board-wrap { position: relative; }
.board-wrap::after { content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 48px; pointer-events: none; background: linear-gradient(to right, transparent, var(--bg)); opacity: 0; transition: opacity .2s; }
.board-wrap.has-more-r::after { opacity: 1; }
.board-arrow { position: absolute; top: 2px; z-index: 5; width: 36px; height: 36px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); display: grid; place-items: center; cursor: pointer; box-shadow: 0 8px 20px -10px rgba(0,0,0,.35); }
.board-arrow:hover { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.board-arrow .ic { width: 18px; height: 18px; }
.board-arrow.is-r { right: 16px; }
.board-arrow.is-r .ic { transform: rotate(180deg); }
.board-arrow.is-l { left: 0; }
.board-arrow[hidden] { display: none; }
@media (max-width: 860px) { .board-arrow, .board-wrap::after { display: none; } }

/* Список быстрых клавиш */
.keys-help { position: fixed; inset: 0; z-index: 2300; background: rgba(10,10,10,.45); display: grid; place-items: center; padding: 16px; }
.keys-box { width: min(420px, 100%); background: var(--surface); border-radius: 16px; padding: 16px 18px; box-shadow: 0 24px 60px -20px rgba(0,0,0,.5); }
.keys-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 17px; }
.keys-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line-2); }
.keys-row kbd { min-width: 44px; text-align: center; padding: 3px 8px; border-radius: 7px; border: 1px solid var(--line); border-bottom-width: 2px; background: var(--bg); font: 600 13px/1.3 ui-monospace, monospace; }
.keys-box p { margin: 10px 0 0; font-size: 12.5px; }
.fi-body code, .msg-quote code { font: 13px ui-monospace, monospace; background: var(--line-2); padding: 1px 5px; border-radius: 5px; }
.deal-side dt:has(.hint-i) { white-space: nowrap; }
.deal-side dt .hint-i { width: 14px; height: 14px; font-size: 9.5px; margin-left: 2px; }
.keys-row kbd { white-space: nowrap; flex: none; }

/* Переезд на новый адрес */
.move-bar { display: flex; align-items: center; gap: 14px; padding: 12px 16px; margin-bottom: 14px; border-radius: 12px; background: color-mix(in srgb, var(--brand) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 55%, var(--line)); }
.move-bar > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.move-bar small { color: var(--ink-2); font-size: 13px; line-height: 1.4; }
.move-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--ink); color: var(--brand); flex: none; }
@media (max-width: 700px) { .move-bar { flex-wrap: wrap; } .move-bar form, .move-bar .btn { width: 100%; } }

/* Сервис: компании */
.tn-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--line-2); list-style: none; cursor: pointer; }
.tn-row::-webkit-details-marker { display: none; }
.tn-main { cursor: default; border-top: 0; }
.tn-row-wrap[open] > .tn-row { background: var(--line-2); border-radius: 10px; }
.tn-ic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--line-2); color: var(--ink); font-weight: 800; font-size: 14px; flex: none; }
.tn-ic.is-main { background: var(--brand); color: var(--brand-ink, #141414); }
.tn-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tn-txt small { color: var(--muted); font-size: 12.5px; }
.pill.is-off { background: rgba(229,64,59,.12); color: var(--red); }
.tn-body { padding: 12px 4px 16px 56px; display: flex; flex-direction: column; gap: 12px; }
.tn-body p { margin: 0; font-size: 13px; }
.tn-form { display: flex; gap: 8px; align-items: flex-end; }
.tn-form .field { flex: 1; }
.tn-acts { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; padding-top: 6px; border-top: 1px dashed var(--line); }
.tn-del { display: flex; gap: 8px; }
.tn-del input { width: 170px; }
.tn-slug { display: flex; align-items: center; border: 1px solid var(--line); border-radius: var(--radius, 8px); background: var(--surface); overflow: hidden; }
.tn-slug input { border: 0 !important; flex: 1; min-width: 0; box-shadow: none !important; }
.tn-slug em { font-style: normal; color: var(--muted); padding: 0 12px; white-space: nowrap; }
.tn-new { border: 1px solid color-mix(in srgb, #2ea05a 45%, var(--line)); }
.tn-new h3 { display: flex; align-items: center; gap: 8px; color: #1f8a4c; }
.tn-steps { margin: 0 0 12px; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; line-height: 1.5; }
.tn-creds { display: flex; gap: 10px; align-items: flex-start; }
.tn-creds pre { flex: 1; margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); font: 13.5px/1.35 ui-monospace, monospace; white-space: pre-wrap; }
@media (max-width: 700px) { .tn-body { padding-left: 4px; } .tn-form, .tn-del, .tn-creds { flex-direction: column; align-items: stretch; } .tn-del input { width: 100%; } }
.tn-slug input { font-size: inherit; }

/* Управление сервисом (sigmacrm.ru) */
body.console { background: var(--bg); }
.cn-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; padding: 0 24px; background: #141414; color: #fff; }
.cn-brand { display: flex; align-items: center; gap: 10px; }
.cn-brand img { border-radius: 8px; }
.cn-brand small { color: #9a9a9a; font-size: 13px; }
.cn-me { font-size: 13.5px; color: #cfcfcf; }
.cn-me a { color: var(--brand); }
.cn-main { max-width: 920px; margin: 0 auto; padding: 24px 16px 60px; display: flex; flex-direction: column; gap: 16px; }
.cn-main .card { margin: 0; }
.cn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cn-grid .copy-line { display: flex; gap: 8px; align-items: center; }
.cn-grid .copy-line code { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: 12.5px; padding: 8px 10px; background: var(--bg); border-radius: 8px; border: 1px solid var(--line); }
@media (max-width: 760px) { .cn-grid { grid-template-columns: 1fr; } .cn-brand small { display: none; } .cn-top { padding: 0 14px; } }
.cn-grid > * { min-width: 0; }
.cn-grid .copy-line code { white-space: normal; word-break: break-all; }
.cn-grid .form-grid { grid-template-columns: 1fr 1fr; }

/* Отрасль: карточки выбора */
.ind-list { display: grid; gap: 10px; margin-bottom: 14px; }
.ind-list.ind-3 { grid-template-columns: repeat(3, 1fr); }
.ind-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.ind-card:hover { border-color: color-mix(in srgb, var(--brand) 60%, var(--line)); }
.ind-card.is-on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.ind-card input { position: absolute; opacity: 0; pointer-events: none; }
.ind-card:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.ind-card > span:last-child { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ind-card small { color: var(--ink-2); font-size: 13px; line-height: 1.4; }
.ind-card em { font-style: normal; font-size: 12px; color: var(--muted); }
.ind-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--line-2); flex: none; }
.ind-card.is-on .ind-ic { background: var(--brand); color: var(--brand-ink, #141414); }
.mod-list { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 760px) { .ind-list.ind-3 { grid-template-columns: 1fr; } }
