:root {
    --bg-dark: #0d1117;
    --sidebar-bg: #161b22;
    --card-bg: #21262d;
    --accent-color: #58a6ff;
    --text-main: #c9d1d9;
    --text-dim: #8b949e;
    --border: #30363d;
    --danger: #f85149;
    --success: #2ea043;

    /* --- 2.0 全局色彩视觉规范 --- */
    --color-pri: #58a6ff;
    /* 主干大模型：科技蓝 */
    --color-sec: #d2a8ff;
    /* 备用兜底：备援紫 */
    --color-rag: #7ee787;
    /* 检索骨骼：生命绿 */
    --color-hybrid: #e3b341;
    /* 混合集群：星芒金 */
    --color-single: #00e5ff;
    /* 单一直连：湖蓝 */
    --color-agg: #ff9900;
    /* 聚合阵列：香蕉橙 */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ================= 侧边栏与 LOGO 特效 ================= */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.logo-area {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    position: relative;
    cursor: pointer;
}

.logo-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.logo-bg::before {
    content: '';
    position: absolute;
    inset: -50%;
    opacity: 0.1;
    background-image: linear-gradient(var(--accent-color) 1px, transparent 1px), linear-gradient(90deg, var(--accent-color) 1px, transparent 1px);
    background-size: 20px 20px;
    animation: gridMove 15s linear infinite;
}

@keyframes gridMove {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(20px);
    }
}

