/* Дополнения кабинета телефонии к стилям CRM (base.css = partner.css + admin.css реферальной программы). */

.nav-soon {
  margin-left: auto; padding: 1px 7px; border-radius: 999px;
  background: var(--pill); color: var(--muted); font-size: 11px; white-space: nowrap;
}
.side-nav__item { min-width: 0; }
.side-nav__item > span:not(.nav-soon) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-tenant { display: grid; gap: 8px; padding: 10px 12px; }
.side-tenant .select { min-height: 44px; font-size: 15px; }
.js .js-hide { display: none; }
.side-logout { margin: 0; }
.side-nav__btn { width: 100%; border: 0; cursor: pointer; text-align: left; font: inherit; color: var(--text); }

/* Фильтры звонков: поиск, направление, статус, кнопка */
@media (min-width: 720px) {
  .filters--calls { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
}

.dir { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dir .icon { width: 18px; height: 18px; }
.dir--inbound .icon { color: #1f7a32; }
.dir--outbound .icon { color: var(--blue); }

.rec { display: inline-flex; align-items: center; gap: 2px; }
.rec .icon-btn { width: 40px; height: 40px; }
.rec .icon { width: 20px; height: 20px; }
.rec audio { height: 36px; max-width: 260px; }

.table--calls td, .table--calls th { padding-left: 14px; padding-right: 14px; }
.table--calls small { display: block; }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 20px 0; flex-wrap: wrap; }

/* Графики: красный для пропущенных, столбики по часам */
.chart--red .chart__line { stroke: #d0453a; }
.chart--red .chart__area { fill: rgba(208, 69, 58, .1); }
.chart--red .chart__dot { fill: #d0453a; }
.chart--red .chart__total { color: #b3322a; }
.hbar--all { fill: #cfe0fb; }
.hbar--ok { fill: #77d07a; }
.legend { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 14px; }
.legend__dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: 6px; }
.legend__dot--all { background: #cfe0fb; }
.legend__dot--ok { background: #77d07a; }

.lead { margin: -8px 0 16px; }
/* Подзаголовок из нескольких частей (карточка звонка, карточка клиента): части не рвутся, строка переносится целыми частями. */
.page-sub--meta { flex-wrap: wrap; gap: 4px 8px; }
.page-sub--meta > * { white-space: nowrap; }
@media (max-width: 719.98px) { .page-sub--meta { gap: 6px 14px; } .page-sub__sep { display: none; } }

/* Користувачі: список, форма клиента, ссылка-приглашение */
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--link); text-decoration: none; font-size: 15px; }
.back-link .icon { width: 18px; height: 18px; }
.num-list { display: grid; gap: 2px; }
.user-form { gap: 20px; }
.user-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.user-form legend { padding: 0; margin-bottom: 6px; }
.form-pair { display: grid; gap: 16px; }
@media (min-width: 720px) { .form-pair { grid-template-columns: 1fr 1fr; } }
.input.is-invalid { border-color: var(--bad); }
.input:disabled { background: var(--bg); color: var(--muted); }
.num-picks { display: grid; gap: 8px; margin-top: 12px; }
@media (min-width: 720px) { .num-picks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.num-pick { align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.num-pick:has(input:checked) { border-color: #b9d2fb; background: var(--blue-soft); }
.num-pick small { display: block; }
.num-picks.is-off { opacity: .45; }
.card--invite { border: 1px solid #b9d2fb; background: var(--blue-soft); }
.copy-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.copy-row .input { flex: 1 1 320px; min-width: 0; font-size: 15px; }
.user-actions .actions + .actions { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.btn--danger { color: var(--bad-text); }
.btn--danger:hover { border-color: #f7c9c3; background: var(--bad-soft); }
.table--users .btn { white-space: nowrap; padding-left: 16px; padding-right: 16px; }

/* Контроль якості: оцінка, пункти перевірки, текст розмови */
.score { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 30px; padding: 0 10px;
  border-radius: 999px; font-weight: 700; font-variant-numeric: tabular-nums; text-decoration: none; white-space: nowrap; }
.score--ok { background: var(--ok-soft); color: var(--ok-text); }
.score--bad { background: var(--bad-soft); color: var(--bad-text); }
.score--big { min-width: 72px; height: 52px; font-size: 26px; }
/* .table a в base.css (inline-block, padding 11px 0, margin -11px 0 — зона нажатия) сильнее .score и ломал плашку в «Дзвінки». */
.table a.score { position: relative; display: inline-flex; padding: 0 10px; margin: 0; font-weight: 700; }
.table a.score::after { content: ""; position: absolute; inset: -7px 0; }  /* зона нажатия 44 px */
.qc-prompt { margin-bottom: 16px; }
.qc-textarea { width: 100%; min-height: 130px; resize: vertical; line-height: 1.45; padding: 10px 14px; font: inherit; }
.qc-prompt__row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.qc-threshold { width: 120px; }
.prompt-text { white-space: pre-wrap; margin: 0 0 8px; }
.qc-tabs { margin: 0 0 16px; }
.qc-summary { min-width: 220px; max-width: 420px; }
.qc-summary-full { margin: 0 0 14px; }
.qc-grid { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1000px) { .qc-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); } }
.qc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.qc-recheck { margin-top: 16px; }
.qc-error { color: var(--bad-text); overflow-wrap: anywhere; }
.call-rec { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px; }
.call-rec__audio { flex: 1 1 320px; min-width: 0; max-width: 100%; height: 40px; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.check { display: grid; grid-template-columns: 30px minmax(0, 1fr); column-gap: 10px; row-gap: 2px; align-items: start;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.check > :not(.check__mark) { grid-column: 2; }
.check__mark { grid-row: 1 / span 3; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; }
.check--yes .check__mark { background: var(--ok-soft); color: var(--ok-text); }
.check--no { border-color: #f7c9c3; }
.check--no .check__mark { background: var(--bad-soft); color: var(--bad-text); }
.check--na .check__mark { background: var(--pill); color: var(--muted); }
.check__name { font-weight: 500; }
.check__quote { color: var(--muted); font-style: italic; }
.transcript { display: grid; gap: 8px; max-height: 70vh; overflow-y: auto; padding-right: 4px; }
.line { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 8px; }
.line__time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; padding-top: 9px; }
.line__text { margin: 0; padding: 8px 12px; border-radius: 12px; background: var(--bg); overflow-wrap: anywhere; }
.line__who { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 2px; }
.line--1 .line__text { background: var(--blue-soft); }
.line--1 .line__who { color: var(--link); }

/* Сховище: диск і видалення записів; перемикач розпізнавання */
.disk__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.disk__big { font-size: 28px; font-weight: 700; }
.disk__bar { display: block; width: 100%; height: 28px; border-radius: 8px; overflow: hidden; }
.disk__seg--rec { fill: #0f5fd6; }
.disk__seg--other { fill: #9aa3b2; }
.disk__seg--free { fill: #d9f2dc; }
.disk__legend { list-style: none; margin: 12px 0 8px; padding: 0; display: grid; gap: 6px; }
.disk__legend li { display: flex; align-items: center; gap: 8px; }
.disk__legend .legend__dot { margin-left: 0; }
.disk__dot--rec { background: #0f5fd6; }
.disk__dot--other { background: #9aa3b2; }
.disk__dot--free { background: #d9f2dc; box-shadow: inset 0 0 0 1px #77d07a; }
.cleanup-confirm { margin-top: 14px; padding: 14px; border: 1px solid #f7c9c3; border-radius: var(--radius-sm);
  background: var(--bad-soft); display: grid; gap: 10px; justify-items: start; }
.cleanup-confirm p { margin: 0; }
.cleanup-last { margin-top: 14px; }
.qc-switch { display: flex; justify-content: space-between; align-items: center; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 16px; }
.qc-switch .card__title { margin-bottom: 6px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.qc-switch__text { flex: 1 1 320px; }
.qc-switch__text p { margin: 0; }
.qc-switch--on { box-shadow: inset 0 0 0 1px #bfe5c3; }
.table-scroll { overflow-x: auto; }

/* Текст розмови: кнопки «Завантажити .txt», «Копіювати», «Надіслати» поруч із заголовком */
.tr-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 12px; margin-bottom: 14px; }
.tr-head .card__title { margin-bottom: 0; }
.tr-head .tr-actions { margin-top: 0; }
.tr-status { margin: 0 0 12px; }

/* NUMBERS-PAGER-20261127 — «Номери»: вкладки за типом, пошук, сторінки; пошук у списках номерів у формах */
.num-tabs { margin-top: 4px; }
.tab__n { margin-left: 8px; padding: 1px 8px; border-radius: 999px; background: rgba(0, 0, 0, .06);
  font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.tab.is-active .tab__n { background: rgba(255, 255, 255, .24); }
@media (min-width: 720px) {
  .filters--numbers { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; }
  .filters--numbers-admin { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
}
.found { margin: -4px 0 12px; }
.table--numbers .num-list a { padding: 2px 0; margin: 0; }
.table--numbers .btn { display: inline-flex; padding: 0 16px; margin: 0; white-space: nowrap; }
.table--numbers .btn .icon { width: 18px; height: 18px; }
.list-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin: 16px 0; }
.list-foot .pager { margin: 0; }
@media (max-width: 719.98px) { .list-foot { justify-content: center; text-align: center; } }
.pager--pages { gap: 6px; }
.pager__num, .pager__step { display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 10px;
  border-radius: 999px; background: var(--pill); color: var(--text); font-weight: 500;
  font-variant-numeric: tabular-nums; text-decoration: none; }
a.pager__num:hover, a.pager__step:hover { background: #e2e5ea; }
.pager__num.is-current { background: var(--blue); color: #fff; }
.pager__step.is-off { opacity: .4; }
.pager__gap { min-width: 16px; text-align: center; color: var(--muted); }
.per-page { margin: 0; }
.per-page__field { display: inline-flex; align-items: center; gap: 8px; }
.per-page .select { width: auto; min-height: 44px; }
.num-more { padding: 2px 0 !important; margin: 0 !important; }

.num-box.is-off { opacity: .45; }
.num-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 12px; }
.num-tools[hidden] { display: none; }
.num-tools__search { flex: 1 1 240px; min-height: 44px; }
.num-tools__only { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.num-tools__only input { width: 20px; height: 20px; accent-color: var(--blue); }
.num-tools__btns { display: inline-flex; flex-wrap: wrap; gap: 8px; }
.num-tools .btn { min-height: 40px; padding: 0 14px; font-size: 14px; }
.num-picks--long { max-height: 440px; overflow-y: auto; padding: 2px 4px 2px 2px; align-content: start; }
.num-pick[hidden] { display: none; }
.num-empty { margin: 10px 0 0; }

/* TABLE-SCROLL-20261127 — широкі таблиці на екранах ≥ 720 px (iPhone горизонтально, вузьке вікно ПК)
   гортаються по горизонталі, а не обрізаються (у base.css .table-card має overflow: hidden). */
@media (min-width: 720px) { .table-card { overflow-x: auto; } }

/* LOGO-20261127 — знак HelperCRM 42×50 (пропорции 0.84) і блок біля меню як в CRM:
   знак 42×50, кнопка 50 px, відступи 22 зліва / 19 справа, проміжок 8. */
.logo { width: 34px; height: 40px; }
.topbar__brand .logo { width: 30px; height: 36px; }
.side-brand { gap: 8px; padding: 10px 19px 10px 22px; }
.side-brand .logo { width: 42px; height: 50px; }
.side-brand__btn { min-height: 50px; }

/* TABLE-SCROLL-SR-20261127 — прихований текст .sr (position: absolute) у заголовках таблиць не має
   вилазити за картку, що гортається, і розширювати всю сторінку. */
.table-card, .table-scroll { position: relative; }
/* HOURS-20261127: робочий час у формі сценарію («Цілодобово» ховає графік) */
.hours-box:has(input[name="hours_mode"][value="always"]:checked) .hours-body { display: none; }
.hours-body { display: grid; gap: 12px; }
.hours { display: grid; gap: 8px; }
.hours__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.hours__day { display: inline-flex; align-items: center; gap: 10px; min-width: 150px; min-height: 44px; cursor: pointer; }
.hours__day input { width: 20px; height: 20px; accent-color: var(--blue); flex: none; }
.hours .input.hours__time { width: 92px; text-align: center; font-variant-numeric: tabular-nums; }
.hours__off { display: none; }
.hours__row:has(.hours__day input:not(:checked)) .hours__time { opacity: .4; }
.hours__row:has(.hours__day input:not(:checked)) .hours__off { display: inline; }
.hours__row .field__error { flex-basis: 100%; }

/* AUDIO-SCN-20261127: аудіо в сценарії */
.scn-audio .card__title { margin-bottom: 6px; }
.aud-list { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.aud-item { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.aud-item__info { display: grid; gap: 2px; flex: 1 1 220px; min-width: 0; }
.aud-item__name { overflow-wrap: anywhere; }
.aud-item__use { color: var(--ok-text); }
.aud-item form { margin: 0; }
.scn-audio__upload { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
@media (max-width: 719.98px) { .aud-item .rec, .aud-item .rec audio { width: 100%; max-width: none; } }
/* AUDIO-SCN2-20261127: рівні колонки — назва | плеєр | кнопка (порожня, якщо файл звучить) */
@media (min-width: 720px) {
  .aud-item { display: grid; grid-template-columns: minmax(0, 1fr) auto 112px; }
  .aud-item form { justify-self: end; }
}

/* LINE-NAMES-20261127 — назви номерів: «Університет» над номером; редагування в «Номерах» */
.line-cell { display: inline-flex; flex-direction: column; gap: 1px; vertical-align: middle; }
.line-cell__name { font-weight: 500; white-space: normal; overflow-wrap: anywhere; max-width: 18em; }
.line-cell__num { color: var(--muted); font-size: 14px; font-weight: 400; white-space: nowrap; }
.line-edit summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; list-style: none; }
.line-edit summary::-webkit-details-marker { display: none; }
.line-edit summary .icon { width: 16px; height: 16px; flex: none; color: var(--muted); }
.line-edit summary:hover .icon, .line-edit[open] summary .icon { color: var(--link); }
.line-edit__add { color: var(--link); font-weight: 500; }
.line-edit__form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center;
  width: min(360px, 100%); margin: 2px 0 6px; text-align: left; }
.line-edit__form .input { min-height: 44px; text-align: left; }
.line-edit__hint { grid-column: 1 / -1; font-size: 13px; line-height: 1.35; color: var(--muted); white-space: normal; }
.table--numbers tr { scroll-margin-top: 96px; }
@media (min-width: 720px) { .table--numbers .line-td { min-width: 170px; } .line-edit[open] { min-width: 320px; } }
@media (max-width: 719.98px) {
  .table--stack .line-cell { align-items: flex-end; text-align: right; }
  .table.table--stack td > .line-edit { justify-self: stretch; }
  .line-edit summary { width: 100%; justify-content: flex-end; }
  .line-edit__form { width: 100%; }
  .table.table--stack td.line-td { grid-template-columns: auto minmax(0, 1fr); }
  .line-edit__form .input { grid-column: 1 / -1; }
  .line-edit__form .btn { grid-column: 2; grid-row: 2; }
  .line-edit__hint { grid-column: 1; grid-row: 2; }
}

/* QC-PER-NUMBER-20261127: що перевіряти — окремо для кожного номера */
.qc-prompt .table-scroll { margin-top: 12px; }
.qc-prompt-cell { max-width: 560px; }
.qc-prompt-preview { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; overflow-wrap: anywhere; }
.qc-prompt__num { margin: 0 0 12px; }
.qc-also { margin: 2px 0 14px; }
.qc-also > summary { cursor: pointer; color: var(--link); padding: 10px 0; }
.qc-also .num-picks { margin-top: 4px; }
.qc-pick { display: flex; gap: 10px; cursor: pointer; }
.qc-pick input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--blue); flex: none; }
.qc-pick small { display: block; margin-top: 2px; }
.qc-nums { list-style: none; margin: 12px 0 8px; padding: 0; display: grid; gap: 10px; }
.qc-nums li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
/* QC-PER-NUMBER-BTN-20261127: кнопка в таблиці — свої відступи, а не зона нажаття посилання */
.table a.btn--sm { padding: 0 18px; margin: 0; }

/* RESPONSIVE-TABLES-20261127 — таблиці адаптивні:
   < 1280 px (телефони, планшети, вузькі вікна) — карточками (720–1279 — по 2+ в ряд);
   1280–1439 px — щільніші таблиці, щоб «Дзвінки» і «Якість» вміщалися на ноутбуці без прокрутки вбік. */
@media (min-width: 720px) and (max-width: 1439.98px) {
  .table th, .table td, .table--calls th, .table--calls td { padding-left: 8px; padding-right: 8px; }
  .table th { font-size: 14px; }
  .table--calls td[data-l="Дата"] { white-space: normal; }
  .qc-summary { min-width: 180px; }
}
@media (min-width: 720px) and (max-width: 1279.98px) {
  .table-card:has(> .table--stack), .table-scroll:has(> .table--stack) { background: transparent; box-shadow: none; overflow: visible; }
  .table--stack thead { display: none; }
  .table.table--stack { display: block; }
  .table--stack tbody { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; }
  .table.table--stack tr { display: block; padding: 12px 16px; margin: 0; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
  .table.table--stack tbody tr:hover { background: var(--card); }
  .table.table--stack td { display: grid; grid-template-columns: minmax(96px, 42%) minmax(0, 1fr); column-gap: 12px; padding: 4px 0; border: 0;
    grid-column: auto !important; grid-row: auto !important; text-align: right !important; font-size: 15px; color: var(--text) !important; overflow-wrap: anywhere; white-space: normal; }
  .table.table--stack td::before { content: attr(data-l); grid-column: 1; grid-row: 1 / span 6; color: var(--muted); text-align: left; }
  .table.table--stack td > * { grid-column: 2; justify-self: end; }
  .table.table--stack td:empty { display: none; }
  .table.table--stack td:first-child { font-size: 17px; }
  .table--stack .badge { white-space: normal; }
  .table--stack .line-cell { align-items: flex-end; text-align: right; }
  .table.table--stack td > .line-edit { justify-self: stretch; }
  .table--stack .line-edit summary { width: 100%; justify-content: flex-end; }
  .table--stack .line-edit[open], .table--stack .line-td { min-width: 0; }
  .table--stack .line-edit__form { width: 100%; }
  .table.table--stack td.line-td { grid-template-columns: auto minmax(0, 1fr); }
  .table--stack .line-edit__form .input { grid-column: 1 / -1; }
  .table--stack .line-edit__form .btn { grid-column: 2; grid-row: 2; }
  .table--stack .line-edit__hint { grid-column: 1; grid-row: 2; }
}
@media (max-width: 1279.98px) {
  .table--stack td.qc-summary, .table--stack td.qc-prompt-cell { min-width: 0; max-width: none; }
  .table.table--stack td.qc-summary, .table.table--stack td.qc-prompt-cell { grid-template-columns: minmax(0, 1fr); row-gap: 2px; text-align: left !important; }
  .table.table--stack td.qc-summary::before, .table.table--stack td.qc-prompt-cell::before { grid-row: auto; }
  .table.table--stack td.qc-summary > *, .table.table--stack td.qc-prompt-cell > * { grid-column: 1; justify-self: start; }
}
