/*
 * Стилі кабінету BOT-panel.
 *
 * До 05.09.2026 вони жили в трьох місцях: bot-panel.css, ~1190 рядків
 * heredoc-ом усередині PanelUi.php і ще сотні в registerCss окремих в'юх.
 * Через це однакові компоненти правились у різних файлах, а брейкпоінти
 * розповзалися. Зібрано сюди; PanelUi лишає собі лише PHP.
 *
 * Файл підключає PanelUiAsset, залежний від FrontendAsset, тому вантажиться
 * ПІСЛЯ bot-panel.css — каскад той самий, що був у inline-блоку.
 *
 * Брейкпоінти — тільки бутстрапівські, інших тут не заводити:
 *   max-width: 575.98px  телефон
 *   max-width: 767.98px  телефон/планшет — основний мобільний поріг панелі
 *   max-width: 991.98px  вузький ноутбук, сайдбар ще накладний
 *   min-width:  992px    десктоп, сайдбар у потоці
 */

/* =====================================================================
 * 1. Каркас панелі: тулбари, картки, таблиці, сайдбар, чат
 *    (було: PanelUi::registerAssets)
 * ===================================================================== */

.bot-panel-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.5rem;
}
.bot-panel-toolbar .btn,
.bot-panel-toolbar .bot-panel-toolbar-btn {
    margin: 0 !important;
}
.bot-panel-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.bot-panel-toolbar-btn .bot-panel-toolbar-label {
    line-height: 1.25;
}
.bot-panel-toolbar .btn i,
.bot-panel-toolbar-btn > i {
    flex-shrink: 0;
}

.bot-panel-shell {
    display: flex;
    align-items: flex-start;
    gap: 0;
    position: relative;
    min-height: 200px;
}
.bot-panel-shell-main {
    flex: 1;
    min-width: 0;
    width: 100%;
}
.bot-panel-sidebar {
    flex: 0 0 220px;
    width: 220px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-right: 1rem;
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.bot-panel-sidebar-head {
    padding: 12px 14px;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 1px solid #eee;
    color: #1a5c38;
    word-break: break-word;
}
.bot-panel-sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    flex: 1;
}
.bot-panel-sidebar-foot {
    padding: 8px;
    border-top: 1px solid #eee;
}
.bot-panel-sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    color: #333;
    text-decoration: none !important;
    font-size: 0.875rem;
    border-left: 3px solid transparent;
    transition: background 0.15s, color 0.15s;
}
.bot-panel-sidebar-link:hover {
    background: #f0f7f3;
    color: #1a5c38;
}
.bot-panel-sidebar-link.is-active {
    background: #e8f5ee;
    color: #1a5c38;
    font-weight: 600;
    border-left-color: #1a5c38;
}
.bot-panel-sidebar-link i {
    width: 18px;
    text-align: center;
    color: #1a5c38;
    flex-shrink: 0;
}
.bot-panel-sidebar-link--action {
    border-radius: 6px;
    border: 1px solid #1a5c38;
    background: #1a5c38;
    color: #fff;
    justify-content: center;
}
.bot-panel-sidebar-link--action i,
.bot-panel-sidebar-link--action .bot-panel-sidebar-label {
    color: #fff;
}
.bot-panel-sidebar-link--action:hover {
    background: #145336;
    color: #fff;
}
.bot-panel-sidebar-account {
    display: none;
    border-top: 1px solid #eee;
    padding: 8px 0 10px;
    margin-top: auto;
}
.bot-panel-sidebar-account-head {
    padding: 8px 14px 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.bot-panel-sidebar-link--account {
    font-size: 0.85rem;
}
.bot-panel-sidebar-lang {
    padding: 8px 14px 4px;
    border-top: 1px solid #f1f3f5;
    margin-top: 4px;
}
.bot-panel-sidebar-lang-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 6px;
    text-transform: uppercase;
}
.bot-panel-sidebar-lang-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.bot-panel-sidebar-lang-link {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid #dee2e6;
    color: #333;
    text-decoration: none !important;
    font-size: 0.8rem;
}
.bot-panel-sidebar-lang-link.is-active,
.bot-panel-sidebar-lang-link:hover {
    background: #e8f5ee;
    border-color: #1a5c38;
    color: #1a5c38;
}
.bot-panel-burger-bar {
    display: none;
}
.bot-panel-burger {
    display: none;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    padding: 10px 16px;
    background: #1a5c38;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(26, 92, 56, 0.25);
}
.bot-panel-burger:hover,
.bot-panel-burger:focus {
    background: #145336;
    color: #fff;
}
.bot-panel-burger i {
    font-size: 1.35rem;
    line-height: 1;
}
.bot-panel-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1040;
}
/* Каркас кабінету переходить у режим «сайдбар за бургером» до 992px, а не до
 * 768px. Між 768 і 992 колонка на 220px з'їдала третину ширини, і таблиці
 * розділів лишались без місця. Поріг збігається з bootstrap-івським lg, на
 * якому нижче міняється й ширина контейнера. */