/* 🚀 全新炫酷 Logo 动效 */
.cyber-logo {
    position: relative;
    z-index: 1;
    font-size: 1.25rem;
    font-weight: 900;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-text {
    background: linear-gradient(90deg, #00e5ff, #58a6ff, #d2a8ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(88, 166, 255, 0.5);
}

.lightning-icon {
    display: inline-block;
    color: #ffcc00;
    -webkit-text-fill-color: initial;
    filter: drop-shadow(0 0 8px #ffcc00);
    animation: lightningFlash 2.5s infinite;
}

@keyframes lightningFlash {

    0%,
    100% {
        opacity: 0.9;
        filter: drop-shadow(0 0 8px #ffcc00);
        transform: scale(1);
    }

    40% {
        opacity: 0.9;
        filter: drop-shadow(0 0 8px #ffcc00);
        transform: scale(1);
    }

    42% {
        opacity: 0.2;
        filter: drop-shadow(0 0 2px #ffcc00);
        transform: scale(0.9);
    }

    45% {
        opacity: 1;
        filter: drop-shadow(0 0 20px #ffffff);
        transform: scale(1.15);
    }

    48% {
        opacity: 0.3;
    }

    50% {
        opacity: 1;
        filter: drop-shadow(0 0 15px #ffcc00);
        transform: scale(1.05);
    }

    55% {
        opacity: 0.9;
        transform: scale(1);
    }
}

.logo-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    display: none;
    z-index: 100;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

.logo-dropdown div {
    padding: 12px 24px;
    cursor: pointer;
}

.logo-dropdown div:hover {
    background: var(--card-bg);
    color: var(--accent-color);
}

/* ================= 菜单导航 ================= */
.menu {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.menu-item {
    padding: 14px 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    color: var(--text-dim);
    transition: all 0.2s;
    border-left: 3px solid transparent;
    border-top: 1px solid transparent;
    border-bottom: 1px solid transparent;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.menu-icon {
    margin-right: 12px;
    font-size: 1.1rem;
    filter: grayscale(50%);
}

.menu-item.active {
    background: var(--bg-dark);
    color: var(--accent-color);
    border-left-color: var(--accent-color);
    border-top-color: var(--border);
    border-bottom-color: var(--border);
    margin-right: -1px;
    padding-right: 25px;
    position: relative;
    z-index: 2;
    box-shadow: inset 0 5px 10px rgba(0, 0, 0, 0.15), inset 0 -5px 10px rgba(0, 0, 0, 0.15);
}

.menu-item.active .menu-icon {
    filter: grayscale(0%);
    text-shadow: 0 0 8px rgba(88, 166, 255, 0.5);
}

.sidebar-footer {
    padding: 20px;
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: center;
    border-top: 1px solid var(--border);
    line-height: 1.6;
}

/* ================= 主干内容与排版 ================= */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
    position: relative;
    z-index: 1;
}

.page {
    display: none;
    max-width: 900px;
    margin: 0 auto;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h2 {
    margin-bottom: 24px;
    font-size: 1.5rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.tabs {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}

.tab {
    padding: 8px 0;
    cursor: pointer;
    color: var(--text-dim);
    position: relative;
}

.tab.active {
    color: var(--accent-color);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-color);
}

.sub-page {
    display: none;
}

.sub-page.active {
    display: block;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-row {
    display: flex;
    gap: 20px;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dim);
    font-size: 0.9rem;
}

input,
select,
textarea {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    color: var(--text-main);
    outline: none;
    transition: 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--sidebar-bg);
}

select[multiple] {
    height: 180px;
    padding: 5px;
}

select[multiple] option {
    padding: 8px;
    margin-bottom: 2px;
    border-radius: 4px;
    cursor: pointer;
}

select[multiple] option:checked {
    background: var(--accent-color) linear-gradient(0deg, var(--accent-color) 0%, var(--accent-color) 100%);
    color: white;
}

input[type="checkbox"],
input[type="radio"] {
    width: 16px !important;
    height: 16px !important;
    margin: 0 8px 0 0 !important;
    flex-shrink: 0;
    vertical-align: middle;
    appearance: auto;
}

.nowrap-label {
    display: inline-flex !important;
    align-items: center;
    white-space: nowrap !important;
    color: var(--text-main) !important;
    font-size: 0.9rem;
    cursor: pointer;
}

/* ================= 按钮样式 ================= */
button {
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.2s;
}

button:hover {
    filter: brightness(1.1);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--border) !important;
}

button.danger {
    background: linear-gradient(135deg, rgba(142, 45, 52, 0.92), rgba(105, 32, 40, 0.96));
    color: #ffd7da;
    border: 1px solid rgba(248, 81, 73, 0.42);
    box-shadow: 0 0 10px rgba(248, 81, 73, 0.14);
}

button.danger:hover:not(:disabled) {
    filter: brightness(1.16);
    border-color: rgba(255, 123, 116, 0.72);
    box-shadow: 0 0 16px rgba(248, 81, 73, 0.3);
    transform: translateY(-1px);
}

button.danger:active:not(:disabled) {
    filter: brightness(1.05);
    transform: translateY(0);
    box-shadow: 0 0 8px rgba(248, 81, 73, 0.2);
}

button.danger:disabled {
    color: var(--text-dim);
    border-color: var(--border);
    box-shadow: none;
    transform: none;
}

button.secondary {
    background: linear-gradient(135deg, #315f9e, #6f42c1);
    color: #ffffff;
    border: 1px solid rgba(210, 168, 255, 0.45);
    box-shadow: 0 0 10px rgba(88, 166, 255, 0.18);
}

button.secondary:hover {
    filter: brightness(1.15);
    box-shadow: 0 0 14px rgba(88, 166, 255, 0.32);
}

button.secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--border) !important;
    color: var(--text-dim);
    border-color: var(--border);
    box-shadow: none;
}

.btn-purple {
    background: #8a2be2 !important;
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.4);
}

.btn-purple:hover {
    filter: brightness(1.2);
}

.btn-orange {
    background: #f0883e !important;
    color: white !important;
    box-shadow: 0 0 10px rgba(240, 136, 62, 0.4);
}

.btn-orange:hover {
    filter: brightness(1.2);
}

/* ================= Key 管理规范表格样式 ================= */
.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 10px 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
}

.data-table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-dim);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.data-table tbody tr:hover {
    background: rgba(88, 166, 255, 0.05);
}

.status-idle {
    color: var(--success);
    font-weight: bold;
}

.status-used {
    color: var(--danger);
    font-weight: bold;
}

.btn-detail {
    background: rgba(138, 43, 226, 0.2);
    color: #d2a8ff;
    border: 1px solid #8a2be2;
    padding: 4px 12px;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-detail:hover {
    background: #8a2be2;
    color: white;
    box-shadow: 0 0 8px rgba(138, 43, 226, 0.6);
}

/* ================= 滑动条与特殊组件 ================= */
.textarea-keys {
    height: 120px;
    font-family: monospace;
    font-size: 0.85rem;
    resize: none;
    background: #000;
}

.eye-icon {
    position: absolute;
    right: 12px;
    top: 35px;
    cursor: pointer;
    opacity: 0.7;
    z-index: 2;
}

.eye-icon:hover {
    opacity: 1;
}

.slider-container {
    margin: 30px 0;
}

.slider {
    width: 100%;
    -webkit-appearance: none;
    height: 6px;
    background: var(--border);
    border-radius: 5px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    color: var(--text-dim);
    font-size: 0.8rem;
}

/* --- 2.0 专属控件样式 (单多行切换) --- */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
    flex-shrink: 0;
    margin-left: 8px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-switch {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--sidebar-bg);
    border: 1px solid var(--border);
    transition: .4s;
    border-radius: 24px;
}

.slider-switch:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-dim);
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider-switch {
    background-color: #8a2be2;
    border-color: #8a2be2;
}

input:checked+.slider-switch:before {
    transform: translateX(22px);
    background-color: white;
}

.textarea-multi-key {
    width: 100%;
    font-family: monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    padding: 10px 40px 10px 12px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-main);
    outline: none;
    transition: height 0.3s ease;
    resize: none;
    overflow-x: auto;
    white-space: pre;
}

.text-obscured {
    -webkit-text-security: disc;
}

.single-line-mode {
    height: 42px;
    overflow: hidden;
    white-space: nowrap;
}

.multi-line-mode {
    height: 180px;
    overflow-y: auto;
}

/* ================= 登录页与赛博朋克特效 ================= */
#login-page {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #050505;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.cyber-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    perspective: 1000px;
}

.cyber-grid {
    position: absolute;
    inset: -100%;
    background-image: linear-gradient(rgba(88, 166, 255, 0.15) 1px, transparent 1px), linear-gradient(90deg, rgba(88, 166, 255, 0.15) 1px, transparent 1px);
    background-size: 60px 60px;
    transform: rotateX(60deg) translateY(0);
    animation: gridMove3D 3s linear infinite;
}

@keyframes gridMove3D {
    0% {
        transform: rotateX(60deg) translateY(0);
    }

    100% {
        transform: rotateX(60deg) translateY(60px);
    }
}

.glow-orb {
    position: absolute;
    width: 80vw;
    height: 80vh;
    background: radial-gradient(circle, rgba(88, 166, 255, 0.15) 0%, transparent 60%);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulseOrb 4s ease-in-out infinite alternate;
}

@keyframes pulseOrb {
    0% {
        opacity: 0.5;
        transform: translate(-50%, -50%) scale(0.8);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.login-box {
    width: 420px;
    padding: 50px 40px;
    border-radius: 16px;
    text-align: center;
    z-index: 1;
    background: rgba(22, 27, 34, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(88, 166, 255, 0.2);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.8), inset 0 0 20px rgba(88, 166, 255, 0.05);
}

.login-box input {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
    font-size: 1rem;
    padding: 12px;
}

.login-box input:focus {
    border-color: var(--accent-color);
    background: rgba(0, 0, 0, 0.8);
    box-shadow: 0 0 10px rgba(88, 166, 255, 0.3);
}

.login-box button {
    width: 100%;
    font-size: 1.1rem;
    padding: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

/* ================= 浮层与弹窗 ================= */
#app-container {
    display: none;
    width: 100%;
    height: 100%;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-box {
    width: 400px;
    background: var(--sidebar-bg);
    border: 1px solid var(--border);
    padding: 40px;
    border-radius: 12px;
    text-align: center;
}

/* ================= 状态栏与拖拽区 ================= */
.drop-zone {
    border: 2px dashed var(--border);
    padding: 50px;
    text-align: center;
    border-radius: 8px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

.drop-zone:hover {
    border-color: var(--accent-color);
    background: rgba(88, 166, 255, 0.05);
}

.status-banner {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-success {
    background: rgba(46, 160, 67, 0.1);
    border: 1px solid var(--success);
    color: #7ee787;
}

.status-hybrid {
    background: rgba(240, 136, 62, 0.1);
    border: 1px solid #f0883e;
    color: #f0883e;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* ================= 聊天窗口 ================= */
.chat-window {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #000;
    display: flex;
    flex-direction: column;
    height: 400px;
    margin-bottom: 20px;
    transition: 0.3s;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.msg {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.msg.user {
    background: var(--accent-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 0;
}

.msg.ai {
    background: var(--card-bg);
    border: 1px solid var(--border);
    align-self: flex-start;
    border-bottom-left-radius: 0;
}

.msg.debug-loading {
    color: var(--accent-color);
    background: transparent;
    border: 1px dashed var(--accent-color);
    font-style: italic;
    animation: pulse 1.5s infinite;
}

.chat-input-area {
    display: flex;
    padding: 15px;
    border-top: 1px solid var(--border);
    background: var(--sidebar-bg);
    border-radius: 0 0 8px 8px;
    transition: 0.3s;
}

.chat-input-area input {
    flex: 1;
    margin-right: 15px;
    border: none;
    background: #000;
}

.gray-out {
    opacity: 0.4 !important;
    pointer-events: none !important;
    cursor: not-allowed !important;
    filter: grayscale(100%);
}

/* ================= RAG 统计面板（外发光科技感） ================= */
.rag-stats-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(22, 27, 34, 0.8);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 0 25px rgba(88, 166, 255, 0.1), 0 0 10px rgba(88, 166, 255, 0.05) inset;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.stat-row {
    display: flex;
    gap: 15px;
}

.stat-row .stat-item {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid var(--border);
    transition: 0.2s;
}

.stat-row .stat-item:hover {
    background: rgba(88, 166, 255, 0.08);
    border-color: var(--accent-color);
    box-shadow: 0 0 12px rgba(88, 166, 255, 0.2);
}

.stat-icon {
    font-size: 1.8rem;
    filter: drop-shadow(0 0 5px var(--accent-color));
}

.stat-detail {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(88, 166, 255, 0.4);
}

.stat-small {
    font-size: 0.95rem;
}

/* ================= RAG 管理容器 ================= */
.rag-manage-container {
    display: flex;
    flex-direction: column;
    max-height: 1200px;
}

/* ================= 分类面板 ================= */
.rag-category-panel {
    height: 30%;
    min-height: 100px;
    max-height: 200px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    overflow-y: auto;
}

.category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.category-tag {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
    user-select: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.category-tag:hover {
    filter: brightness(1.2);
    transform: translateY(-1px);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.category-tag.active-cate {
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.5), 0 0 40px currentColor;
    border-color: #ffffff;
    transform: scale(1.03);
}

/* ================= 文件面板 ================= */
.rag-file-panel {
    height: 70%;
    min-height: 400px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
}

.file-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.search-area {
    display: flex;
    gap: 10px;
    align-items: center;
    flex: 1;
}

.search-area select {
    width: auto;
    min-width: 100px;
}

.search-area input {
    flex: 1;
}

.file-count-info {
    white-space: nowrap;
    color: var(--text-dim);
    font-size: 0.85rem;
}

.file-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-dim);
}

/* ================= 进度条 ================= */
.progress-bar {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
    height: 22px;
}

.progress-fill {
    height: 100%;
    background: var(--accent-color);
    color: white;
    font-size: 0.75rem;
    line-height: 22px;
    text-align: center;
    white-space: nowrap;
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* 滚动条 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* -------------- RAG 表格风格部分 --------------- */

/* 文件列表容器 */
.rag-file-panel .table-container {
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #000;
    overflow-x: auto;
}

/* 重置表格布局为自动，以更好地适配各列内容 */
#rag-file-table {
    table-layout: auto;
    border-collapse: collapse;
}

/* 表头与单元格分割线显式化 */
#rag-file-table th,
#rag-file-table td {
    border-bottom: 1px solid var(--border);
    padding: 8px 10px;
    font-size: 0.85rem;
}

/* 交替行背景，防止看花眼 */
#rag-file-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

#rag-file-table tbody tr:nth-child(odd) {
    background: transparent;
}

/* 勾选框列：去掉省略号，留出正常空间 */
#rag-file-table th:first-child,
#rag-file-table td:first-child {
    width: 38px;
    text-overflow: clip;
    overflow: visible;
    white-space: normal;
    padding: 8px 6px;
    text-align: center;
    table-layout: auto;
}

/* 文件名列：字体稍小，不换行，限制最大宽度 ≈18个汉字，超出显示省略号 */
#rag-file-table td:nth-child(2) {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 16rem;
}

/* 文件类型列：保持正常，可适当缩小 */
#rag-file-table td:nth-child(3) {
    width: 50px;
    text-align: center;
}

/* 唯一ID列：内容字体最小，完整显示不截断，允许容器滚动 */
#rag-file-table td:nth-child(4) {
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    min-width: 170px;
    max-width: none;
    font-family: monospace;
    text-align: left;
    padding: 0px 0px;
    word-break: keep-all;
}

/* Chunks 列：居右显示，较窄 */
#rag-file-table td:nth-child(5) {
    font-size: 0.8rem;
    text-align: right;
    width: 50px;
}

/* 上传时间列：适当宽度 */
#rag-file-table th:nth-child(6),
#rag-file-table td:nth-child(6) {
    width: 150px;
    white-space: nowrap;
}

/* 状态列：居中 */
#rag-file-table th:nth-child(7),
#rag-file-table td:nth-child(7) {
    width: 60px;
    text-align: center;
}

