.ai-page {
    --ai-bg: #f7f7fa;
    --ai-paper: #ffffff;
    --ai-ink: #171821;
    --ai-muted: #747684;
    --ai-line: #e5e5eb;
    --ai-soft: #f0f0f4;
    --ai-purple: #7055e8;
    --ai-purple-dark: #5940ce;
    --ai-orange: #ff754e;
    --ai-blue: #4e8cf5;
    --ai-green: #1eb384;
    --ai-shadow: 0 24px 70px rgba(32, 29, 53, .12);
}

body.secportal-ai-standalone {
    margin: 0;
    min-height: 100%;
    background: var(--ai-bg);
}

.ai-page,
.ai-page button,
.ai-page input,
.ai-page textarea {
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

body.ai-modal-open {
    overflow: hidden;
}

body.admin-bar .ai-page {
    height: calc(100vh - 32px);
}

body.secportal-ai-standalone .site-shell-spa,
body.secportal-ai-standalone .site-main-spa {
    min-height: 100vh;
}

body.secportal-ai-standalone .site-main-spa {
    overflow: hidden;
}

.ai-page {
    position: relative;
    display: flex;
    width: 100%;
    height: 100vh;
    flex-direction: column;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 7%, rgba(112, 85, 232, .06), transparent 27%),
        var(--ai-bg);
    color: var(--ai-ink);
    -webkit-font-smoothing: antialiased;
}

.secportal-ai-route-host {
    display: block;
    width: 100%;
    min-width: 0;
}

.secportal-ai-route-host[hidden] {
    display: none !important;
}

.ai-portal-page {
    min-height: 100%;
    padding: 32px 0 48px;
    background:
        radial-gradient(circle at 88% 5%, rgba(249, 115, 22, .13), transparent 27%),
        radial-gradient(circle at 8% 84%, rgba(112, 85, 232, .1), transparent 25%),
        linear-gradient(rgba(148, 163, 184, .1) 1px, transparent 1px),
        linear-gradient(90deg, rgba(148, 163, 184, .1) 1px, transparent 1px),
        #fbfbfd;
    background-size: auto, auto, 48px 48px, 48px 48px, auto;
}

.ai-portal-intro {
    display: flex;
    width: min(1120px, calc(100% - 32px));
    align-items: flex-end;
    justify-content: space-between;
    gap: 28px;
    margin: 0 auto 22px;
}

.ai-portal-heading p,
.ai-portal-heading h1,
.ai-portal-heading > div {
    margin: 0;
}

.ai-portal-heading p {
    color: #6d4be4;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
}

.ai-portal-heading h1 {
    margin-top: 9px;
    color: #172033;
    font-size: clamp(30px, 3.1vw, 40px);
    font-weight: 820;
    letter-spacing: -.045em;
    line-height: 1.05;
}

