* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(79, 70, 229, .25), transparent 30%),
        radial-gradient(circle at bottom right, rgba(16, 185, 129, .18), transparent 35%),
        #0f172a;
    color: #e5e7eb;
}

button {
    border: none;
    cursor: pointer;
    border-radius: 12px;
    color: white;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    padding: 9px 14px;
    transition: .2s;
    font-family: inherit;
}

button:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
}

button:active {
    transform: translateY(0);
}

.app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* 左侧栏 */
.sidebar {
    width: 320px;
    padding: 22px;
    background: rgba(15, 23, 42, .82);
    backdrop-filter: blur(18px);
    border-right: 1px solid rgba(148, 163, 184, .18);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: linear-gradient(135deg, #6366f1, #22c55e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    box-shadow: 0 15px 35px rgba(99, 102, 241, .35);
}

.brand h1 {
    margin: 0;
    font-size: 22px;
}

.brand p {
    margin: 4px 0 0;
    color: #94a3b8;
    font-size: 13px;
}

.panel {
    background: rgba(30, 41, 59, .62);
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 20px;
    padding: 14px;
    min-height: 130px;
}

.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #cbd5e1;
    font-size: 14px;
    margin-bottom: 10px;
}

.panel-title button {
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 10px;
    font-size: 20px;
    line-height: 1;
}

.list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 230px;
    overflow-y: auto;
}

.item {
    padding: 10px 12px;
    border-radius: 12px;
    color: #cbd5e1;
    background: rgba(15, 23, 42, .5);
    cursor: pointer;
    border: 1px solid transparent;
    font-size: 14px;
    word-break: break-all;
}

.item:hover,
.item.active {
    border-color: rgba(99, 102, 241, .8);
    background: rgba(79, 70, 229, .22);
}

.tools {
    margin-top: auto;
    display: grid;
    gap: 9px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 3px;
}

.tools button {
    width: 100%;
    background: rgba(51, 65, 85, .9);
    text-align: left;
}

/* 主区域 */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 92px;
    padding: 22px 30px;
    border-bottom: 1px solid rgba(148, 163, 184, .16);
    background: rgba(15, 23, 42, .35);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar h2 {
    margin: 0;
    font-size: 22px;
}

.topbar p {
    margin: 6px 0 0;
    color: #94a3b8;
    font-size: 13px;
}

.mode-switch {
    background: rgba(30, 41, 59, .8);
    padding: 5px;
    border-radius: 16px;
    display: flex;
    gap: 4px;
}

.mode-switch button {
    background: transparent;
    color: #94a3b8;
}

.mode-switch button.active {
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    color: white;
}

/* 消息区 */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
}

.message {
    display: flex;
    margin-bottom: 22px;
}

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

.message.assistant {
    justify-content: flex-start;
}

.bubble {
    max-width: 78%;
    padding: 16px 18px;
    border-radius: 20px;
    line-height: 1.7;
    font-size: 15px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, .18);
    word-break: break-word;
}

.user .bubble {
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    color: white;
    border-bottom-right-radius: 6px;
}

.assistant .bubble {
    background: rgba(30, 41, 59, .86);
    border: 1px solid rgba(148, 163, 184, .18);
    color: #e5e7eb;
    border-bottom-left-radius: 6px;
}

.bubble p {
    margin-top: 0;
}

.bubble pre {
    border-radius: 14px;
    overflow: auto;
    padding: 14px;
}

.bubble code {
    font-family: Consolas, Monaco, monospace;
}

.bubble img {
    max-width: 420px;
    width: 100%;
    border-radius: 18px;
    display: block;
}

.empty-state {
    height: 100%;
    min-height: 380px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    text-align: center;
}

.empty-icon {
    width: 72px;
    height: 72px;
    border-radius: 24px;
    background: rgba(99, 102, 241, .16);
    border: 1px solid rgba(99, 102, 241, .35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 16px;
}

.empty-state h3 {
    margin: 0 0 8px;
    color: #e5e7eb;
}

/* 输入框 */
.composer {
    padding: 20px 28px;
    border-top: 1px solid rgba(148, 163, 184, .16);
    display: flex;
    gap: 14px;
    background: rgba(15, 23, 42, .45);
}

.composer textarea {
    flex: 1;
    resize: none;
    height: 70px;
    border: 1px solid rgba(148, 163, 184, .22);
    background: rgba(15, 23, 42, .88);
    color: #e5e7eb;
    outline: none;
    padding: 14px 16px;
    border-radius: 18px;
    line-height: 1.6;
    font-size: 15px;
    font-family: inherit;
}

.composer textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, .18);
}

