/*
    Fix 97-7: единый вид галочек (чекбоксов) на всём сайте.
    Подключается на всех страницах после jd-dark.css.
    Не трогает переключатели-«тумблеры», где сам input спрятан (.cpx-toggle, .jdn-switch, .supplier-autoprice-toggle)
    и чекбоксы с классом .jd-native (если где-то нужен системный вид).
*/
:root {
    --jdc-box-bg: #ffffff;
    --jdc-box-border: #b8c4d6;
    --jdc-box-hover: #2563eb;
    --jdc-on: #2563eb;
    --jdc-mark: #ffffff;
    --jdc-focus: rgba(37, 99, 235, .22);
    --jdc-text: inherit;
}
html[data-theme="dark"] {
    --jdc-box-bg: #141b2b;
    --jdc-box-border: #3b4a63;
    --jdc-box-hover: #61a4ed;
    --jdc-on: #3b82f6;
    --jdc-mark: #ffffff;
    --jdc-focus: rgba(97, 164, 237, .28);
}

input[type="checkbox"]:not(.jd-native):not(.cpx-toggle input):not(.jdn-switch input):not(.supplier-autoprice-toggle input) {
    -webkit-appearance: none !important;
    appearance: none !important;
    box-sizing: border-box !important;
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    max-width: 20px !important;
    flex: 0 0 20px !important;
    margin: 1px 0 0 !important;
    padding: 0 !important;
    border: 1.5px solid var(--jdc-box-border) !important;
    border-radius: 6px !important;
    background: var(--jdc-box-bg) !important;
    box-shadow: none !important;
    display: inline-grid !important;
    place-content: center !important;
    vertical-align: middle !important;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, box-shadow .15s;
}
input[type="checkbox"]:not(.jd-native):not(.cpx-toggle input):not(.jdn-switch input):not(.supplier-autoprice-toggle input)::before {
    content: "";
    width: 10px;
    height: 6px;
    border-left: 2.5px solid var(--jdc-mark);
    border-bottom: 2.5px solid var(--jdc-mark);
    transform: translateY(-1px) rotate(-45deg) scale(0);
    transition: transform .12s ease-out;
}
input[type="checkbox"]:not(.jd-native):not(.cpx-toggle input):not(.jdn-switch input):not(.supplier-autoprice-toggle input):hover:not(:disabled) {
    border-color: var(--jdc-box-hover) !important;
}
input[type="checkbox"]:not(.jd-native):not(.cpx-toggle input):not(.jdn-switch input):not(.supplier-autoprice-toggle input):focus-visible {
    outline: none !important;
    box-shadow: 0 0 0 4px var(--jdc-focus) !important;
}
input[type="checkbox"]:not(.jd-native):not(.cpx-toggle input):not(.jdn-switch input):not(.supplier-autoprice-toggle input):checked,
input[type="checkbox"]:not(.jd-native):not(.cpx-toggle input):not(.jdn-switch input):not(.supplier-autoprice-toggle input):indeterminate {
    background: var(--jdc-on) !important;
    border-color: var(--jdc-on) !important;
}
input[type="checkbox"]:not(.jd-native):not(.cpx-toggle input):not(.jdn-switch input):not(.supplier-autoprice-toggle input):checked::before {
    transform: translateY(-1px) rotate(-45deg) scale(1);
}
input[type="checkbox"]:not(.jd-native):not(.cpx-toggle input):not(.jdn-switch input):not(.supplier-autoprice-toggle input):indeterminate::before {
    width: 10px; height: 0; border-left: 0; transform: none;
}
input[type="checkbox"]:not(.jd-native):disabled {
    opacity: .45;
    cursor: not-allowed;
}

/* Строка «галочка + подпись»: в одну строку, по левому краю, кликабельна целиком. */
label:has(> input[type="checkbox"]:first-child:not(.jd-native)):not(.cpx-toggle):not(.jdn-switch):not(.supplier-autoprice-toggle) {
    display: flex !important;
    grid-template-columns: none !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    text-align: left !important;
    cursor: pointer;
}
label:has(> input[type="checkbox"]:first-child:not(.jd-native)):not(.cpx-toggle):not(.jdn-switch):not(.supplier-autoprice-toggle) > span {
    flex: 1 1 auto;
    text-align: left !important;
    line-height: 1.4;
}

/* Карточка клиента: «работа в долг» — как обычное поле формы. */
.supplier-check-row {
    padding: 14px 16px !important;
    border: 1px solid var(--jdc-box-border);
    border-radius: 14px;
    font-weight: 700;
}
html[data-theme="dark"] .supplier-check-row { background: rgba(20, 27, 43, .6); }
.supplier-check-row:has(input:checked) { border-color: var(--jdc-on); }
