.oleg-ai {
    --oleg-blue: #3d7bb4;
    --oleg-blue-hover: #2f699f;
    --oleg-dark: #1d3d6e;
    --oleg-text: #172b47;
    --oleg-muted: #6c7d91;
    --oleg-soft: #f3fbff;
    --oleg-border: #dce8f2;
    --oleg-shadow: 0 24px 70px rgba(20, 45, 82, .22);
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 10050;
    color: var(--oleg-text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.4;
}

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

.oleg-ai__launcher {
    height: 58px;
    padding: 0 22px 0 17px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 29px;
    background: var(--oleg-dark);
    color: #fff;
    box-shadow: 0 14px 36px rgba(29, 61, 110, .28);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.oleg-ai__launcher svg { width: 25px; height: 25px; fill: currentColor; }

.oleg-ai__panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    width: 400px;
    height: min(690px, calc(100vh - 120px));
    display: none;
    grid-template-rows: auto minmax(0, 1fr) auto auto auto;
    overflow: hidden;
    border: 1px solid var(--oleg-border);
    border-radius: 24px;
    background: #fff;
    box-shadow: var(--oleg-shadow);
}

.oleg-ai.is-open .oleg-ai__panel { display: grid; }
.oleg-ai.is-open .oleg-ai__launcher { display: none; }

.oleg-ai__header {
    min-height: 78px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--oleg-dark);
    color: #fff;
}

.oleg-ai__identity { display: flex; align-items: center; min-width: 0; gap: 12px; }
.oleg-ai__identity-text { min-width: 0; }
.oleg-ai__identity-text strong { display: block; overflow: hidden; font-size: 17px; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.oleg-ai__identity-text > span { display: block; margin-top: 4px; font-size: 12px; opacity: .78; }

.oleg-ai__avatar {
    position: relative;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 15px;
    background: rgba(255, 255, 255, .12);
}

.oleg-ai__avatar svg { width: 26px; height: 26px; fill: currentColor; }
.oleg-ai__avatar > span {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 12px;
    height: 12px;
    border: 2px solid var(--oleg-dark);
    border-radius: 50%;
    background: #37c976;
}

.oleg-ai__header-actions { display: flex; gap: 8px; }
.oleg-ai__header-actions button {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .22);
    border-radius: 12px;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}
.oleg-ai__header-actions button:hover { background: rgba(255, 255, 255, .16); }
.oleg-ai__header-actions svg { width: 18px; height: 18px; fill: currentColor; }

