:root {
    --bs-font-sans-serif: JetBrains Mono, monospace;
    --bs-font-sans-mono:  JetBrains Mono, monospace;

    --bs-info-bg-subtle:  #e7f1ff;   /* переопределение: active item в списке чатов (стандарт #cff4fc — слишком холодный) */

    --kmc-accent:         #d2f4ea;   /* мятный: hover/active в sidebar nav и .btn-toggle */
    --kmc-divider:        #f0f0f0;   /* серый тоньше --bs-border-color, для тонких линий в списке чатов и аватарок */
    --kmc-app-header-height: 4rem;
}

body {
    margin: 0;
    background: var(--bs-secondary-bg);
}

.popover {
    --bs-popover-max-width: 320px;
    --bs-popover-body-padding-x: 1rem;
    --bs-popover-body-padding-y: 0.5rem;
}

.app-shell {
    display: grid;
    grid-template-rows: var(--kmc-app-header-height) minmax(0, 1fr);
    grid-template-columns: minmax(0, 1fr);
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bs-secondary-bg);
}

.app-shell-immersive {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

.kmc-skip-link {
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 1100;
    padding: 0.5rem 0.75rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
}

.app-sidebar-root {
    display: contents;
}

.app-header {
    grid-row: 1;
    position: sticky;
    top: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    min-width: 0;
    height: var(--kmc-app-header-height);
    background: var(--bs-secondary-bg);
    z-index: 30;
}

.app-header-brand,
.app-header-context,
.app-header-actions {
    min-width: 0;
    padding: 0 1rem;
}

.app-header-actions {
    grid-column: 2;
}

.app-header-account .dropdown-menu {
    max-width: min(22rem, calc(100vw - 2rem));
}

.app-sidebar {
    grid-row: 2;
    --bs-offcanvas-width: 280px;
    background: var(--bs-tertiary-bg);
}

.app-sidebar .offcanvas-body {
    min-height: 100%;
    background: var(--bs-tertiary-bg);
}

.app-sidebar-nav {
    margin-bottom: 1rem;
}

.app-sidebar-nav .nav-link {
    gap: 0.5rem;
    border-radius: var(--bs-border-radius-pill);
}

.app-sidebar-nav .nav-link.active {
    color: var(--bs-primary-text-emphasis);
    background: rgba(var(--bs-primary-rgb), 0.18);
    font-weight: 700;
}

.app-sidebar-icon {
    width: 1.25rem;
    flex: 0 0 1.25rem;
    text-align: center;
}

.kmc-avatar-placeholder {
    background: var(--kmc-divider);
}

.kmc-avatar {
    --kmc-avatar-size: 2.5rem;
    width: var(--kmc-avatar-size);
    height: var(--kmc-avatar-size);
    border-radius: 50%;
    object-fit: cover;
    background: var(--kmc-divider);
}

.kmc-avatar-sm { --kmc-avatar-size: 2rem; }
.kmc-avatar-md { --kmc-avatar-size: 2.5rem; }
.kmc-avatar-lg { --kmc-avatar-size: 4rem; }
.kmc-avatar-xl { --kmc-avatar-size: 6rem; }

.kmc-avatar-wrap {
    position: relative;
}

.kmc-presence-dot {
    position: absolute;
    top: -0.1rem;
    right: -0.1rem;
    width: 0.7rem;
    height: 0.7rem;
    box-sizing: content-box;
    border: 2px solid var(--bs-body-bg);
    border-radius: 50%;
    background: var(--bs-success);
}

.app-content {
    min-width: 0;
    padding: 1rem;
}

.app-main {
    grid-row: 2;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    position: relative;
}

.app-surface {
    flex: 1 0 auto;
    background: var(--bs-body-bg);
}

.onboarding-banner-immersive {
    flex-shrink: 0;
    margin-bottom: 0 !important;
    border-radius: 0;
}

.app-main-immersive,
.app-surface-immersive {
    min-height: 0;
    overflow: hidden;
}

.app-surface-immersive {
    flex: 1 1 auto;
}

.app-content-immersive {
    display: flex;
    flex-direction: column;
    padding: 0;
}

.app-content-immersive #chat-app,
.app-content-immersive #partners-app {
    flex: 1 1 auto;
    min-height: 0;
}