.composer button {
    width: 100px;
    font-size: 16px;
}

/* 登录弹窗 */
.login-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background:
        radial-gradient(circle at top left, rgba(99,102,241,.35), transparent 35%),
        rgba(2, 6, 23, .92);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 390px;
    padding: 34px;
    border-radius: 28px;
    background: rgba(15, 23, 42, .9);
    border: 1px solid rgba(148, 163, 184, .22);
    box-shadow: 0 30px 80px rgba(0,0,0,.45);
    text-align: center;
    backdrop-filter: blur(20px);
}

.logo.big {
    margin: 0 auto 16px;
    width: 64px;
    height: 64px;
    font-size: 24px;
}

.login-card h2 {
    margin: 0 0 8px;
}

.login-card p {
    color: #94a3b8;
    margin-bottom: 22px;
}

.login-card input {
    width: 100%;
    margin-bottom: 14px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, .22);
    background: rgba(15, 23, 42, .9);
    color: white;
    outline: none;
    font-family: inherit;
}

.login-card input:focus {
    border-color: #6366f1;
}

.login-card button {
    width: 100%;
    padding: 13px;
    font-size: 16px;
}

.login-tip {
    margin-top: 18px;
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.6;
}

.login-tip code {
    color: #93c5fd;
}

/* 项目上下文弹窗 */
.context-modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, .82);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
}

.context-card {
    width: 760px;
    max-width: 94vw;
    max-height: 90vh;
    overflow: auto;
    padding: 26px;
    border-radius: 24px;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, .22);
    box-shadow: 0 30px 80px rgba(0,0,0,.45);
}

.context-card h2 {
    margin-top: 0;
}

.context-card input,
.context-card textarea {
    width: 100%;
    margin-bottom: 14px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, .22);
    background: rgba(15, 23, 42, .9);
    color: white;
    outline: none;
    font-family: inherit;
}

.context-card textarea {
    min-height: 100px;
    resize: vertical;
}

.context-card label {
    display: block;
    color: #cbd5e1;
    margin-bottom: 6px;
    font-size: 14px;
}

.context-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* 移动端适配 */
@media (max-width: 900px) {
    .app {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: 330px;
        overflow-y: auto;
    }

    .main {
        height: calc(100vh - 330px);
    }

    .topbar {
        height: auto;
        gap: 12px;
        align-items: flex-start;
        flex-direction: column;
    }

    .bubble {
        max-width: 92%;
    }

    .composer {
        padding: 14px;
    }
}
/* ================================
   代码块复制按钮
================================ */

.code-block-wrapper {
    position: relative;
    margin: 14px 0;
}

.code-block-wrapper pre {
    margin: 0;
    padding-top: 42px !important;
    border-radius: 14px;
    overflow: auto;
    background: #020617 !important;
    border: 1px solid rgba(148, 163, 184, .18);
}

.copy-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 8px;
    background: rgba(30, 41, 59, .95);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, .24);
    cursor: pointer;
    box-shadow: none;
}

.copy-code-btn:hover {
    background: rgba(51, 65, 85, .98);
    color: #ffffff;
    transform: none;
    filter: none;
}

.copy-code-btn:active {
    transform: scale(.98);
}

/* 让代码块里的代码更好阅读 */
.code-block-wrapper code {
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 14px;
    line-height: 1.7;
}

/* 防止复制按钮被 Prism 样式影响 */
.code-block-wrapper .copy-code-btn {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}
/* ================================
   代码块复制按钮
================================ */

.code-block-wrapper {
    position: relative;
    margin: 14px 0;
}

.code-block-wrapper pre {
    margin: 0;
    padding-top: 42px !important;
    border-radius: 14px;
    overflow: auto;
    background: #020617 !important;
    border: 1px solid rgba(148, 163, 184, .18);
}

.copy-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 8px;
    background: rgba(30, 41, 59, .95);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, .24);
    cursor: pointer;
    box-shadow: none;
}

.copy-code-btn:hover {
    background: rgba(51, 65, 85, .98);
    color: #ffffff;
    transform: none;
    filter: none;
}

.copy-code-btn:active {
    transform: scale(.98);
}

/* 让代码块里的代码更好阅读 */
.code-block-wrapper code {
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 14px;
    line-height: 1.7;
}