/* 动作列：居中 */
#rag-file-table th:nth-child(8),
#rag-file-table td:nth-child(8) {
    width: 80px;
    text-align: center;
}

/* 模型名称下拉框与输入框无缝连接 */
#llm-name+select {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-left: none;
}
/* ================= Key 详情管理弹窗 ================= */
.key-manage-dialog {
    width: 792px;
    max-width: calc(100vw - 32px);
    text-align: left;
    padding: 32px;
}

.key-dialog-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.key-dialog-tab {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid transparent;
    border-bottom: none;
    padding: 8px 18px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    width: auto;
}

.key-dialog-tab.active {
    color: var(--accent-color);
    background: rgba(88, 166, 255, 0.08);
    border-color: var(--border);
}

.key-dialog-page {
    display: none;
}

.key-dialog-page.active {
    display: block;
}

.key-manage-panel {
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 14px;
}

.key-panel-title {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 10px;
}

.key-model-scroll {
    max-height: 210px;
    overflow-y: auto;
    padding-right: 6px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 14px;
}

.key-model-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    color: var(--text-main);
    font-size: 0.82rem;
}

.key-model-check-row span {
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.key-bottom-panel {
    display: flex;
    gap: 16px;
    align-items: flex-end;
}

.key-status-field {
    flex: 0 0 130px;
}

.key-alias-field {
    flex: 1;
}

.key-alias-field input {
    width: 100%;
    box-sizing: border-box;
}

.key-enabled-toggle {
    width: 100%;
    border-radius: 8px;
    padding: 9px 12px;
    font-weight: bold;
}

.key-enabled-toggle.enabled {
    background: rgba(46, 160, 67, 0.2);
    color: var(--success);
    border: 1px solid var(--success);
}

.key-enabled-toggle.suspended {
    background: rgba(248, 81, 73, 0.18);
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* ================= 规则化配置 / 大模型规则视觉分区 ================= */
.rule-llm-card {
    position: relative;
    overflow: hidden;
    border-color: rgba(88, 166, 255, 0.28);
    background:
        radial-gradient(circle at top left, rgba(88, 166, 255, 0.16), transparent 34%),
        radial-gradient(circle at bottom right, rgba(126, 231, 135, 0.08), transparent 32%),
        linear-gradient(180deg, rgba(33, 38, 45, 0.98), rgba(22, 27, 34, 0.96));
}

.rule-llm-card::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: linear-gradient(180deg, rgba(0,0,0,0.65), transparent 70%);
}

.rule-rag-card {
    position: relative;
    overflow: hidden;
    border-color: rgba(126, 231, 135, 0.28);
    background:
        radial-gradient(circle at top left, rgba(46, 160, 67, 0.18), transparent 34%),
        radial-gradient(circle at bottom right, rgba(88, 166, 255, 0.09), transparent 32%),
        linear-gradient(180deg, rgba(33, 38, 45, 0.98), rgba(22, 27, 34, 0.96));
}

.rule-rag-card::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(126,231,135,0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(126,231,135,0.025) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: linear-gradient(180deg, rgba(0,0,0,0.58), transparent 70%);
}

.rule-llm-hero,
.rule-rag-hero,
.rule-section-grid,
.rule-save-bar {
    position: relative;
    z-index: 1;
}

.rule-llm-hero,
.rule-rag-hero {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 18px 20px;
    margin-bottom: 22px;
    border: 1px solid rgba(88, 166, 255, 0.22);
    border-radius: 16px;
    background: rgba(13, 17, 23, 0.38);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.rule-llm-hero-icon,
.rule-rag-hero-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    font-size: 1.5rem;
    background: linear-gradient(135deg, rgba(88,166,255,0.24), rgba(210,168,255,0.18));
    border: 1px solid rgba(88,166,255,0.32);
    box-shadow: 0 0 22px rgba(88,166,255,0.18);
}

.rule-llm-hero-title,
.rule-rag-hero-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: 0.5px;
}

.rule-llm-hero-desc,
.rule-rag-hero-desc {
    margin: 6px 0 0;
    color: var(--text-dim);
    font-size: 0.86rem;
    line-height: 1.7;
}

.rule-rag-hero {
    border-color: rgba(126, 231, 135, 0.24);
    background: rgba(13, 17, 23, 0.42);
}

.rule-rag-hero-icon {
    background: linear-gradient(135deg, rgba(46,160,67,0.26), rgba(88,166,255,0.16));
    border-color: rgba(126,231,135,0.32);
    box-shadow: 0 0 22px rgba(46,160,67,0.18);
}

.rule-rag-routing {
    grid-column: span 2;
    border-top: 3px solid var(--color-rag);
}

.rule-rag-threshold {
    border-top: 3px solid var(--color-hybrid);
}

.rule-rag-quality {
    border-top: 3px solid var(--success);
}

.rule-rag-warning {
    margin: 0 0 14px;
    padding: 10px 12px;
    color: var(--danger);
    font-size: 0.82rem;
    line-height: 1.55;
    border-radius: 10px;
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.25);
}

.rule-rag-slider-panel {
    padding: 14px;
    border-radius: 14px;
    background: rgba(0,0,0,0.24);
    border: 1px solid rgba(126,231,135,0.14);
}

.rule-rag-slider {
    width: 100%;
}

.rule-rag-strategy-labels {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.rule-rag-strategy-labels span {
    padding: 11px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,0.035);
    border: 1px solid rgba(255,255,255,0.06);
}

.rule-rag-strategy-labels span.active {
    border-color: rgba(126,231,135,0.34);
    background: rgba(46,160,67,0.13);
}

.rule-rag-strategy-labels b,
.rule-rag-strategy-labels em {
    display: block;
}

.rule-rag-strategy-labels b {
    color: var(--text-main);
    font-size: 0.84rem;
}

.rule-rag-strategy-labels em {
    margin-top: 4px;
    color: var(--text-dim);
    font-size: 0.74rem;
    font-style: normal;
    line-height: 1.35;
}

.rule-rag-threshold-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.rule-rag-threshold-input {
    border-color: rgba(88,166,255,0.26) !important;
}

.rule-rag-quality-list,
.rule-rag-note-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.rule-rag-quality-list span,
.rule-rag-note-list span {
    padding: 7px 10px;
    border-radius: 999px;
    color: #7ee787;
    background: rgba(46,160,67,0.12);
    border: 1px solid rgba(126,231,135,0.22);
    font-size: 0.77rem;
    line-height: 1.35;
}

.rule-rag-note-list span {
    color: var(--text-dim);
    background: rgba(255,255,255,0.035);
    border-color: rgba(255,255,255,0.06);
}

.rule-rag-save-bar {
    border-color: rgba(126,231,135,0.24);
    background: rgba(46,160,67,0.09);
}

.rule-rag-save-bar button {
    box-shadow: 0 10px 24px rgba(46,160,67,0.22);
}

.rule-section-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(280px, 1fr));
    gap: 18px;
}

.rule-setting-card {
    min-height: 190px;
    padding: 18px;
    border-radius: 16px;
    border: 1px solid rgba(48, 54, 61, 0.95);
    background: rgba(13, 17, 23, 0.48);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.035), 0 14px 30px rgba(0,0,0,0.16);
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.rule-setting-card:hover {
    transform: translateY(-1px);
    border-color: rgba(88, 166, 255, 0.38);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 18px 34px rgba(0,0,0,0.22);
}

.rule-setting-sampling {
    border-top: 3px solid var(--color-pri);
}

.rule-setting-reasoning {
    border-top: 3px solid var(--color-sec);
}

.rule-setting-cleaner {
    border-top: 3px solid var(--color-rag);
}

