/* =========================================================
   Страница чата chat.nagoroh.ru — самостоятельный шелл.
   Тема Able Pro даёт бутстрап-утилиты, всё остальное здесь.
   ========================================================= */

:root {
    --ngc-brand: #673ab7;
    --ngc-brand-strong: #522e92;
    --ngc-brand-soft: #f1ecfa;
    --ngc-accent: #8bc34a;
    --ngc-ink: #1d1b28;
    --ngc-muted: #6b6880;
    --ngc-line: #e7e4f0;
    --ngc-surface: #ffffff;
    --ngc-canvas: #f5f3fa;
    --ngc-radius: 18px;
    --ngc-shadow: 0 18px 45px -28px rgba(45, 26, 90, .45);
    --ngc-topbar-h: 64px;
}

/* --- Каркас страницы --- */

html.ngc-html,
body.ngc-page {
    height: 100%;
}

body.ngc-page {
    margin: 0;
    background: var(--ngc-canvas);
    color: var(--ngc-ink);
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.ngc-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
}

/* --- Верхняя панель --- */

.ngc-topbar {
    flex: 0 0 auto;
    height: var(--ngc-topbar-h);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--ngc-line);
}

.ngc-topbar__logo img {
    height: 30px;
    width: auto;
    display: block;
}

.ngc-topbar__spacer {
    flex: 1 1 auto;
}

.ngc-topbar__tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--ngc-brand-soft);
    color: var(--ngc-brand);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.ngc-iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border: 1px solid var(--ngc-line);
    border-radius: 12px;
    background: #fff;
    color: var(--ngc-ink);
    transition: background .18s ease, border-color .18s ease, color .18s ease;
}

.ngc-iconbtn:hover {
    background: var(--ngc-brand-soft);
    border-color: rgba(103, 58, 183, .35);
    color: var(--ngc-brand);
}

.ngc-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border: 0;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
    transition: transform .15s ease, box-shadow .18s ease, background .18s ease;
}

.ngc-btn--primary {
    background: linear-gradient(135deg, #7b4bd0 0%, var(--ngc-brand) 55%, #4f2b91 100%);
    color: #fff;
    box-shadow: 0 10px 24px -12px rgba(103, 58, 183, .9);
}

.ngc-btn--primary:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 14px 28px -12px rgba(103, 58, 183, .95);
}

.ngc-btn--ghost {
    background: #fff;
    color: var(--ngc-ink);
    border: 1px solid var(--ngc-line);
}

.ngc-btn--ghost:hover {
    color: var(--ngc-brand);
    border-color: rgba(103, 58, 183, .35);
    background: var(--ngc-brand-soft);
}

/* --- Рабочая область --- */

.ngc-workspace {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    gap: 18px;
    padding: 18px 20px 22px;
}

/* --- Список чатов --- */

.ngc-aside {
    flex: 0 0 288px;
    width: 288px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: var(--ngc-surface);
    border: 1px solid var(--ngc-line);
    border-radius: var(--ngc-radius);
    box-shadow: var(--ngc-shadow);
    overflow: hidden;
}

.ngc-aside__head {
    padding: 18px 18px 14px;
    border-bottom: 1px solid var(--ngc-line);
}

.ngc-aside__title {
    margin: 0 0 12px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ngc-muted);
}

.ngc-aside__new {
    width: 100%;
    justify-content: center;
}

.ngc-aside__list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ngc-session {
    display: block;
    width: 100%;
    padding: 11px 13px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    text-align: left;
    text-decoration: none;
    color: inherit;
    transition: background .16s ease, border-color .16s ease;
}

.ngc-session:hover {
    background: #f7f5fc;
}

.ngc-session.is-active {
    background: var(--ngc-brand-soft);
    border-color: rgba(103, 58, 183, .28);
}

.ngc-session__row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.ngc-session__name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--ngc-ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ngc-session.is-active .ngc-session__name {
    color: var(--ngc-brand-strong);
}

.ngc-session__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    font-size: 12px;
    color: var(--ngc-muted);
}

