.jpa-chat-widget {
    position: fixed;
    right: 20px;
    bottom: 96px;
    z-index: 1050;
    font-family: inherit;
}

.jpa-chat-dismiss {
    position: absolute;
    right: -10px;
    top: -10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid #c8d1dc;
    border-radius: 50%;
    background: #fff;
    color: #3b4654;
    box-shadow: 0 6px 16px rgba(22, 30, 44, 0.18);
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
}

.jpa-chat-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    background: #145c45;
    color: #fff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
    font-weight: 700;
    cursor: pointer;
}

.jpa-chat-toggle:focus,
.jpa-chat-dismiss:focus,
.jpa-chat-close:focus,
.jpa-chat-send:focus,
.jpa-privacy-form__button:focus,
.jpa-budget-form__button:focus,
.jpa-budget-form__skip:focus,
.jpa-size-form__button:focus,
.jpa-product-card__button:focus,
.jpa-link-card__button:focus,
.jpa-link-card__edit:focus,
.jpa-settings-form__button:focus {
    outline: 3px solid rgba(24, 123, 205, 0.45);
    outline-offset: 2px;
}

.jpa-chat-toggle__icon {
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-radius: 50%;
    position: relative;
}

.jpa-chat-toggle__icon::after {
    content: "";
    position: absolute;
    right: -3px;
    bottom: -5px;
    width: 7px;
    height: 7px;
    border-left: 2px solid currentColor;
    transform: rotate(-35deg);
}

.jpa-chat-panel {
    width: min(390px, calc(100vw - 24px));
    max-height: min(680px, calc(100vh - 96px));
    margin-bottom: 12px;
    border: 1px solid #d8dee7;
    border-radius: 8px;
    background: #fff;
    color: #1c2430;
    box-shadow: 0 18px 48px rgba(22, 30, 44, 0.25);
    overflow: hidden;
}

.jpa-chat-panel__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: #f3f6f8;
    border-bottom: 1px solid #d8dee7;
}

.jpa-chat-panel__header strong,
.jpa-chat-panel__header span {
    display: block;
    line-height: 1.35;
}

.jpa-chat-panel__header span {
    margin-top: 2px;
    color: #556170;
    font-size: 13px;
}

.jpa-chat-close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #3b4654;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
}

.jpa-chat-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 390px;
    max-height: calc(100vh - 260px);
    overflow-y: auto;
    padding: 14px;
    background: #f9fbfc;
}

.jpa-message {
    width: fit-content;
    max-width: 92%;
    padding: 10px 12px;
    border-radius: 8px;
    line-height: 1.45;
    font-size: 14px;
    word-wrap: break-word;
    overflow-wrap: anywhere;
    white-space: pre-line;
}

.jpa-message--assistant {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #d8dee7;
}

.jpa-message--user {
    align-self: flex-end;
    background: #187bcd;
    color: #fff;
}

.jpa-message--status {
    align-self: center;
    color: #556170;
    background: transparent;
    border: 0;
    padding: 3px 6px;
}

.jpa-product-list {
    display: grid;
    gap: 10px;
    width: 100%;
}

.jpa-answer-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
}

.jpa-answer-option {
    min-height: 36px;
    border: 1px solid #187bcd;
    border-radius: 8px;
    padding: 0 12px;
    background: #fff;
    color: #155f9e;
    font-weight: 700;
    cursor: pointer;
}

.jpa-answer-option:hover,
.jpa-answer-option:focus {
    background: #eef6fd;
}

.jpa-answer-option:disabled {
    opacity: 0.55;
    cursor: default;
}

.jpa-room-form {
    width: fit-content;
    max-width: 100%;
    padding: 12px;
    border: 1px solid #d8dee7;
    border-radius: 8px;
    background: #fff;
}

.jpa-budget-form,
.jpa-size-form,
.jpa-privacy-form,
.jpa-settings-form {
    width: 100%;
    padding: 12px;
    border: 1px solid #d8dee7;
    border-radius: 8px;
    background: #fff;
}

.jpa-room-form__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 128px));
    gap: 10px;
}

.jpa-room-form label,
.jpa-budget-form label,
.jpa-settings-form__field {
    display: grid;
    gap: 5px;
    color: #3b4654;
    font-size: 13px;
    font-weight: 700;
}