.rule-setting-watchdog {
    border-top: 3px solid var(--color-hybrid);
}

.rule-setting-header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.rule-setting-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
}

.rule-setting-title {
    display: block;
    margin: 0;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 750;
}

.rule-setting-subtitle {
    margin: 5px 0 0;
    color: var(--text-dim);
    font-size: 0.82rem;
    line-height: 1.55;
}

.rule-checkbox-line {
    margin: 8px 0 14px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255,255,255,0.035);
    border: 1px solid rgba(255,255,255,0.055);
}

.rule-control-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.rule-number-input {
    width: 132px !important;
    background: rgba(0,0,0,0.34) !important;
    border-color: rgba(88,166,255,0.22) !important;
}

.rule-range-hint,
.rule-note {
    color: var(--accent-color);
    font-size: 0.8rem;
}

.rule-mode-select {
    max-width: 240px;
    background: var(--bg-dark) !important;
    color: var(--text-main) !important;
    border-color: rgba(210,168,255,0.26);
}

.rule-mode-select option {
    background: var(--bg-dark);
    color: var(--text-main);
}

.rule-mode-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.rule-mode-legend span {
    padding: 8px 10px;
    border-radius: 10px;
    color: var(--text-dim);
    font-size: 0.78rem;
    line-height: 1.45;
    background: rgba(255,255,255,0.035);
    border: 1px solid rgba(255,255,255,0.055);
}

.rule-mode-legend b {
    color: var(--text-main);
}

.rule-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.rule-tag-list span {
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 0.76rem;
    color: #7ee787;
    background: rgba(46,160,67,0.12);
    border: 1px solid rgba(126,231,135,0.22);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.rule-inline-pair {
    display: grid;
    grid-template-columns: auto 132px auto 132px;
    align-items: center;
    gap: 10px;
}

.rule-inline-pair label {
    margin: 0;
    color: var(--text-main);
    font-size: 0.86rem;
}

.rule-note {
    margin-top: 12px;
    line-height: 1.55;
}

.rule-save-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-top: 20px;
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid rgba(88,166,255,0.22);
    background: rgba(88,166,255,0.08);
}

.rule-save-bar strong {
    color: var(--text-main);
    font-size: 0.95rem;
}

.rule-save-bar p {
    margin: 5px 0 0;
    color: var(--text-dim);
    font-size: 0.82rem;
}

.rule-save-bar button {
    min-width: 160px;
    box-shadow: 0 10px 24px rgba(88,166,255,0.22);
}

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

    .rule-inline-pair {
        grid-template-columns: 1fr;
    }

    .rule-rag-routing {
        grid-column: span 1;
    }

    .rule-rag-strategy-labels {
        grid-template-columns: 1fr;
    }

    .rule-inline-pair .rule-number-input {
        width: 100% !important;
    }
}

@media (max-width: 720px) {
    .rule-llm-hero,
    .rule-rag-hero,
    .rule-save-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .rule-save-bar button {
        width: 100%;
    }

    .rule-mode-legend {
        grid-template-columns: 1fr;
    }
}


/* ================= DeepNow Neural UI 3.0 ================= */
:root {
    --neural-cyan: #55e6ff;
    --neural-blue: #4d7dff;
    --neural-violet: #9a6cff;
    --neural-pink: #ff5fd2;
    --neural-glass: rgba(11, 18, 35, 0.72);
    --neural-border: rgba(117, 207, 255, 0.18);
    --neural-shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
}

body {
    background:
        radial-gradient(circle at 16% 12%, rgba(67, 110, 255, 0.12), transparent 28%),
        radial-gradient(circle at 86% 8%, rgba(154, 108, 255, 0.10), transparent 30%),
        linear-gradient(145deg, #080c15 0%, #0c111d 48%, #080d16 100%);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.22;
    background-image:
        linear-gradient(rgba(103, 160, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(103, 160, 255, 0.045) 1px, transparent 1px);
    background-size: 36px 36px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.9), transparent 92%);
}

.sidebar {
    background: linear-gradient(180deg, rgba(14, 21, 37, 0.96), rgba(9, 14, 25, 0.98));
    border-right: 1px solid rgba(101, 187, 255, 0.18);
    box-shadow: 18px 0 60px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(18px);
}

.logo-area {
    background: linear-gradient(135deg, rgba(62, 126, 255, 0.10), rgba(154, 108, 255, 0.06));
}

.menu-item {
    margin: 4px 10px;
    padding: 13px 14px;
    border-radius: 10px;
    border-left: 1px solid transparent;
}

.menu-item:hover {
    background: linear-gradient(90deg, rgba(69, 139, 255, 0.10), rgba(154, 108, 255, 0.05));
    border-color: rgba(88, 166, 255, 0.16);
    transform: translateX(2px);
}

.menu-item.active {
    margin-right: 10px;
    padding-right: 14px;
    background: linear-gradient(90deg, rgba(61, 139, 255, 0.18), rgba(153, 94, 255, 0.10));
    border: 1px solid rgba(100, 193, 255, 0.25);
    box-shadow: inset 0 0 24px rgba(83, 159, 255, 0.06), 0 8px 28px rgba(0, 0, 0, 0.2);
}

.main-content {
    background:
        radial-gradient(circle at 50% -10%, rgba(80, 137, 255, 0.09), transparent 30%),
        transparent;
}

.page h2 {
    letter-spacing: 0.02em;
    text-shadow: 0 0 24px rgba(91, 173, 255, 0.18);
}

.card {
    position: relative;
    overflow: hidden;
    background: linear-gradient(145deg, rgba(24, 33, 52, 0.86), rgba(17, 24, 39, 0.92));
    border: 1px solid var(--neural-border);
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.025);
    backdrop-filter: blur(16px);
}

.card::before {
    content: '';
    position: absolute;
    left: 18px;
    right: 18px;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(95, 218, 255, 0.55), rgba(148, 105, 255, 0.4), transparent);
    opacity: 0.75;
}

input,
select,
textarea {
    background: rgba(5, 11, 23, 0.72);
    border-color: rgba(103, 164, 255, 0.18);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(83, 221, 255, 0.65);
    box-shadow: 0 0 0 3px rgba(82, 193, 255, 0.10), 0 0 24px rgba(71, 155, 255, 0.08);
}

button {
    background: linear-gradient(135deg, #397ff5, #7b5cf0);
    box-shadow: 0 10px 24px rgba(64, 112, 255, 0.20), inset 0 1px 0 rgba(255,255,255,0.14);
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(64, 112, 255, 0.28), inset 0 1px 0 rgba(255,255,255,0.18);
}

.status-banner,
.rag-stats-panel,
.modal-box {
    backdrop-filter: blur(18px);
}

/* ================= Neural Gateway Login ================= */
#login-page {
    background:
        radial-gradient(circle at 50% 50%, rgba(47, 79, 150, 0.14), transparent 35%),
        linear-gradient(145deg, #04070d 0%, #07101f 52%, #050812 100%);
    isolation: isolate;
}

#reasoning-collision-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.92;
}

#login-page .cyber-bg {
    background:
        radial-gradient(circle at 22% 18%, rgba(77, 125, 255, 0.14), transparent 24%),
        radial-gradient(circle at 78% 78%, rgba(154, 108, 255, 0.12), transparent 28%);
}

#login-page .cyber-grid {
    inset: -35%;
    opacity: 0.42;
    background-image:
        linear-gradient(rgba(72, 142, 255, 0.12) 1px, transparent 1px),
        linear-gradient(90deg, rgba(72, 142, 255, 0.12) 1px, transparent 1px);
    background-size: 54px 54px;
    transform: perspective(800px) rotateX(68deg) translateY(8%);
    transform-origin: center bottom;
    animation: neuralGridFlow 8s linear infinite;
    mask-image: linear-gradient(to top, rgba(0,0,0,0.9), transparent 78%);
}

@keyframes neuralGridFlow {
    from { background-position: 0 0, 0 0; }
    to { background-position: 0 54px, 54px 0; }
}

#login-page .glow-orb {
    width: 760px;
    height: 760px;
    background:
        radial-gradient(circle, rgba(80, 186, 255, 0.14) 0%, rgba(111, 87, 255, 0.07) 38%, transparent 68%);
    filter: blur(12px);
    animation: neuralOrbBreathe 6s ease-in-out infinite alternate;
}

@keyframes neuralOrbBreathe {
    from { opacity: 0.55; transform: translate(-50%, -50%) scale(0.82); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1.12); }
}

