/* iOS-подобный тоггл для булевых настроек (22.11.2026).
   Input остаётся input[type=checkbox] — x-model, :checked, @change и
   e2e-селекторы input[type=checkbox] работают без изменений.
   Подключён в base.html сразу после tailwind.css; 5 прежних тогглов
   на inline-утилитах peer-checked не тронуты (обратная совместимость). */

.crm-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Визуально скрываем input, но оставляем его в DOM и доступным с клавиатуры. */
.crm-toggle input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    opacity: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Дорожка 51×31, как у эталонных тогглов в app.html. */
.crm-toggle-track {
    position: relative;
    flex: 0 0 auto;
    width: 51px;
    height: 31px;
    border-radius: 9999px;
    background: #e9e9ea;
    transition: background-color .2s ease;
}

/* Прозрачная тап-цель 51×45 px без увеличения высоты строки. */
.crm-toggle-track::before {
    content: "";
    position: absolute;
    top: -7px;
    bottom: -7px;
    left: 0;
    right: 0;
}

/* Кружок 27×27 с тенью. */
.crm-toggle-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 27px;
    height: 27px;
    border-radius: 9999px;
    background: #fff;
    box-shadow: 0 3px 8px rgba(0, 0, 0, .15);
    transition: transform .2s ease;
}

.crm-toggle input:checked + .crm-toggle-track { background: #34c759; }
.crm-toggle input:checked + .crm-toggle-track::after { transform: translateX(20px); }
.crm-toggle input:focus-visible + .crm-toggle-track {
    outline: 2px solid #a7f3d0;
    outline-offset: 2px;
}