/* 防止复制按钮被 Prism 样式影响 */
.code-block-wrapper .copy-code-btn {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}
/* ================================
   输入区增强：Prompt 模板 / 重新生成
================================ */

.composer-wrap {
    border-top: 1px solid rgba(148, 163, 184, .16);
    background: rgba(15, 23, 42, .45);
}

.quickbar {
    display: flex;
    gap: 10px;
    padding: 12px 28px 0;
}

.quickbar button {
    background: rgba(51, 65, 85, .9);
    color: #cbd5e1;
    font-size: 13px;
    padding: 7px 12px;
}

.quickbar button:hover {
    background: rgba(71, 85, 105, .95);
}

/* 覆盖原 composer 顶部边框 */
.composer-wrap .composer {
    border-top: none;
}

/* ================================
   消息操作按钮：复制全文
================================ */

.message-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 8px;
    opacity: .65;
    transition: .2s;
}

.bubble:hover .message-actions {
    opacity: 1;
}

.message-actions button {
    background: rgba(15, 23, 42, .55);
    border: 1px solid rgba(148, 163, 184, .18);
    color: #cbd5e1;
    padding: 4px 8px;
    border-radius: 8px;
    font-size: 12px;
}

.message-actions button:hover {
    background: rgba(51, 65, 85, .9);
    transform: none;
    filter: none;
}

.message-content {
    overflow: hidden;
}

/* ================================
   代码块复制按钮
================================ */

.code-block-wrapper {
    position: relative;
    margin: 14px 0;
}

.code-block-wrapper pre {
    margin: 0;
    padding-top: 42px !important;
    border-radius: 14px;
    overflow: auto;
    background: #020617 !important;
    border: 1px solid rgba(148, 163, 184, .18);
}

.copy-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 5;
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 8px;
    background: rgba(30, 41, 59, .95);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, .24);
    cursor: pointer;
    box-shadow: none;
}

.copy-code-btn:hover {
    background: rgba(51, 65, 85, .98);
    color: #ffffff;
    transform: none;
    filter: none;
}

.copy-code-btn:active {
    transform: scale(.98);
}

.code-block-wrapper code {
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 14px;
    line-height: 1.7;
}

.code-block-wrapper .copy-code-btn {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

/* ================================
   Prompt 模板库弹窗
================================ */

.template-modal {
    position: fixed;
    inset: 0;
    z-index: 9997;
    background: rgba(2, 6, 23, .82);
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-card {
    width: 820px;
    max-width: 94vw;
    max-height: 88vh;
    overflow: auto;
    padding: 26px;
    border-radius: 24px;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, .22);
    box-shadow: 0 30px 80px rgba(0,0,0,.45);
}

.template-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 20px;
}

.template-header h2 {
    margin: 0 0 6px;
}

.template-header p {
    margin: 0;
    color: #94a3b8;
    font-size: 14px;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.template-item {
    padding: 16px;
    border-radius: 16px;
    background: rgba(30, 41, 59, .72);
    border: 1px solid rgba(148, 163, 184, .16);
    cursor: pointer;
    transition: .2s;
}

.template-item:hover {
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, .8);
    background: rgba(79, 70, 229, .22);
}

.template-title {
    color: #e5e7eb;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 8px;
}

.template-category {
    color: #93c5fd;
    font-size: 12px;
}

/* ================================
   移动端优化
================================ */

@media (max-width: 700px) {
    .template-grid {
        grid-template-columns: 1fr;
    }

    .quickbar {
        padding: 10px 14px 0;
        overflow-x: auto;
    }

    .quickbar button {
        white-space: nowrap;
    }
}
/* ================================
   代码文件管理
================================ */

.file-modal {
    position: fixed;
    inset: 0;
    z-index: 9996;
    background: rgba(2, 6, 23, .86);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-card {
    width: 1100px;
    max-width: 96vw;
    height: 86vh;
    padding: 24px;
    border-radius: 26px;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, .22);
    box-shadow: 0 30px 80px rgba(0,0,0,.48);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.file-header h2 {
    margin: 0 0 6px;
}

.file-header p {
    margin: 0;
    color: #94a3b8;
    font-size: 14px;
}

.file-layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 330px 1fr;
    gap: 18px;
}

.file-list-panel,
.file-editor-panel {
    min-height: 0;
    background: rgba(15, 23, 42, .65);
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 20px;
}

.file-list-panel {
    padding: 14px;
    display: flex;
    flex-direction: column;
}