.ai-portal-heading h1 span {
    background: linear-gradient(110deg, #f06f54, #7a48df);
    background-clip: text;
    color: transparent;
    -webkit-background-clip: text;
}

.ai-portal-heading > div {
    margin-top: 11px;
    color: #6e7482;
    font-size: 13px;
    line-height: 1.7;
}

.ai-portal-status {
    display: flex;
    min-width: 176px;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border: 1px solid rgba(148, 163, 184, .24);
    border-radius: 14px;
    background: rgba(255, 255, 255, .82);
    box-shadow: 0 14px 34px rgba(35, 39, 56, .07);
    backdrop-filter: blur(14px);
}

.ai-portal-status > i {
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    border-radius: 50%;
    background: var(--ai-green, #1eb384);
    box-shadow: 0 0 0 5px rgba(30, 179, 132, .1);
}

.ai-portal-status.is-offline > i {
    background: #d17a49;
    box-shadow: 0 0 0 5px rgba(209, 122, 73, .1);
}

.ai-portal-status span,
.ai-portal-status small,
.ai-portal-status strong {
    display: block;
}

.ai-portal-status small {
    color: #999ba5;
    font-size: 8px;
    font-weight: 750;
    letter-spacing: .08em;
}

.ai-portal-status strong {
    margin-top: 2px;
    color: #383a45;
    font-size: 11px;
}

.ai-page.ai-page--spa {
    width: min(1120px, calc(100% - 32px));
    height: clamp(520px, calc(100dvh - 220px), 760px);
    min-height: 520px;
    margin: 0 auto;
    border: 1px solid rgba(148, 163, 184, .24);
    border-radius: 24px;
    box-shadow: 0 28px 80px rgba(31, 35, 52, .12);
}

.ai-page--spa .ai-main {
    min-height: 0;
}

.ai-page--spa .ai-conversation {
    padding-top: 22px;
}

.ai-page--spa .ai-welcome {
    margin-top: clamp(8px, 2.8vh, 28px);
}

.ai-page--spa .ai-welcome-mark {
    margin-bottom: 13px;
}

.ai-page--spa .ai-welcome-copy {
    margin-top: 10px;
}

.ai-page--spa .ai-starter-list {
    margin-top: 22px;
}

.ai-page a {
    color: inherit;
    text-decoration: none;
}

.ai-page button,
.ai-page input,
.ai-page textarea {
    color: inherit;
    font: inherit;
}

.ai-page button {
    cursor: pointer;
}

.ai-page [hidden] {
    display: none !important;
}

.ai-page svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Header */
.ai-topbar {
    position: relative;
    z-index: 20;
    height: 66px;
    flex: 0 0 66px;
    border-bottom: 1px solid rgba(26, 26, 36, .08);
    background: rgba(255, 255, 255, .82);
    backdrop-filter: blur(18px);
}

.ai-topbar-inner {
    display: grid;
    width: min(1180px, calc(100% - 36px));
    height: 100%;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin: 0 auto;
}

.ai-brand {
    display: inline-flex;
    width: max-content;
    align-items: center;
    gap: 10px;
}

.ai-brand-mark,
.ai-login-mark {
    display: grid;
    background: linear-gradient(135deg, var(--ai-orange), var(--ai-purple));
    box-shadow: 0 9px 22px rgba(112, 85, 232, .19);
    color: #fff;
    font-weight: 900;
    place-items: center;
}

.ai-brand-mark {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    overflow: hidden;
    border: 1px solid rgba(112, 85, 232, .16);
    border-radius: 12px;
    background: #f2ecff;
    box-shadow: 0 9px 22px rgba(112, 85, 232, .16);
}

.ai-brand-mark img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ai-brand-copy strong,
.ai-brand-copy small {
    display: block;
}

.ai-brand-copy strong {
    font-size: 13px;
    font-weight: 780;
}

.ai-brand-copy small {
    margin-top: 2px;
    color: #a0a1ad;
    font-size: 8px;
    font-weight: 750;
    letter-spacing: .12em;
}

.ai-topbar-center {
    display: flex;
    align-items: center;
    gap: 7px;
    color: #727480;
    font-size: 9px;
    font-weight: 750;
    letter-spacing: .08em;
}

.ai-topbar-center i {
    padding: 3px 6px;
    border-radius: 5px;
    background: rgba(112, 85, 232, .08);
    color: var(--ai-purple);
    font-size: 7px;
    font-style: normal;
}

.ai-topbar-center i.is-offline {
    background: rgba(211, 119, 68, .1);
    color: #ba6233;
}

.ai-prototype-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ai-green);
    box-shadow: 0 0 0 4px rgba(30, 179, 132, .1);
}

.ai-topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
}

.ai-topbar-button {
    display: inline-flex;
    height: 35px;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #6f717d !important;
    font-size: 10px !important;
    font-weight: 650 !important;
}

.ai-topbar-button:hover {
    border-color: var(--ai-line);
    background: rgba(255, 255, 255, .8);
    color: #353640 !important;
}

.ai-topbar-button svg {
    width: 15px;
    height: 15px;
}

.ai-login-button {
    height: 34px;
    padding: 0 15px;
    border: 0;
    border-radius: 10px;
    background: var(--ai-ink);
    color: #fff !important;
    font-size: 10px !important;
    font-weight: 700 !important;
}

.ai-login-button:hover {
    background: #2a2b35;
}

.ai-member-pill {
    display: inline-flex;
    height: 36px;
    align-items: center;
    gap: 7px;
    padding: 3px 9px 3px 3px;
    border: 1px solid var(--ai-line);
    border-radius: 12px;
    background: #fff;
    color: #4e505c !important;
    font-size: 10px;
    font-weight: 700;
}