@media (min-width: 992px) {
    .app-shell {
        grid-template-columns: 280px minmax(0, 1fr);
    }

    .app-header {
        grid-column: 1 / -1;
        grid-template-columns: 280px minmax(0, 1fr) auto;
    }

    .app-header-brand {
        grid-column: 1;
        /* Logo guide: offcanvas body padding (1rem) + nav-link left padding (1rem) + icon column (1.25rem) + nav gap (0.5rem) */
        padding-left: calc(1rem + 1rem + 1.25rem + 0.5rem);
    }

    .app-header-context {
        grid-column: 2;
        padding-left: 1.5rem;
    }

    .app-header-actions {
        grid-column: 3;
        padding-right: 1.5rem;
    }

    .app-sidebar {
        grid-column: 1;
        min-width: 0;
        position: sticky;
        top: var(--kmc-app-header-height);
        height: calc(100vh - var(--kmc-app-header-height));
        height: calc(100dvh - var(--kmc-app-header-height));
        align-self: start;
        overflow-y: auto;
    }

    .app-sidebar-nav {
        padding-top: 0;
        border-top: 0;
    }

    .app-main {
        grid-column: 2;
        padding: 1rem 1.5rem 0;
    }

    .app-surface {
        border-radius: var(--bs-border-radius-lg);
    }

    .app-content:not(.app-content-immersive) {
        padding: 1.5rem;
    }

    .app-main-immersive {
        padding-bottom: 1rem;
    }
}

.b-example-divider {
    flex-shrink: 0;
    width: 1.5rem;
    height: 100vh;
    background-color: rgba(var(--bs-emphasis-color-rgb), .1);
    border: solid rgba(var(--bs-emphasis-color-rgb), .15);
    border-width: 1px 0;
    box-shadow:
        inset 0 .5em 1.5em rgba(var(--bs-emphasis-color-rgb), .1),
        inset 0 .125em .5em rgba(var(--bs-emphasis-color-rgb), .15);
}

.bi {
    vertical-align: -.125em;
    pointer-events: none;
    fill: currentColor;
}

.dropdown-toggle { outline: 0; }

/* Gmail-like legal links in the account dropdown (layout.phtml) */
.kmc-dropdown-legal {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding: .25rem 1rem;
}
.kmc-dropdown-legal .dropdown-item {
    width: auto;
    padding: .125rem .5rem;
    font-size: .75rem;
    color: var(--bs-secondary-color);
}
.kmc-dropdown-legal .dropdown-item:hover,
.kmc-dropdown-legal .dropdown-item:focus {
    background: transparent;
    text-decoration: underline;
}

.nav-flush .nav-link {
    border-radius: 0;
}

.btn-toggle {
    display: inline-flex;
    align-items: center;
    padding: .25rem .5rem;
    font-weight: 600;
    color: rgba(var(--bs-emphasis-color-rgb), .65);
    background-color: transparent;
    border: 0;
}
.btn-toggle:hover,
.btn-toggle:focus {
    color: rgba(var(--bs-emphasis-color-rgb), .85);
    background-color: var(--kmc-accent);
}

.btn-toggle::before {
    width: 1.25em;
    line-height: 0;
    content: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='rgba%280,0,0,.5%29' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 14l6-6-6-6'/%3e%3c/svg%3e");
    transition: transform .35s ease;
    transform-origin: .5em 50%;
}

.btn-toggle[aria-expanded="true"] {
    color: rgba(var(--bs-emphasis-color-rgb), .85);
}
.btn-toggle[aria-expanded="true"]::before {
    transform: rotate(90deg);
}

.btn-toggle-nav a {
    display: inline-flex;
    padding: .1875rem .5rem;
    margin-top: .125rem;
    margin-left: 1.25rem;
    text-decoration: none;
}
.btn-toggle-nav a:hover,
.btn-toggle-nav a:focus {
    background-color: var(--kmc-accent);
}

.scrollarea {
    overflow-y: auto;
}

.fw-semibold { font-weight: 600; }
.lh-tight { line-height: 1.25; }