.file-list-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.file-list-actions button {
    flex: 1;
    background: rgba(51, 65, 85, .9);
    font-size: 13px;
}

.file-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.file-empty {
    color: #94a3b8;
    font-size: 14px;
    line-height: 1.7;
    padding: 14px;
}

.file-item {
    padding: 12px;
    border-radius: 14px;
    background: rgba(30, 41, 59, .72);
    border: 1px solid transparent;
    cursor: pointer;
    transition: .2s;
}

.file-item:hover,
.file-item.active {
    border-color: rgba(99, 102, 241, .8);
    background: rgba(79, 70, 229, .22);
}

.file-item-path {
    color: #e5e7eb;
    font-size: 14px;
    font-weight: 700;
    word-break: break-all;
    margin-bottom: 6px;
}

.file-item-meta {
    color: #93c5fd;
    font-size: 12px;
    margin-bottom: 6px;
}

.file-item-desc {
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.5;
    word-break: break-all;
}

.file-editor-panel {
    padding: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-editor-panel label {
    color: #cbd5e1;
    font-size: 13px;
    margin-bottom: 6px;
}

.file-editor-panel input,
.file-editor-panel textarea {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, .22);
    background: rgba(15, 23, 42, .9);
    color: #e5e7eb;
    outline: none;
    border-radius: 12px;
    padding: 11px 12px;
    margin-bottom: 12px;
    font-family: inherit;
}

.file-editor-panel input:focus,
.file-editor-panel textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .16);
}

#fileContent {
    flex: 1;
    min-height: 260px;
    resize: none;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 13px;
    line-height: 1.7;
}

.file-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 4px;
}

.file-editor-actions button {
    background: rgba(51, 65, 85, .9);
}

.file-editor-actions button:first-child {
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
}

/* 移动端 */
@media (max-width: 900px) {
    .file-card {
        height: 92vh;
        padding: 16px;
    }

    .file-layout {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .file-list-panel {
        max-height: 260px;
    }

    #fileContent {
        min-height: 260px;
    }
}
/* ================================
   搜索历史 / 代码
================================ */

.search-modal {
    position: fixed;
    inset: 0;
    z-index: 9995;
    background: rgba(2, 6, 23, .86);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-card {
    width: 980px;
    max-width: 96vw;
    height: 84vh;
    padding: 24px;
    border-radius: 26px;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, .22);
    box-shadow: 0 30px 80px rgba(0,0,0,.48);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.search-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.search-header h2 {
    margin: 0 0 6px;
}

.search-header p {
    margin: 0;
    color: #94a3b8;
    font-size: 14px;
}

.search-bar {
    display: grid;
    grid-template-columns: 1fr 160px 100px;
    gap: 10px;
    margin-bottom: 16px;
}

.search-bar input,
.search-bar select {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, .22);
    background: rgba(15, 23, 42, .9);
    color: #e5e7eb;
    outline: none;
    border-radius: 12px;
    padding: 11px 12px;
    font-family: inherit;
}

.search-bar input:focus,
.search-bar select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .16);
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.search-loading,
.search-empty,
.search-error {
    padding: 18px;
    border-radius: 16px;
    background: rgba(30, 41, 59, .72);
    border: 1px solid rgba(148, 163, 184, .16);
    color: #cbd5e1;
    line-height: 1.7;
}

.search-error {
    color: #fecaca;
    border-color: rgba(248, 113, 113, .4);
}

.search-summary {
    padding: 12px 14px;
    margin-bottom: 14px;
    border-radius: 14px;
    background: rgba(79, 70, 229, .18);
    border: 1px solid rgba(99, 102, 241, .35);
    color: #c7d2fe;
    font-size: 14px;
}

.search-section {
    margin-bottom: 22px;
}

.search-section h3 {
    margin: 0 0 10px;
    font-size: 15px;
    color: #e5e7eb;
}

.search-item {
    padding: 14px;
    border-radius: 16px;
    background: rgba(30, 41, 59, .72);
    border: 1px solid rgba(148, 163, 184, .14);
    cursor: pointer;
    transition: .2s;
    margin-bottom: 10px;
}

.search-item:hover {
    transform: translateY(-1px);
    border-color: rgba(99, 102, 241, .8);
    background: rgba(79, 70, 229, .22);
}

.search-item-title {
    color: #e5e7eb;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 7px;
    word-break: break-all;
}

.search-item-meta {
    color: #93c5fd;
    font-size: 12px;
    margin-bottom: 8px;
}

.search-snippet {
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.6;
    word-break: break-word;
}

