.ai-page {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(255, 125, 76, 0.24), transparent 30%),
        radial-gradient(circle at top right, rgba(31, 166, 122, 0.16), transparent 28%),
        linear-gradient(180deg, #f5f1e8 0%, #f4f6f8 50%, #ecf1ee 100%);
    color: #1f2937;
    font-family: "IBM Plex Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

.ai-page-chat {
    height: 100vh;
    box-sizing: border-box;
    overflow: hidden;
    padding: 12px 0 20px;
}

.ai-page .btn,
.ai-page .form-control {
    border-radius: 14px;
}

.ai-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(16, 24, 40, 0.08);
    color: #475467;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ai-primary-btn {
    min-height: 52px;
    border: none;
    background: linear-gradient(135deg, #156f58 0%, #1f8f68 100%);
    box-shadow: 0 16px 30px rgba(21, 111, 88, 0.2);
}

.ai-login-shell {
    min-height: 100vh;
    display: flex;
}

.ai-login-hero,
.ai-login-panel {
    width: 50%;
    min-height: 100vh;
}

.ai-login-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px;
}

.ai-login-hero__inner {
    max-width: 520px;
}

.ai-login-hero h1 {
    margin: 18px 0 16px;
    font-size: 56px;
    line-height: 1.02;
    font-weight: 700;
    letter-spacing: -0.04em;
}

.ai-login-hero p {
    max-width: 420px;
    margin: 0;
    color: #475467;
    font-size: 17px;
    line-height: 1.8;
}

.ai-login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.ai-login-card {
    width: 100%;
    max-width: 460px;
    padding: 34px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 32px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: 0 28px 64px rgba(33, 54, 44, 0.12);
    backdrop-filter: blur(18px);
}