.ai-member-avatar {
    display: grid;
    width: 28px;
    height: 28px;
    overflow: hidden;
    border-radius: 9px;
    background: linear-gradient(135deg, #eeeaff, #ddd5ff);
    color: var(--ai-purple);
    font-size: 10px;
    place-items: center;
}

.ai-member-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Conversation */
.ai-main {
    position: relative;
    min-height: 0;
    flex: 1;
    margin-left: 252px;
}

.ai-sidebar-open {
    display: none;
}

.ai-chat-shell {
    display: flex;
    width: min(900px, 100%);
    height: 100%;
    flex-direction: column;
    margin: 0 auto;
}

.ai-conversation {
    min-height: 0;
    flex: 1;
    padding: 34px 18px 28px;
    overflow-y: auto;
    scroll-behavior: smooth;
}

.ai-welcome {
    width: min(720px, 100%);
    margin: clamp(22px, 7vh, 72px) auto 0;
    text-align: center;
}

.ai-welcome[hidden] {
    display: none;
}

.ai-welcome-mark {
    position: relative;
    display: grid;
    width: 54px;
    height: 54px;
    overflow: hidden;
    margin: 0 auto 17px;
    border: 1px solid rgba(112, 85, 232, .12);
    border-radius: 17px;
    background: linear-gradient(145deg, #fff, #f1edff);
    box-shadow: 0 14px 38px rgba(89, 63, 200, .13);
    color: var(--ai-purple);
    font-size: 15px;
    font-weight: 900;
    place-items: center;
}

.ai-welcome-mark img {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    object-fit: cover;
}

.ai-welcome-mark i {
    position: absolute;
    right: 5px;
    bottom: 5px;
    width: 8px;
    height: 8px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--ai-green);
}

.ai-eyebrow {
    margin: 0 0 10px;
    color: var(--ai-purple);
    font-size: 8px;
    font-weight: 850;
    letter-spacing: .18em;
}

.ai-welcome h1 {
    margin: 0;
    color: #20212a;
    font-size: clamp(31px, 4vw, 43px);
    font-weight: 760;
    letter-spacing: -.045em;
}

.ai-welcome-copy {
    max-width: 540px;
    margin: 13px auto 0;
    color: var(--ai-muted);
    font-size: 12px;
    line-height: 1.7;
}

.ai-starter-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 31px;
}

.ai-starter-list button {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 94px;
    flex-direction: column;
    align-items: flex-start;
    padding: 14px;
    border: 1px solid var(--ai-line);
    border-radius: 15px;
    background: rgba(255, 255, 255, .76);
    box-shadow: 0 7px 24px rgba(33, 31, 48, .035);
    text-align: left;
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.ai-starter-list button:hover {
    border-color: #d5d1e8;
    box-shadow: 0 12px 30px rgba(49, 42, 81, .08);
    transform: translateY(-2px);
}

.ai-starter-list button > span {
    display: grid;
    width: 28px;
    height: 28px;
    margin-bottom: 11px;
    border-radius: 8px;
    place-items: center;
}

.ai-starter-list button > span svg {
    width: 14px;
    height: 14px;
}

.ai-starter-list .is-orange {
    background: rgba(255, 117, 78, .1);
    color: var(--ai-orange);
}

.ai-starter-list .is-purple {
    background: rgba(112, 85, 232, .1);
    color: var(--ai-purple);
}

.ai-starter-list .is-blue {
    background: rgba(78, 140, 245, .1);
    color: var(--ai-blue);
}

.ai-starter-list strong,
.ai-starter-list small {
    display: block;
}

.ai-starter-list strong {
    font-size: 11px;
    font-weight: 750;
}

.ai-starter-list small {
    margin-top: 3px;
    overflow: hidden;
    color: #9496a2;
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-starter-list button > i {
    position: absolute;
    top: 13px;
    right: 13px;
    color: #bbbcc6;
    font-size: 12px;
    font-style: normal;
}

.ai-message {
    display: flex;
    width: min(760px, 100%);
    align-items: flex-start;
    gap: 12px;
    margin: 0 auto 28px;
    animation: ai-message-in .28s ease both;
}

.ai-message.is-user {
    justify-content: flex-end;
}

.ai-message-avatar {
    display: grid;
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    border-radius: 10px;
    background: #e8e8ed;
    color: #747682;
    font-size: 9px;
    font-weight: 800;
    place-items: center;
}

.ai-message-avatar.is-bot {
    background: linear-gradient(135deg, var(--ai-orange), var(--ai-purple));
    box-shadow: 0 7px 18px rgba(112, 85, 232, .16);
    color: #fff;
}

.ai-user-bubble {
    max-width: min(78%, 560px);
    padding: 12px 15px;
    border-radius: 16px 4px 16px 16px;
    background: #292a34;
    color: #fff;
    font-size: 13px;
    line-height: 1.65;
}

.ai-assistant-body {
    min-width: 0;
    flex: 1;
    padding-top: 4px;
    color: #41434f;
    font-size: 13px;
    line-height: 1.75;
}

.ai-answer-status {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 10px;
}

.ai-answer-status span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ai-green);
    font-size: 9px;
    font-weight: 750;
}

