/* «Итог звонка» — тема Битрикс24 Air: акцент #0075ff, текст #424956, линии #dfe0e3, фон #eef2f5. */
:root {
    --ink: #424956; --muted: #828b95; --line: #dfe0e3; --bg: #eef2f5; --card: #fff; --soft: #f6fafb;
    --accent: #0075ff; --accent-d: #0068e0; --accent-l: #e5f0ff; --ok: #1bce7b; --ok-l: #e3f8ee; --off: #c3c8cd;
    --warn: #e5464c; --warn-l: #fdecec; --amber: #f5a623; --amber-l: #fff4e0;
    --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 -apple-system, "Segoe UI", Roboto, "Open Sans", Arial, sans-serif; }
.cr { max-width: 980px; margin: 0 auto; padding: 22px 20px 64px; }
h1 { font-size: 24px; font-weight: 600; margin: 0 0 4px; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 8px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.cr-lead { color: var(--muted); margin: 0 0 16px; max-width: 720px; }
.cr-muted { color: var(--muted); }
.cr-small { font-size: 12px; }
.cr-card { background: var(--card); border-radius: 12px; padding: 18px 20px; margin: 0 0 14px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.cr-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cr-between { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.fade { animation: fadeUp .28s var(--ease); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Вкладки */
.cr-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin: 0 0 16px; }
.cr-tab { border: 0; background: none; padding: 10px 0; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer;
          border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .18s, border-color .18s; display: inline-flex; gap: 6px; align-items: center; }
.cr-tab:hover { color: var(--ink); }
.cr-tab.on { color: var(--accent); border-color: var(--accent); }
.cr-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--warn); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }

/* Чипы */
.cr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cr-chip { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 4px 12px; font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; transition: background .18s, border-color .18s, color .18s; }
.cr-chip:hover { border-color: var(--accent); color: var(--accent); }
.cr-chip.on { background: var(--accent-l); border-color: var(--accent-l); color: var(--accent-d); font-weight: 600; }
.cr-empty { text-align: center; padding: 28px 10px; color: var(--muted); }

/* Поля */
.cr-field { display: flex; flex-direction: column; gap: 4px; margin: 0 0 14px; }
.cr-field > span { font-size: 12px; color: var(--muted); }
input[type=text], input[type=number], textarea {
    width: 100%; max-width: 460px; height: 34px; padding: 0 10px; border: 1px solid #c6cdd3; border-radius: 6px;
    background: #fff; font: inherit; color: inherit;
}
textarea { height: auto; min-height: 38px; padding: 8px 10px; resize: vertical; max-width: 100%; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,117,255,.15); }
.cr-check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; margin: 0 0 10px; }
.cr-check input { margin-top: 3px; }
.cr-check small { display: block; color: var(--muted); }
.cr-x { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1; }
.cr-x:hover { color: var(--warn); }

/* Шаги подключения */
.cr-steps { counter-reset: st; list-style: none; margin: 0; padding: 0; }
.cr-steps li { counter-increment: st; position: relative; padding: 0 0 14px 38px; }
.cr-steps li::before { content: counter(st); position: absolute; left: 0; top: -2px; width: 26px; height: 26px; border-radius: 50%;
                       background: var(--accent-l); color: var(--accent); font-weight: 600; display: flex; align-items: center; justify-content: center; }