.jpa-room-form input,
.jpa-budget-form input,
.jpa-settings-form input,
.jpa-settings-form select {
    box-sizing: border-box;
    width: 100%;
    min-height: 40px;
    border: 1px solid #c8d1dc;
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
}

.jpa-size-form__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.jpa-size-form__hint {
    margin: 0 0 10px;
    color: #3b4654;
    font-size: 13px;
    line-height: 1.4;
    font-weight: 700;
}

.jpa-size-form__option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    margin: 0;
    border: 1px solid #c8d1dc;
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
    color: #1c2430;
    font-weight: 700;
}

.jpa-size-form__option input {
    margin: 0;
}

.jpa-size-form__button {
    width: 100%;
    min-height: 40px;
    margin-top: 10px;
    border: 0;
    border-radius: 8px;
    background: #145c45;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.jpa-room-form__button {
    width: 100%;
    min-height: 40px;
    margin-top: 10px;
    border: 0;
    border-radius: 8px;
    background: #145c45;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.jpa-budget-form__actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 10px;
}

.jpa-budget-form__button,
.jpa-budget-form__skip {
    min-height: 40px;
    border-radius: 8px;
    padding: 0 12px;
    font-weight: 700;
    cursor: pointer;
}

.jpa-budget-form__button {
    border: 0;
    background: #145c45;
    color: #fff;
}

.jpa-budget-form__skip {
    border: 1px solid #187bcd;
    background: #fff;
    color: #155f9e;
}

.jpa-room-form__error,
.jpa-privacy-form__error,
.jpa-budget-form__error,
.jpa-size-form__error,
.jpa-settings-form__error {
    margin-top: 8px;
    color: #a83232;
    font-size: 13px;
}

.jpa-privacy-form {
    display: grid;
    gap: 10px;
}

.jpa-privacy-form__check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
    color: #3b4654;
    font-size: 13px;
    line-height: 1.4;
}

.jpa-privacy-form__check input {
    margin-top: 3px;
}

.jpa-privacy-form__check a {
    color: #155f9e;
    font-weight: 700;
}

.jpa-privacy-form__button {
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    background: #145c45;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.jpa-fit-summary {
    width: 100%;
    padding: 12px;
    border: 1px solid #d8dee7;
    border-radius: 8px;
    background: #fff;
}

.jpa-fit-summary h3,
.jpa-settings-form h3 {
    margin: 0 0 8px;
    font-size: 15px;
    line-height: 1.3;
}

.jpa-fit-summary p {
    margin: 0 0 10px;
    color: #3b4654;
    font-size: 13px;
    line-height: 1.4;
}

.jpa-fit-group {
    border-top: 1px solid #e3e8ee;
    padding-top: 10px;
    margin-top: 10px;
}

.jpa-fit-group h4 {
    margin: 0 0 8px;
    font-size: 14px;
    line-height: 1.3;
}

.jpa-fit-group--good h4 {
    color: #145c45;
}

.jpa-fit-group--limited h4 {
    color: #8a5a00;
}

.jpa-fit-group--tight h4 {
    color: #8f2f2f;
}

.jpa-fit-group ul {
    display: grid;
    gap: 8px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.jpa-fit-group li {
    display: grid;
    gap: 3px;
    padding: 9px 10px;
    border: 1px solid #e3e8ee;
    border-radius: 8px;
    background: #f9fbfc;
    font-size: 13px;
    line-height: 1.35;
}

.jpa-fit-group__size,
.jpa-fit-group__detail,
.jpa-fit-group__queue {
    display: block;
}

.jpa-fit-group strong {
    font-size: 14px;
}

.jpa-fit-group__queue {
    font-weight: 700;
    color: #8a5a00;
}

.jpa-link-card {
    width: 100%;
    padding: 12px;
    border: 1px solid #d8dee7;
    border-radius: 8px;
    background: #fff;
}

.jpa-link-card h3 {
    margin: 0 0 8px;
    font-size: 15px;
    line-height: 1.3;
}

.jpa-link-card p {
    margin: 0 0 10px;
    color: #3b4654;
    font-size: 13px;
    line-height: 1.4;
}

.jpa-settings-summary {
    display: grid;
    gap: 6px;
    margin: 0 0 10px;
}

.jpa-settings-summary div {
    display: grid;
    grid-template-columns: minmax(96px, 0.9fr) 1.4fr;
    gap: 8px;
    padding: 6px 0;
    border-top: 1px solid #eef2f5;
    font-size: 13px;
    line-height: 1.35;
}

.jpa-settings-summary dt {
    color: #556170;
    font-weight: 700;
}

.jpa-settings-summary dd {
    margin: 0;
    color: #1c2430;
}

.jpa-link-card__actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.jpa-link-card__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 8px;
    background: #145c45;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.jpa-link-card__edit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid #145c45;
    border-radius: 8px;
    background: #eef7f2;
    color: #145c45;
    font-weight: 700;
    cursor: pointer;
}