.reasoning-cloud {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 18px;
    font: 600 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.08em;
    color: rgba(138, 222, 255, 0.46);
    text-shadow: 0 0 18px rgba(74, 176, 255, 0.30);
    user-select: none;
}

.reasoning-cloud span {
    width: max-content;
    padding: 6px 10px;
    border: 1px solid rgba(103, 198, 255, 0.10);
    border-radius: 999px;
    background: rgba(10, 21, 40, 0.28);
    backdrop-filter: blur(6px);
    animation: thoughtFloat 7s ease-in-out infinite;
}

.reasoning-cloud span:nth-child(2) { animation-delay: -1.7s; }
.reasoning-cloud span:nth-child(3) { animation-delay: -3.2s; }
.reasoning-cloud span:nth-child(4) { animation-delay: -4.8s; }

.reasoning-cloud-a { left: 5%; top: 15%; transform: rotate(-7deg); }
.reasoning-cloud-b { right: 4%; bottom: 14%; align-items: flex-end; transform: rotate(6deg); }

@keyframes thoughtFloat {
    0%, 100% { transform: translate3d(0, 0, 0); opacity: 0.32; }
    50% { transform: translate3d(10px, -12px, 0); opacity: 0.78; }
}

.login-scanline {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.12;
    background: repeating-linear-gradient(to bottom, transparent 0, transparent 3px, rgba(142, 216, 255, 0.12) 4px);
    animation: scanlineShift 10s linear infinite;
}

@keyframes scanlineShift {
    from { background-position-y: 0; }
    to { background-position-y: 100px; }
}

.login-shell {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: minmax(340px, 1.15fr) minmax(360px, 0.85fr);
    align-items: center;
    gap: clamp(44px, 8vw, 120px);
    width: min(1120px, calc(100vw - 64px));
    min-height: 100vh;
    padding: 48px 0;
}

.login-intelligence-panel {
    max-width: 610px;
    animation: loginPanelIn 0.8s ease both;
}

.login-kicker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 22px;
    color: rgba(135, 218, 255, 0.78);
    font: 700 0.72rem/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.22em;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--neural-cyan);
    box-shadow: 0 0 0 0 rgba(85, 230, 255, 0.65);
    animation: pulseDot 2s infinite;
}

@keyframes pulseDot {
    70% { box-shadow: 0 0 0 12px rgba(85, 230, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(85, 230, 255, 0); }
}

.login-intelligence-panel h2 {
    margin: 0 0 22px;
    color: #f4f8ff;
    font-size: clamp(2.4rem, 5vw, 4.5rem);
    line-height: 1.08;
    letter-spacing: -0.045em;
    text-shadow: 0 0 44px rgba(70, 141, 255, 0.18);
}

.login-intelligence-panel h2 span {
    background: linear-gradient(90deg, #55e6ff, #7798ff 48%, #b67cff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-intelligence-panel > p {
    max-width: 560px;
    color: rgba(202, 216, 239, 0.68);
    font-size: 1rem;
    line-height: 1.85;
}

.login-capabilities {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 30px;
}

.login-capabilities span {
    padding: 8px 13px;
    border: 1px solid rgba(102, 202, 255, 0.16);
    border-radius: 999px;
    color: rgba(195, 226, 255, 0.78);
    background: rgba(17, 33, 59, 0.36);
    font: 600 0.75rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    backdrop-filter: blur(10px);
}

.login-metric-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-top: 34px;
    max-width: 540px;
}

.login-metric-row div {
    padding: 16px;
    border: 1px solid rgba(98, 188, 255, 0.12);
    border-radius: 14px;
    background: linear-gradient(145deg, rgba(20, 40, 71, 0.38), rgba(9, 18, 34, 0.34));
    backdrop-filter: blur(12px);
}

.login-metric-row strong,
.login-metric-row small {
    display: block;
}

.login-metric-row strong {
    color: #bdeeff;
    font-size: 1.05rem;
    letter-spacing: 0.08em;
}

.login-metric-row small {
    margin-top: 6px;
    color: rgba(174, 196, 224, 0.5);
    font-size: 0.72rem;
}

#login-page .login-box {
    position: relative;
    width: min(100%, 430px);
    justify-self: end;
    padding: 38px;
    overflow: hidden;
    text-align: left;
    background:
        linear-gradient(145deg, rgba(19, 31, 54, 0.78), rgba(8, 15, 30, 0.88));
    border: 1px solid rgba(118, 207, 255, 0.22);
    border-radius: 24px;
    box-shadow:
        0 36px 90px rgba(0, 0, 0, 0.52),
        0 0 0 1px rgba(114, 91, 255, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.055);
    backdrop-filter: blur(24px) saturate(130%);
    -webkit-backdrop-filter: blur(24px) saturate(130%);
    animation: loginPanelIn 0.8s 0.08s ease both;
}

@keyframes loginPanelIn {
    from { opacity: 0; transform: translateY(18px) scale(0.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-box-glow {
    position: absolute;
    width: 240px;
    height: 240px;
    top: -120px;
    right: -100px;
    border-radius: 50%;
    background: rgba(91, 112, 255, 0.20);
    filter: blur(48px);
    pointer-events: none;
}

.login-brand-mark {
    position: relative;
    width: 54px;
    height: 54px;
    margin-bottom: 22px;
}

.login-brand-core {
    position: absolute;
    inset: 7px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    color: #eefaff;
    font-size: 1.25rem;
    font-weight: 900;
    background: linear-gradient(145deg, #3bbdf2, #665bea 60%, #b052df);
    box-shadow: 0 0 28px rgba(76, 170, 255, 0.34);
}

.login-brand-orbit {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(100, 220, 255, 0.42);
    border-radius: 50%;
    animation: brandOrbit 6s linear infinite;
}

.login-brand-orbit::after {
    content: '';
    position: absolute;
    width: 7px;
    height: 7px;
    top: -4px;
    left: 50%;
    border-radius: 50%;
    background: var(--neural-cyan);
    box-shadow: 0 0 14px var(--neural-cyan);
}

@keyframes brandOrbit { to { transform: rotate(360deg); } }

.login-heading {
    margin-bottom: 28px;
}

.login-status {
    display: block;
    margin-bottom: 8px;
    color: rgba(118, 218, 255, 0.58);
    font: 700 0.66rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    letter-spacing: 0.18em;
}

.login-heading h1 {
    margin: 0;
    color: #f2f7ff;
    font-size: 1.8rem;
    letter-spacing: -0.03em;
}

.login-heading p {
    margin-top: 7px;
    color: rgba(174, 195, 221, 0.58);
    font-size: 0.86rem;
}

#login-page .login-field {
    margin-bottom: 18px;
}

#login-page .login-field label {
    margin-bottom: 8px;
    color: rgba(189, 212, 239, 0.72);
    font-size: 0.76rem;
    letter-spacing: 0.06em;
}

.login-input-wrap {
    position: relative;
}

.login-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
    color: rgba(111, 210, 255, 0.55);
    font-size: 1rem;
    pointer-events: none;
}

#login-page .login-box input {
    height: 48px;
    margin-bottom: 0;
    padding: 12px 14px 12px 42px;
    border-radius: 12px;
    color: #eaf4ff;
    background: rgba(3, 9, 20, 0.58);
    border: 1px solid rgba(102, 175, 255, 0.15);
}

#login-page .login-box input:focus {
    background: rgba(4, 12, 26, 0.82);
    border-color: rgba(83, 223, 255, 0.62);
    box-shadow: 0 0 0 3px rgba(79, 203, 255, 0.08), 0 0 26px rgba(62, 139, 255, 0.10);
}

#login-page .login-submit {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-top: 8px;
    padding: 13px 16px;
    border: 1px solid rgba(144, 226, 255, 0.16);
    border-radius: 12px;
    background: linear-gradient(100deg, #277fe3, #625ee7 55%, #9c54d9);
    box-shadow: 0 16px 34px rgba(60, 94, 224, 0.28);
}

.login-submit-arrow {
    font-size: 1.2rem;
    transition: transform 0.2s ease;
}

#login-page .login-submit:hover .login-submit-arrow {
    transform: translateX(4px);
}

.login-security-note {
    margin-top: 17px;
    text-align: center;
    color: rgba(154, 184, 214, 0.42);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
}

.login-security-note span {
    color: #57d9b5;
    text-shadow: 0 0 10px rgba(87, 217, 181, 0.5);
}