@media (max-width: 991.98px) {
    .bot-panel-shell {
        flex-direction: column;
        align-items: stretch;
    }
    .bot-panel-has-shell .bot-panel-navbar .navbar-toggler,
    .bot-panel-has-shell .bot-panel-navbar .navbar-collapse,
    .bot-panel-has-shell .bot-panel-navbar .navbar-nav,
    body:has(.bot-panel-shell) .bot-panel-navbar .navbar-toggler,
    body:has(.bot-panel-shell) .bot-panel-navbar .navbar-collapse,
    body:has(.bot-panel-shell) .bot-panel-navbar .navbar-nav {
        display: none !important;
    }
    .bot-panel-has-shell .bot-panel-navbar,
    body:has(.bot-panel-shell) .bot-panel-navbar {
        min-height: 56px;
        padding-top: 0.35rem;
        padding-bottom: 0.35rem;
    }
    .bot-panel-has-shell .bot-panel-navbar .container,
    .bot-panel-has-shell .bot-panel-navbar .container-fluid,
    body:has(.bot-panel-shell) .bot-panel-navbar .container,
    body:has(.bot-panel-shell) .bot-panel-navbar .container-fluid {
        flex-wrap: nowrap;
        justify-content: flex-start;
    }
    .bot-panel-burger-bar {
        display: block;
        position: sticky;
        top: 56px;
        z-index: 1020;
        padding: 8px 0 6px;
        margin-bottom: 8px;
        background: #f8f9fa;
        border-bottom: 1px solid #e9ecef;
    }
    .bot-panel-burger-bar .bot-panel-burger {
        display: inline-flex;
        align-self: flex-start;
        width: auto;
        max-width: 100%;
        padding: 12px 16px;
        font-size: 1rem;
        flex-shrink: 0;
        border-radius: 10px;
    }
    .bot-panel-burger-bar .bot-panel-burger i {
        font-size: 1.5rem;
    }
    /* Підпис лишається видимим: сама іконка нічого не пояснює, а це єдиний
     * вхід у розділи бота на вузькому екрані. */
    .bot-panel-burger-text {
        display: inline;
        font-size: 0.95rem;
        font-weight: 600;
    }
    .bot-panel-sidebar-account {
        display: block;
    }
    .bot-panel-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 1050;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
        width: min(280px, 88vw);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.12);
    }
    .bot-panel-shell.is-sidebar-open .bot-panel-sidebar {
        transform: translateX(0);
    }
    .bot-panel-shell.is-sidebar-open .bot-panel-overlay {
        display: block;
    }
    .bot-panel-shell-main {
        width: 100%;
    }
}

