/* Премии отдела продаж — дополнения к app.css из b24-focus. Только переменные и приёмы оттуда же:
   карточки, плитки, таблицы в рамке, метки .pill, полоса .bar. Предпросмотр документа и список правил — из b24-docgen. */

/* плитка с крупной суммой и строкой пояснения */
.tile .v small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.tile.accent { background: var(--info-bg); box-shadow: none; }
.tile.accent .k { color: var(--info-ink); }
.tile.warn { background: var(--warn-bg); box-shadow: none; }
.tile.warn .k, .tile.warn .v { color: var(--warn-ink); }

/* следующая ступень — как блок знакомства: полоса слева */
.next { border-left: 4px solid var(--cta); display: flex; gap: 16px 28px; align-items: center; flex-wrap: wrap; }
.next-main { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 4px; }
.next-title { font-size: 17px; font-weight: 600; }
.next-title b { color: var(--ok-ink); }
.next-side { display: flex; gap: 24px; flex-wrap: wrap; }
.next-side .k { font-size: 13px; color: var(--muted); }
.next-side .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* шкала выполнения плана со ступенями */
.meter { position: relative; padding: 50px 0 30px; }
.meter-track { height: 12px; border-radius: 6px; background: var(--chip-bg); position: relative; overflow: hidden; }
.meter-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 6px; }
.meter-fill.forecast { background: repeating-linear-gradient(135deg, var(--info-bg) 0 6px, #c9eefa 6px 12px); }
.meter-tick { position: absolute; top: 34px; bottom: 22px; width: 0; border-left: 1.5px dashed var(--line-strong); }
.meter-tick span { position: absolute; top: -18px; left: 0; transform: translateX(-50%); font-size: 12px; color: var(--muted); white-space: nowrap; }
.meter-tick em { position: absolute; bottom: -22px; left: 0; transform: translateX(-50%); font-style: normal; font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.meter-tick.cur em { color: #fff; background: var(--accent); border-radius: 6px; padding: 1px 6px; }
.meter-tick.goal em { color: var(--ok-ink); background: var(--ok-bg); border-radius: 6px; padding: 1px 6px; }
.meter-you { position: absolute; top: 0; transform: translateX(-50%); font-size: 12px; font-weight: 600; color: var(--accent-dark); white-space: nowrap; }

/* KPI: строка с полосой */
.kpis { display: flex; flex-direction: column; gap: 12px; }
.kpi { display: grid; grid-template-columns: minmax(0, 1fr) 90px; gap: 4px 12px; align-items: center; font-size: 14px; }
.kpi .bar { grid-column: 1 / -1; height: 8px; }
.kpi .bar i { background: var(--accent); }
.kpi.done .bar i { background: var(--cta); }
.kpi .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.kpi .sub { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }

/* две колонки: основное и боковая карточка (как .launch в app.css, но шире бок) */
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.cols > .main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.cols > .side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 12px; }
@media (max-width: 980px) { .cols { grid-template-columns: minmax(0, 1fr); } .cols > .side { position: static; } }

/* таблицы с итогом */
table.money { min-width: 860px; }
.meter-you::after { content: ""; position: absolute; left: 50%; top: 18px; height: 14px; border-left: 2px solid var(--accent-dark); }
.money td { vertical-align: middle; }
.money td.who a { font-weight: 500; text-decoration: none; }
.money td.who .sub, .money td .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.money tr.total td { border-top: 2px solid var(--line-strong); background: var(--chip-bg); font-weight: 600; }
.money td.neg { color: var(--err-ink); }
.money td.big-sum { font-weight: 600; font-size: 15px; }
.pct { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.pct .bar { width: 64px; height: 6px; }
.pct .bar i { background: var(--accent); }
.pct.low .bar i { background: var(--danger); }
.pct.over .bar i { background: var(--cta); }

/* замечания РОПу */
.issues { display: flex; flex-direction: column; }
.issue { display: flex; align-items: center; gap: 10px 14px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; flex-wrap: wrap; }
.issue:first-child { border-top: 0; padding-top: 0; }
.issue .grow { color: var(--ink-2); }
.issue .grow b { color: var(--ink); font-weight: 500; }

/* состав схемы фразами — список правил из b24-docgen */
.rules { display: flex; flex-direction: column; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: #fff; }
.rule { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 14px; border-top: 1px solid var(--line); }
.rule:first-child { border-top: 0; }
.rule.open { background: #f7fbfd; }
.rule-on input { accent-color: var(--accent); width: 16px; height: 16px; margin: 3px 0 0; }
.rule-main { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.rule-when { font-size: 15px; line-height: 1.45; }
.rule-when b { font-weight: 600; }
.rule-when .tok { display: inline-block; background: var(--info-bg); color: var(--info-ink); border-radius: 6px; padding: 0 6px; font-weight: 500; }
.rule-to { color: var(--ink-2); }
.rule-stat { font-size: 12px; color: var(--muted); }
.rule-actions { display: flex; gap: 6px; }
.rule-edit { margin-top: 8px; display: flex; flex-direction: column; gap: 10px; }
.steps-table { min-width: 0; }
.steps-table td, .steps-table th { padding: 7px 10px; }
.steps-table .input { min-height: 32px; padding: 4px 8px; }
.add-rule { display: flex; gap: 6px; flex-wrap: wrap; }

/* пробный расчёт */
.trial .facts dd.neg { color: var(--err-ink); }
.trial .total-line { display: flex; justify-content: space-between; align-items: baseline; border-top: 1px solid var(--line); padding-top: 12px; }
.trial .total-line .big { font-size: 32px; }
.compare { font-size: 13px; color: var(--ink-2); background: var(--chip-bg); border-radius: 10px; padding: 10px 12px; }
.compare b { color: var(--ok-ink); }

/* таблица планов с полями ввода */
table.plans { min-width: 900px; }
.plans td { vertical-align: middle; }
.plans .input { min-height: 32px; padding: 4px 8px; text-align: right; font-variant-numeric: tabular-nums; width: 130px; }
.plans .input.s { width: 80px; }
.plans .input.changed { border-color: var(--accent); background: var(--info-bg); }
.plans .input.bad { border-color: var(--danger); background: var(--err-bg); }

/* выбор источника: карточки с переключателем */
.choice { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line-strong); border-radius: 10px; padding: 12px 14px; background: #fff; font-size: 14px; cursor: pointer; }
.opt input { accent-color: var(--accent); margin: 3px 0 0; flex: none; }
.opt.on { border-color: var(--accent); background: #f7fbfd; }
.opt b { display: block; font-weight: 600; margin-bottom: 2px; }
.opt .sub { color: var(--muted); font-size: 13px; }
.opt .pill { margin-top: 6px; }
.form-row { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 8px 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.form-row:first-of-type { border-top: 0; }
.form-row .field-label { font-size: 14px; color: var(--ink); font-weight: 500; }
.form-row .field-label small { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
@media (max-width: 720px) { .form-row { grid-template-columns: minmax(0, 1fr); } }

/* предпросмотр документа — из b24-docgen */
.doc-scroll { background: var(--ground); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.doc-page { background: #fff; color: #111; max-width: 820px; margin: 0 auto; padding: 48px 56px; box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
  font: 15px/1.45 "Times New Roman", Times, serif; overflow-wrap: anywhere; }
.doc-page p { margin: 0 0 6px; }
.doc-page p.h { font-weight: 700; font-size: 17px; margin-top: 10px; text-align: center; }
.doc-page p.r { text-align: right; }
.doc-page table { border-collapse: collapse; width: 100%; margin: 6px 0 10px; font-size: 14px; }
.doc-page td, .doc-page th { border: 1px solid #bbb; padding: 4px 6px; vertical-align: top; background: none; font-size: 14px; font-weight: 400; white-space: normal; }
.doc-page th { font-weight: 700; }
.doc-page td.n { text-align: right; white-space: nowrap; }
.doc-page tr.t td { font-weight: 700; }
.doc-page .sign { display: flex; justify-content: space-between; margin-top: 28px; }

/* вкладка в карточке сделки — без верхнего меню, плотнее */
.tab-app { max-width: none; padding: 14px 18px 24px; gap: 14px; }
.tab-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; }
.tab-head h1 { font-size: 20px; }
.share { display: grid; grid-template-columns: minmax(0, 1.4fr) 120px 110px minmax(0, 1fr) 28px; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }
.share:first-of-type { border-top: 0; }
.share .input { min-height: 32px; padding: 4px 8px; }
.share .who b { font-weight: 500; display: block; }
.share .who span { font-size: 12px; color: var(--muted); }

/* чат Битрикс24 — только для макета сообщений бота */
.chat { background: #dfe8ec; border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.chat-day { align-self: center; font-size: 12px; color: var(--ink-2); background: rgba(255, 255, 255, .7); border-radius: 10px; padding: 2px 10px; }
.msg { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; max-width: 640px; }
.ava { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 15px; }
.bubble { background: #fff; border-radius: 4px 14px 14px 14px; padding: 10px 14px; font-size: 14px; line-height: 1.5; box-shadow: 0 1px 1px rgba(0, 0, 0, .06); }
.bubble .from { font-size: 13px; font-weight: 600; color: var(--link); margin-bottom: 2px; display: flex; justify-content: space-between; gap: 12px; }
.bubble .from time { font-weight: 400; color: var(--muted); }
.bubble p { margin: 0 0 6px; }
.bubble .kb { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.bubble .kb span { border: 1px solid var(--accent); color: var(--accent-dark); border-radius: 6px; padding: 4px 12px; font-size: 13px; font-weight: 500; }
.chat-title { display: flex; align-items: center; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid rgba(0, 0, 0, .08); }
.chat-title b { font-size: 15px; }
.chat-title span { font-size: 12px; color: var(--ink-2); }

/* оглавление макетов */
.toc { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.toc a { text-decoration: none; color: inherit; }