.sticky-bottom-shadow {
    box-shadow: 0 -0.5rem 1rem -0.5rem var(--bs-body-bg) !important;
}

/* === Page actions and settings === */

.kmc-page-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 1rem;
}

.kmc-site-footer {
    flex-shrink: 0;
    padding: 1rem;
    background: transparent;
}

.kmc-site-links a {
    color: var(--bs-secondary-color);
    text-decoration: none;
}

.kmc-site-links a:hover,
.kmc-site-links a:focus-visible {
    color: var(--bs-body-color);
    text-decoration: underline;
}

@media (min-width: 992px) {
    .kmc-site-footer {
        padding: 1rem 1.5rem;
    }
}

.settings-header {
    min-width: 0;
}

.settings-nav {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
}

.settings-nav .nav-tabs {
    width: max-content;
    min-width: 100%;
}

.settings-avatar-controls {
    min-width: 0;
}

@media (max-width: 575.98px) {
    .settings-progress {
        padding-top: 0.75rem;
        border-top: 1px solid var(--bs-border-color);
    }
}

@media (min-width: 576px) {
    .settings-progress {
        padding-left: 1rem;
        border-left: 1px solid var(--bs-border-color);
    }
}

/* === Chat /messages === */

.chat-app-full {
    height: 100%;
    min-height: 0;
}

.chat-shell {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: var(--bs-body-bg);
}

.chat-header,
.chat-body {
    display: flex;
    min-width: 0;
}

.chat-header {
    height: var(--kmc-app-header-height);
    min-height: var(--kmc-app-header-height);
    box-sizing: border-box;
    flex: 0 0 auto;
    background: var(--bs-secondary-bg);
}

.chat-body {
    flex: 1 1 auto;
    min-height: 0;
    background: var(--bs-secondary-bg);
}

.chat-list-col,
.chat-thread-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.chat-list-col {
    width: 320px;
    flex-shrink: 0;
    background: var(--bs-body-bg);
}

.chat-thread-col {
    flex: 1;
    min-width: 0;
    background: var(--bs-body-bg);
}

.chat-list-header {
    width: 320px;
    padding: 0 1rem;
    background: var(--bs-body-bg);
    flex-shrink: 0;
    height: 100%;
    min-height: 0;
    display: flex;
    align-items: center;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-list-section-label {
    padding: 0.5rem 1rem 0.25rem;
    font-size: 0.7rem;
    color: var(--bs-secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bs-tertiary-bg);
    border-top: 1px solid var(--kmc-divider);
}

.chat-list-section-label:first-child {
    border-top: none;
}

.chat-list-empty {
    margin-top: 1rem;
}

.chat-list-item {
    display: flex;
    padding: 0.65rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--kmc-divider);
    align-items: center;
}

.chat-list-item:hover {
    background: var(--bs-secondary-bg);
}

.chat-list-item.active {
    background: var(--bs-info-bg-subtle);
}

.chat-list-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--kmc-divider);
    flex-shrink: 0;
}

.chat-list-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.kmc-unread-badge {
    min-width: 1.1rem;
    height: 1.1rem;
    padding: 0 0.4rem;
    font-size: 0.7rem;
    line-height: 1.1rem;
    font-weight: 600;
    box-sizing: content-box;
}

.chat-list-unread {
    position: absolute;
    right: -0.3rem;
    bottom: -0.3rem;
    border: 2px solid var(--bs-body-bg);
}

.chat-list-item.active .chat-list-unread {
    border-color: var(--bs-info-bg-subtle);
}

.chat-presence-dot {
    position: absolute;
    right: -0.1rem;
    top: -0.1rem;
    width: 0.7rem;
    height: 0.7rem;
    background-color: var(--bs-success);
    border: 2px solid var(--bs-body-bg);
    border-radius: 50%;
    box-sizing: content-box;
}

.chat-list-item.active .chat-presence-dot {
    border-color: var(--bs-info-bg-subtle);
}

.chat-list-body {
    flex: 1;
    min-width: 0;
    margin-left: 0.75rem;
}

.chat-list-time {
    flex-shrink: 0;
    white-space: nowrap;
}