.ngc-session__count {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ngc-aside__empty {
    padding: 18px 14px;
    font-size: 13px;
    color: var(--ngc-muted);
    text-align: center;
}

.ngc-aside__foot {
    padding: 14px 18px;
    border-top: 1px solid var(--ngc-line);
    font-size: 12px;
    color: var(--ngc-muted);
    line-height: 1.5;
}

.ngc-aside__foot a {
    color: var(--ngc-brand);
    font-weight: 600;
    text-decoration: none;
}

.ngc-aside__foot a:hover {
    text-decoration: underline;
}

/* --- Панель диалога --- */

.ngc-panel {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    background: var(--ngc-surface);
    border: 1px solid var(--ngc-line);
    border-radius: var(--ngc-radius);
    box-shadow: var(--ngc-shadow);
    overflow: hidden;
}

.ngc-panel__head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--ngc-line);
}

.ngc-avatar {
    position: relative;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--ngc-brand-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ngc-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ngc-avatar--sm {
    width: 34px;
    height: 34px;
}

.ngc-panel__title {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
}

.ngc-panel__status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12.5px;
    color: var(--ngc-muted);
}

.ngc-dot-online {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #2ca87f;
    box-shadow: 0 0 0 3px rgba(44, 168, 127, .18);
}

/* --- Лента сообщений --- */

.ngc-thread {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 22px 20px 8px;
}

.ngc-thread__inner {
    max-width: 780px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 100%;
}

/* Короткий диалог прижимаем к низу; auto-поле схлопывается,
   когда сообщений становится больше экрана, и прокрутка не ломается. */
.ngc-thread__inner > .ngc-msg:first-child {
    margin-top: auto;
}

/* Индикатор ответа на первое сообщение: приветствие уже скрыто,
   и без auto-поля пузырь повис бы у верхней границы ленты. */
.ngc-msg--solo {
    margin-top: auto;
}

.ngc-msg {
    display: flex;
    gap: 10px;
    max-width: 100%;
}

.ngc-msg--in {
    align-self: flex-start;
    max-width: min(90%, 640px);
}

.ngc-msg--out {
    align-self: flex-end;
    max-width: min(85%, 560px);
    flex-direction: row-reverse;
}

.ngc-bubble {
    padding: 11px 15px;
    border-radius: 16px;
    font-size: 14.5px;
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.ngc-bubble p {
    margin: 0;
}

.ngc-msg--in .ngc-bubble {
    background: #f6f5fa;
    border: 1px solid var(--ngc-line);
    border-bottom-left-radius: 5px;
    color: var(--ngc-ink);
}

.ngc-msg--out .ngc-bubble {
    background: linear-gradient(135deg, #7b4bd0 0%, var(--ngc-brand) 60%, #52309a 100%);
    border-bottom-right-radius: 5px;
    color: #fff;
    box-shadow: 0 12px 26px -18px rgba(103, 58, 183, .95);
}

.ngc-msg__time {
    margin-top: 5px;
    font-size: 11.5px;
    color: var(--ngc-muted);
}

.ngc-msg--out .ngc-msg__time {
    text-align: right;
}

.ngc-msg__body {
    min-width: 0;
}

.ngc-copy {
    border: 0;
    background: none;
    padding: 0;
    margin-left: 8px;
    font-size: 11.5px;
    color: var(--ngc-muted);
    opacity: 0;
    transition: opacity .15s ease, color .15s ease;
}

.ngc-msg:hover .ngc-copy,
.ngc-copy:focus-visible {
    opacity: 1;
}

.ngc-copy:hover {
    color: var(--ngc-brand);
}

/* Индикатор набора */

.ngc-typing {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 2px;
}

.ngc-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #b6aed2;
    animation: ngc-bounce 1.2s infinite ease-in-out;
}

.ngc-typing span:nth-child(2) { animation-delay: .16s; }
.ngc-typing span:nth-child(3) { animation-delay: .32s; }

@keyframes ngc-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: .45; }
    30%           { transform: translateY(-5px); opacity: 1; }
}

/* --- Пустое состояние --- */

.ngc-empty {
    /* auto-поля центрируют блок, но не срезают верх на низких экранах */
    margin: auto 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px 0 24px;
}

.ngc-empty__mascot {
    width: 148px;
    max-width: 45vw;
    height: auto;
    margin-bottom: 6px;
}

.ngc-empty__title {
    margin: 0 0 8px;
    font-size: clamp(20px, 3vw, 26px);
    font-weight: 800;
    letter-spacing: -.01em;
}

