/* Cookie consent (qc-) */
.qc {
    --qc-primary: #877FB0;
    --qc-primary-dark: #6f679b;
    --qc-green: #697B6F;
    --qc-green-light: #E2EBE5;
    --qc-border: #E4E7E5;
    --qc-text: #626262;
    --qc-heading: #202020;
    --qc-radius: 16px;
    --qc-gap: 24px;
    font-family: "Inter", sans-serif;
}

.qc *,
.qc *::before,
.qc *::after {
    box-sizing: border-box;
}

/* Layers: hidden by default, JS toggles .is-open */
.qc-layer {
    display: none;
    position: fixed;
    inset: 0;
    /* Above third-party widgets (Bitrix24 button uses 10150) */
    z-index: 2147483000;
}

.qc-layer.is-open {
    display: flex;
}

.qc-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(32, 32, 32, 0.55);
}

.qc-layer--popup {
    align-items: flex-end;
    justify-content: flex-end;
    padding: var(--qc-gap);
}

.qc-layer--settings {
    align-items: center;
    justify-content: center;
    padding: var(--qc-gap);
}

.qc-popup:focus,
.qc-modal:focus {
    outline: none;
}

/* Typography */
.qc-title {
    margin: 0 0 14px;
    color: var(--qc-heading);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.25;
}

.qc-text p {
    margin: 0 0 10px;
    color: var(--qc-text);
    font-size: 14px;
    line-height: 1.5;
}

.qc-link {
    display: inline-block;
    margin: 4px 0 18px;
    color: var(--qc-primary);
    font-size: 14px;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.qc-link:hover {
    color: var(--qc-primary-dark);
}

/* Popup */
/* Popup: text scrolls, buttons always visible */
.qc-popup {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 420px;
    max-width: 100%;
    max-height: calc(100vh - 2 * var(--qc-gap));
    max-height: calc(100dvh - 2 * var(--qc-gap));
    overflow: hidden;
    background: #fff;
    border-radius: var(--qc-radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.qc-popup__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 28px 28px 0;
}

.qc-popup__body .qc-link {
    margin-bottom: 4px;
}

.qc-popup__foot {
    flex: 0 0 auto;
    padding: 14px 28px 28px;
}

/* Buttons */
.qc-actions {
    display: flex;
    gap: 10px;
}

.qc-actions--stack {
    flex-direction: column;
}

.qc-actions--row > .qc-btn {
    flex: 1 1 0;
    padding: 12px 14px;
    font-size: 14px;
    white-space: nowrap;
}

.qc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 12px 20px;
    border: 1px solid transparent;
    border-radius: 50px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.qc-btn:focus-visible,
.qc-cat__toggle:focus-visible,
.qc-link:focus-visible {
    outline: 2px solid var(--qc-primary);
    outline-offset: 2px;
}

.qc-btn--primary {
    background: var(--qc-primary);
    border-color: var(--qc-primary);
    color: #fff;
}

.qc-btn--primary:hover {
    background: var(--qc-primary-dark);
    border-color: var(--qc-primary-dark);
}

.qc-btn--outline {
    background: #fff;
    border-color: var(--qc-primary);
    color: var(--qc-heading);
}

.qc-btn--outline:hover {
    background: #F3F0FF;
}

.qc-btn--muted {
    background: var(--qc-green-light);
    border-color: var(--qc-green-light);
    color: var(--qc-green);
}

.qc-btn--muted:hover {
    background: #d3e0d7;
    border-color: #d3e0d7;
}

/* Settings modal: body scrolls, footer stays visible */
.qc-modal {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 760px;
    max-width: 100%;
    max-height: 90vh;
    background: #fff;
    border-radius: var(--qc-radius);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

.qc-close {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--qc-heading);
    cursor: pointer;
    transition: background-color 0.2s;
}

.qc-close:hover {
    background: #F6F6F6;
}

.qc-close:focus-visible {
    outline: 2px solid var(--qc-primary);
    outline-offset: 2px;
}

.qc-layer--settings.is-first-run .qc-close {
    display: none;
}

.qc-modal__body .qc-title {
    padding-right: 40px;
}

.qc-modal__body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 28px 28px 8px;
}

.qc-modal__foot {
    flex: 0 0 auto;
    padding: 16px 28px 24px;
    border-top: 1px solid var(--qc-border);
    background: #fff;
}

.qc-note {
    margin: 0 0 14px;
    color: var(--qc-text);
    font-size: 13px;
    line-height: 1.45;
}

/* Categories */
.qc-cats {
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--qc-border);
}

.qc-cat {
    border-bottom: 1px solid var(--qc-border);
}

.qc-cat__head {
    display: flex;
    align-items: center;
    gap: 16px;
}

.qc-cat__toggle {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border: 0;
    background: none;
    color: var(--qc-heading);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.qc-cat__chevron {
    flex: 0 0 auto;
    color: var(--qc-heading);
    transition: transform 0.2s;
}

.qc-cat__toggle[aria-expanded="true"] .qc-cat__chevron {
    transform: rotate(90deg);
}

.qc-cat__lock {
    flex: 0 0 auto;
    color: var(--qc-green);
}

.qc-cat__panel {
    display: none;
    padding: 0 0 18px 28px;
}

.qc-cat.is-expanded .qc-cat__panel {
    display: block;
}

.qc-cat__desc {
    margin: 0 0 14px;
    color: var(--qc-text);
    font-size: 14px;
    line-height: 1.5;
}

/* Switch */
.qc-switch {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    margin: 0;
    cursor: pointer;
}

.qc-switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: inherit;
}