.ai-answer-status span i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.ai-answer-status small {
    color: #afb0ba;
    font-size: 9px;
}

.ai-assistant-body > p {
    margin: 0;
}

.ai-answer-content {
    color: #3f414d;
    line-height: 1.82;
    white-space: normal;
    overflow-wrap: anywhere;
}

.ai-answer-content > :first-child {
    margin-top: 0;
}

.ai-answer-content > :last-child {
    margin-bottom: 0;
}

.ai-answer-content p {
    margin: 0 0 12px;
}

.ai-answer-content h3,
.ai-answer-content h4 {
    margin: 18px 0 8px;
    color: #252731;
    line-height: 1.45;
}

.ai-answer-content h3 {
    font-size: 15px;
}

.ai-answer-content h4 {
    font-size: 13px;
}

.ai-answer-content ul,
.ai-answer-content ol {
    display: grid;
    gap: 5px;
    margin: 8px 0 14px;
    padding-left: 22px;
}

.ai-answer-content li {
    padding-left: 2px;
}

.ai-answer-content strong {
    color: #292b35;
    font-weight: 750;
}

.ai-answer-content code {
    padding: 2px 5px;
    border: 1px solid rgba(112, 85, 232, .12);
    border-radius: 6px;
    background: rgba(112, 85, 232, .07);
    color: #6549d0;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: .9em;
    overflow-wrap: normal;
}

.ai-answer-content a {
    color: #6248d1;
    font-weight: 650;
    text-decoration: underline;
    text-decoration-color: rgba(98, 72, 209, .35);
    text-underline-offset: 3px;
}

.ai-answer-content blockquote {
    margin: 12px 0;
    padding: 9px 12px;
    border-left: 3px solid rgba(112, 85, 232, .6);
    border-radius: 0 8px 8px 0;
    background: rgba(112, 85, 232, .045);
    color: #636572;
}

.ai-answer-content hr {
    height: 1px;
    margin: 17px 0;
    border: 0;
    background: var(--ai-line);
}

.ai-markdown-code {
    margin: 12px 0 15px;
    overflow: hidden;
    border: 1px solid #2f313b;
    border-radius: 11px;
    background: #20212a;
    box-shadow: 0 10px 24px rgba(28, 29, 37, .12);
}

.ai-markdown-code header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 34px;
    padding: 6px 10px 6px 13px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    background: #282a34;
}

.ai-markdown-code header span {
    color: #aaa9bc;
    font-size: 9px;
    font-weight: 750;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.ai-markdown-code header button {
    padding: 4px 7px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 6px;
    background: rgba(255, 255, 255, .05);
    color: #d8d8e2 !important;
    font-size: 9px !important;
}

.ai-markdown-code header button:hover {
    background: rgba(255, 255, 255, .1);
}

.ai-markdown-code pre {
    max-width: 100%;
    margin: 0;
    padding: 14px 15px;
    overflow-x: auto;
    color: #ebebf2;
    white-space: pre;
    tab-size: 4;
}

.ai-markdown-code pre code {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: inherit;
    font-size: 11px;
    line-height: 1.7;
    overflow-wrap: normal;
}

.ai-message.is-error .ai-message-avatar.is-bot {
    background: linear-gradient(135deg, #e58566, #c64e60);
}

.ai-message.is-error .ai-answer-status span,
.ai-message.is-error .ai-answer-status small,
.ai-error-copy {
    color: #b34755;
}

.ai-answer-steps {
    display: grid;
    gap: 8px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.ai-answer-steps li {
    display: flex;
    gap: 11px;
    padding: 11px 12px;
    border: 1px solid var(--ai-line);
    border-radius: 11px;
    background: rgba(255, 255, 255, .72);
}

.ai-answer-steps li > span {
    color: var(--ai-purple);
    font-size: 9px;
    font-weight: 850;
}

.ai-answer-steps p {
    margin: 0;
    color: #666875;
    font-size: 11px;
    line-height: 1.65;
}

.ai-answer-steps strong {
    display: block;
    margin-bottom: 2px;
    color: #292a34;
    font-size: 11px;
}

.ai-answer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
}

.ai-answer-source {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 8px 11px;
    border-radius: 10px;
    background: rgba(112, 85, 232, .06);
    color: var(--ai-purple);
}

.ai-answer-source > span {
    font-size: 12px;
}

.ai-answer-source small,
.ai-answer-source strong {
    display: block;
}

.ai-answer-source small {
    color: #9b94bb;
    font-size: 8px;
}

.ai-answer-source strong {
    margin-top: 1px;
    font-size: 9px;
}

.ai-copy-answer {
    padding: 6px 9px;
    border: 1px solid var(--ai-line);
    border-radius: 8px;
    background: transparent;
    color: #858793 !important;
    font-size: 9px !important;
}

.ai-copy-answer:hover {
    background: #fff;
    color: #494b56 !important;
}

.ai-message.is-thinking .ai-assistant-body {
    color: var(--ai-muted);
    font-size: 11px;
}

.ai-thinking-dots {
    display: inline-flex;
    gap: 3px;
}

.ai-thinking-dots i {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--ai-purple);
    animation: ai-thinking 1s ease-in-out infinite;
}

.ai-thinking-dots i:nth-child(2) { animation-delay: .12s; }
.ai-thinking-dots i:nth-child(3) { animation-delay: .24s; }

/* Composer */
.ai-composer-area {
    flex: 0 0 auto;
    padding: 8px 18px 16px;
    background: linear-gradient(to top, var(--ai-bg) 78%, rgba(247, 247, 250, 0));
}

.ai-guest-note {
    display: flex;
    width: min(760px, 100%);
    min-height: 31px;
    align-items: center;
    gap: 9px;
    margin: 0 auto 7px;
    padding: 5px 9px;
    border: 1px solid rgba(112, 85, 232, .1);
    border-radius: 10px;
    background: rgba(112, 85, 232, .045);
    color: #777383;
    font-size: 9px;
}

.ai-guest-note > span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ai-purple);
    font-weight: 750;
}