.ngc-empty__title span {
    background: linear-gradient(120deg, var(--ngc-brand) 0%, #a855f7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.ngc-empty__lead {
    margin: 0 0 22px;
    max-width: 460px;
    font-size: 14.5px;
    line-height: 1.6;
    color: var(--ngc-muted);
}

.ngc-suggests {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    max-width: 560px;
}

.ngc-suggest {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--ngc-line);
    border-radius: 14px;
    background: #fff;
    text-align: left;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ngc-ink);
    transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.ngc-suggest:hover {
    border-color: rgba(103, 58, 183, .4);
    box-shadow: 0 12px 24px -18px rgba(103, 58, 183, .9);
    transform: translateY(-1px);
}

.ngc-suggest__emoji {
    font-size: 17px;
    line-height: 1;
}

/* --- Карточка заказа в сообщении: план, почта, ссылка на работу --- */

.ngc-card {
    margin-top: 12px;
    padding: 14px;
    border: 1px solid rgba(103, 58, 183, .25);
    border-radius: 14px;
    background: linear-gradient(135deg, #f7f3ff 0%, #f2fbf2 100%);
}

.ngc-card__head {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 10px;
}

.ngc-card__type {
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ngc-brand);
}

.ngc-card__title {
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--ngc-ink);
}

.ngc-card__desc {
    margin: 0 0 10px !important;
    font-size: 13px;
    line-height: 1.5;
    color: var(--ngc-muted);
}

.ngc-outline {
    margin: 0 0 10px;
    padding: 10px 12px 10px 30px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .7);
    font-size: 13px;
    line-height: 1.45;
}

.ngc-outline > li {
    padding: 3px 0;
}

.ngc-outline > li > span {
    font-weight: 600;
}

.ngc-outline ul {
    margin: 4px 0 0;
    padding-left: 16px;
    list-style: disc;
    color: var(--ngc-muted);
}

.ngc-outline ul li {
    padding: 1px 0;
}

.ngc-card__status {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ngc-brand-strong);
}

.ngc-card__status .spinner-border {
    flex: 0 0 auto;
    color: var(--ngc-brand);
}

.ngc-card__status .ngc-typing {
    flex: 0 0 auto;
}

.ngc-card__status--done {
    color: #3f7d2a;
}

.ngc-card__status--error {
    color: #b4413a;
}

.ngc-card .ngc-btn {
    justify-content: center;
}

.ngc-card__open {
    margin-top: 12px;
    width: 100%;
}

.ngc-card__hint {
    margin: 8px 0 0 !important;
    font-size: 12px;
    line-height: 1.45;
    color: var(--ngc-muted);
}

.ngc-card__mailed {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .8);
    font-size: 13px;
    line-height: 1.5;
    color: var(--ngc-ink);
}

.ngc-card__mailed > i {
    flex: 0 0 auto;
    margin-top: 3px;
    color: var(--ngc-brand);
}

.ngc-card__resend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--ngc-muted);
}

.ngc-card__resend button {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 600;
    color: var(--ngc-brand);
    text-decoration: underline;
    cursor: pointer;
}

.ngc-card__resend button:disabled {
    opacity: .6;
    cursor: default;
}

/* Вопрос про почту */

.ngc-lead {
    margin-top: 12px;
}

.ngc-lead__label {
    display: block;
    margin-bottom: 8px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ngc-ink);
}

.ngc-lead__row {
    display: flex;
    gap: 8px;
}

.ngc-lead__input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 9px 12px;
    border: 1px solid var(--ngc-line);
    border-radius: 12px;
    background: #fff;
    font: inherit;
    font-size: 14px;
    color: var(--ngc-ink);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.ngc-lead__input:focus {
    border-color: rgba(103, 58, 183, .5);
    box-shadow: 0 0 0 3px rgba(103, 58, 183, .12);
}

.ngc-lead__row .ngc-btn {
    flex: 0 0 auto;
}

.ngc-lead__error {
    margin-top: 6px;
    font-size: 12px;
    color: #b4413a;
}

.ngc-lead__agree {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--ngc-muted);
    cursor: pointer;
    user-select: none;
}

.ngc-lead__agree input {
    flex: 0 0 auto;
    width: 15px;
    height: 15px;
    margin: 2px 0 0;
    accent-color: var(--ngc-brand);
    cursor: pointer;
}

.ngc-lead__agree a {
    color: var(--ngc-brand);
}

@media (max-width: 575.98px) {
    .ngc-lead__row {
        flex-direction: column;
    }

    .ngc-lead__row .ngc-btn {
        width: 100%;
    }
}

/* --- Композер --- */

.ngc-composer {
    flex: 0 0 auto;
    padding: 12px 20px 16px;
    border-top: 1px solid var(--ngc-line);
    background: #fff;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.ngc-composer__inner {
    max-width: 780px;
    margin: 0 auto;
}