.qc-switch__track {
    position: relative;
    display: block;
    width: 46px;
    height: 26px;
    border-radius: 13px;
    background: #D5D5D9;
    transition: background-color 0.2s;
}

.qc-switch__track::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s;
}

.qc-switch input:checked + .qc-switch__track {
    background: var(--qc-primary);
}

.qc-switch input:checked + .qc-switch__track::after {
    transform: translateX(20px);
}

.qc-switch input:focus-visible + .qc-switch__track {
    outline: 2px solid var(--qc-primary);
    outline-offset: 2px;
}

.qc-switch:has(input:disabled) {
    cursor: not-allowed;
}

.qc-switch input:disabled + .qc-switch__track {
    opacity: 0.8;
}

/* Cookie table */
.qc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    line-height: 1.4;
}

.qc-table th,
.qc-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--qc-border);
    text-align: left;
    vertical-align: top;
}

.qc-table th {
    color: var(--qc-heading);
    font-weight: 600;
    background: #F6F6F6;
}

.qc-table td {
    color: var(--qc-text);
}

.qc-table code {
    font-family: inherit;
    font-size: inherit;
    font-weight: 600;
    color: var(--qc-heading);
    word-break: break-word;
}

.qc-table th:nth-child(1) { width: 26%; }
.qc-table th:nth-child(2) { width: 20%; }
.qc-table th:nth-child(4) { width: 16%; }

/* Cookie policy page */
.qc-policy {
    margin-top: 32px;
}

.qc-policy__title {
    margin: 0 0 20px;
    color: var(--qc-heading);
    font-size: 22px;
    font-weight: 700;
}

.qc-policy__cat {
    margin-bottom: 32px;
}

.qc-policy__cat h3 {
    margin: 0 0 10px;
    color: var(--qc-heading);
    font-size: 18px;
    font-weight: 600;
}

.qc-policy__cat p {
    margin: 0 0 14px;
}

.qc-policy__settings {
    padding: 20px 24px;
    border-radius: var(--qc-radius);
    background: var(--qc-green-light);
}

.qc-policy__settings p {
    margin: 0 0 14px;
}

/* Support and legal links under the auth form */
.qc-auth-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px 0;
    margin: 32px 0 24px;
    color: #626262;
    font-family: "Inter", sans-serif;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}

.qc-auth-links__item + .qc-auth-links__item::before {
    content: "·";
    display: inline-block;
    margin: 0 12px;
    color: #BFCFC4;
    text-decoration: none;
}

.qc-auth-links span.qc-auth-links__item {
    color: #626262;
}

.qc-auth-links a {
    color: #877FB0;
    text-decoration: none;
}

.qc-auth-links a:hover,
.qc-auth-links a:focus-visible {
    text-decoration: underline;
}

.qc-auth-links__item > a {
    text-decoration: underline;
}

@media screen and (max-width: 575px) {
    .qc-auth-links {
        flex-direction: column;
        gap: 8px;
    }

    .qc-auth-links__item + .qc-auth-links__item::before {
        display: none;
    }
}

/* Page scroll lock while a layer is open (iOS-safe) */
body.qc-locked {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
    overflow: hidden;
}

/* Low screens (phone landscape) */
@media screen and (max-height: 500px) {
    .qc {
        --qc-gap: 12px;
    }

    .qc-title {
        margin-bottom: 8px;
        font-size: 18px;
    }

    .qc-text p {
        margin-bottom: 6px;
        font-size: 13px;
    }

    .qc-popup__body {
        padding: 18px 20px 0;
    }

    .qc-popup__foot {
        gap: 8px;
        padding: 10px 20px 16px;
    }

    .qc-btn {
        min-height: 38px;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .qc-modal {
        max-height: calc(100dvh - 2 * var(--qc-gap));
    }
}

/* Mobile */
@media screen and (max-width: 767px) {
    .qc {
        --qc-gap: 0px;
    }

    .qc-popup {
        width: 100%;
        max-height: 85vh;
        max-height: 85dvh;
        border-radius: var(--qc-radius) var(--qc-radius) 0 0;
    }

    .qc-popup__body {
        padding: 22px 18px 0;
    }

    .qc-popup__foot {
        padding: 12px 18px calc(18px + env(safe-area-inset-bottom));
    }

    .qc-layer--settings {
        align-items: flex-end;
    }

    .qc-modal {
        width: 100%;
        max-height: 92vh;
        border-radius: var(--qc-radius) var(--qc-radius) 0 0;
    }

    .qc-modal__body {
        padding: 22px 18px 8px;
    }

    .qc-modal__foot {
        padding: 14px 18px calc(18px + env(safe-area-inset-bottom));
    }

    .qc-actions--row {
        flex-direction: column;
    }

    .qc-actions--row > .qc-btn {
        font-size: 15px;
        white-space: normal;
    }

    .qc-title {
        font-size: 19px;
    }

    .qc-cat__panel {
        padding-left: 0;
    }

    /* Table becomes cards */
    .qc-table thead {
        display: none;
    }

    .qc-table,
    .qc-table tbody,
    .qc-table tr,
    .qc-table td {
        display: block;
        width: 100%;
    }

    .qc-table tr {
        padding: 10px 12px;
        margin-bottom: 8px;
        border: 1px solid var(--qc-border);
        border-radius: 10px;
    }

    .qc-table td {
        display: grid;
        grid-template-columns: 110px 1fr;
        gap: 8px;
        padding: 4px 0;
        border: 0;
    }

    .qc-table td::before {
        content: attr(data-label);
        color: var(--qc-heading);
        font-weight: 600;
    }
}