.chat-list-status {
    font-size: 0.75rem;
    line-height: 1;
    flex-shrink: 0;
}

.chat-list-preview {
    line-height: 1.3;
}

.chat-thread-header {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 1rem;
    background: var(--bs-body-bg);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    height: 100%;
    min-height: 0;
}

.chat-back-btn {
    font-size: 1.1rem;
    color: var(--bs-secondary-color);
    text-decoration: none;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.chat-message {
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    max-width: 75%;
    min-width: 0;
    align-items: flex-start;
}

.chat-message-mine {
    align-self: flex-end;
    align-items: flex-end;
}

.chat-message-bubble {
    background: var(--kmc-divider);
    padding: 0.5rem 0.75rem;
    border-radius: 1rem;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: pre-wrap;
    line-height: 1.3;
}

.chat-message-mine .chat-message-bubble {
    background: var(--bs-primary);
    color: var(--bs-body-bg);
}

.chat-message-time {
    font-size: 0.7rem;
    color: var(--bs-secondary-color);
    margin-top: 0.15rem;
    padding: 0 0.5rem;
}

.chat-message-status {
    color: var(--bs-secondary-color);
}

.chat-message-status-read {
    color: var(--bs-primary);
}

.chat-input {
    position: relative;
    padding: 0.75rem;
    border-top: 1px solid var(--bs-border-color);
    flex-shrink: 0;
    background: var(--bs-body-bg);
}

.chat-input textarea {
    width: 100%;
    resize: none;
    min-height: calc(2.25rem + 2px);
    max-height: 10rem;
    padding-right: 4.5rem;
    overflow-y: auto;
}

.chat-input-actions {
    position: absolute;
    right: 1.25rem;
    bottom: 1rem;
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.chat-input-action {
    width: 1.25rem;
    height: 1.25rem;
    padding: 0;
    flex: 0 0 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-input-send {
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--bs-primary);
}

.chat-input-send:hover:not(:disabled) {
    color: var(--bs-primary-text-emphasis);
}

.chat-input-send:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

.chat-input-send:disabled {
    color: var(--bs-secondary-color);
    opacity: 0.5;
}

.chat-input-emoji {
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--bs-secondary-color);
    cursor: pointer;
}

.chat-input-emoji:hover,
.chat-input-emoji.active {
    color: var(--bs-primary);
}

.chat-input-emoji:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

.chat-emoji-picker {
    position: absolute;
    right: 0.5rem;
    bottom: calc(100% + 0.5rem);
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 0.5rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
    z-index: 10;
    width: min(22.75rem, calc(100vw - 2rem));
    max-width: calc(100% - 1rem);
}

.chat-emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(2rem, 1fr));
    gap: 0.25rem;
    max-height: 10rem;
    overflow-y: auto;
}

.chat-emoji-item {
    background: transparent;
    border: none;
    width: 2rem;
    height: 2rem;
    padding: 0;
    font-size: 1.25rem;
    line-height: 1;
    border-radius: 0.25rem;
    cursor: pointer;
}

.chat-emoji-item:hover {
    background: var(--bs-secondary-bg);
}

.chat-empty {
    flex: 1;
    align-items: center;
    justify-content: center;
    background: var(--bs-body-bg);
}

@media (min-width: 768px) {
    .chat-list-header,
    .chat-list-col {
        margin-right: 1rem;
    }

    .chat-list-header {
        border-radius: 0 var(--bs-border-radius-lg) 0 0;
    }

    .chat-list-col {
        border-radius: 0 0 var(--bs-border-radius-lg) 0;
    }

    .chat-thread-header {
        border-radius: var(--bs-border-radius-lg) 0 0 0;
    }

    .chat-thread-col,
    .chat-empty {
        border-radius: 0 0 0 var(--bs-border-radius-lg);
    }
}

@media (max-width: 767.98px) {
    .chat-list-header {
        width: 100%;
        border-right: 0;
    }

    .chat-list-col {
        width: 100%;
        border-right: none;
    }
    .chat-list-col.d-none {
        display: none !important;
    }
}

/* === Sticky message notifications (bottom-right) === */

