/**
 * tea-server Web Admin · LLM 多模态推理网关与 API Key 金库专属样式表 (assets/llm-gateway.css)
 * 职责：
 * 1. 构建工业级 4 栏 Bento KPI 仪表盘、Appwrite 主权横幅、双模态主备拓扑流卡片
 * 2. 隔离全局 .field 样式冲突，提供干净无错位的 .llm-field 表单控件与密钥掩码工具条
 * 3. 精算表格列宽防止横向截断，提供配额水位条 (Quota Bar)、预设厂商模板与在线联调沙盒样式
 * 严守单文件 <= 500 行规范
 */

#scene-llm-gateway.scene.active {
  display: block;
  overflow-y: auto;
  padding: 24px 28px 40px;
}

/* 1. 工业级页头：左标题 + 右操作栏两端对齐（不掉行） */
.llm-page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.llm-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; color: #6D28D9; letter-spacing: 0.03em; margin-bottom: 3px; }
.llm-eyebrow-pill { background: #F5F3FF; color: #6D28D9; border: 1px solid rgba(109, 40, 217, 0.28); padding: 1px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 700; white-space: nowrap; }
.llm-page-title { margin: 0 0 3px; font-size: 20px; font-weight: 800; color: var(--ink); letter-spacing: -0.01em; }
.llm-page-sub { margin: 0; font-size: 12px; color: var(--ink2); }
.llm-head-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* 2. Appwrite 主权安全横幅（强制左右单行两端对齐） */
.llm-sovereignty-banner {
  background: linear-gradient(92deg, #F5F3FF 0%, #FAF5FF 55%, #F0FDF4 100%);
  border: 1px solid rgba(109, 40, 217, 0.24);
  border-left: 4px solid #7C3AED;
  border-radius: 11px;
  padding: 12px 18px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.llm-sovereignty-left { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #3B0764; line-height: 1.45; flex: 1; min-width: 0; }
.llm-sovereignty-icon { width: 32px; height: 32px; border-radius: 8px; background: #7C3AED; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; box-shadow: 0 3px 8px rgba(124, 58, 237, 0.22); }
.llm-sync-pill { display: inline-flex; align-items: center; gap: 6px; background: #1E1B4B; color: #EDE9FE; font-family: var(--tabular); font-size: 11px; font-weight: 600; padding: 5px 11px; border-radius: 999px; white-space: nowrap; flex-shrink: 0; }
.llm-sync-dot { width: 7px; height: 7px; border-radius: 50%; background: #34D399; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.25); }

/* 3. 顶部 4 卡 Bento KPI 仪表盘（禁止徽章折行） */
.llm-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.llm-kpi-card { background: #fff; border: 1px solid var(--border); border-radius: 11px; padding: 14px 16px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.llm-kpi-card::before { content: ""; position: absolute; top: 0; left: 0; bottom: 0; width: 4px; background: var(--kpi-accent, var(--primary)); }
.llm-kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.llm-kpi-label { font-size: 11.5px; font-weight: 700; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.llm-kpi-tag { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; white-space: nowrap; flex-shrink: 0; }
.llm-kpi-main { font-size: 17px; font-weight: 800; color: var(--ink); font-family: var(--tabular); line-height: 1.25; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.llm-kpi-sub { font-size: 11px; color: var(--ink3); font-family: var(--tabular); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 4. 双模态拓扑路由卡片与 5 大子场景参数矩阵 */
.llm-section-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.03); }
.llm-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.llm-section-head > div:first-child { flex: 1; min-width: 0; }
.llm-section-title { margin: 0; font-size: 14.5px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.llm-section-desc { margin: 2px 0 0; font-size: 11.5px; color: var(--ink2); }
.llm-route-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.llm-pipeline-card { background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 10px; padding: 12px 14px; }
.llm-pipeline-card.vision { background: linear-gradient(180deg, rgba(224, 242, 254, 0.35) 0%, #F8FAFC 65%); border-color: rgba(2, 132, 199, 0.28); }
.llm-pipeline-card.text { background: linear-gradient(180deg, rgba(243, 232, 255, 0.38) 0%, #F8FAFC 65%); border-color: rgba(124, 58, 237, 0.28); }
.llm-pipeline-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.llm-pipeline-title { font-size: 13px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.llm-scene-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.llm-scene-chip { font-size: 10.5px; padding: 2px 7px; border-radius: 5px; background: #fff; border: 1px solid #CBD5E1; color: var(--ink2); font-weight: 600; }
.llm-topology-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 6px; }
.llm-topology-arrow { height: 32px; display: flex; align-items: center; justify-content: center; color: var(--ink3); font-size: 10.5px; font-weight: 700; padding: 0 2px; white-space: nowrap; }

/* 5 大植保子场景精细路由矩阵条 */
.llm-subscene-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 11px; padding-top: 11px; border-top: 1px dashed #E2E8F0; }
.llm-subscene-item { background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 7px; padding: 6px 9px; font-size: 11px; }
.llm-subscene-name { font-weight: 700; color: var(--ink); display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.llm-subscene-meta { color: var(--ink3); font-family: var(--tabular); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 5. 专属无冲突表单控件 (.llm-field) */
.llm-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.llm-field-label { font-size: 11.5px; font-weight: 600; color: var(--ink); display: flex; align-items: center; justify-content: space-between; }
.llm-input, .llm-select { width: 100%; height: 32px; padding: 0 9px; border: 1px solid #CBD5E1; border-radius: 7px; background: #fff; color: var(--ink); font-size: 12px; box-sizing: border-box; }
.llm-input:focus, .llm-select:focus { outline: none; border-color: #7C3AED; box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12); }
.llm-key-input-wrap { display: flex; align-items: center; gap: 6px; }
.llm-key-input-wrap .llm-input { flex: 1; font-family: var(--tabular); }

/* 6. 紧凑型金库表格与配额水位条（严格 100% 宽度，防止右侧列截断） */
.llm-vault-table { width: 100% !important; min-width: 0 !important; border-collapse: collapse; table-layout: fixed; }
.llm-vault-table th, .llm-vault-table td { padding: 8px 6px !important; font-size: 11.5px; vertical-align: middle; overflow: hidden; text-overflow: ellipsis; }
.llm-key-code { display: inline-block; background: #F5F3FF; color: #6D28D9; padding: 2px 6px; border-radius: 4px; font-size: 11px; font-family: var(--tabular); border: 1px solid rgba(124, 58, 237, 0.22); white-space: nowrap; }
.llm-quota-bar { width: 100%; max-width: 105px; height: 5px; background: #E2E8F0; border-radius: 999px; overflow: hidden; margin-top: 4px; }
.llm-quota-fill { height: 100%; border-radius: 999px; }
.llm-act-group { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; }
.llm-act-btn { border: 1px solid #E2E8F0; background: #F8FAFC; color: var(--ink); font-size: 11px; font-weight: 600; padding: 3px 6px; border-radius: 5px; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.llm-act-btn:hover { border-color: #94A3B8; background: #F1F5F9; }
.llm-act-btn.primary { background: #F5F3FF; color: #6D28D9; border-color: rgba(124, 58, 237, 0.28); font-weight: 700; }
.llm-act-btn.warn { color: #D97706; border-color: rgba(217, 119, 6, 0.25); background: #FFFBEB; }
.llm-act-btn.ok { color: #15803D; border-color: rgba(22, 163, 74, 0.25); background: #F0FDF4; }
.llm-act-btn.danger { color: #DC2626; }

/* 7. 弹窗内 6 大厂商一键预设芯片 */
.llm-vendor-presets { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 8px 10px; background: #F8FAFC; border: 1px dashed #CBD5E1; border-radius: 8px; }
.llm-preset-btn { border: 1px solid #CBD5E1; background: #fff; border-radius: 6px; padding: 3px 8px; font-size: 11px; font-weight: 600; color: var(--ink); cursor: pointer; }
.llm-preset-btn:hover { border-color: #7C3AED; color: #6D28D9; background: #F5F3FF; }

/* 8. 区块三：在线联调沙盒与 1008/429 容灾演练台 */
.llm-sandbox-grid { display: grid; grid-template-columns: 1.08fr 0.92fr; gap: 14px; }
.llm-sandbox-pane { background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 9px; }
.llm-terminal-box { background: #0F172A; color: #E2E8F0; border-radius: 8px; padding: 10px 12px; font-family: var(--tabular); font-size: 11px; line-height: 1.5; overflow-x: auto; border: 1px solid #1E293B; }
.llm-terminal-head { display: flex; align-items: center; justify-content: space-between; color: #94A3B8; font-size: 10.5px; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px solid rgba(148, 163, 184, 0.18); }
.llm-trace-table { width: 100%; border-collapse: collapse; font-size: 11px; background: #fff; border: 1px solid #E2E8F0; border-radius: 8px; overflow: hidden; }
.llm-trace-table th { background: #F1F5F9; color: var(--ink2); font-weight: 700; text-align: left; padding: 6px 8px; font-size: 10.5px; }
.llm-trace-table td { padding: 6px 8px; border-top: 1px solid #F1F5F9; font-family: var(--tabular); }