@media (max-width: 900px) {
    .login-shell {
        grid-template-columns: 1fr;
        width: min(520px, calc(100vw - 36px));
        gap: 28px;
        align-content: center;
    }

    .login-intelligence-panel {
        text-align: center;
    }

    .login-intelligence-panel h2 {
        font-size: clamp(2rem, 9vw, 3.2rem);
    }

    .login-intelligence-panel > p {
        margin-inline: auto;
    }

    .login-capabilities,
    .login-metric-row {
        justify-content: center;
        margin-inline: auto;
    }

    #login-page .login-box {
        justify-self: center;
    }

    .reasoning-cloud {
        opacity: 0.5;
    }
}

@media (max-width: 560px) {
    .login-shell {
        padding: 28px 0;
    }

    .login-intelligence-panel > p,
    .login-metric-row {
        display: none;
    }

    #login-page .login-box {
        padding: 28px 22px;
        border-radius: 20px;
    }

    .login-capabilities {
        margin-top: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #login-page *,
    #login-page *::before,
    #login-page *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
    }
}


/* ================= DeepNow Console Performance Guard ================= */
/* 登录页隐藏后彻底暂停登录层所有 CSS 动画，避免不可见合成层继续占用资源。 */
body:not(.deepnow-login-active) #login-page *,
body:not(.deepnow-login-active) #login-page *::before,
body:not(.deepnow-login-active) #login-page *::after {
    animation-play-state: paused !important;
}

/* 后台控制台保持科技质感，但不保留任何无意义的永久动画。 */
#app-container .logo-bg::before,
#app-container .lightning-icon {
    animation: none !important;
}

/* 管理页面使用静态半透明层，不再对大面积内容执行实时 backdrop blur。 */
#app-container .sidebar,
#app-container .card,
#app-container .rag-stats-panel,
#app-container .status-banner,
#app-container .modal-box {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

#app-container .sidebar {
    background: linear-gradient(180deg, rgb(14, 21, 37), rgb(9, 14, 25));
}

#app-container .card {
    background: linear-gradient(145deg, rgb(24, 33, 52), rgb(17, 24, 39));
    contain: layout paint style;
}

#app-container .rag-stats-panel,
#app-container .status-banner,
#app-container .modal-box {
    background-color: rgb(17, 24, 39);
}

/* 控制台静态网格只保留视觉纹理，不创建额外固定合成层。 */
body.deepnow-console-active::before {
    position: absolute;
    mask-image: none;
    -webkit-mask-image: none;
    opacity: 0.12;
}

/* 页面切换只执行一次短动画，其余后台元素保持静止。 */
#app-container .page:not(.active),
#app-container .sub-page:not(.active) {
    animation: none !important;
}


/* ================= Compact Collapsible Sidebar ================= */
:root {
    --sidebar-expanded-width: 218px;
    --sidebar-collapsed-width: 72px;
}

#app-container .sidebar {
    width: var(--sidebar-expanded-width);
    transition: width 0.22s ease;
}

#app-container .logo-area {
    min-height: 82px;
    padding: 20px 14px;
}

#app-container .cyber-logo {
    gap: 8px;
    font-size: 1.08rem;
    white-space: nowrap;
}

#app-container .lightning-icon {
    font-size: 1.12rem;
}

#app-container .menu {
    padding: 14px 0;
}

#app-container .menu-item {
    min-height: 48px;
    margin: 4px 8px;
    padding: 11px 12px;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

#app-container .menu-icon {
    width: 25px;
    margin-right: 10px;
    text-align: center;
    font-size: 1.08rem;
}

#app-container .sidebar-collapse-toggle {
    position: absolute;
    z-index: 120;
    top: 94px;
    right: -14px;
    display: grid;
    place-items: center;
    width: 29px;
    height: 42px;
    padding: 0;
    border: 1px solid rgba(97, 190, 255, 0.34);
    border-radius: 9px;
    color: #8bdfff;
    background: linear-gradient(180deg, rgb(21, 38, 66), rgb(12, 23, 43));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34), 0 0 14px rgba(69, 157, 255, 0.12);
    font-size: 1.35rem;
    line-height: 1;
    transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

#app-container .sidebar-collapse-toggle:hover {
    transform: none;
    color: #ffffff;
    border-color: rgba(100, 220, 255, 0.68);
    background: linear-gradient(180deg, rgb(28, 55, 92), rgb(15, 31, 58));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34), 0 0 18px rgba(69, 181, 255, 0.20);
}

#app-container .sidebar-collapse-toggle:focus-visible {
    outline: 2px solid rgba(85, 230, 255, 0.72);
    outline-offset: 2px;
}

#app-container.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

#app-container.sidebar-collapsed .logo-area {
    padding: 20px 10px;
}

#app-container.sidebar-collapsed .cyber-logo {
    justify-content: center;
}

#app-container.sidebar-collapsed .logo-text,
#app-container.sidebar-collapsed .menu-label,
#app-container.sidebar-collapsed .sidebar-footer {
    display: none;
}

#app-container.sidebar-collapsed .menu-item {
    justify-content: center;
    margin-inline: 8px;
    padding-inline: 0;
}

#app-container.sidebar-collapsed .menu-icon {
    width: auto;
    margin-right: 0;
    font-size: 1.2rem;
}

#app-container.sidebar-collapsed .logo-dropdown {
    left: calc(100% + 10px);
    top: 10px;
    width: 180px;
}

#app-container.sidebar-collapsed .sidebar-collapse-toggle {
    right: -14px;
}

@media (max-width: 920px) {
    :root {
        --sidebar-expanded-width: 202px;
    }

    #app-container .main-content {
        padding: 28px;
    }
}


/* ================= Language-aware Sidebar Typography & Split Logo ================= */
#app-container .logo-area {
    padding-left: 11px;
    padding-right: 12px;
}

#app-container .cyber-logo {
    gap: 7px;
    align-items: center;
}

#app-container .logo-text {
    position: relative;
    display: inline-block;
    min-width: 118px;
    height: 37px;
    line-height: 1;
    overflow: visible;
}

#app-container .logo-deepnow {
    position: absolute;
    left: 0;
    top: 1px;
    display: block;
    font-size: 1.22rem;
    font-weight: 900;
    letter-spacing: -0.035em;
    white-space: nowrap;
}

#app-container .logo-server {
    position: absolute;
    left: 72px;
    top: 22px;
    display: block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.72;
    white-space: nowrap;
    -webkit-text-fill-color: #9eb8ff;
    text-shadow: 0 0 12px rgba(103, 153, 255, 0.35);
}

#app-container .menu-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Latin-script languages need a smaller menu font because translations are much longer. */
html.ui-lang-compact #app-container .menu-item {
    font-size: 0.80rem;
    letter-spacing: 0;
}

html.ui-lang-compact #app-container .menu-icon {
    width: 22px;
    margin-right: 8px;
    font-size: 1rem;
}

html.ui-lang-compact #app-container .menu-item {
    padding-left: 10px;
    padding-right: 9px;
}

html.ui-lang-compact #app-container .menu-label {
    text-overflow: clip;
}

@media (max-width: 920px) {
    html.ui-lang-compact #app-container .menu-item {
        font-size: 0.74rem;
    }
}

#app-container.sidebar-collapsed .logo-text {
    display: none;
}

/* ================= Split Logo Rendering Fix ================= */
/* 父容器不再承担文字渐变，避免绝对定位子文字继承透明填充后只剩发光阴影。 */
#app-container .logo-text {
    background: none;
    -webkit-background-clip: border-box;
    -webkit-text-fill-color: initial;
    text-shadow: none;
}

#app-container .logo-deepnow {
    color: #69dfff;
    background: linear-gradient(90deg, #28e2ff 0%, #5ca7ff 58%, #a785ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    filter: drop-shadow(0 0 7px rgba(65, 183, 255, 0.24));
}

#app-container .logo-server {
    left: 73px;
    top: 21px;
    color: #9eb8ff;
    background: none;
    -webkit-background-clip: border-box;
    background-clip: border-box;
    -webkit-text-fill-color: #9eb8ff;
    text-shadow: 0 0 7px rgba(103, 153, 255, 0.24);
    filter: none;
    opacity: 0.86;
}

/* ================= MCP Router 配置中心 ================= */
.mcp-router-card {
    border-color: rgba(210, 168, 255, 0.28);
    background:
        radial-gradient(circle at top left, rgba(138, 43, 226, 0.16), transparent 36%),
        linear-gradient(180deg, rgba(33, 38, 45, 0.98), rgba(22, 27, 34, 0.96));
}