.kmc-notifications-container {
    z-index: 1090;
    max-width: 360px;
    pointer-events: none;
}

.kmc-notification {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
    cursor: pointer;
    pointer-events: auto;
    min-width: 280px;
    max-width: 360px;
}

.kmc-notification:hover {
    background: var(--bs-secondary-bg);
}

.kmc-notification-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.kmc-notification-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--kmc-divider);
    flex-shrink: 0;
}

.kmc-notification-presence-dot {
    border-color: var(--bs-body-bg);
}

.kmc-notification:hover .kmc-notification-presence-dot {
    border-color: var(--bs-secondary-bg);
}

.kmc-notification-body {
    flex: 1;
    min-width: 0;
}

.kmc-notification-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.15rem;
}

.kmc-notification-sender {
    font-size: 0.9rem;
    flex: 1;
    min-width: 0;
}

.kmc-notification-time {
    flex-shrink: 0;
    color: var(--bs-secondary-color);
    font-size: 0.7rem;
}

.kmc-notification-text {
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
}

.kmc-notification-close {
    flex-shrink: 0;
    background: transparent;
    border: 0;
    font-size: 1.25rem;
    line-height: 1;
    color: var(--bs-secondary-color);
    padding: 0;
    cursor: pointer;
    margin-left: 0.25rem;
}

.kmc-notification-close:hover {
    color: var(--bs-emphasis-color);
}

.kmc-notif-enter-from {
    opacity: 0;
    transform: translateX(100%);
}
.kmc-notif-leave-to {
    opacity: 0;
    transform: translateX(100%);
}
.kmc-notif-enter-active,
.kmc-notif-leave-active {
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.kmc-notif-move {
    transition: transform 0.2s ease;
}

/* === Settings: preview уведомления (/settings/notifications) === */

.kmc-preview {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
}

.kmc-preview-content {
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--bs-body-color);
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.kmc-preview-content a {
    color: var(--bs-primary);
}

/* === Partners /partners (swipe cards) === */

.partners-shell {
    display: flex;
    flex-direction: column;
}

.partners-shell-full {
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.partners-header {
    min-height: var(--kmc-app-header-height);
    padding: 0.5rem 1rem;
    box-sizing: border-box;
    background: var(--bs-body-bg);
    flex-shrink: 0;
}

.partners-filter-row {
    position: relative;
    width: 100%;
    min-height: 2.75rem;
    padding: 0;
    flex-shrink: 0;
    background: var(--bs-body-bg);
    border: 0;
    border-radius: 0;
}

.partners-filter-control {
    min-height: 2rem;
    font-size: 0.875rem;
}

.partners-tag-input {
    position: relative;
}

.partners-filter-add {
    align-items: center;
    gap: 0.35rem;
    min-height: 2rem;
    padding-left: 0.25rem;
    cursor: text;
}

.partners-tag-chip {
    font-weight: 500;
    padding: 0.3rem 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    color: var(--bs-body-color);
}

.partners-tag-chip-icon {
    font-size: 0.7rem;
    color: var(--bs-secondary-color);
    margin-right: 0.2rem;
}

.partners-tag-chip .btn-close {
    font-size: 0.7rem;
}

.partners-tag-input-input {
    flex: 1 1 6rem;
    min-width: 6rem;
    border: 0;
    outline: none;
    background: transparent;
    padding: 0.15rem 0.25rem;
    font-size: 0.875rem;
    color: var(--bs-body-color);
}

.partners-tag-input-input::placeholder {
    color: var(--bs-secondary-color);
}

.partners-typeahead {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    margin-top: 0.25rem;
    padding: 0.25rem 0;
    max-height: 16rem;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
}

.partners-typeahead-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
}

.partners-typeahead-item:hover {
    background: var(--bs-secondary-bg);
}

.partners-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 1rem 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-gutter: stable;
    container-type: size;
    container-name: partners-stage;
}

/* Vertical auto-margins center children when they fit and keep them
   top-reachable (scrollable) when they overflow the stage. */
.partners-stage > * {
    margin-block: auto;
}

.partners-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.swipe-card {
    width: 100%;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    overflow: hidden;
    touch-action: pan-y;
    user-select: none;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, opacity 0.3s ease;
    align-self: center;
}