.ai-guest-note > span i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

.ai-guest-note p {
    flex: 1;
    margin: 0;
}

.ai-guest-note strong {
    color: #4f4c59;
}

.ai-guest-note button {
    padding: 4px 7px;
    border: 0;
    background: transparent;
    color: var(--ai-purple) !important;
    font-size: 9px !important;
    font-weight: 700 !important;
}

.ai-composer {
    position: relative;
    display: grid;
    width: min(760px, 100%);
    min-height: 88px;
    grid-template-columns: minmax(0, 1fr) 43px;
    margin: 0 auto;
    padding: 12px 10px 10px 15px;
    border: 1px solid #dcdce5;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 16px 44px rgba(35, 33, 54, .09);
    transition: border-color .2s ease, box-shadow .2s ease;
}

.ai-composer:focus-within {
    border-color: rgba(112, 85, 232, .45);
    box-shadow: 0 18px 48px rgba(73, 58, 138, .12), 0 0 0 3px rgba(112, 85, 232, .05);
}

.ai-composer textarea {
    width: 100%;
    height: 31px;
    max-height: 150px;
    padding: 4px 4px 0;
    overflow-y: auto;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--ai-ink);
    font-size: 13px;
    line-height: 1.55;
    resize: none;
}

.ai-composer textarea::placeholder {
    color: #a9aab4;
}

.ai-composer-footer {
    display: flex;
    grid-column: 1;
    align-items: center;
    gap: 14px;
    margin-top: 5px;
}

.ai-scope-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #7e808b;
    font-size: 8px;
}

.ai-scope-label svg {
    width: 13px;
    height: 13px;
    color: var(--ai-green);
}

.ai-send-hint {
    color: #b0b1ba;
    font-size: 8px;
}

.ai-send-button {
    display: grid;
    grid-column: 2;
    grid-row: 1 / span 2;
    width: 39px;
    height: 39px;
    align-self: end;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #8065ed, #6046da);
    box-shadow: 0 8px 20px rgba(96, 70, 218, .22);
    color: #fff !important;
    place-items: center;
    transition: transform .2s ease, opacity .2s ease;
}

.ai-send-button:hover {
    transform: translateY(-1px);
}

.ai-send-button:disabled {
    cursor: wait;
    opacity: .5;
}

.ai-send-button svg {
    width: 17px;
    height: 17px;
    stroke-width: 2.1;
}

.ai-disclaimer {
    margin: 7px 0 0;
    color: #a5a6af;
    font-size: 8px;
    text-align: center;
}

/* Persistent conversation sidebar */
.ai-panel-overlay {
    position: absolute;
    z-index: 45;
    inset: 0;
    background: rgba(20, 19, 28, .3);
    backdrop-filter: blur(2px);
}