.search-code-snippet {
    margin-top: 8px;
    padding: 10px;
    border-radius: 12px;
    background: rgba(2, 6, 23, .75);
    border: 1px solid rgba(148, 163, 184, .12);
    color: #cbd5e1;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.search-item mark {
    background: rgba(250, 204, 21, .25);
    color: #fde68a;
    padding: 0 2px;
    border-radius: 4px;
}

/* 移动端搜索 */
@media (max-width: 760px) {
    .search-card {
        height: 92vh;
        padding: 16px;
    }

    .search-bar {
        grid-template-columns: 1fr;
    }
}
/* ================================
   系统设置 / 模型切换
================================ */

.settings-modal {
    position: fixed;
    inset: 0;
    z-index: 9994;
    background: rgba(2, 6, 23, .86);
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-card {
    width: 1060px;
    max-width: 96vw;
    max-height: 90vh;
    padding: 24px;
    border-radius: 26px;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, .22);
    box-shadow: 0 30px 80px rgba(0,0,0,.48);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.settings-header h2 {
    margin: 0 0 6px;
}

.settings-header p {
    margin: 0;
    color: #94a3b8;
    font-size: 14px;
}

.settings-body {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.settings-section {
    padding: 18px;
    border-radius: 20px;
    background: rgba(15, 23, 42, .65);
    border: 1px solid rgba(148, 163, 184, .16);
}

.settings-section h3 {
    margin: 0 0 16px;
    color: #e5e7eb;
}

.settings-section label {
    display: block;
    color: #cbd5e1;
    font-size: 13px;
    margin-bottom: 6px;
}

.settings-section input,
.settings-section select {
    width: 100%;
    border: 1px solid rgba(148, 163, 184, .22);
    background: rgba(15, 23, 42, .9);
    color: #e5e7eb;
    outline: none;
    border-radius: 12px;
    padding: 11px 12px;
    margin-bottom: 13px;
    font-family: inherit;
}

.settings-section input:focus,
.settings-section select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, .16);
}

.setting-row {
    display: grid;
    grid-template-columns: 1fr 170px;
    gap: 10px;
}

.check-line {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    color: #93c5fd !important;
}

.check-line input {
    width: auto;
    margin: 0;
}

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.settings-actions button {
    background: rgba(51, 65, 85, .9);
}

.settings-actions button:first-child {
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
}

.settings-tip,
.settings-loading,
.settings-error {
    margin-top: 18px;
    padding: 14px;
    border-radius: 16px;
    background: rgba(30, 41, 59, .72);
    border: 1px solid rgba(148, 163, 184, .16);
    color: #cbd5e1;
    line-height: 1.7;
    font-size: 13px;
}

.settings-error {
    color: #fecaca;
    border-color: rgba(248, 113, 113, .4);
}