.ngc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
}

.ngc-chips::-webkit-scrollbar {
    display: none;
}

.ngc-chip {
    flex: 0 0 auto;
    padding: 6px 13px;
    border: 1px solid var(--ngc-line);
    border-radius: 999px;
    background: #fff;
    font-size: 12.5px;
    color: var(--ngc-muted);
    white-space: nowrap;
    transition: border-color .16s ease, color .16s ease, background .16s ease;
}

.ngc-chip:hover {
    border-color: rgba(103, 58, 183, .4);
    background: var(--ngc-brand-soft);
    color: var(--ngc-brand-strong);
}

.ngc-field {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 7px 7px 7px 16px;
    border: 1px solid var(--ngc-line);
    border-radius: 16px;
    background: #faf9fd;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.ngc-field:focus-within {
    background: #fff;
    border-color: rgba(103, 58, 183, .45);
    box-shadow: 0 0 0 4px rgba(103, 58, 183, .1);
}

.ngc-field__input {
    flex: 1 1 auto;
    min-width: 0;
    border: 0;
    outline: 0;
    resize: none;
    background: transparent;
    font: inherit;
    font-size: 14.5px;
    line-height: 1.5;
    color: var(--ngc-ink);
    padding: 9px 0;
    max-height: 148px;
}

.ngc-field__input::placeholder {
    color: #9a95ae;
}

.ngc-send {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    min-width: 42px;
    padding: 0 16px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #7b4bd0 0%, var(--ngc-brand) 60%, #4f2b91 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 22px -12px rgba(103, 58, 183, .95);
    transition: opacity .16s ease, transform .16s ease;
}

.ngc-send:hover:not(:disabled) {
    transform: translateY(-1px);
}

.ngc-send:disabled {
    opacity: .45;
    box-shadow: none;
    transform: none;
}

.ngc-composer__note {
    margin: 8px 2px 0;
    font-size: 11.5px;
    color: var(--ngc-muted);
    text-align: center;
}

/* --- Прокрутка --- */

.ngc-thread::-webkit-scrollbar,
.ngc-aside__list::-webkit-scrollbar {
    width: 6px;
}

.ngc-thread::-webkit-scrollbar-thumb,
.ngc-aside__list::-webkit-scrollbar-thumb {
    background: #d9d4e6;
    border-radius: 3px;
}

.ngc-thread::-webkit-scrollbar-thumb:hover,
.ngc-aside__list::-webkit-scrollbar-thumb:hover {
    background: #c3bcd8;
}

/* --- Мобильная раскладка --- */

@media (max-width: 1199.98px) {
    .ngc-aside {
        flex-basis: 250px;
        width: 250px;
    }
}

@media (max-width: 991.98px) {
    :root {
        --ngc-topbar-h: 58px;
    }

    .ngc-workspace {
        padding: 0;
        gap: 0;
    }

    .ngc-panel {
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .ngc-workspace > .ngc-aside {
        display: none;
    }

    .ngc-thread {
        padding: 16px 14px 4px;
    }

    .ngc-composer {
        padding: 10px 14px 12px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
    }

    .ngc-chips {
        flex-wrap: nowrap;
    }

    .ngc-topbar {
        padding: 0 14px;
    }

    .ngc-empty__mascot {
        width: 112px;
        margin-bottom: 2px;
    }

    .ngc-empty__lead {
        margin-bottom: 16px;
        font-size: 13.5px;
    }

    .ngc-suggests {
        grid-template-columns: 1fr;
        max-width: 380px;
        gap: 8px;
    }

    .ngc-suggest {
        padding: 10px 13px;
    }

    .ngc-msg--in,
    .ngc-msg--out {
        max-width: 92%;
    }
}

/* Оффканвас со списком чатов — только на мобильных */

.ngc-offcanvas {
    width: 300px;
}

.ngc-offcanvas .ngc-aside {
    display: flex;
    width: 100%;
    flex-basis: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    height: 100%;
}

@media (min-width: 992px) {
    .ngc-offcanvas {
        display: none !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ngc-typing span,
    .ngc-btn,
    .ngc-send,
    .ngc-suggest {
        animation: none !important;
        transition: none !important;
    }
}

/* --- Мелкие утилиты --- */

[x-cloak] {
    display: none !important;
}

.ngc-min0 {
    min-width: 0;
}