.ai-history-drawer {
    position: absolute;
    z-index: 50;
    top: 0;
    left: 0;
    bottom: 0;
    width: 252px;
    border-right: 1px solid rgba(31, 32, 43, .07);
    background: rgba(242, 242, 247, .94);
    box-shadow: none;
    transform: none;
    transition: transform .25s ease;
}

.ai-history-drawer.is-open {
    transform: translateX(0);
}

.ai-history-drawer > header {
    display: flex;
    height: 72px;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    border-bottom: 0;
}

.ai-sidebar-brand {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.ai-sidebar-brand .ai-brand-copy {
    min-width: 0;
}

.ai-sidebar-brand .ai-brand-copy strong {
    font-size: 13px;
}

.ai-sidebar-brand .ai-brand-copy small {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 3px;
    color: #8e8f99;
    font-size: 8px;
    letter-spacing: .05em;
}

.ai-sidebar-brand .ai-brand-copy small span.is-offline {
    color: #ba6233;
}

.ai-sidebar-brand .ai-prototype-dot {
    width: 5px;
    height: 5px;
    flex: 0 0 5px;
    box-shadow: 0 0 0 3px rgba(30, 179, 132, .09);
}

.ai-history-drawer .ai-sidebar-close,
.ai-login-close {
    display: grid;
    width: 33px;
    height: 33px;
    padding: 0;
    border: 1px solid var(--ai-line);
    border-radius: 10px;
    background: #fff;
    color: #7a7c87;
    place-items: center;
}

.ai-history-drawer .ai-sidebar-close {
    display: none;
}

.ai-history-drawer header svg,
.ai-login-close svg {
    width: 15px;
    height: 15px;
}

.ai-history-content {
    display: flex;
    height: calc(100% - 72px);
    flex-direction: column;
    padding: 4px 12px 14px;
}

.ai-drawer-new {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    padding: 0 12px;
    border: 1px solid rgba(31, 32, 43, .08);
    border-radius: 12px;
    background: rgba(255, 255, 255, .82);
    color: #353640 !important;
    font-size: 11px !important;
    font-weight: 700 !important;
}

.ai-drawer-new:hover {
    border-color: rgba(112, 85, 232, .18);
    background: #fff;
}

.ai-drawer-new svg {
    width: 15px;
    height: 15px;
}

.ai-sidebar-section-label {
    margin: 22px 8px 4px;
    color: #9697a1;
    font-size: 8px;
    font-weight: 750;
    letter-spacing: .08em;
}

.ai-history-empty {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: flex-start;
    flex-direction: column;
    padding: 26px 16px;
    text-align: center;
}

.ai-history-empty > span {
    display: grid;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .72);
    color: #a0a1ad;
    place-items: center;
}

.ai-history-empty svg {
    width: 18px;
    height: 18px;
}

.ai-history-empty h3 {
    margin: 11px 0 0;
    font-size: 11px;
}

.ai-history-empty p {
    max-width: 210px;
    margin: 7px 0 0;
    color: #989aa5;
    font-size: 8px;
    line-height: 1.6;
}

.ai-current-session {
    flex: 1;
    padding-top: 21px;
}

.ai-current-session > p {
    margin: 0 0 8px 3px;
    color: #9a9ba5;
    font-size: 8px;
    font-weight: 750;
}

.ai-current-session button {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(112, 85, 232, .15);
    border-radius: 12px;
    background: rgba(112, 85, 232, .055);
    text-align: left;
}

.ai-current-session strong,
.ai-current-session small {
    display: block;
}

.ai-current-session strong {
    max-width: 225px;
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-current-session small {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    color: #9592a6;
    font-size: 8px;
}

.ai-current-session small i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--ai-green);
}

.ai-current-session b {
    color: var(--ai-purple);
    font-size: 8px;
}

.ai-history-info {
    padding: 13px;
    border: 1px solid rgba(31, 32, 43, .07);
    border-radius: 11px;
    background: rgba(255, 255, 255, .68);
}

.ai-history-info strong {
    font-size: 9px;
}

.ai-history-info p {
    margin: 4px 0 0;
    color: #989aa5;
    font-size: 8px;
    line-height: 1.55;
}

/* Login modal */
.ai-login-modal {
    position: fixed;
    z-index: 90;
    inset: 0;
    display: grid;
    padding: 18px;
    place-items: center;
}