/* 移动端 */
@media (max-width: 860px) {
    .settings-card {
        max-height: 94vh;
        padding: 16px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .setting-row {
        grid-template-columns: 1fr;
    }
}
/* ================================
   文件上传管理
================================ */

.upload-modal {
    position: fixed;
    inset: 0;
    z-index: 9993;
    background: rgba(2, 6, 23, .86);
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-card {
    width: 1100px;
    max-width: 96vw;
    height: 86vh;
    padding: 24px;
    border-radius: 26px;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, .22);
    box-shadow: 0 30px 80px rgba(0,0,0,.48);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.upload-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.upload-header h2 {
    margin: 0 0 6px;
}

.upload-header p {
    margin: 0;
    color: #94a3b8;
    font-size: 14px;
}

.upload-box {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px;
    border-radius: 18px;
    background: rgba(15, 23, 42, .65);
    border: 1px solid rgba(148, 163, 184, .16);
}

.upload-box input[type="file"] {
    flex: 1;
    color: #cbd5e1;
}

.upload-box button {
    background: rgba(51, 65, 85, .9);
}

.upload-layout {
    flex: 1;
    min-height: 0;
    display: grid;
    grid-template-columns: 330px 1fr;
    gap: 18px;
}

.upload-list-panel,
.upload-detail-panel {
    min-height: 0;
    background: rgba(15, 23, 42, .65);
    border: 1px solid rgba(148, 163, 184, .16);
    border-radius: 20px;
}

.upload-list-panel {
    padding: 14px;
    overflow-y: auto;
}

.upload-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.upload-empty,
.upload-detail-empty,
.upload-no-preview {
    color: #94a3b8;
    font-size: 14px;
    line-height: 1.7;
    padding: 16px;
}

.upload-item {
    padding: 12px;
    border-radius: 14px;
    background: rgba(30, 41, 59, .72);
    border: 1px solid transparent;
    cursor: pointer;
    transition: .2s;
}

.upload-item:hover {
    border-color: rgba(99, 102, 241, .8);
    background: rgba(79, 70, 229, .22);
}

.upload-item-name {
    color: #e5e7eb;
    font-weight: 700;
    font-size: 14px;
    word-break: break-all;
    margin-bottom: 6px;
}

.upload-item-meta {
    color: #93c5fd;
    font-size: 12px;
    margin-bottom: 5px;
}

.upload-item-time {
    color: #94a3b8;
    font-size: 12px;
}

.upload-detail-panel {
    padding: 16px;
    overflow-y: auto;
}

.upload-detail-title {
    color: #e5e7eb;
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 12px;
    word-break: break-all;
}

.upload-detail-meta {
    display: grid;
    gap: 6px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(30, 41, 59, .72);
    color: #cbd5e1;
    font-size: 13px;
    margin-bottom: 12px;
    word-break: break-all;
}

.upload-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
}

.upload-detail-actions button {
    background: rgba(51, 65, 85, .9);
}

.upload-preview-image {
    padding: 12px;
    border-radius: 16px;
    background: rgba(2, 6, 23, .55);
    border: 1px solid rgba(148, 163, 184, .12);
}

.upload-preview-image img {
    max-width: 100%;
    border-radius: 14px;
    display: block;
}

.upload-preview-code {
    padding: 14px;
    border-radius: 16px;
    background: #020617;
    border: 1px solid rgba(148, 163, 184, .12);
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.7;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

/* 移动端 */
@media (max-width: 900px) {
    .upload-card {
        height: 92vh;
        padding: 16px;
    }

    .upload-layout {
        grid-template-columns: 1fr;
        overflow-y: auto;
    }

    .upload-list-panel {
        max-height: 260px;
    }

    .upload-box {
        flex-direction: column;
    }
}
/* ================================
   长历史分页加载
================================ */

.load-more-messages-wrap {
    display: flex;
    justify-content: center;
    margin: 0 0 18px;
}

.load-more-messages-wrap button {
    background: rgba(51, 65, 85, .88);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, .22);
    font-size: 13px;
    padding: 8px 16px;
}

.load-more-messages-wrap button:hover {
    background: rgba(79, 70, 229, .32);
    border-color: rgba(99, 102, 241, .6);
}
/* ================================
   消息收藏
================================ */

.message-actions button.favorited {
    background: rgba(250, 204, 21, .18);
    border-color: rgba(250, 204, 21, .45);
    color: #fde68a;
}

.favorites-modal {
    position: fixed;
    inset: 0;
    z-index: 9992;
    background: rgba(2, 6, 23, .86);
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorites-card {
    width: 900px;
    max-width: 96vw;
    height: 84vh;
    padding: 24px;
    border-radius: 26px;
    background: #0f172a;
    border: 1px solid rgba(148, 163, 184, .22);
    box-shadow: 0 30px 80px rgba(0,0,0,.48);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.favorites-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.favorites-header h2 {
    margin: 0 0 6px;
}

.favorites-header p {
    margin: 0;
    color: #94a3b8;
    font-size: 14px;
}

.favorites-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.favorites-empty,
.favorites-error {
    padding: 18px;
    border-radius: 16px;
    background: rgba(30, 41, 59, .72);
    border: 1px solid rgba(148, 163, 184, .16);
    color: #cbd5e1;
    line-height: 1.7;
}

.favorites-error {
    color: #fecaca;
    border-color: rgba(248, 113, 113, .4);
}

.favorite-item {
    padding: 16px;
    border-radius: 18px;
    background: rgba(30, 41, 59, .72);
    border: 1px solid rgba(148, 163, 184, .16);
}

.favorite-title {
    color: #e5e7eb;
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 7px;
}

.favorite-meta {
    color: #93c5fd;
    font-size: 12px;
    margin-bottom: 10px;
}

.favorite-snippet {
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 160px;
    overflow: hidden;
    margin-bottom: 12px;
}

.favorite-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.favorite-actions button {
    background: rgba(51, 65, 85, .9);
    font-size: 13px;
}

/* 移动端 */
@media (max-width: 760px) {
    .favorites-card {
        height: 92vh;
        padding: 16px;
    }
}
