/* shared standalone base — auto: tools/generate-standalone-css.mjs */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}
.chat-container {
    --bottom-nav-h: calc(52px + env(safe-area-inset-bottom, 0px));
}

.app-bottom-nav {
    flex-shrink: 0;
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    min-height: 52px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #fff;
    border-top: none;
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.05);
    z-index: 6;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #9a9a9a;
    font-family: inherit;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav-item.is-active {
    color: #1a1a1a;
}

.bottom-nav-icon {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bottom-nav-icon--chat {
    position: relative;
    width: 30px;
    height: 30px;
}

.bottom-nav-icon--chat::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 10px;
    background: radial-gradient(circle, rgba(255, 127, 80, 0.16) 0%, transparent 70%);
    pointer-events: none;
}

.bottom-nav-icon img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    background: transparent;
    border-radius: 0;
    opacity: 0.72;
}

.bottom-nav-item.is-active .bottom-nav-icon img {
    opacity: 1;
}

.bottom-nav-icon svg {
    display: block;
}

.bottom-nav-item.is-active .bottom-nav-icon svg {
    stroke: #ff7f50;
}

.bottom-nav-item.is-active .bottom-nav-icon--kb svg {
    fill: rgba(255, 127, 80, 0.15);
    stroke: #ff7f50;
}

.bottom-nav-label {
    font-size: 10px;
    line-height: 1.2;
    font-weight: 500;
    letter-spacing: 0.02em;
}

.bottom-nav-item.is-active .bottom-nav-label {
    font-weight: 600;
    color: #ff7f50;
}

.bottom-nav-item[data-tab="apikey"] .bottom-nav-label {
    font-size: 10px;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.auth-modal-overlay {
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 1001;
    display: none;
}

.auth-modal-overlay.open {
    display: block;
}

.auth-modal {
    position: fixed;
    inset: 0;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    transform: none;
    overflow: hidden;
    background: #fff;
    border: none;
    border-radius: 0;
    box-shadow: none;
    z-index: 1002;
    display: none;
    flex-direction: column;
}

.auth-modal.open {
    display: flex;
}

.auth-modal-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100dvh;
    overflow: hidden;
}

.auth-page-top {
    flex-shrink: 0;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 8px 8px 16px;
}

.auth-back-btn {
    width: 44px;
    height: 44px;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
}

.auth-back-btn:hover {
    background: #f5f5f5;
}

.auth-back-btn svg {
    display: block;
}

.auth-modal-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 0 28px 28px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
}

.auth-pane {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.auth-page-title {
    margin: 8px 0 0;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #1a1a1a;
    line-height: 1.25;
}

.auth-page-subtitle {
    margin: 10px 0 36px;
    font-size: 14px;
    color: #999;
    line-height: 1.45;
}

.auth-field {
    border-bottom: 1px solid #eee;
    margin-bottom: 0;
}

.auth-field input {
    width: 100%;
    padding: 16px 0;
    border: none;
    background: transparent;
    font-size: 16px;
    color: #333;
    outline: none;
    font-family: inherit;
}

.auth-field input::placeholder {
    color: #bbb;
}

.auth-field--code {
    display: flex;
    align-items: center;
    gap: 12px;
}

.auth-field--code input {
    flex: 1;
    min-width: 0;
}

.auth-sms-send-btn {
    flex-shrink: 0;
    padding: 8px 0 8px 8px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 500;
    color: #3dccc0;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.auth-sms-send-btn:hover:not(:disabled) {
    color: #2eb8a6;
}

.auth-sms-send-btn:disabled {
    color: #bbb;
    cursor: not-allowed;
}

.auth-agree-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 28px 0 24px;
    font-size: 13px;
    line-height: 1.55;
    color: #666;
}

.auth-agree-row input[type="checkbox"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border-radius: 50%;
    accent-color: #3dccc0;
    cursor: pointer;
}

.auth-agree-text {
    flex: 1;
    min-width: 0;
}

.auth-legal-link {
    color: #3dccc0;
    text-decoration: none;
}

.auth-legal-link:hover {
    color: #2eb8a6;
    text-decoration: underline;
}

.auth-form-error {
    color: #e53935;
    font-size: 13px;
    margin: -12px 0 12px;
    line-height: 1.45;
    display: none;
}

.auth-form-error:not(:empty) {
    display: block;
}

.auth-login-btn {
    width: 100%;
    padding: 15px 16px;
    border: none;
    border-radius: 999px;
    font-size: 16px;
    font-weight: 600;
    color: #999;
    background: #f0f0f0;
    cursor: not-allowed;
    font-family: inherit;
    transition: background 0.2s, color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.auth-login-btn.is-ready {
    color: #fff;
    background: linear-gradient(135deg, #ff8f6b 0%, #ff7f50 100%);
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(255, 127, 80, 0.35);
}

.auth-login-btn.is-ready:active {
    transform: scale(0.99);
}

.auth-login-btn:disabled:not(.is-ready) {
    opacity: 1;
}

.auth-oauth-wrap {
    margin-top: auto;
    padding-top: 48px;
}

.auth-oauth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
    color: #ccc;
    font-size: 13px;
}

.auth-oauth-divider::before,
.auth-oauth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #eee;
}

.auth-oauth-divider span {
    flex-shrink: 0;
    color: #bbb;
}

.auth-oauth-icons {
    display: flex;
    justify-content: center;
    padding-bottom: 12px;
}

.auth-wechat-btn {
    width: 48px;
    height: 48px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.auth-wechat-btn:hover {
    opacity: 0.88;
}

.auth-wechat-btn svg {
    display: block;
}

@media (min-width: 641px) {
    .auth-modal {
        left: 50%;
        top: 50%;
        right: auto;
        bottom: auto;
        width: min(420px, 100%);
        height: auto;
        max-height: min(720px, 92vh);
        transform: translate(-50%, -50%);
        border-radius: 16px;
        box-shadow: 0 16px 48px rgba(0, 0, 0, 0.12);
    }

    .auth-modal-inner {
        max-height: min(720px, 92vh);
        border-radius: 16px;
        overflow: hidden;
    }

    .auth-modal-overlay.open {
        background: rgba(0, 0, 0, 0.35);
    }
}



body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    background: #ffffff;
    overflow-x: hidden;
    overflow-y: auto;
}

[hidden] {
    display: none !important;
}

/* 独立页外壳：API-KEY 设置 / 会员中心 / 知识库 */
.settings-standalone-app,
.me-standalone-app,
.kb-standalone-app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.04);
    --bottom-nav-h: calc(52px + env(safe-area-inset-bottom, 0px));
}

.settings-standalone-app,
.me-standalone-app {
    background: #ffffff;
}

.settings-standalone-app .app-bottom-nav,
.me-standalone-app .app-bottom-nav,
.kb-standalone-app .app-bottom-nav {
    flex-shrink: 0;
}

.kb-standalone-app .kb-page {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
    background: #fff;
}

a.bottom-nav-item,
button.bottom-nav-item,
span.bottom-nav-item {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-family: inherit;
    padding: 6px 4px 4px;
    box-sizing: border-box;
}

span.bottom-nav-item {
    cursor: default;
}

.bottom-nav-item[data-tab="apikey"] .bottom-nav-label {
    font-size: 10px;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.app-toast {
    position: fixed;
    left: 50%;
    bottom: calc(var(--bottom-nav-h, 52px) + 16px);
    transform: translateX(-50%) translateY(12px);
    max-width: min(90vw, 360px);
    padding: 10px 16px;
    border-radius: 10px;
    background: rgba(26, 26, 26, 0.88);
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 1100;
}

.app-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