.swipe-card-photo-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--kmc-divider);
    flex-shrink: 0;
}

@media (min-width: 992px) {
    .swipe-card {
        flex-direction: row;
    }
    .swipe-card-photo-wrap {
        flex: 0 0 auto;
        width: 420px;
        aspect-ratio: 3 / 4;
        align-self: stretch;
    }
    .swipe-card-body {
        flex: 1 1 0;
        min-width: 0;
    }
}

.swipe-card-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.swipe-card-online {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 0.9rem;
    height: 0.9rem;
    background-color: var(--bs-success);
    border: 3px solid var(--bs-body-bg);
    border-radius: 50%;
    box-sizing: content-box;
}

.onboarding-preview-online {
    position: absolute;
    top: 0;
    right: 0;
    width: 0.7rem;
    height: 0.7rem;
    background-color: var(--bs-success);
    border: 2px solid var(--bs-body-bg);
    border-radius: 50%;
    box-sizing: content-box;
}

.swipe-card-body {
    padding: 1rem 1.25rem 1.25rem;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.swipe-card-bio {
    font-size: 0.95rem;
    line-height: 1.4;
    color: var(--bs-body-color);
    margin: 0.5rem 0 0.75rem;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.swipe-card-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
}

.kmc-int-chip {
    font-weight: 500;
    padding: 0.35rem 0.6rem;
    cursor: default;
}

.kmc-int-chip-with-sub {
    cursor: help;
}

.kmc-int-chip-sup {
    font-size: 0.65em;
    margin-left: 0.15rem;
    vertical-align: super;
    opacity: 0.6;
}

.swipe-card-meta {
    line-height: 1.4;
    margin-top: 0.5rem;
}

.swipe-actions {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem 0 0.5rem;
    flex-shrink: 0;
}

/* Резервируем место под action bar, чтобы stage не менял высоту при открытии composer. */
.swipe-actions-slot {
    min-height: 5rem;
    flex: 0 0 5rem;
}

.partners-inline-composer {
    width: min(100cqw, 75cqh);
    max-width: var(--bs-breakpoint-md);
    margin: 0 auto;
    padding: 0.75rem;
    background: var(--bs-body-bg);
}

.chat-input.partners-inline-composer {
    border-top: 0;
    padding-left: 0;
}

.chat-input.partners-inline-composer textarea {
    padding-right: 7rem;
    scrollbar-width: none;
}

.chat-input.partners-inline-composer .chat-input-actions {
    right: 1rem;
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
}

.chat-input.partners-inline-composer textarea::-webkit-scrollbar {
    display: none;
}

.partners-inline-composer-shell {
    width: min(100cqw, 75cqh);
    max-width: var(--bs-breakpoint-md);
    margin: 0 auto;
}

.partners-stage:has(.partners-inline-composer) {
    flex-direction: column;
    gap: 0.75rem;
}

.partners-stage:has(.partners-inline-composer) > * {
    margin-block: 0;
}

.chat-input-cancel {
    border: none;
    border-radius: 0;
    color: var(--bs-secondary-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-input-cancel:hover:not(:disabled) {
    color: var(--bs-danger);
}

.chat-input-cancel:focus-visible {
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

.chat-input-cancel:disabled {
    opacity: 0.5;
}

.partners-inline-feedback {
    width: min(100%, var(--bs-breakpoint-md));
    margin: 0 auto;
    text-align: center;
}

.partners-stage:has(.partners-inline-feedback) {
    flex-direction: column;
    gap: 0.75rem;
}

.swipe-btn {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.08);
}

.swipe-btn-message {
    width: auto;
    min-width: 12rem;
    border-radius: 1.75rem;
    padding: 0 1.5rem;
}

.swipe-card-fly-left {
    transform: translateX(-150%) rotate(-25deg) !important;
    opacity: 0;
}

.swipe-card-fly-right {
    transform: translateX(150%) rotate(25deg) !important;
    opacity: 0;
}

@media (max-width: 575.98px) {
    .swipe-btn-message {
        min-width: auto;
        padding: 0 1rem;
    }
}

/* === Standalone pages === */

.standalone-layout {
    display: flex;
    justify-content: center;
    flex: 1 0 auto;
}

.standalone-body {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    flex-direction: column;
    background: var(--bs-secondary-bg);
}

.standalone-body > .kmc-site-footer {
    width: 100%;
}

/* === KissMeChat component catalog /ui === */

.kmc-ui-catalog {
    width: 100%;
    max-width: 60rem;
}

.kmc-ui-section + .kmc-ui-section {
    margin-top: 2rem;
}

.kmc-ui-section-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.kmc-ui-preview {
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    background: var(--bs-body-bg);
}

.kmc-ui-layout-demo {
    background: var(--bs-secondary-bg);
}

.kmc-ui-app-header {
    position: static;
    grid-column: auto;
    grid-template-columns: 12rem minmax(0, 1fr) auto;
}

.kmc-ui-demo-surface {
    border-radius: var(--bs-border-radius-lg);
}

.kmc-ui-layout-demo-body > .kmc-site-footer {
    padding-right: 0;
    padding-left: 0;
}

.kmc-ui-chat-messages {
    min-height: 10rem;
}

.kmc-ui-chat-header .chat-list-header {
    width: 40%;
}

.standalone-layout-center {
    align-items: center;
}

.standalone-layout-start {
    align-items: flex-start;
}

.standalone-shell {
    width: 100%;
    padding: 1.5rem;
    border-radius: var(--bs-border-radius-lg);
    background: var(--bs-body-bg);
}

.standalone-shell-sm {
    max-width: var(--bs-breakpoint-sm);
}

.standalone-shell-md {
    max-width: var(--bs-breakpoint-md);
}

.standalone-shell-lg {
    max-width: var(--bs-breakpoint-lg);
}

@media (max-width: 575.98px) {
    .standalone-layout {
        padding-right: 0 !important;
        padding-left: 0 !important;
    }

    .standalone-shell {
        padding: 1rem;
        border-radius: 0;
    }
}

.public-brand {
    font-family: JetBrains Mono, monospace;
}

/* === Виджет карточки юзера: overlay-режим (default) === */

.partners-responsive-tabs .nav-link.active {
    color: var(--bs-primary-text-emphasis);
    background: rgba(var(--bs-primary-rgb), 0.18);
    font-weight: 700;
}

.partners-responsive-tabs {
    padding: 0 0 0.75rem;
}

.user-card {
    position: relative;
    width: 100%;
    /* 3/4 of the 52rem height cap keeps the 3:4 ratio at the max height */
    max-width: 39rem;
    aspect-ratio: 3 / 4;
    max-height: 52rem;
    background: var(--kmc-divider);
    border-radius: 1rem;
    overflow: hidden;
    isolation: isolate;
    touch-action: pan-y;
    user-select: none;
    display: flex;
    flex-direction: column;
}

/* Fallback (no container queries): fit stage height, 3:4 via aspect-ratio */
.partners-stage .user-card {
    width: auto;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
}

/* Modern: the card size follows stage height, not the scrollbar-dependent
   container width. The 100% limit keeps it inside narrow stages. */
.partners-stage .user-card {
    width: min(75cqh, 100%, var(--bs-breakpoint-md));
    height: auto;
    max-height: 100cqh;
}

.user-card-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.user-card-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0, 0, 0, 0.45) 0%,
        rgba(0, 0, 0, 0) 30%,
        rgba(0, 0, 0, 0) 55%,
        rgba(0, 0, 0, 0.65) 100%
    );
    pointer-events: none;
    z-index: 1;
}