.bot-panel-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.5rem 0.75rem;
}
.bot-panel-filter-bar .form-group {
    margin-bottom: 0 !important;
}
.bot-panel-filter-bar .btn {
    margin: 0 !important;
}
.bot-panel-form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.bot-panel-form-actions .btn {
    margin: 0 !important;
}
.bot-scenarios-panel {
    background: #f6f8fa;
    border: 1px solid #e8ecef;
    border-radius: 8px;
    padding: 1rem 1.15rem;
}
.bot-scenarios-panel + .bot-scenarios-panel {
    margin-top: 1rem;
}
.bot-scenarios-panel__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    margin-bottom: 0.75rem;
}
.bot-scenarios-panel__head h6 {
    margin: 0;
    font-weight: 600;
}
.bot-scenarios-enable-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1.25rem;
}
.bot-scenarios-enable-row .custom-control {
    margin-bottom: 0;
}
.bot-scenarios-form .form-group:last-of-type {
    margin-bottom: 0;
}
.bot-scenarios-form .form-control {
    max-width: 100%;
}
.bot-scenarios-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem 1.5rem;
    margin-top: 0.25rem;
}
.bot-scenarios-meta-row .form-group {
    margin-bottom: 0;
    min-width: 5rem;
}
.bot-scenarios-meta-row .custom-control {
    margin-bottom: 0;
}
.bot-scenarios-status {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}
.bot-scenarios-status--sent {
    background: #e8f5ee;
    color: #1a5c38;
}
.bot-scenarios-status--failed {
    background: #fdecea;
    color: #b42318;
}
.bot-scenarios-status--skipped {
    background: #f3f4f6;
    color: #6b7280;
}
.bot-panel-table .bot-panel-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.35rem;
    min-width: 9.5rem;
}
.bot-panel-table .bot-panel-actions > .btn,
.bot-panel-table .bot-panel-actions > a.btn {
    display: block;
    width: 100%;
    text-align: center;
    white-space: nowrap;
}
.bot-panel-table .bot-panel-action-form {
    display: block;
    width: 100%;
    margin: 0;
}
.bot-panel-table .bot-panel-action-form .btn {
    display: block;
    width: 100%;
    margin: 0 !important;
}
.bot-panel-actions--row {
    flex-direction: row !important;
    align-items: center !important;
    min-width: 0 !important;
    gap: 0.35rem !important;
}
.bot-panel-actions--row .bot-panel-action-form,
.bot-panel-actions--row .bot-panel-action-form .btn {
    width: auto !important;
    display: inline-block !important;
}
.bot-authorization-table .bot-panel-action-cell {
    width: 10.5rem;
    min-width: 10.5rem;
    vertical-align: middle;
}
.bot-authorization-table .bot-panel-action-cell .bot-panel-actions .btn {
    font-size: 0.8125rem;
    padding: 0.35rem 0.5rem;
}
.bot-dashboard-stat-card .card-body {
    padding: 1rem 0.75rem;
}
.bot-dashboard-stat-label {
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}
.bot-dashboard-stat-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1a5c38;
    line-height: 1.2;
}
.bot-dashboard-stat-sub {
    font-size: 0.8rem;
    color: #6c757d;
}
.bot-dashboard-compact-stats {
    display: none;
}
.bot-dashboard-top {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}
@media (max-width: 991.98px) {
    .bot-dashboard-top {
        grid-template-columns: 1fr;
    }
}
.bot-dashboard-chart-card {
    border: 1px solid #e2ebe6;
    border-radius: 10px;
    background: #fff;
    padding: 1rem 1rem 0.85rem;
    min-height: 280px;
    display: flex;
    flex-direction: column;
}
.bot-dashboard-chart-card__head,
.bot-dashboard-chart-card__title-row,
.bot-dashboard-chart-card__section,
.bot-dashboard-chart-card__title-wrap,
.bot-dashboard-chart-card .bot-dashboard-chart-card__title {
    display: none !important;
}
.bot-dashboard-chart-card__banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem 1rem;
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}
.bot-dashboard-chart-card__banner-main {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex: 1 1 180px;
    min-width: 0;
}
.bot-dashboard-chart-card__stat {
    min-width: 0;
}
.bot-dashboard-chart-card__banner--calls {
    background: linear-gradient(135deg, #e9f7ee 0%, #d2edd9 100%);
    border: 1px solid #b7dfc3;
}
.bot-dashboard-chart-card__banner--broadcast {
    background: linear-gradient(135deg, #eaf5ff 0%, #cfe8ff 100%);
    border: 1px solid #a8d4f5;
}
.bot-dashboard-chart-card__icon {
    font-size: 1.35rem;
    color: #1a5c38;
    flex: 0 0 auto;
}
.bot-dashboard-chart-card__banner--broadcast .bot-dashboard-chart-card__icon {
    color: #2b7bbf;
}
.bot-dashboard-chart-card__headline {
    display: block;
    font-size: 1.35rem;
    font-weight: 800;
    color: #1a5c38;
    margin: 0;
    line-height: 1.15;
}
.bot-dashboard-chart-card__banner--broadcast .bot-dashboard-chart-card__headline {
    color: #1f5f99;
}
.bot-dashboard-chart-card__title {
    font-size: 1.35rem;
    font-weight: 800;
    color: #1a5c38;
    margin: 0;
    line-height: 1.15;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.bot-dashboard-chart-card__banner--broadcast .bot-dashboard-chart-card__title {
    color: #1f5f99;
}
.bot-dashboard-chart-card__subtitle {
    display: block;
    font-size: 0.76rem;
    color: #5f6f66;
    margin-top: 0.1rem;
}
.bot-dashboard-chart-card__banner--broadcast .bot-dashboard-chart-card__subtitle {
    color: #5a7085;
}
.bot-dashboard-chart-summary-label {
    font-size: 0.78rem;
    color: #6c757d;
    margin-right: 0.15rem;
}
.bot-dashboard-barchart-wrap {
    border-top: 1px solid #edf2ef;
    padding-top: 0.35rem;
}
.bot-dashboard-barchart-y {
    display: block;
    font-size: 0.68rem;
    color: #6c757d;
    margin-bottom: 0.2rem;
}
.bot-dashboard-barchart {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    min-height: 118px;
    flex: 1 1 auto;
    overflow-x: hidden;
    width: 100%;
}
.bot-dashboard-barchart--period-month {
    overflow-x: auto;
}
.bot-dashboard-barchart--period-day .bot-dashboard-barchart__bar,
.bot-dashboard-barchart--period-week .bot-dashboard-barchart__bar {
    min-width: 0;
    max-width: none;
    flex: 1 1 0;
}
.bot-dashboard-barchart--period-month .bot-dashboard-barchart__bar {
    min-width: 0;
    max-width: none;
    flex: 1 1 0;
}
.bot-dashboard-barchart__label.is-tick {
    font-size: 0.65rem;
}
.bot-dashboard-barchart__value.is-empty {
    visibility: hidden;
    height: 0;
    margin: 0;
    padding: 0;
}
.bot-dashboard-barchart__bar {
    flex: 1 1 0;
    min-width: 8px;
    max-width: 22px;
    height: 108px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 0.15rem;
}
.bot-dashboard-barchart__fill {
    width: 100%;
    min-height: 2px;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, #3ecf7a 0%, #1a5c38 100%);
    transition: height 0.2s ease;
}
.bot-dashboard-barchart__label {
    font-size: 0.58rem;
    color: #6c757d;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    min-height: 0.7rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.bot-dashboard-barchart__label:not(.is-tick) {
    visibility: hidden;
}
.bot-dashboard-barchart-axis-x {
    margin-top: 0.25rem;
    font-size: 0.68rem;
    color: #6c757d;
    text-align: center;
}
.bot-dashboard-barchart__value {
    font-size: 0.6rem;
    font-weight: 700;
    color: #1a5c38;
    line-height: 1;
}
.bot-dashboard-barchart__value.is-zero {
    color: #c5d4cc;
    font-weight: 500;
}
.bot-dashboard-chart-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.bot-dashboard-chart-tab {
    border: 1px solid #cfe0d6;
    background: #f8fbf9;
    color: #1a5c38;
    border-radius: 999px;
    padding: 0.2rem 0.65rem;
    font-size: 0.78rem;
    line-height: 1.3;
    cursor: pointer;
}
.bot-dashboard-chart-tab.is-active {
    background: #1a5c38;
    border-color: #1a5c38;
    color: #fff;
}
.bot-dashboard-chart-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.35rem 1rem;
    margin-bottom: 0.5rem;
}
.bot-dashboard-chart-summary .bot-dashboard-stat-value {
    font-size: 1.75rem;
}
.bot-dashboard-barchart--broadcast .bot-dashboard-barchart__fill {
    background: linear-gradient(180deg, #6ec1ff 0%, #2b7bbf 100%);
}
.bot-dashboard-barchart--broadcast .bot-dashboard-barchart__value {
    color: #2b7bbf;
}
.bot-dashboard-chat-id-link {
    text-decoration: none;
    font-weight: 600;
}
.bot-dashboard-chat-id-link:hover code {
    text-decoration: underline;
}
.bot-dashboard-compact-block {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.85rem;
}
.bot-dashboard-compact-block strong {
    color: #1a5c38;
}
.bot-dashboard-compact-block b {
    color: #28a745;
    font-weight: 700;
}
.bot-panel-chat-id,
.bot-dashboard-table .col-chat code,
.bot-authorization-table code,
.bot-panel-table .col-chat-id code {
    color: #28a745;
    background: transparent;
    font-size: 0.95em;
    font-weight: 600;
    padding: 0;
}
.bot-dashboard-chat-link {
    color: #1a5c38;
    font-weight: 600;
    text-decoration: none;
}
.bot-dashboard-chat-link:hover {
    color: #28a745;
    text-decoration: underline;
}
.bot-dashboard-telegram-link {
    color: #28a745;
    font-size: 1rem;
    vertical-align: middle;
}
.bot-dashboard-table .col-chat a code {
    color: inherit;
}
.bot-chat-sender-link {
    color: inherit;
    text-decoration: underline;
}
.bot-chat-sender-link:hover {
    color: #1a5c38;
}
.bot-chat-compose {
    padding: 1rem;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    background: #fafbfc;
}
.bot-chat-compose .form-group {
    margin-bottom: 0.75rem;
}
.bot-chat-compose__top {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem 1.25rem;
}
.bot-chat-compose__media {
    flex: 0 0 140px;
    width: 140px;
    max-width: 100%;
    min-width: 0;
}
.bot-chat-compose__links {
    flex: 1 1 280px;
    min-width: 0;
}
.bot-chat-compose__extras > summary {
    cursor: pointer;
    color: #0f5132;
    font-size: 0.875rem;
    padding: 0.35rem 0;
    list-style: none;
}
.bot-chat-compose__extras > summary::before {
    content: "+ ";
    font-weight: 600;
}
.bot-chat-compose__extras[open] > summary::before {
    content: "\2212 ";
}
.bot-chat-compose__bottom {
    margin-top: 0.25rem;
}
.bot-chat-compose__bottom textarea {
    min-height: 96px;
    resize: vertical;
}
.bot-chat-compose__actions {
    display: flex;
    justify-content: flex-end;
    margin-top: -0.25rem;
}
.bot-chat-compose__media .upload-kit,
.bot-chat-compose__media .upload-kit-input,
.bot-chat-compose__media .upload-kit-item,
.bot-chat-compose__media .upload-kit-input .upload-kit-item-add {
    max-width: 100%;
    box-sizing: border-box;
}
.bot-chat-compose__media .upload-kit-item,
.bot-chat-compose__media .upload-kit-input .upload-kit-item-add {
    width: 120px !important;
    height: 120px !important;
    max-width: 100%;
    margin: 0 auto;
}
.bot-panel-chat-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem 1rem;
}
.bot-panel-chat-meta {
    font-size: 0.875rem;
    color: #6c757d;
}
#bot-chat-thread {
    max-height: min(60vh, 640px);
    overflow-y: auto;
    padding: 0.5rem 0.25rem 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.bot-panel-chat-bubble {
    max-width: min(85%, 720px);
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    background: #f1f3f5;
    word-break: break-word;
}
.bot-panel-chat-bubble.is-right {
    align-self: flex-end;
    background: #e8f5ee;
}
.bot-panel-chat-bubble.is-left {
    align-self: flex-start;
}
.bot-panel-chat-bubble .chat-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    margin-bottom: 0.35rem;
}
.bot-panel-chat-bubble .chat-body {
    white-space: pre-wrap;
}
@media (max-width: 767.98px) {
    .bot-chat-compose {
        padding: 0.85rem;
    }
    .bot-chat-compose__top {
        flex-direction: column;
    }
    .bot-chat-compose__media {
        flex-basis: auto;
        width: 100%;
    }
    .bot-panel-chat-bubble {
        max-width: 95%;
    }
}
.bot-dashboard-main-card .card-header {
    padding: 0.85rem 1rem;
}
.bot-dashboard-table-wrap {
    overflow-x: auto;
}
.bot-dashboard-table {
    width: 100%;
    min-width: 640px;
    table-layout: auto;
}
.bot-dashboard-table th,
.bot-dashboard-table td {
    padding: 0.7rem 1rem !important;
    vertical-align: middle;
}
.bot-dashboard-table .col-name {
    min-width: 220px;
    max-width: 420px;
    word-break: break-word;
}
.bot-dashboard-table .col-chat {
    width: 150px;
    white-space: nowrap;
}
.bot-dashboard-table .col-rating {
    width: 100px;
    text-align: center;
}
.bot-dashboard-table .col-date {
    width: 170px;
    white-space: nowrap;
}
.bot-panel-icon-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}
.bot-panel-btn-icon {
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.bot-panel-btn-icon i {
    font-size: 0.9rem;
}

.bot-panel-table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 767.98px) {
    .bot-panel-shell-main {
        padding: 0 0.5rem;
    }
    .bot-panel-shell-main .bot-panel-card {
        border-radius: 10px;
        overflow: hidden;
    }
    .bot-panel-shell-main .bot-panel-card > .card-header {
        padding: 0.65rem 0.75rem;
        border-bottom: 1px solid #eef1f3;
    }
    .bot-panel-toolbar {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.45rem;
    }
    .bot-panel-toolbar form.d-inline {
        display: contents;
    }
    .bot-panel-toolbar .btn,
    .bot-panel-toolbar .bot-panel-toolbar-btn,
    .bot-panel-toolbar button.bot-panel-toolbar-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.3rem;
        min-height: 3.4rem;
        padding: 0.45rem 0.35rem;
        font-size: 0.72rem;
        line-height: 1.2;
        text-align: center;
        white-space: normal;
        border-radius: 8px;
    }
    .bot-panel-toolbar .btn > i,
    .bot-panel-toolbar-btn > i,
    .bot-panel-toolbar button.bot-panel-toolbar-btn > i {
        margin: 0;
        font-size: 1rem;
    }
    .bot-panel-toolbar-btn--wide {
        grid-column: 1 / -1;
        min-height: 2.75rem;
        flex-direction: row;
        justify-content: center;
        font-size: 0.8rem;
    }
    .bot-panel-shell-main .bot-panel-card .card-body {
        padding: 0.75rem;
    }
    .bot-panel-filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .bot-panel-filter-bar .form-group {
        width: 100%;
    }
    .bot-panel-filter-bar .form-control,
    .bot-panel-filter-bar input[type="date"],
    .bot-panel-filter-bar select {
        width: 100% !important;
        max-width: 100%;
    }
    .bot-panel-table-scroll {
        overflow-x: visible;
    }
    .bot-panel-table.is-mobile-cards {
        border: 0;
        background: transparent;
    }
    /* Деякі розділи ставлять таблиці min-width (дашборд — 640 px). Поки це
       таблиця — доречно, у картках — знову горизонтальний скрол. */
    body.bot-panel-body .bot-panel-table.is-mobile-cards {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        table-layout: auto !important;
    }
    .bot-panel-table.is-mobile-cards thead {
        display: none;
    }
    .bot-panel-table.is-mobile-cards tbody tr {
        display: block;
        border: 1px solid #dee2e6;
        border-radius: 8px;
        margin-bottom: 0.65rem;
        background: #fff;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    }
    .bot-panel-table.is-mobile-cards tbody td {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 0.65rem;
        border: none;
        border-bottom: 1px solid #f1f3f5;
        padding: 0.45rem 0.65rem;
        white-space: normal !important;
        font-size: 0.875rem;
    }
    .bot-panel-table.is-mobile-cards tbody td:last-child {
        border-bottom: none;
    }
    .bot-panel-table.is-mobile-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.72rem;
        color: #1a5c38;
        flex: 0 0 36%;
        max-width: 40%;
        line-height: 1.35;
    }
    .bot-panel-table.is-mobile-cards tbody td.bot-panel-action-cell,
    .bot-panel-table.is-mobile-cards tbody td[data-label=""] {
        flex-direction: column;
        align-items: stretch;
    }
    .bot-panel-table.is-mobile-cards tbody td.bot-panel-action-cell::before,
    .bot-panel-table.is-mobile-cards tbody td[data-label=""]::before {
        margin-bottom: 0.15rem;
    }
    .bot-panel-table.is-mobile-cards .bot-panel-actions {
        min-width: 0;
        width: 100%;
    }
    /*
     * У картці на рядок дій є вся ширина, тож іконки ставимо в ряд, а не
     * стовпчиком, і піднімаємо їх з 32 px до розміру, у який попадає палець.
     */
    body.bot-panel-body .bot-panel-table.is-mobile-cards tbody td .bot-grid-actions-wrap,
    body.bot-panel-body .bot-panel-table.is-mobile-cards tbody td .bot-panel-actions,
    body.bot-panel-body .bot-panel-table.is-mobile-cards tbody td .bot-panel-icon-actions {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 0.35rem;
        justify-content: flex-end;
    }
    body.bot-panel-body .bot-panel-table.is-mobile-cards tbody td .btn {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        max-width: none !important;
    }
    /*
     * Окремі сторінки (наприклад список ботів) прибивають свої колонки
     * через display: table-cell !important і width: 1%. Поки таблиця
     * лишається таблицею — це доречно, але в картковому режимі саме воно
     * і ламало розкладку. Перебиваємо адресно, тільки під картки й тільки
     * на телефоні.
     */
    body.bot-panel-body .bot-panel-table.is-mobile-cards tbody tr {
        display: block !important;
    }
    body.bot-panel-body .bot-panel-table.is-mobile-cards tbody td {
        display: flex !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        white-space: normal !important;
    }
    .bot-panel-table.is-mobile-cards thead {
        display: block;
    }
    body.bot-panel-body .bot-panel-table.is-mobile-cards thead tr:not(.filters) {
        display: none !important;
    }
    .bot-panel-table.is-mobile-cards thead tr.filters {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
        padding: 0 0 0.7rem;
        border: 0;
        background: transparent;
    }
    body.bot-panel-body .bot-panel-table.is-mobile-cards thead tr.filters td {
        display: block !important;
        border: 0;
        padding: 0;
        background: transparent;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
    }
    body.bot-panel-body .bot-panel-table.is-mobile-cards thead tr.filters td.is-empty-filter {
        display: none !important;
    }
    .bot-panel-table.is-mobile-cards thead tr.filters td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.7rem;
        font-weight: 600;
        color: #1a5c38;
        line-height: 1.2;
        margin-bottom: 2px;
    }
    .bot-panel-table.is-mobile-cards thead tr.filters .form-control {
        width: 100% !important;
        max-width: 100%;
        min-height: 42px;
    }
    .bot-panel-table.is-mobile-cards tbody td {
        min-height: 42px;
        width: auto !important;
        min-width: 0;
        max-width: none;
    }
    .bot-panel-table.is-mobile-cards tbody tr:active {
        background: #f2f9f5;
    }
    .bot-panel-shell-main .form-control,
    .bot-panel-shell-main select.form-control,
    .bot-panel-shell-main .custom-select {
        min-height: 42px;
    }
    .bot-panel-shell-main .btn:not(.bot-panel-toolbar-btn):not(.btn-sm) {
        min-height: 44px;
    }
    .pagination {
        justify-content: center;
    }
    .page-link {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/*
 * Пагінація й підсвітки. Бутстрап за замовчуванням малює це синім (#007bff),
 * що не має нічого спільного з палітрою панелі. Перекриваємо на зелений
 * і заразом даємо кнопкам розмір, придатний для пальця.
 */
.pagination {
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 0;
}
.page-link {
    color: #1a5c38;
    border-color: #dee2e6;
    border-radius: 6px;
}
.page-link:hover {
    color: #103b24;
    background-color: #e8f5ee;
    border-color: #cfe6da;
}
.page-link:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(26, 92, 56, 0.25);
}
.page-item.active .page-link {
    background-color: #1a5c38;
    border-color: #1a5c38;
    color: #fff;
}
.page-item.disabled .page-link {
    color: #adb5bd;
}