.mcp-hero,
.mcp-editor-title,
.mcp-action-row,
.mcp-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.mcp-hero h3,
.mcp-editor-title h3 {
    margin-bottom: 6px;
}

.mcp-hero p,
.mcp-help-text {
    color: var(--text-dim);
    font-size: 0.82rem;
    line-height: 1.6;
}

.mcp-server-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.mcp-server-item {
    width: 100%;
    min-width: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px;
    text-align: left;
    background: rgba(13, 17, 23, 0.7);
    border: 1px solid var(--border);
    color: var(--text-main);
}

.mcp-server-item:hover,
.mcp-server-item.active {
    border-color: #d2a8ff;
    background: rgba(138, 43, 226, 0.12);
    box-shadow: 0 0 16px rgba(138, 43, 226, 0.14);
}

.mcp-server-main,
.mcp-server-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mcp-server-main small,
.mcp-server-meta small {
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mcp-server-meta {
    align-items: flex-end;
    flex-shrink: 0;
}

.mcp-status {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 0.72rem;
    border: 1px solid var(--border);
}

.mcp-status.ready {
    color: #7ee787;
    border-color: rgba(46, 160, 67, 0.8);
    background: rgba(46, 160, 67, 0.14);
}

.mcp-status.error {
    color: #ff7b72;
    border-color: rgba(248, 81, 73, 0.8);
    background: rgba(248, 81, 73, 0.14);
}

.mcp-status.unknown {
    color: var(--text-dim);
    background: rgba(139, 148, 158, 0.08);
}

.mcp-toggle-row {
    justify-content: flex-start;
    margin-bottom: 20px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
}

.mcp-action-row {
    justify-content: flex-start;
    flex-wrap: wrap;
}

.mcp-result-box {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 8px;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: monospace;
    font-size: 0.78rem;
}

.mcp-result-box.success {
    color: #7ee787;
    border: 1px solid rgba(46, 160, 67, 0.65);
    background: rgba(46, 160, 67, 0.1);
}

.mcp-result-box.error {
    color: #ff7b72;
    border: 1px solid rgba(248, 81, 73, 0.65);
    background: rgba(248, 81, 73, 0.1);
}

.mcp-tool-table-wrap {
    max-height: 420px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #000;
    margin-top: 16px;
}

.mcp-tool-table {
    min-width: 760px;
    table-layout: fixed;
}

.mcp-tool-table th:nth-child(1),
.mcp-tool-table td:nth-child(1) { width: 190px; }
.mcp-tool-table th:nth-child(2),
.mcp-tool-table td:nth-child(2) { width: 150px; }
.mcp-tool-table th:nth-child(4),
.mcp-tool-table td:nth-child(4),
.mcp-tool-table th:nth-child(5),
.mcp-tool-table td:nth-child(5) { width: 90px; text-align: center; }

.mcp-tool-table code {
    color: #d2a8ff;
    font-size: 0.76rem;
}

.mcp-empty {
    color: var(--text-dim);
    text-align: center;
    padding: 22px;
}

.mcp-coming-soon {
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: var(--text-dim);
}

.mcp-coming-soon h3 {
    color: var(--text-main);
    margin: 14px 0 8px;
}

.mcp-coming-soon p {
    max-width: 580px;
    line-height: 1.8;
}

.mcp-coming-icon {
    font-size: 3rem;
    filter: drop-shadow(0 0 16px rgba(210, 168, 255, 0.45));
}

@media (max-width: 900px) {
    .mcp-server-list {
        grid-template-columns: 1fr;
    }
    .mcp-hero,
    .mcp-editor-title {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* ================= DeepNow 统一按钮视觉规范 ================= */
/*
 * 所有可点击按钮统一采用低饱和深色渐变、细描边与柔和内外光。
 * 真正 disabled 的按钮才使用灰色，避免正常操作被误判为不可用。
 */
button,
.btn-detail,
.key-dialog-tab,
.key-enabled-toggle {
    border: 1px solid rgba(113, 169, 255, 0.34);
    background: linear-gradient(135deg, rgba(42, 86, 151, 0.96), rgba(80, 58, 145, 0.96));
    color: #e8f1ff;
    box-shadow: 0 7px 18px rgba(23, 52, 103, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.10);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.22);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, transform 0.2s ease, filter 0.2s ease;
}

button:hover:not(:disabled),
.btn-detail:hover,
.key-dialog-tab:hover,
.key-enabled-toggle:hover:not(:disabled) {
    filter: brightness(1.10);
    border-color: rgba(135, 195, 255, 0.58);
    box-shadow: 0 10px 24px rgba(37, 82, 157, 0.32), 0 0 12px rgba(88, 166, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.14);
    transform: translateY(-1px);
}

button:active:not(:disabled),
.btn-detail:active,
.key-dialog-tab:active,
.key-enabled-toggle:active:not(:disabled) {
    filter: brightness(1.03);
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(23, 52, 103, 0.22), inset 0 1px 2px rgba(0, 0, 0, 0.18);
}

button.secondary {
    background: linear-gradient(135deg, rgba(39, 79, 133, 0.96), rgba(77, 58, 129, 0.96));
    color: #e6efff;
    border-color: rgba(118, 169, 238, 0.34);
    box-shadow: 0 7px 18px rgba(22, 48, 90, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

button.secondary:hover:not(:disabled) {
    filter: brightness(1.10);
    border-color: rgba(143, 193, 255, 0.56);
    box-shadow: 0 10px 24px rgba(35, 76, 139, 0.30), 0 0 12px rgba(88, 166, 255, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.13);
}

button.danger,
.key-enabled-toggle.suspended {
    background: linear-gradient(135deg, rgba(105, 45, 52, 0.96), rgba(78, 34, 43, 0.97));
    color: #f4d8dc;
    border-color: rgba(211, 92, 101, 0.40);
    box-shadow: 0 7px 18px rgba(87, 30, 40, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

button.danger:hover:not(:disabled),
.key-enabled-toggle.suspended:hover:not(:disabled) {
    filter: brightness(1.11);
    color: #ffe3e6;
    border-color: rgba(231, 119, 127, 0.62);
    box-shadow: 0 10px 24px rgba(122, 42, 53, 0.30), 0 0 12px rgba(220, 80, 92, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn-purple {
    background: linear-gradient(135deg, rgba(75, 52, 139, 0.96), rgba(101, 42, 152, 0.96)) !important;
    color: #eee4ff !important;
    border-color: rgba(178, 122, 235, 0.40) !important;
    box-shadow: 0 7px 18px rgba(71, 38, 120, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.09) !important;
}

.btn-purple:hover:not(:disabled) {
    filter: brightness(1.10);
    border-color: rgba(199, 149, 248, 0.60) !important;
    box-shadow: 0 10px 24px rgba(90, 46, 148, 0.30), 0 0 12px rgba(164, 92, 230, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.13) !important;
}

.btn-orange {
    background: linear-gradient(135deg, rgba(132, 82, 38, 0.96), rgba(108, 57, 36, 0.96)) !important;
    color: #f8e4d3 !important;
    border-color: rgba(221, 142, 82, 0.40) !important;
    box-shadow: 0 7px 18px rgba(101, 54, 26, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

.btn-orange:hover:not(:disabled) {
    filter: brightness(1.10);
    border-color: rgba(239, 164, 105, 0.60) !important;
    box-shadow: 0 10px 24px rgba(130, 68, 31, 0.30), 0 0 12px rgba(225, 128, 61, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
}

.btn-detail {
    padding: 4px 12px;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
}

.key-dialog-tab {
    background: rgba(31, 49, 78, 0.52);
    color: var(--text-dim);
    border-color: transparent;
    border-bottom: none;
    box-shadow: none;
    text-shadow: none;
}

.key-dialog-tab.active {
    color: #dcecff;
    background: linear-gradient(180deg, rgba(48, 82, 128, 0.58), rgba(34, 50, 78, 0.72));
    border-color: rgba(113, 169, 255, 0.30);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.key-enabled-toggle.enabled {
    background: linear-gradient(135deg, rgba(35, 101, 75, 0.94), rgba(29, 77, 66, 0.96));
    color: #d7f4e5;
    border-color: rgba(80, 185, 130, 0.40);
    box-shadow: 0 7px 18px rgba(26, 79, 58, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

button:disabled,
button.secondary:disabled,
button.danger:disabled,
.btn-purple:disabled,
.btn-orange:disabled,
.key-enabled-toggle:disabled {
    opacity: 0.52;
    cursor: not-allowed;
    background: linear-gradient(135deg, rgba(54, 61, 72, 0.94), rgba(42, 48, 58, 0.96)) !important;
    color: #8b949e !important;
    border-color: rgba(139, 148, 158, 0.20) !important;
    box-shadow: none !important;
    text-shadow: none;
    transform: none !important;
    filter: none !important;
}

/* ================= 2026-07-13 MCP / Select / RAG 视觉统一 ================= */
/* MCP 启用说明：保持为辅助信息，不与开关正文争夺视觉层级。 */
.mcp-toggle-row .mcp-transport-note {
    color: rgba(139, 148, 158, 0.82);
    font-size: 0.72rem;
    line-height: 1.55;
    font-weight: 400;
    letter-spacing: 0.1px;
}

/* 免费示例只作为低频辅助入口，采用轻量胶囊样式。 */
.mcp-template-button {
    width: auto;
    min-height: 30px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.1px;
    color: rgba(188, 211, 255, 0.9);
    background: linear-gradient(135deg, rgba(34, 58, 92, 0.76), rgba(67, 49, 98, 0.76));
    border: 1px dashed rgba(113, 169, 255, 0.32);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 0 9px rgba(88, 166, 255, 0.06);
}

.mcp-template-button:hover {
    color: #d7e7ff;
    border-color: rgba(137, 188, 255, 0.58);
    background: linear-gradient(135deg, rgba(42, 73, 116, 0.9), rgba(82, 57, 119, 0.9));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 13px rgba(88, 166, 255, 0.13);
    transform: translateY(-1px);
}

.mcp-template-button:active {
    transform: translateY(0);
}

/* 所有原生下拉菜单保持 DeepNow 深色主题。 */
select {
    color-scheme: dark;
    background-color: #111722;
    background-image: linear-gradient(180deg, rgba(22, 31, 46, 0.98), rgba(13, 18, 28, 0.98));
    border-color: rgba(72, 99, 137, 0.7);
}

select:hover:not(:disabled) {
    border-color: rgba(88, 166, 255, 0.55);
    background-image: linear-gradient(180deg, rgba(27, 38, 56, 0.98), rgba(15, 22, 34, 0.98));
}

select:focus {
    background-color: #111722;
}

select option,
select optgroup {
    color: var(--text-main);
    background: #111722;
}

select option:checked {
    color: #eef6ff;
    background: #253c5d linear-gradient(0deg, #253c5d 0%, #253c5d 100%);
}

select:disabled {
    color: rgba(139, 148, 158, 0.72);
    background: #151a23;
    border-color: rgba(48, 54, 61, 0.88);
}

/* RAG 配置中心：统一到 DeepNow 的低饱和蓝绿科技视觉。 */
#rag-config.rag-console-page {
    position: relative;
}

#rag-config.rag-console-page::before {
    content: '';
    position: absolute;
    inset: -18px -20px auto;
    height: 220px;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at 14% 0%, rgba(46, 160, 67, 0.12), transparent 38%),
        radial-gradient(circle at 82% 8%, rgba(88, 166, 255, 0.12), transparent 34%);
    filter: blur(2px);
}

#rag-config > h2 {
    margin-bottom: 20px;
    color: #dcecff;
    letter-spacing: 0.5px;
    text-shadow: 0 0 14px rgba(88, 166, 255, 0.12);
}

#rag-config .rag-stats-panel {
    gap: 12px;
    margin-bottom: 22px;
    padding: 16px;
    background:
        linear-gradient(180deg, rgba(26, 35, 49, 0.96), rgba(17, 23, 34, 0.98));
    border: 1px solid rgba(74, 111, 145, 0.48);
    border-radius: 14px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035), 0 14px 34px rgba(0, 0, 0, 0.18);
}

#rag-config .stat-row {
    gap: 12px;
}

#rag-config .stat-row .stat-item {
    min-height: 74px;
    padding: 12px 14px;
    background: linear-gradient(145deg, rgba(27, 38, 53, 0.94), rgba(18, 25, 36, 0.96));
    border: 1px solid rgba(68, 91, 119, 0.52);
    border-radius: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

#rag-config .stat-row .stat-item:hover {
    background: linear-gradient(145deg, rgba(31, 46, 62, 0.98), rgba(20, 30, 42, 0.98));
    border-color: rgba(92, 150, 183, 0.72);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 0 15px rgba(63, 145, 176, 0.1);
    transform: translateY(-1px);
}

#rag-config .stat-icon {
    font-size: 1.45rem;
    opacity: 0.9;
    filter: drop-shadow(0 0 5px rgba(88, 166, 255, 0.28));
}

#rag-config .stat-label {
    color: rgba(139, 148, 158, 0.9);
    font-size: 0.7rem;
    letter-spacing: 0.65px;
}

#rag-config .stat-value {
    color: #8ed9c1;
    font-size: 1.25rem;
    text-shadow: 0 0 9px rgba(78, 201, 161, 0.18);
}

#rag-config > .tabs {
    padding: 0 14px;
    margin-bottom: 18px;
    border: 1px solid rgba(64, 81, 108, 0.52);
    border-radius: 10px;
    background: rgba(17, 23, 34, 0.76);
}

#rag-config > .tabs .tab {
    padding: 12px 2px;
}

#rag-config .rag-manage-container {
    gap: 14px;
}