.user-card-online {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 3;
    width: 0.9rem;
    height: 0.9rem;
    background-color: var(--bs-success);
    border: 3px solid rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    box-sizing: content-box;
}

.user-card-presence {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 3;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.35rem 0.6rem;
    border-radius: 0.5rem;
    color: white;
    font-size: 0.8rem;
    line-height: 1;
}

.user-card-top {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 3;
    max-width: calc(100% - 7rem);
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.5rem 0.85rem;
    border-radius: 0.5rem;
    color: white;
}

.user-card-top-name {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.15;
    margin: 0;
}

.user-card-gender {
    font-size: 0.85em;
    margin-right: 0.3rem;
    opacity: 0.85;
}

.user-card-top-city {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-top: 0.2rem;
    line-height: 1.2;
}

.user-card-bio {
    position: absolute;
    top: 50%;
    left: 1rem;
    right: 1rem;
    transform: translateY(-50%);
    z-index: 3;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.75rem 0.85rem;
    border-radius: 0.5rem;
    color: white;
    font-size: 0.9rem;
    line-height: 1.4;
    max-height: 60%;
    overflow-y: auto;
    overflow-wrap: anywhere;
}

.user-card-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 0.75rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.user-card-bottom > * {
    pointer-events: auto;
}

.user-card-block {
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    color: white;
    font-size: 0.85rem;
    line-height: 1.4;
}