.ai-login-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(18, 17, 25, .53);
    backdrop-filter: blur(6px);
}

.ai-login-card {
    position: relative;
    z-index: 1;
    width: min(410px, 100%);
    padding: 34px;
    border: 1px solid rgba(255, 255, 255, .8);
    border-radius: 22px;
    background: #fff;
    box-shadow: var(--ai-shadow);
    text-align: center;
    animation: ai-modal-in .24s ease both;
}

.ai-login-close {
    position: absolute;
    top: 15px;
    right: 15px;
}

.ai-login-mark {
    width: 46px;
    height: 46px;
    margin: 0 auto 15px;
    border-radius: 14px;
    font-size: 13px;
}

.ai-login-card h2 {
    margin: 0;
    font-size: 23px;
    letter-spacing: -.03em;
}

.ai-login-copy {
    max-width: 300px;
    margin: 10px auto 22px;
    color: var(--ai-muted);
    font-size: 10px;
    line-height: 1.65;
}

.ai-login-card form {
    text-align: left;
}

.ai-login-card label {
    display: block;
    margin-top: 12px;
}

.ai-login-card label span {
    display: block;
    margin: 0 0 6px 2px;
    color: #626470;
    font-size: 9px;
    font-weight: 700;
}

.ai-login-card input {
    width: 100%;
    height: 44px;
    padding: 0 13px;
    border: 1px solid var(--ai-line);
    border-radius: 11px;
    outline: 0;
    background: #fafafd;
    font-size: 12px;
}

.ai-login-card input:focus {
    border-color: rgba(112, 85, 232, .5);
    box-shadow: 0 0 0 3px rgba(112, 85, 232, .06);
}

.ai-login-error {
    margin: 10px 0 0;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(220, 62, 78, .07);
    color: #c44555;
    font-size: 9px;
}