#rag-config .rag-category-panel,
#rag-config .rag-file-panel,
#rag-config .rag-upload-card {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at top left, rgba(46, 160, 67, 0.07), transparent 35%),
        linear-gradient(180deg, rgba(27, 36, 50, 0.98), rgba(18, 24, 35, 0.98));
    border: 1px solid rgba(68, 94, 121, 0.58);
    border-radius: 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 12px 26px rgba(0, 0, 0, 0.14);
}

#rag-config .rag-category-panel {
    min-height: 108px;
    padding: 16px;
    margin-bottom: 0;
}

#rag-config .rag-category-panel::before,
#rag-config .rag-file-panel::before,
#rag-config .rag-upload-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    height: 2px;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(79, 196, 158, 0.65), rgba(88, 166, 255, 0.56), transparent 90%);
}

#rag-config .category-tag {
    padding: 7px 13px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    filter: saturate(0.72) brightness(0.88);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 4px 10px rgba(0, 0, 0, 0.18);
}

#rag-config .category-tag:hover {
    filter: saturate(0.86) brightness(1.02);
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 0 13px rgba(88, 166, 255, 0.1);
}

#rag-config .category-tag.active-cate {
    filter: saturate(0.9) brightness(1.03);
    border-color: rgba(222, 241, 255, 0.7);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 14px rgba(88, 166, 255, 0.16);
    transform: translateY(-1px);
}

#rag-config .rag-file-panel {
    min-height: 430px;
    padding: 16px;
}

#rag-config .file-toolbar {
    padding: 11px;
    margin-bottom: 14px;
    border: 1px solid rgba(58, 77, 102, 0.58);
    border-radius: 9px;
    background: rgba(11, 16, 24, 0.42);
}

#rag-config .rag-file-panel .table-container {
    border-color: rgba(61, 83, 108, 0.7);
    border-radius: 9px;
    background: #0b1018;
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.22);
}

#rag-config #rag-file-table th {
    color: rgba(186, 203, 220, 0.82);
    background: rgba(28, 39, 54, 0.92);
    border-bottom-color: rgba(71, 94, 119, 0.72);
}

#rag-config #rag-file-table tbody tr:nth-child(even) {
    background: rgba(32, 45, 59, 0.24);
}

#rag-config #rag-file-table tbody tr:hover {
    background: rgba(52, 101, 128, 0.14);
}

#rag-config .file-pagination {
    margin-top: 14px;
    padding-top: 13px;
    border-top-color: rgba(63, 82, 105, 0.58);
}

#rag-config .rag-upload-card {
    padding: 24px;
}

#rag-config .progress-bar {
    background: rgba(5, 9, 14, 0.65);
    border: 1px solid rgba(57, 78, 100, 0.62);
}

#rag-config .progress-fill {
    background: linear-gradient(90deg, rgba(44, 132, 116, 0.95), rgba(62, 117, 181, 0.95));
}

@media (max-width: 760px) {
    #rag-config .stat-row {
        flex-direction: column;
    }

    #rag-config .file-toolbar,
    #rag-config .file-pagination {
        align-items: stretch;
        flex-direction: column;
    }

    #rag-config .search-area {
        flex-wrap: wrap;
    }
}