.user-card-block-body i {
    opacity: 0.85;
    margin-right: 0.4rem;
}

.user-card-block-interests {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    padding: 0;
}

.user-card-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.user-card-chip {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    line-height: 1.2;
    font-weight: 500;
}

.user-card-actions {
    display: flex;
    justify-content: center;
    padding-top: 0.25rem;
}

.user-card-btn {
    border: 0;
    background: var(--bs-primary);
    color: white;
    padding: 0.65rem 1.75rem;
    border-radius: 2rem;
    font-size: 1rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.35);
}

.user-card-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* === Бренд kissme[icon]chat === */

.kmc-brand {
    font-family: var(--bs-font-sans-serif);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.01em;
}

.kmc-brand-lg {
    font-size: 1.5rem;
}

.kmc-brand-md {
    font-size: 1.25rem;
}

.kmc-brand-icon {
    color: #dc3545;
    margin: 0 0.2em;
    font-size: 0.95em;
    line-height: 1;
    vertical-align: -0.05em;
}

.kmc-brand-kissme,
.kmc-brand-chat {
    color: inherit;
}

.kmc-brand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
}

.kmc-brand-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1rem 0.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    background: var(--bs-body-bg);
}

.kmc-brand-cell.on-dark {
    background: #1a1a2e;
    border-color: #1a1a2e;
}

.kmc-brand-cell.on-dark .kmc-brand-kissme,
.kmc-brand-cell.on-dark .kmc-brand-chat {
    color: #fff;
}

.kmc-brand-favicon {
    display: block;
    width: 40px;
    height: 40px;
}

.kmc-brand-cell-label {
    font-size: 0.8rem;
    color: var(--bs-secondary-color);
}

.kmc-brand-cell.on-dark .kmc-brand-cell-label {
    color: #aaa;
}

.public-qr {
    width: 132px;
    height: 132px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.public-qr img {
    display: block;
}


/* ===== Onboarding ===== */

.onboarding-header small.text-body-secondary {
    font-size: 0.825rem;
    font-weight: 100;
    letter-spacing: 0;
}

.onboarding-progress {
    width: 100%;
}

.onboarding-progress-track {
    height: 6px;
    background: var(--bs-secondary-bg);
    border-radius: 999px;
    overflow: hidden;
}

.onboarding-progress-bar {
    height: 100%;
    background: var(--bs-primary);
    border-radius: 999px;
    transition: width .3s ease;
}


.onboarding-card {
    width: 100%;
}

.founder-quote {
    position: relative;
    background: var(--bs-tertiary-bg);
    padding: 0.75rem 1rem;
    padding-left: 4rem;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--bs-body-color);
}

.founder-quote::before {
    content: "\f10d";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 0;
    left: 1rem;
    color: var(--bs-secondary-color);
    opacity: 0.5;
    font-size: 2rem;
    line-height: 1.4;
}

.founder-quote-author {
    border-top: 1px solid var(--bs-border-color);
    padding-top: 0.5rem;
    margin-top: 0.75rem;
    margin-bottom: -0.25rem;
    color: var(--bs-secondary-color);
}

.founder-quote-author::before {
    content: none;
}

.founder-quote .blockquote {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.onboarding-choice {
    height: 100%;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-width: 2px;
}

.onboarding-choice i {
    transition: color .15s ease;
}