.ai-login-card__head h2 {
    margin: 0 0 10px;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.ai-login-card__head p {
    margin: 0 0 26px;
    color: #667085;
    line-height: 1.75;
}

.ai-login-form label {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #344054;
}

.ai-login-form .form-group {
    margin-bottom: 22px;
}

.ai-login-form .form-control {
    height: 52px;
    border: 1px solid #d0d5dd;
    box-shadow: none;
}

.ai-login-form .form-control:focus {
    border-color: #1f8f68;
    box-shadow: 0 0 0 4px rgba(31, 143, 104, 0.12);
}

.ai-code-row {
    display: flex;
    gap: 12px;
}

.ai-code-btn {
    min-width: 128px;
    height: 52px;
    border-color: #d0d5dd;
}

.ai-login-tips {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    color: #667085;
    font-size: 12px;
}

.ai-chat-shell {
    height: 100%;
    box-sizing: border-box;
    display: flex;
    padding: 8px 20px 0;
    gap: 18px;
    overflow: hidden;
}

.ai-sidebar,
.ai-main {
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 28px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 22px 58px rgba(33, 54, 44, 0.1);
    backdrop-filter: blur(20px);
}

.ai-sidebar {
    width: 320px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 0;
    overflow: hidden;
}

.ai-sidebar__head,
.ai-topbar,
.ai-progress-head,
.ai-section-title,
.ai-memory-card__head,
.ai-message__meta,
.ai-topbar-left,
.ai-topbar-actions,
.ai-member-card {
    display: flex;
    align-items: center;
}

.ai-sidebar__head {
    justify-content: space-between;
}

.ai-sidebar__head h1 {
    margin: 10px 0 0;
    font-size: 24px;
    font-weight: 700;
}

.ai-new-chat {
    min-height: 50px;
    border: none;
    background: linear-gradient(135deg, #c85c38 0%, #e88455 100%);
}

.ai-member-card,
.ai-quota-card,
.ai-memory-card {
    padding: 16px;
    border-radius: 22px;
    background: rgba(247, 247, 245, 0.9);
    border: 1px solid rgba(16, 24, 40, 0.05);
}

.ai-member-avatar {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: linear-gradient(135deg, #1f8f68 0%, #45b18d 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
}

.ai-member-meta {
    margin-left: 12px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ai-member-meta strong,
.ai-member-meta span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-member-meta span,
.ai-section-title span:last-child,
.ai-conversation-item__meta,
.ai-conversation-item__time,
.ai-composer__tips,
.ai-progress-head span,
.ai-memory-card__head small {
    color: #667085;
}

.ai-progress-item + .ai-progress-item {
    margin-top: 14px;
}

.ai-progress-head {
    justify-content: space-between;
    margin-bottom: 8px;
}

.ai-progress-bar {
    height: 8px;
    border-radius: 999px;
    background: rgba(16, 24, 40, 0.08);
    overflow: hidden;
}

.ai-progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #1f8f68 0%, #56c49a 100%);
    transition: width 0.25s ease;
}

.ai-conversation-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.ai-section-title {
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 700;
}

.ai-conversation-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.ai-conversation-item {
    width: 100%;
    margin-bottom: 10px;
    padding: 14px;
    border: 1px solid rgba(16, 24, 40, 0.06);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
    text-align: left;
    transition: all 0.2s ease;
}

.ai-conversation-item:hover,
.ai-conversation-item.is-active {
    border-color: rgba(31, 143, 104, 0.24);
    box-shadow: 0 12px 24px rgba(31, 143, 104, 0.1);
    transform: translateY(-1px);
}

.ai-conversation-item span {
    display: block;
}

.ai-conversation-item__title {
    margin-bottom: 6px;
    color: #101828;
    font-weight: 600;
    line-height: 1.5;
}

.ai-conversation-item__meta,
.ai-conversation-item__time {
    font-size: 12px;
    line-height: 1.6;
}

.ai-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-topbar {
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid rgba(16, 24, 40, 0.06);
}

.ai-topbar-title h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.ai-topbar-title p {
    margin: 4px 0 0;
    color: #667085;
}

.ai-topbar-actions {
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ai-model-select {
    min-width: 180px;
    height: 42px;
}

.ai-chat-main {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 22px;
    gap: 16px;
}

.ai-memory-card__head {
    justify-content: space-between;
    margin-bottom: 8px;
    font-weight: 700;
}

.ai-memory-card__body {
    color: #475467;
    line-height: 1.8;
}

.ai-message-stream {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding-right: 6px;
}

.ai-empty-state,
.ai-empty-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #667085;
}

.ai-empty-state {
    min-height: 100%;
    flex-direction: column;
    padding: 48px 20px;
}

.ai-empty-state__icon {
    width: 74px;
    height: 74px;
    margin-bottom: 20px;
    border-radius: 24px;
    background: linear-gradient(135deg, #1f8f68 0%, #e88455 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    box-shadow: 0 18px 36px rgba(31, 143, 104, 0.18);
}

.ai-empty-state h3 {
    margin: 0 0 10px;
    font-size: 28px;
    font-weight: 700;
}

.ai-empty-state p {
    max-width: 520px;
    margin: 0;
    line-height: 1.8;
}

.ai-empty-mini {
    min-height: 160px;
    padding: 20px;
    border: 1px dashed rgba(16, 24, 40, 0.1);
    border-radius: 18px;
    background: rgba(247, 247, 245, 0.72);
}

.ai-message {
    display: flex;
    gap: 14px;
    margin-bottom: 18px;
}

.ai-message__avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    background: #e5e7eb;
    color: #344054;
}

.ai-message.is-assistant .ai-message__avatar {
    background: linear-gradient(135deg, #1f8f68 0%, #45b18d 100%);
    color: #fff;
}

.ai-message.is-user .ai-message__avatar {
    background: linear-gradient(135deg, #c85c38 0%, #e88455 100%);
    color: #fff;
}

.ai-message__body {
    min-width: 0;
    flex: 1;
}

.ai-message__meta {
    gap: 8px;
    margin-bottom: 8px;
    color: #667085;
    font-size: 12px;
}

.ai-message__meta i {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #98a2b3;
}

.ai-message__content {
    display: inline-block;
    max-width: min(860px, 100%);
    padding: 14px 16px;
    border-radius: 6px 24px 24px;
    background: #fff;
    border: 1px solid rgba(16, 24, 40, 0.06);
    color: #101828;
    line-height: 1.8;
    box-shadow: 0 10px 24px rgba(16, 24, 40, 0.04);
    word-break: break-word;
}

.ai-message.is-user .ai-message__content {
    border-radius: 24px 6px 24px 24px;
    background: linear-gradient(135deg, #1f8f68 0%, #2da177 100%);
    color: #fff;
}

.ai-message__error {
    margin-top: 8px;
    color: #b42318;
    font-size: 12px;
}

.ai-message.is-failed .ai-message__content {
    background: #fff3f2;
    border-color: rgba(180, 35, 24, 0.14);
    color: #912018;
}

.ai-composer {
    padding: 18px 22px 22px;
    border-top: 1px solid rgba(16, 24, 40, 0.06);
}

.ai-composer__inner {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 12px;
    border-radius: 24px;
    background: rgba(247, 247, 245, 0.9);
    border: 1px solid rgba(16, 24, 40, 0.06);
}

.ai-composer textarea {
    min-height: 54px;
    max-height: 220px;
    resize: none;
    border: none;
    background: transparent;
    box-shadow: none;
    line-height: 1.8;
}

.ai-composer textarea:focus {
    box-shadow: none;
}

.ai-send-btn {
    min-width: 112px;
    min-height: 54px;
    border: none;
    background: linear-gradient(135deg, #156f58 0%, #1f8f68 100%);
}

.ai-composer__tips {
    margin-top: 10px;
    text-align: center;
    font-size: 12px;
}

.ai-typing {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ai-typing b {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #98a2b3;
    animation: aiTyping 1s infinite ease-in-out;
}

.ai-typing b:nth-child(2) {
    animation-delay: 0.15s;
}

.ai-typing b:nth-child(3) {
    animation-delay: 0.3s;
}

.hidden {
    display: none !important;
}

@keyframes aiTyping {
    0%, 80%, 100% {
        transform: scale(0.7);
        opacity: 0.45;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 1199px) {
    .ai-login-shell {
        flex-direction: column;
    }

    .ai-login-hero,
    .ai-login-panel {
        width: 100%;
        min-height: auto;
    }

    .ai-login-hero {
        padding: 52px 24px 16px;
    }

    .ai-login-panel {
        padding: 24px;
    }
}

@media (max-width: 991px) {
    .ai-page-chat {
        padding: 8px 0 14px;
    }

    .ai-chat-shell {
        padding: 4px 12px 0;
    }

    .ai-sidebar {
        position: fixed;
        top: 12px;
        bottom: 12px;
        left: 12px;
        z-index: 1000;
        transform: translateX(calc(-100% - 24px));
        transition: transform 0.25s ease;
        width: min(320px, calc(100vw - 24px));
    }

    .ai-sidebar-toggle,
    .ai-sidebar-close {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }

    .ai-topbar {
        flex-direction: column;
        align-items: stretch;
    }

    .ai-topbar-left,
    .ai-topbar-actions {
        width: 100%;
    }

    .ai-topbar-actions {
        justify-content: space-between;
    }

    body.ai-sidebar-open .ai-sidebar {
        transform: translateX(0);
    }

    body.ai-sidebar-open:before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.24);
        z-index: 999;
    }
}

@media (min-width: 992px) {
    .ai-sidebar-toggle,
    .ai-sidebar-close {
        display: none !important;
    }
}

@media (max-width: 767px) {
    .ai-login-hero h1 {
        font-size: 42px;
    }

    .ai-login-card {
        padding: 24px 18px;
        border-radius: 24px;
    }

    .ai-code-row,
    .ai-login-tips,
    .ai-composer__inner {
        flex-direction: column;
    }

    .ai-code-btn,
    .ai-send-btn,
    .ai-model-select {
        width: 100%;
    }

    .ai-chat-shell,
    .ai-chat-main,
    .ai-topbar,
    .ai-composer {
        padding-left: 12px;
        padding-right: 12px;
    }

    .ai-topbar-title h2 {
        font-size: 20px;
    }

    .ai-empty-state h3 {
        font-size: 24px;
    }
}