.cr-state { display: flex; align-items: center; gap: 8px; }
.cr-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--off); flex: none; }
.cr-dot.on { background: var(--ok); }
.cr-setup { list-style: none; padding: 0; margin: 12px 0 0; }
.cr-setup li { padding: 3px 0 3px 18px; position: relative; }
.cr-setup li::before { content: ""; position: absolute; left: 2px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.cr-setup li.err::before { background: var(--warn); }

/* Кнопки */
.cr-btn { height: 34px; padding: 0 16px; border: 0; border-radius: 17px; background: var(--accent); color: #fff; font: 600 13px/34px inherit; font-family: inherit; cursor: pointer; white-space: nowrap; transition: background .18s; }
.cr-btn:hover { background: var(--accent-d); }
.cr-btn:disabled { opacity: .5; cursor: default; }
.cr-btn--ok { background: var(--ok); }
.cr-btn--ok:hover { background: #17b56c; }
.cr-btn--ghost { background: #fff; color: var(--ink); border: 1px solid #c6cdd3; }
.cr-btn--ghost:hover { background: #f1f4f6; }
.cr-btn--sm { height: 28px; line-height: 28px; padding: 0 12px; font-size: 12px; border-radius: 14px; }
.cr-btn--link { background: none; color: var(--accent); padding: 0 4px; height: auto; line-height: inherit; }
.cr-btn--link:hover { background: none; text-decoration: underline; }

/* Своё выпадающее меню */
.cr-pop { position: fixed; z-index: 40; min-width: 200px; width: max-content; max-width: calc(100vw - 24px); background: #fff; border: 1px solid var(--line); border-radius: 10px;
          box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: 8px; opacity: 0; transform: translateY(-4px) scale(.98); transition: opacity .16s, transform .16s var(--ease); }
.cr-pop.show { opacity: 1; transform: none; }
.cr-pop input { max-width: none; margin-bottom: 6px; }
.cr-pop__list { max-height: 260px; overflow: auto; }
.cr-pop__item { display: flex; justify-content: space-between; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.cr-pop__item:hover, .cr-pop__item.act { background: var(--soft); }
.cr-pop__item small { color: var(--muted); }
.cr-pop__item.is-in { color: var(--muted); cursor: default; }

.cr-toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; transition: .25s;
            background: #333; color: #fff; padding: 10px 16px; border-radius: 8px; max-width: 90vw; z-index: 50; }
.cr-toast.show { opacity: 1; transform: translate(-50%, 0); }
.cr-toast--err { background: var(--warn); }

@media (max-width: 680px) {
    .cr { padding: 16px 12px 56px; }
}
@media (prefers-reduced-motion: reduce) {
    .fade { animation: none; }
    .cr-pop, .cr-tab, .cr-chip, .cr-btn { transition: none; }
}

/* Отчёт */
.cr-toolbar { display: flex; flex-direction: column; gap: 8px; margin: 0 0 14px; }
.cr-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 0 0 14px; }
.cr-kpi { background: var(--card); border-radius: 12px; padding: 14px 16px; box-shadow: 0 1px 2px rgba(0,0,0,.04); min-width: 0; }
.cr-kpi span { display: block; font-size: 12px; color: var(--muted); }
.cr-kpi b { display: block; font-size: 22px; font-weight: 600; line-height: 1.25; margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-kpi small { color: var(--muted); font-size: 12px; }
.cr-kpi.is-warn b { color: var(--warn); }
.cr-kpi b.is-text { font-size: 17px; line-height: 1.6; }
.cr-hbs { display: flex; flex-direction: column; gap: 10px; }
.cr-hb { border-radius: 8px; padding: 4px 6px; margin: 0 -6px; transition: background .18s; }
.cr-hb.is-click { cursor: pointer; }
.cr-hb.is-click:hover, .cr-hb.on { background: var(--soft); }
.cr-hb__head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 4px; }
.cr-hb__name { font-weight: 600; }
.cr-hb__val { white-space: nowrap; font-weight: 600; }
.cr-hb__val small { color: var(--muted); font-weight: 400; }
.cr-hb__track { height: 8px; border-radius: 4px; background: #edf0f2; overflow: hidden; }
.cr-hb__fill { height: 100%; border-radius: 4px; background: var(--accent); transition: width .4s var(--ease); }
.cr-hb.is-warn .cr-hb__fill { background: var(--amber); }
.cr-hb.on .cr-hb__fill { background: var(--accent-d); }
.cr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cr-grid .cr-card { margin: 0 0 14px; }
.cr-table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.cr-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.cr-table td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cr-table td.n { white-space: nowrap; }
.cr-table td.warn { color: var(--warn); font-weight: 600; }
.cr-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

@media (max-width: 760px) {
    .cr-kpis { grid-template-columns: 1fr 1fr; }
    .cr-grid { grid-template-columns: 1fr; }
    .cr-table { display: block; overflow-x: auto; }
}

/* Итоги по видам: дозвонились — зелёный, не дозвонились — красный, перезвонить — синий, не актуально — серый */
.cr-hb.is-ok .cr-hb__fill { background: var(--ok); }
.cr-hb.is-miss .cr-hb__fill { background: var(--warn); }
.cr-hb.is-cb .cr-hb__fill { background: var(--accent); }
.cr-hb.is-off .cr-hb__fill { background: var(--off); }
.cr-kpi.is-ok b { color: #0e8a52; }
.cr-scroll { overflow-x: auto; }
.cr-table th.n, .cr-table td.n { text-align: right; }
.cr-table th:first-child, .cr-table td:first-child { text-align: left; }
.cr-rate { display: inline-flex; align-items: center; gap: 6px; }
.cr-rate i { display: inline-block; width: 48px; height: 6px; border-radius: 3px; background: #edf0f2; overflow: hidden; }
.cr-rate i b { display: block; height: 100%; background: var(--ok); }

/* Настройки: список итогов */
.cr-results { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.cr-result { display: grid; grid-template-columns: minmax(160px, 260px) 150px 60px 104px; gap: 10px; align-items: center; }
.cr-result--head { font-size: 12px; color: var(--muted); }
.cr-result input[type=text] { max-width: none; }
.cr-kind { font-size: 13px; color: var(--muted); padding-left: 2px; }
.cr-select { height: 34px; padding: 0 28px 0 10px; border: 1px solid #c6cdd3; border-radius: 6px; background: #fff; font: inherit; color: inherit;
             text-align: left; cursor: pointer; position: relative; white-space: nowrap; }
.cr-select::after { content: ""; position: absolute; right: 11px; top: 13px; width: 6px; height: 6px; border-right: 1.5px solid var(--muted);
                    border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); }
.cr-select:hover { border-color: var(--accent); }
.cr-switch { display: flex; justify-content: center; }
.cr-switch input { width: 16px; height: 16px; cursor: pointer; }
.cr-result__act { display: flex; gap: 4px; }
.cr-result .cr-x { width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--muted); font-size: 15px; }
.cr-result .cr-x:disabled { opacity: .35; cursor: default; }
.cr-x--ph { display: inline-block; width: 30px; }
.cr-results > .cr-btn { margin-top: 6px; }
.cr-bar-actions { margin: 4px 0 14px; display: flex; gap: 10px; }

/* Окно итога */
.cr-answer__call { font-size: 16px; font-weight: 600; }
.cr-chips--pick { margin: 0 0 14px; }
.cr-chips--pick .cr-chip { padding: 6px 14px; }
.cr-chip.is-ok.on { background: var(--ok-l); border-color: var(--ok-l); color: #0e8a52; }
.cr-chip.is-miss.on { background: var(--warn-l); border-color: var(--warn-l); color: #c2272d; }
.cr-chip.is-off.on { background: #eef0f2; border-color: #eef0f2; color: var(--ink); }
.cr-when { background: var(--soft); border-radius: 10px; padding: 12px 14px; margin: 0 0 14px; }
.cr-when__label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.cr-when .cr-chips { align-items: center; }
.cr-when input[type=datetime-local] { width: auto; height: 30px; border-radius: 15px; padding: 0 12px; font-size: 13px; }

@media (max-width: 680px) {
    .cr-result { grid-template-columns: 1fr 120px 40px; }
    .cr-result__act { grid-column: 1 / -1; }
    .cr-result--head span:last-child { display: none; }
}
.cr-result .cr-x--ph { border: 0; background: none; }