.ai-login-submit {
    width: 100%;
    height: 44px;
    margin-top: 16px;
    border: 0;
    border-radius: 11px;
    background: linear-gradient(135deg, #8065ed, #6046da);
    box-shadow: 0 9px 22px rgba(96, 70, 218, .2);
    color: #fff !important;
    font-size: 11px !important;
    font-weight: 750 !important;
}

.ai-login-submit:disabled {
    cursor: wait;
    opacity: .6;
}

.ai-login-register {
    margin: 15px 0 0;
    color: #92939e;
    font-size: 9px;
}

.ai-login-register a {
    color: var(--ai-purple);
    font-weight: 750;
}

@keyframes ai-message-in {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes ai-modal-in {
    from { opacity: 0; transform: translateY(8px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ai-thinking {
    0%, 70%, 100% { opacity: .3; transform: translateY(0); }
    35% { opacity: 1; transform: translateY(-2px); }
}

@media (max-width: 900px) {
    .ai-main {
        margin-left: 0;
    }

    .ai-history-drawer {
        width: min(300px, 86vw);
        border-right-color: rgba(31, 32, 43, .1);
        box-shadow: 22px 0 60px rgba(29, 27, 47, .15);
        transform: translateX(-105%);
    }

    .ai-history-drawer.is-open {
        transform: translateX(0);
    }

    .ai-history-drawer .ai-sidebar-close {
        display: grid;
    }

    .ai-sidebar-open {
        position: absolute;
        z-index: 30;
        top: 12px;
        left: 12px;
        display: grid;
        width: 38px;
        height: 38px;
        padding: 0;
        border: 1px solid rgba(31, 32, 43, .08);
        border-radius: 12px;
        background: rgba(255, 255, 255, .9);
        box-shadow: 0 8px 24px rgba(29, 27, 47, .08);
        color: #646671;
        place-items: center;
    }

    .ai-sidebar-open svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 760px) {
    body.admin-bar .ai-page {
        height: calc(100dvh - 46px);
    }

    .ai-page {
        height: 100dvh;
    }

    .ai-portal-page {
        padding: 29px 0 34px;
        background-size: auto, auto, 36px 36px, 36px 36px, auto;
    }

    .ai-portal-intro {
        width: calc(100% - 24px);
        align-items: flex-start;
        flex-direction: column;
        gap: 15px;
        margin-bottom: 20px;
    }

    .ai-portal-heading p {
        font-size: 10px;
    }

    .ai-portal-heading h1 {
        margin-top: 7px;
        font-size: 30px;
    }

    .ai-portal-heading > div {
        max-width: 34em;
        margin-top: 8px;
        font-size: 11px;
    }

    .ai-portal-status {
        min-width: 0;
        padding: 8px 11px;
        border-radius: 12px;
    }

    .ai-page.ai-page--spa {
        width: calc(100% - 24px);
        height: min(680px, calc(100dvh - 84px));
        min-height: 620px;
        border-radius: 20px;
    }

    .ai-main {
        margin-left: 0;
    }

    .ai-history-drawer {
        width: min(300px, 86vw);
        border-right-color: rgba(31, 32, 43, .1);
        box-shadow: 22px 0 60px rgba(29, 27, 47, .15);
        transform: translateX(-105%);
    }

    .ai-history-drawer.is-open {
        transform: translateX(0);
    }

    .ai-history-drawer .ai-sidebar-close {
        display: grid;
    }

    .ai-sidebar-open {
        position: absolute;
        z-index: 30;
        top: 12px;
        left: 12px;
        display: grid;
        width: 38px;
        height: 38px;
        padding: 0;
        border: 1px solid rgba(31, 32, 43, .08);
        border-radius: 12px;
        background: rgba(255, 255, 255, .9);
        box-shadow: 0 8px 24px rgba(29, 27, 47, .08);
        color: #646671;
        place-items: center;
    }

    .ai-sidebar-open svg {
        width: 18px;
        height: 18px;
    }

    .ai-page--spa .ai-conversation {
        padding: 58px 14px 19px;
    }

    .ai-welcome {
        margin-top: 8px;
    }

    .ai-welcome h1 {
        font-size: 30px;
    }

    .ai-welcome-copy {
        padding: 0 12px;
        font-size: 11px;
    }

    .ai-starter-list {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-top: 24px;
    }

    .ai-starter-list button {
        min-height: 62px;
        flex-direction: row;
        align-items: center;
        gap: 11px;
        padding: 11px 12px;
    }

    .ai-starter-list button > span {
        flex: 0 0 34px;
        width: 34px;
        height: 34px;
        margin: 0;
    }

    .ai-starter-list button > i {
        top: 50%;
        transform: translateY(-50%);
    }

    .ai-composer-area {
        padding: 7px 12px 11px;
    }

    .ai-guest-note {
        min-height: 29px;
    }

    .ai-guest-note > span {
        display: none;
    }

    .ai-composer {
        min-height: 80px;
        border-radius: 16px;
    }

    .ai-send-hint,
    .ai-disclaimer {
        display: none;
    }

    .ai-message {
        margin-bottom: 23px;
    }

    .ai-user-bubble {
        max-width: 84%;
    }

    .ai-answer-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .ai-login-card {
        padding: 31px 22px 24px;
        border-radius: 19px;
    }
}

@media (max-width: 390px) {
    .ai-welcome-mark {
        width: 48px;
        height: 48px;
    }

    .ai-guest-note {
        gap: 4px;
        padding-left: 7px;
    }
}

/* Keep the established orange-purple palette while matching the site's staged page reveals. */
@keyframes ai-portal-enter {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes ai-workspace-enter {
    from { opacity: 0; transform: translateY(24px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes ai-sidebar-enter {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}

.ai-portal-heading {
    animation: ai-portal-enter .52s cubic-bezier(.22, 1, .36, 1) both;
}

.ai-portal-status {
    animation: ai-portal-enter .48s .1s cubic-bezier(.22, 1, .36, 1) both;
}

.ai-page.ai-page--spa {
    animation: ai-workspace-enter .64s .14s cubic-bezier(.22, 1, .36, 1) both;
}

.ai-page--spa .ai-history-drawer {
    animation: ai-sidebar-enter .48s .28s cubic-bezier(.22, 1, .36, 1) both;
}

.ai-page--spa .ai-welcome {
    animation: ai-portal-enter .5s .36s cubic-bezier(.22, 1, .36, 1) both;
}

.ai-page--spa .ai-composer-area {
    animation: ai-portal-enter .48s .48s cubic-bezier(.22, 1, .36, 1) both;
}

.ai-page--spa .ai-starter-list button {
    animation: ai-portal-enter .42s cubic-bezier(.22, 1, .36, 1) both;
}

.ai-page--spa .ai-starter-list button:nth-child(1) { animation-delay: .45s; }
.ai-page--spa .ai-starter-list button:nth-child(2) { animation-delay: .52s; }
.ai-page--spa .ai-starter-list button:nth-child(3) { animation-delay: .59s; }

@media (prefers-reduced-motion: reduce) {
    .ai-page,
    .ai-page *,
    .ai-page *::before,
    .ai-page *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