.oleg-ai__messages {
    min-height: 0;
    padding: 20px 18px 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
    background:
        radial-gradient(circle at 5% 0%, rgba(61, 123, 180, .08), transparent 28%),
        linear-gradient(180deg, #fbfdff 0%, var(--oleg-soft) 100%);
    scrollbar-width: thin;
    scrollbar-color: #b9ccdd transparent;
}

.oleg-ai__message { display: flex; margin: 0 0 14px; }
.oleg-ai__message--user { justify-content: flex-end; }
.oleg-ai__bubble {
    max-width: 86%;
    padding: 12px 14px;
    border: 1px solid var(--oleg-border);
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 5px 16px rgba(29, 61, 110, .055);
    font-size: 14px;
    line-height: 1.52;
    white-space: pre-wrap;
    word-break: break-word;
}
.oleg-ai__message--assistant .oleg-ai__bubble { border-bottom-left-radius: 6px; }
.oleg-ai__message--user .oleg-ai__bubble {
    border-color: var(--oleg-blue);
    border-bottom-right-radius: 6px;
    background: var(--oleg-blue);
    color: #fff;
    box-shadow: 0 7px 18px rgba(61, 123, 180, .18);
}
.oleg-ai__typing .oleg-ai__bubble { color: var(--oleg-muted); }

.oleg-ai__cards {
    display: grid;
    gap: 12px;
    margin: 2px 0 18px;
}

.oleg-ai__card {
    overflow: hidden;
    border: 1px solid var(--oleg-border);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(29, 61, 110, .075);
}

.oleg-ai__card-image {
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: #f7fafc;
}
.oleg-ai__card-image img { width: 100%; height: 100%; object-fit: contain; }
.oleg-ai__card-body { padding: 14px; }
.oleg-ai__card-title { color: var(--oleg-dark); font-size: 15px; font-weight: 700; }
.oleg-ai__card-meta { margin-top: 5px; color: var(--oleg-muted); font-size: 12px; }
.oleg-ai__card-values { display: flex; flex-wrap: wrap; gap: 7px 14px; margin-top: 11px; font-size: 13px; }
.oleg-ai__card-price { margin-top: 10px; color: var(--oleg-dark); font-size: 18px; font-weight: 700; }
.oleg-ai__card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 13px; }
.oleg-ai__card-actions a, .oleg-ai__card-actions button {
    min-height: 38px;
    padding: 9px 10px;
    border-radius: 10px;
    text-align: center;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.oleg-ai__card-actions a { display: grid; place-items: center; background: var(--oleg-dark); color: #fff; }
.oleg-ai__card-actions a:hover { color: #fff; background: #162f57; }
.oleg-ai__card-actions button { border: 1px solid var(--oleg-blue); background: #fff; color: var(--oleg-blue); }
.oleg-ai__card-actions button.is-selected { background: var(--oleg-soft); }

.oleg-ai__comparison { margin: 3px 0 18px; overflow-x: auto; border-radius: 14px; }
.oleg-ai__comparison table { width: 100%; min-width: 420px; border-collapse: collapse; background: #fff; font-size: 12px; }
.oleg-ai__comparison th, .oleg-ai__comparison td { padding: 10px; border: 1px solid var(--oleg-border); text-align: left; }
.oleg-ai__comparison th { background: var(--oleg-soft); color: var(--oleg-dark); }

.oleg-ai__quick {
    display: flex;
    gap: 8px;
    padding: 12px 14px 10px;
    overflow-x: auto;
    border-top: 1px solid var(--oleg-border);
    background: #fff;
    scrollbar-width: none;
}
.oleg-ai__quick::-webkit-scrollbar { display: none; }
.oleg-ai__quick button {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 7px 12px;
    border: 1px solid #d5e4ef;
    border-radius: 999px;
    background: #f7fbfe;
    color: var(--oleg-dark);
    font-size: 12px;
    cursor: pointer;
}
.oleg-ai__quick button:hover { border-color: var(--oleg-blue); background: var(--oleg-soft); }

.oleg-ai__comparebar {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-top: 1px solid var(--oleg-border);
    background: #eaf5fc;
    font-size: 13px;
}
.oleg-ai__comparebar[hidden] { display: none; }
.oleg-ai__comparebar button { padding: 8px 14px; border: 0; border-radius: 10px; background: var(--oleg-blue); color: #fff; font-weight: 700; cursor: pointer; }

.oleg-ai__form {
    padding: 10px 14px 12px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    align-items: end;
    gap: 9px;
    border-top: 1px solid var(--oleg-border);
    background: #fff;
}
.oleg-ai__input-wrap {
    padding: 3px;
    border: 1px solid var(--oleg-border);
    border-radius: 14px;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}
.oleg-ai__input-wrap:focus-within { border-color: var(--oleg-blue); box-shadow: 0 0 0 3px rgba(61, 123, 180, .1); }
.oleg-ai__form textarea {
    width: 100%;
    min-height: 42px;
    max-height: 110px;
    padding: 10px 11px;
    resize: none;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--oleg-text);
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
}
.oleg-ai__form textarea::placeholder { color: #8a99aa; }
.oleg-ai__form > button {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 14px;
    background: var(--oleg-blue);
    color: #fff;
    cursor: pointer;
    transition: transform .15s, background .15s;
}
.oleg-ai__form > button:hover { background: var(--oleg-blue-hover); transform: translateY(-1px); }
.oleg-ai__form > button svg { width: 21px; height: 21px; fill: currentColor; }
.oleg-ai__note { padding: 0 14px 12px; background: #fff; color: #8a98a8; text-align: center; font-size: 10px; }
.oleg-ai__empty-image { color: #8491a2; font-size: 12px; }
.oleg-ai__error { color: #a43636; }

.oleg-ai__launcher:focus, .oleg-ai button:focus, .oleg-ai a:focus, .oleg-ai textarea:focus { outline: 2px solid rgba(61, 123, 180, .35); outline-offset: 2px; }

/* Полноразмерный режим демонстрационной страницы */
.oleg-ai--page {
    position: relative;
    right: auto;
    bottom: auto;
    z-index: 1;
    width: 100%;
}
.oleg-ai--page .oleg-ai__launcher { display: none; }
.oleg-ai--page .oleg-ai__panel {
    position: relative;
    right: auto;
    bottom: auto;
    width: 100%;
    height: 720px;
    display: grid;
    border: 1px solid rgba(29, 61, 110, .13);
    border-radius: 26px;
    box-shadow: 0 28px 70px rgba(29, 61, 110, .15);
}
.oleg-ai--page .oleg-ai__header {
    min-height: 86px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--oleg-border);
    background: #fff;
    color: var(--oleg-text);
}
.oleg-ai--page .oleg-ai__avatar { border-color: rgba(61, 123, 180, .15); background: var(--oleg-dark); color: #fff; }
.oleg-ai--page .oleg-ai__avatar > span { border-color: #fff; }
.oleg-ai--page .oleg-ai__identity-text strong { color: var(--oleg-dark); font-size: 18px; }
.oleg-ai--page .oleg-ai__identity-text > span { color: #728297; opacity: 1; }
.oleg-ai--page .oleg-ai__header-actions button { border-color: var(--oleg-border); background: #f7fbfe; color: var(--oleg-dark); }
.oleg-ai--page .oleg-ai__header-actions button:hover { background: var(--oleg-soft); }
.oleg-ai--page .oleg-ai__messages { padding: 26px 24px 30px; }
.oleg-ai--page .oleg-ai__bubble { max-width: min(76%, 660px); padding: 13px 16px; font-size: 15px; }
.oleg-ai--page .oleg-ai__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.oleg-ai--page .oleg-ai__card-image { height: 190px; }
.oleg-ai--page .oleg-ai__quick { padding: 13px 18px 11px; }
.oleg-ai--page .oleg-ai__form { padding: 12px 18px; grid-template-columns: minmax(0, 1fr) 52px; }
.oleg-ai--page .oleg-ai__form > button { width: 52px; height: 52px; }
.oleg-ai--page .oleg-ai__note { padding: 0 18px 13px; }

@media (max-width: 700px) {
    .oleg-ai { right: 12px; bottom: 12px; }
    .oleg-ai__launcher { width: 58px; padding: 0; justify-content: center; }
    .oleg-ai__launcher span { display: none; }
    .oleg-ai--floating .oleg-ai__panel { position: fixed; inset: 0; width: 100%; height: 100%; max-height: none; border: 0; border-radius: 0; }
    .oleg-ai--floating .oleg-ai__header { padding-top: max(14px, env(safe-area-inset-top)); }
    .oleg-ai--floating .oleg-ai__note { padding-bottom: max(10px, env(safe-area-inset-bottom)); }

    .oleg-ai--page .oleg-ai__panel { height: min(720px, calc(100vh - 32px)); min-height: 620px; border-radius: 20px; }
    .oleg-ai--page .oleg-ai__header { min-height: 76px; padding: 12px 14px; }
    .oleg-ai--page .oleg-ai__identity { gap: 10px; }
    .oleg-ai--page .oleg-ai__avatar { width: 42px; height: 42px; flex-basis: 42px; border-radius: 13px; }
    .oleg-ai--page .oleg-ai__identity-text strong { font-size: 16px; }
    .oleg-ai--page .oleg-ai__identity-text > span { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .oleg-ai--page .oleg-ai__messages { padding: 18px 14px 22px; }
    .oleg-ai--page .oleg-ai__bubble { max-width: 90%; font-size: 14px; }
    .oleg-ai--page .oleg-ai__cards { grid-template-columns: 1fr; }
    .oleg-ai--page .oleg-ai__card-image { height: 175px; }
    .oleg-ai--page .oleg-ai__quick { padding: 10px 12px 9px; }
    .oleg-ai--page .oleg-ai__form { padding: 10px 12px; grid-template-columns: minmax(0, 1fr) 48px; }
    .oleg-ai--page .oleg-ai__form > button { width: 48px; height: 48px; }
}