.jpa-link-card__edit:hover {
    background: #dff0e8;
}

.jpa-link-card__button:hover {
    color: #fff;
    text-decoration: none;
}

.jpa-settings-form {
    display: grid;
    gap: 10px;
}

.jpa-settings-form__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.jpa-settings-form fieldset {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-width: 0;
    margin: 0;
    border: 1px solid #e3e8ee;
    border-radius: 8px;
    padding: 10px;
}

.jpa-settings-form legend {
    padding: 0 4px;
    color: #3b4654;
    font-size: 13px;
    font-weight: 700;
}

.jpa-settings-form__check {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 34px;
    margin: 0;
    font-size: 13px;
    line-height: 1.3;
}

.jpa-settings-form__check input {
    width: auto;
    min-height: 0;
    margin: 0;
}

.jpa-settings-form__button {
    min-height: 40px;
    border: 0;
    border-radius: 8px;
    background: #145c45;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.jpa-product-card {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 10px;
    padding: 10px;
    border: 1px solid #d8dee7;
    border-radius: 8px;
    background: #fff;
}

.jpa-product-card__image {
    width: 88px;
    height: 88px;
    object-fit: cover;
    border-radius: 6px;
    background: #e8edf2;
}

.jpa-product-card__image--empty {
    display: block;
}

.jpa-product-card__body {
    min-width: 0;
}

.jpa-product-card__name {
    margin: 0 0 4px;
    font-size: 14px;
    line-height: 1.3;
}

.jpa-product-card__price {
    margin-bottom: 5px;
    color: #145c45;
    font-weight: 700;
}

.jpa-product-card__reason {
    margin: 0 0 8px;
    color: #3b4654;
    font-size: 13px;
    line-height: 1.4;
}

.jpa-product-card__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    background: #1c2430;
    color: #fff;
    font-weight: 700;
    text-decoration: none;
}

.jpa-product-card__button:hover {
    color: #fff;
    text-decoration: none;
}

.jpa-chat-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #d8dee7;
    background: #fff;
}

.jpa-chat-input {
    min-height: 44px;
    max-height: 100px;
    resize: vertical;
    border: 1px solid #c8d1dc;
    border-radius: 8px;
    padding: 10px;
    font: inherit;
}

.jpa-chat-send {
    min-height: 44px;
    border: 0;
    border-radius: 8px;
    padding: 0 14px;
    background: #145c45;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.jpa-chat-send:disabled,
.jpa-chat-input:disabled,
.jpa-privacy-form__button:disabled,
.jpa-budget-form__button:disabled,
.jpa-budget-form__skip:disabled,
.jpa-size-form__button:disabled,
.jpa-settings-form__button:disabled,
.jpa-link-card__edit:disabled {
    opacity: 0.65;
    cursor: wait;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 520px) {
    .jpa-chat-widget {
        right: 12px;
        bottom: 86px;
        left: 12px;
    }

    .jpa-chat-toggle {
        width: 100%;
        justify-content: center;
    }

    .jpa-chat-panel {
        width: 100%;
    }

    .jpa-product-card {
        grid-template-columns: 74px 1fr;
    }

    .jpa-product-card__image {
        width: 74px;
        height: 74px;
    }

    .jpa-room-form__grid,
    .jpa-settings-form__grid,
    .jpa-settings-form fieldset,
    .jpa-settings-summary div {
        grid-template-columns: 1fr;
    }
}