::selection {
    background: #bfe6d1;
    color: #10301f;
}
::-moz-selection {
    background: #bfe6d1;
    color: #10301f;
}

.dropdown-item.active,
.dropdown-item:active {
    background-color: #1a5c38;
    color: #fff;
}

.bot-panel-shell-main .form-control:focus,
.bot-panel-shell-main .custom-select:focus {
    border-color: #7fc4a2;
    box-shadow: 0 0 0 0.2rem rgba(26, 92, 56, 0.2);
}

.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* На ПК кабінет займає 80% ширини екрана (по 10% відступу з боків) замість
   фіксованих ~1140px Bootstrap. Тягнемо і шапку з футером, щоб краї збігалися.
   Тільки топ-рівневі контейнери — вкладені .container не чіпаємо, інакше 80% від 80%. */
@media (min-width: 992px) {
    body.bot-panel-body .container.bot-panel-container,
    body.bot-panel-body .bot-panel-navbar > .container,
    body.bot-panel-body footer.footer > .container {
        max-width: none;
        width: 80%;
    }
}

/* =====================================================================
 * 2. Список ботів (views/bot/index.php)
 * ===================================================================== */

.bot-index .bot-index-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}
.bot-index .bot-index-table {
    width: 100%;
    table-layout: auto;
    margin-bottom: 0;
}
.bot-index .bot-index-table th,
.bot-index .bot-index-table td {
    text-align: center !important;
    vertical-align: middle !important;
}
.bot-index .bot-list-col-id {
    width: 1%;
    white-space: nowrap;
}
.bot-index .bot-list-col-actions {
    width: 1%;
    white-space: nowrap;
    padding: 0.35rem 0.45rem !important;
}
.bot-index .bot-index-table thead .bot-list-col-actions {
    display: table-cell !important;
    font-size: 0.75rem;
    line-height: 1.2;
    white-space: nowrap;
    vertical-align: middle !important;
}
.bot-index .bot-index-table thead tr.filters td.bot-list-col-actions-filter {
    display: table-cell !important;
    padding: 0.25rem !important;
    background: #f8f9fa;
}
.bot-index .bot-index-table tbody td.bot-list-col-actions {
    display: table-cell !important;
    vertical-align: middle !important;
    white-space: nowrap;
}
.bot-index .bot-grid-actions-wrap {
    display: inline-flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    vertical-align: middle;
}
.bot-index .bot-list-col-actions .btn,
.bot-index .bot-grid-actions-wrap .btn {
    float: none !important;
    display: inline-flex !important;
    flex: 0 0 auto !important;
    width: 2rem !important;
    height: 2rem !important;
    min-width: 2rem !important;
    max-width: 2rem !important;
    padding: 0 !important;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.bot-index .bot-list-col-actions .btn i,
.bot-index .bot-grid-actions-wrap .btn i {
    font-size: 13px;
    line-height: 1;
    margin: 0;
}
.bot-index .bot-list-col-name {
    min-width: max-content;
    max-width: none;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.25;
}
.bot-index .bot-list-col-type {
    min-width: 7rem;
    white-space: nowrap;
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
}
.bot-index .bot-list-col-visible {
    min-width: 6.5rem;
    white-space: nowrap;
    padding-left: 0.65rem !important;
    padding-right: 0.65rem !important;
}
.bot-index .bot-list-col-visible .badge {
    white-space: nowrap;
    font-size: 0.75rem;
    padding: 0.25em 0.55em;
}
.bot-index .bot-index-table .bot-list-col-type .form-control,
.bot-index .bot-index-table .bot-list-col-visible .form-control {
    min-width: 5.5rem;
    padding: 0.25rem 0.45rem;
}
@media (min-width: 768px) {
    .bot-index .bot-list-col-type {
        min-width: 7.5rem;
        padding-left: 0.85rem !important;
        padding-right: 0.85rem !important;
    }
    .bot-index .bot-list-col-visible {
        min-width: 7rem;
        padding-left: 0.85rem !important;
        padding-right: 0.85rem !important;
    }
    .bot-index .bot-list-col-actions {
        width: 1%;
        padding: 0.35rem 0.5rem !important;
    }
    .bot-index .bot-grid-actions-wrap {
        flex-direction: row !important;
        gap: 0.25rem;
    }
}

/* =====================================================================
 * 3. Дзвінки та вихідний обдзвін (views/bot/calls.php)
 * ===================================================================== */

/* Налаштування таблиці згорнуті в <details> — щоденно вони не потрібні,
   а місце вгорі важливіше віддати вихідним дзвінкам і самому журналу. */
.bot-calls-settings {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 0.75rem 0.95rem;
    margin-bottom: 1rem;
}
.bot-calls-settings > summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 0.92rem;
    color: #495057;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.bot-calls-settings > summary::-webkit-details-marker { display: none; }
.bot-calls-settings > summary::before {
    content: "\f013";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: #868e96;
}
.bot-calls-settings > summary::after {
    content: "\f078";
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    margin-left: auto;
    font-size: 0.7rem;
    color: #adb5bd;
    transition: transform .2s ease;
}
.bot-calls-settings[open] > summary::after { transform: rotate(180deg); }
.bot-calls-settings > summary .bot-calls-settings-state {
    font-weight: 400;
    color: #868e96;
    font-size: 0.82rem;
}
.bot-calls-settings-body { padding-top: 0.85rem; }

/* --- Вихідні дзвінки --- */
.bot-outbound {
    border: 1px solid #c3e6d4;
    border-radius: 10px;
    background: linear-gradient(180deg, #f4fbf7 0%, #ffffff 100%);
    padding: 1rem 1.15rem;
    margin-bottom: 1.25rem;
}
.bot-outbound-head {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.3rem;
}
.bot-outbound-head h5 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
    color: #14532d;
}
.bot-outbound-head .fa-phone-volume { color: #1a5c38; }
.bot-outbound-hint {
    font-size: 0.82rem;
    color: #6c757d;
    margin-bottom: 0.85rem;
}
.bot-outbound-webhook-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 0.9rem;
}
.bot-outbound-webhook-row .form-group {
    flex: 1 1 320px;
    margin-bottom: 0;
}
.bot-outbound-tabs {
    display: flex;
    gap: 0.35rem;
    margin-bottom: 0.65rem;
    border-bottom: 1px solid #dee2e6;
}
.bot-outbound-tab {
    border: none;
    background: none;
    padding: 0.4rem 0.85rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #6c757d;
    border-bottom: 2px solid transparent;
    cursor: pointer;
}
.bot-outbound-tab.is-active {
    color: #1a5c38;
    border-bottom-color: #1a5c38;
}
.bot-outbound-pane { display: none; }
.bot-outbound-pane.is-active { display: block; }
.bot-outbound-pane textarea {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.86rem;
}
.bot-outbound-summary {
    display: none;
    margin-top: 0.75rem;
    padding: 0.7rem 0.85rem;
    border-radius: 8px;
    background: #e7f5ec;
    border: 1px solid #c3e6d4;
    font-size: 0.86rem;
}
.bot-outbound-summary.is-active { display: block; }
.bot-outbound-summary .badge { font-size: 0.78rem; }
.bot-outbound-progress { display: none; margin-top: 0.75rem; }
.bot-outbound-progress.is-active { display: block; }
.bot-outbound-progress .progress { height: 1.05rem; background: #d3ece0; }
.bot-outbound-runs { margin-top: 0.9rem; }
.bot-outbound-runs table { font-size: 0.84rem; margin-bottom: 0; }
.bot-outbound-runs table td, .bot-outbound-runs table th { padding: 0.35rem 0.5rem; }
@media (max-width: 767.98px) {
    .bot-outbound { padding: 0.8rem 0.7rem; }
    .bot-outbound-webhook-row .btn { width: 100%; }
    .bot-outbound-tab { flex: 1; text-align: center; padding: 0.45rem 0.3rem; }
    .bot-outbound-runs { overflow-x: auto; }
}
.bot-calls-table-wrap {
    overflow-x: auto;
}
.bot-calls-table-wrap .bot-panel-table {
    min-width: 1020px;
    table-layout: auto;
    width: 100%;
}
.bot-calls-table-wrap .bot-panel-table thead th {
    white-space: nowrap;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.6rem 0.55rem;
    vertical-align: middle;
    line-height: 1.2;
}
.bot-calls-table-wrap .bot-panel-table th,
.bot-calls-table-wrap .bot-panel-table td {
    vertical-align: middle;
    padding: 0.55rem 0.5rem;
}
.bot-calls-table-wrap .col-call-date {
    width: 128px;
    min-width: 128px;
    white-space: nowrap;
}
.bot-calls-table-wrap .col-call-name {
    width: 110px;
    min-width: 110px;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.bot-calls-table-wrap .col-call-phone {
    width: 132px;
    min-width: 132px;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.bot-calls-table-wrap .col-call-direction {
    width: 96px;
    min-width: 96px;
    text-align: center;
}
.bot-calls-table-wrap .col-call-duration {
    width: 84px;
    min-width: 84px;
    white-space: nowrap;
    text-align: center;
}
.bot-calls-table-wrap .col-call-score {
    width: 76px;
    min-width: 76px;
    text-align: center;
}
.bot-calls-table-wrap .col-call-summary {
    min-width: 200px;
}
.bot-calls-table-wrap .col-call-actions {
    width: 96px;
    min-width: 96px;
    text-align: center;
}
.bot-calls-table-wrap .bot-call-actions-inner,
.bot-calls-table-wrap .bot-panel-icon-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 2rem;
}
.bot-calls-table-wrap .bot-call-actions .btn,
.bot-calls-table-wrap .bot-call-actions-inner .btn,
.bot-calls-table-wrap .bot-panel-icon-actions .btn {
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.bot-calls-table-wrap .bot-call-actions .btn i,
.bot-calls-table-wrap .bot-call-actions-inner .btn i,
.bot-calls-table-wrap .bot-panel-icon-actions .btn i {
    font-size: 0.9rem;
}
.bot-calls-table-wrap .call-summary-cell {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
    font-size: 0.92rem;
    color: #495057;
}
.bot-calls-table-wrap .bot-call-row:hover td {
    background: #f1f8f4;
}
.bot-calls-load-progress {
    display: none;
    margin-bottom: 1rem;
    padding: 1rem 1.15rem;
    border: 1px solid #b6d4fe;
    border-radius: 10px;
    background: #e7f1ff;
}
.bot-calls-load-progress.is-active {
    display: block;
}
.bot-calls-load-progress .progress {
    height: 1.1rem;
    background: #cfe2ff;
}
.bot-calls-load-progress .progress-bar {
    transition: width .3s ease;
}
@media (max-width: 767.98px) {
    .bot-calls .bot-panel-card .card-body {
        padding: 0.65rem 0.55rem;
    }
    .bot-calls-table-wrap {
        overflow-x: visible;
        width: 100%;
        margin: 0;
    }
    .bot-calls-table-wrap .bot-panel-table-scroll,
    .bot-calls-table-wrap .gridview {
        overflow-x: visible;
        width: 100%;
        max-width: 100%;
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards {
        min-width: 0 !important;
        width: 100%;
        border: 0;
        background: transparent;
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards thead {
        display: none;
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards tbody tr {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "date direction"
            "name name"
            "phone phone"
            "duration score"
            "summary summary"
            "actions actions";
        gap: 0.1rem 0.65rem;
        padding: 0.85rem 0.9rem;
        margin-bottom: 0.75rem;
        border: 1px solid #dee2e6;
        border-radius: 10px;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards tbody tr:active {
        background: #f8fbf9;
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards tbody td {
        display: block;
        border: none !important;
        padding: 0.15rem 0;
        white-space: normal !important;
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards tbody td::before {
        display: block;
        font-size: 0.65rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: #868e96;
        margin-bottom: 0.15rem;
        line-height: 1.2;
        flex: none;
        max-width: none;
        width: auto;
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards .col-call-date {
        grid-area: date;
        font-weight: 600;
        font-size: 0.88rem;
        color: #495057;
        padding-top: 0;
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards .col-call-direction {
        grid-area: direction;
        justify-self: end;
        align-self: center;
        padding-top: 0;
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards .col-call-name {
        grid-area: name;
        font-size: 1.08rem;
        font-weight: 700;
        color: #212529;
        padding-top: 0.35rem;
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards .col-call-phone {
        grid-area: phone;
        font-size: 0.92rem;
        color: #6c757d;
        font-variant-numeric: tabular-nums;
        padding-bottom: 0.25rem;
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards .col-call-duration {
        grid-area: duration;
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards .col-call-score {
        grid-area: score;
        justify-self: end;
        text-align: right;
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards .col-call-summary {
        grid-area: summary;
        margin-top: 0.35rem;
        padding-top: 0.55rem;
        border-top: 1px dashed #e9ecef !important;
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards .col-call-actions {
        grid-area: actions;
        margin-top: 0.45rem;
        padding-top: 0.55rem;
        border-top: 1px solid #f1f3f5 !important;
        text-align: right;
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards .col-call-date::before,
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards .col-call-direction::before,
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards .col-call-name::before,
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards .col-call-phone::before,
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards .col-call-actions::before {
        display: none;
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards .col-call-name .text-truncate {
        max-width: none !important;
        white-space: normal !important;
        overflow: visible;
        text-overflow: unset;
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards .call-summary-cell {
        -webkit-line-clamp: 4;
        font-size: 0.88rem;
        line-height: 1.45;
    }
    .bot-calls-table-wrap .bot-panel-table.is-mobile-cards .bot-panel-icon-actions {
        justify-content: flex-end;
        width: 100%;
    }
}

/* =====================================================================
 * 4. Форма книги контактів (views/botcontactbooks/_form.php)
 * ===================================================================== */

/* --- Тривога за оцінкою чату: окремий блок угорі розділу, за зразком
   «Вихідних дзвінків» на сторінці дзвінків --- */
.bot-chat-alert {
    border: 1px solid #f5d6a8;
    border-radius: 10px;
    background: linear-gradient(180deg, #fffaf2 0%, #ffffff 100%);
    padding: 1rem 1.15rem;
    margin-bottom: 1.25rem;
}
.bot-chat-alert-head {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.3rem;
}
.bot-chat-alert-head h5 {
    margin: 0;
    font-size: 1.02rem;
    font-weight: 700;
    color: #7a4a06;
}
.bot-chat-alert-head .fa-bell { color: #b8730a; }
.bot-chat-alert-hint {
    font-size: 0.82rem;
    color: #6c757d;
}
.bot-chat-alert-recipient {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.4rem;
}
.bot-chat-alert-recipient input[name^="alert_recipient_chat_id"] { flex: 0 0 190px; }
.bot-chat-alert-recipient input[name^="alert_recipient_title"] { flex: 1 1 200px; }
.bot-chat-alert-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}
.bot-chat-alert-log { margin-top: 0.9rem; }
.bot-chat-alert-log table { font-size: 0.84rem; margin-bottom: 0; }
.bot-chat-alert-log table td, .bot-chat-alert-log table th { padding: 0.35rem 0.5rem; }
@media (max-width: 767.98px) {
    .bot-chat-alert { padding: 0.8rem 0.7rem; }
    .bot-chat-alert-recipient { flex-wrap: wrap; }
    .bot-chat-alert-recipient input[name^="alert_recipient_chat_id"],
    .bot-chat-alert-recipient input[name^="alert_recipient_title"] { flex: 1 1 100%; }
    .bot-chat-alert-actions .btn { width: 100%; }
    .bot-chat-alert-log { overflow-x: auto; }
}
.bot-contact-books-form .bot-contact-book-settings-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid #dee2e6;
}
.bot-contact-books-form .bot-contact-book-settings-bar h5 {
    margin: 0 0 0.75rem;
    font-weight: 600;
}
.bot-contact-books-form .bot-contact-book-csv-panel {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 1rem 1.15rem;
    width: 100%;
}
@media (min-width: 992px) {
    .bot-contact-books-form .bot-contact-book-csv-panel {
        max-width: 400px;
        margin-left: auto;
    }
}
.bot-contact-books-form .bot-contact-book-csv-panel .form-group {
    margin-bottom: 0.35rem;
}
.bot-contact-books-form .bot-contact-book-csv-panel label {
    font-weight: 600;
    margin-bottom: 0.35rem;
}
.bot-contact-books-form .bot-contact-book-list-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
@media (max-width: 767.98px) {
    .bot-contact-books-form .bot-contact-book-list-header {
        flex-direction: column;
        align-items: stretch;
    }
    .bot-contact-books-form .bot-contact-book-list-header .bot-panel-toolbar {
        width: 100%;
    }
}
.bot-contact-books-form .bot-contact-book-table-wrap {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
}
.bot-contact-books-form .bot-contact-book-table-wrap .grid-view.table-responsive {
    display: block;
    width: 100%;
    overflow-x: visible;
}
.bot-contact-books-form .bot-contact-book-table-wrap .bot-panel-table {
    width: 100%;
    min-width: 900px;
}
@media (max-width: 767.98px) {
    .bot-contact-books-form .bot-contact-book-table-wrap .bot-panel-table {
        min-width: 0;
    }
    .bot-contact-books-form .bot-contact-book-list-header .bot-panel-toolbar .btn {
        min-height: 2.65rem;
    }
}
.bot-contact-books-form .bot-contact-book-actions {
    white-space: nowrap;
    width: 1%;
}


/* =====================================================================
 * 5. Мобільний прохід 05.09.2026: тулбар, фільтри, кнопка підтримки
 * ===================================================================== */

/* --- Тулбар: головна дія лишається, решта ховається за «Ще» ------------
 * На телефоні тулбар — сітка з двох колонок високих плиток. Шість кнопок
 * на «Книгах контактів» і п'ять на «Завданнях» з'їдали перший екран цілком,
 * і контент починався нижче згину. Класи is-collapsible / is-overflow
 * розставляє JS: він же знає, скільки кнопок реально в тулбарі. На десктопі
 * жодне з цих правил не діє, тому вимикати їх назад не треба. */
.bot-panel-toolbar-more {
    display: none;
}

@media (max-width: 767.98px) {
    .bot-panel-toolbar.is-collapsible > .bot-panel-toolbar-btn.is-overflow {
        display: none;
    }
    .bot-panel-toolbar.is-collapsible.is-expanded > .bot-panel-toolbar-btn.is-overflow {
        display: flex;
    }
    .bot-panel-toolbar-more {
        display: flex;
        grid-column: 1 / -1;
        align-items: center;
        justify-content: center;
        gap: 0.4rem;
        min-height: 2.5rem;
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
        font-weight: 600;
        border-radius: 8px;
        border: 1px dashed #b7d3c4;
        background: #f4faf7;
        color: #1a5c38;
    }
    .bot-panel-toolbar-more:hover,
    .bot-panel-toolbar-more:focus {
        background: #e8f5ee;
        color: #1a5c38;
    }
    .bot-panel-toolbar-more i {
        transition: transform 0.15s ease;
    }
    .bot-panel-toolbar.is-expanded .bot-panel-toolbar-more i {
        transform: rotate(180deg);
    }
}

/* --- Фільтри списків: за кнопкою, а не розгорнуті завжди ---------------
 * Рядок фільтрів GridView на телефоні займав ще пів екрана до першого
 * рядка даних. Ховаємо його за перемикачем; лічильник у підписі показує,
 * що фільтр застосовано, інакше користувач не зрозуміє, чому список
 * порожній. */
.bot-panel-filters-toggle {
    display: none;
}

@media (max-width: 767.98px) {
    .bot-panel-filters-toggle {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        margin: 0 0 0.5rem;
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
        font-weight: 600;
        border-radius: 8px;
        border: 1px solid #dee2e6;
        background: #fff;
        color: #495057;
    }
    .bot-panel-filters-toggle.is-active {
        border-color: #1a5c38;
        background: #e8f5ee;
        color: #1a5c38;
    }
    .bot-panel-table.is-filters-hidden thead tr.filters {
        display: none;
    }
}

/* --- Кнопка підтримки не наїжджає на футер ----------------------------
 * FAB висить position: fixed, тож футер і низ контенту опинялись під нею.
 * Відступ додаємо футеру, а не body: body у цьому макеті flex-колонка з
 * mt-auto на футері, і padding на ньому не ламає притискання донизу. */
body.bot-panel-body footer.footer {
    padding-bottom: 4.5rem;
}

@media (max-width: 767.98px) {
    body.bot-panel-body footer.footer {
        padding-bottom: 5.25rem;
    }
    .bot-support-fab {
        right: 12px;
        bottom: 12px;
        padding: 0.5rem 0.85rem;
        font-size: 0.85rem;
    }
}
