/* =====================================================================
   漫途财管 · 财务智能体平台 —— Web 门户样式
   原生 CSS，无构建、无外链、无第三方依赖。
   设计基调：专业金融后台 —— 深色侧栏 + 浅色工作区 + 克制的高亮色，
   数据表格等宽数字，卡片层次清晰，明暗双主题。
   ===================================================================== */

/* ------------------------------ 设计变量 ------------------------------ */
:root {
  --font-sans: "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", system-ui, -apple-system, sans-serif;
  --font-mono: "Cascadia Code", ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace;

  /* ---- 淡紫色主题（浅色）：极浅薰衣草底 + 深紫主色 ---- */
  --bg: #f7f3fe;
  --bg-accent: #efe8fd;
  --surface: #ffffff;
  --surface-2: #faf7ff;
  --surface-3: #f1eafc;
  --text: #1a1129;
  --text-2: #463a5f;
  --text-3: #635581;
  --muted: #756a93;
  --border: #e7e0f7;
  --border-strong: #d2c5ee;

  --brand: #2a1a4c;
  --brand-2: #3a2566;
  --brand-text: #ece6ff;
  --brand-muted: #c3b5e6;
  --gold: #ddd6fe;
  --gold-soft: #f3e8ff;

  --accent: #7c3aed;
  --accent-2: #6d28d9;
  --accent-soft: #f2ecfe;
  --accent-border: #d9c9fa;

  --ok: #06704d;
  --ok-soft: #e7f7f0;
  --warn: #8a4f06;
  --warn-soft: #fdf3e0;
  --danger: #ba1b2b;
  --danger-soft: #fdecee;
  --info: #0369a1;
  --info-soft: #e8f6fd;
  --purple: #7c3aed;
  --purple-soft: #f2ecfe;

  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;

  --shadow-xs: 0 1px 2px rgba(38, 22, 66, 0.06);
  --shadow-sm: 0 2px 6px -2px rgba(38, 22, 66, 0.12), 0 1px 2px rgba(38, 22, 66, 0.05);
  --shadow: 0 10px 30px -16px rgba(58, 32, 104, 0.28), 0 2px 6px -2px rgba(58, 32, 104, 0.07);
  --shadow-lg: 0 28px 70px -30px rgba(36, 18, 66, 0.5);

  --sidebar-w: 248px;
  --topbar-h: 68px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

[data-theme="dark"] {
  --bg: #120f1f;
  --bg-accent: #171328;
  --surface: #1b1630;
  --surface-2: #221c3b;
  --surface-3: #2b2350;
  --text: #f3efff;
  --text-2: #d0c5ec;
  --text-3: #b4a8d4;
  --muted: #9d90be;
  --border: #33295a;
  --border-strong: #4a3b74;

  --brand: #241a40;
  --brand-2: #32245a;
  --brand-text: #ece6ff;
  --brand-muted: #c8bbe8;

  --accent: #a78bfa;
  --accent-2: #c4b5fd;
  --accent-soft: #271f45;
  --accent-border: #42326b;

  --ok: #3ddc97;
  --ok-soft: #10291f;
  --warn: #f0b445;
  --warn-soft: #2c2312;
  --danger: #ff7a86;
  --danger-soft: #2e161c;
  --info: #66c6f0;
  --info-soft: #0f2836;
  --purple: #c4b5fd;
  --purple-soft: #241c3d;

  --gold: #ddd6fe;
  --gold-soft: #3a2b5e;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.32);
  --shadow-sm: 0 2px 8px -2px rgba(0, 0, 0, 0.48);
  --shadow: 0 14px 34px -18px rgba(0, 0, 0, 0.72);
  --shadow-lg: 0 30px 80px -36px rgba(0, 0, 0, 0.86);
}

/* ------------------------------ 基础重置 ------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
h1, h2, h3, h4 { font-weight: 650; line-height: 1.35; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }
::selection { background: color-mix(in srgb, var(--accent) 26%, transparent); }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* 内联图标默认尺寸（避免未指定尺寸时被渲染成 300×150 的巨型图标） */
.ic { width: 16px; height: 16px; flex: none; vertical-align: -2px; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--text-3) 38%, transparent); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--text-3) 60%, transparent); background-clip: padding-box; }

/* ------------------------------ 通用组件 ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 600; white-space: nowrap;
  transition: background 0.18s var(--ease), color 0.18s, border-color 0.18s, transform 0.12s, box-shadow 0.18s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-icon { width: 16px; height: 16px; flex: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--accent) 80%, transparent);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.07); box-shadow: 0 10px 22px -10px color-mix(in srgb, var(--accent) 90%, transparent); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }
.btn-soft { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-border); }
.btn-soft:hover:not(:disabled) { filter: brightness(0.98); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }
.btn-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.btn-ok:hover:not(:disabled) { background: var(--ok); color: #fff; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: var(--radius-xs); }
.btn-xs { height: 27px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.btn-lg { height: 46px; font-size: 15px; border-radius: var(--radius-sm); }
.btn-block { width: 100%; }
.btn-label { letter-spacing: 2px; }
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  color: var(--text-2); background: transparent;
  transition: background 0.18s, color 0.18s;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

.input, .select, .textarea {
  height: 38px; padding: 0 12px; width: 100%;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .select:focus, .textarea:focus, .code-input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.select { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 16px) 16px, calc(100% - 11px) 16px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.input-sm { height: 32px; font-size: 12.5px; padding: 0 10px; }
.code-input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.65; resize: vertical;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.2px;
  background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.chip-ghost { background: transparent; border: 1px solid var(--border); color: var(--text-3); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-ok { background: var(--ok-soft); color: var(--ok); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-accent { background: var(--accent-soft); color: var(--accent); }
.chip-dark { background: rgba(255, 255, 255, 0.12); color: #ece6fa; border: 1px solid rgba(255, 255, 255, 0.16); }

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.status-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent); }
.status-dot.bad { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }
.status-dot.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* 卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 20px;
  min-width: 0;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 15px; letter-spacing: 0.2px; }
.card-sub { margin-top: 3px; font-size: 12px; color: var(--text-3); }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.head-actions .input { width: auto; flex: 0 1 170px; min-width: 130px; }
.col-stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-expense { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.grid-voucher { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.grid-adapter { grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); }

/* 通知条 */
.notice {
  display: flex; gap: 13px; align-items: flex-start;
  padding: 14px 18px; border-radius: var(--radius);
  border: 1px solid transparent; margin-bottom: 18px;
}
.notice strong { display: block; font-size: 13.5px; margin-bottom: 2px; }
.notice p { font-size: 12.5px; opacity: 0.9; }
.notice-icon { width: 20px; height: 20px; flex: none; margin-top: 2px; }
.notice-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 26%, transparent); color: var(--warn); }
.notice-warn strong { color: color-mix(in srgb, var(--warn) 88%, var(--text)); }
.notice-info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 24%, transparent); color: var(--info); }

/* 表格 */
.table-wrap { overflow: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); max-height: 460px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  position: sticky; top: 0; z-index: 1;
  padding: 10px 12px; text-align: left; white-space: nowrap;
  background: var(--surface-2); color: var(--text-3);
  font-size: 11.5px; font-weight: 650; letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text-2); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--surface-2); }
.data-table .num { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--text); white-space: nowrap; }
.data-table .strong { color: var(--text); font-weight: 600; }
.data-table .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.data-table .empty-row td { padding: 34px 12px; text-align: center; color: var(--muted); }
/* 发票表列较多：紧凑排版，避免窄栏横向截断 */
#invoice-table th, #invoice-table td { padding: 9px 9px; }
#invoice-table td:nth-child(1) { white-space: nowrap; font-size: 11px; letter-spacing: -0.2px; }
#invoice-table td:nth-child(2) { white-space: nowrap; }
#invoice-table td:nth-child(3) { max-width: 138px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#invoice-table th:nth-child(2) { white-space: nowrap; }

/* 状态药丸 */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-muted { background: var(--surface-3); color: var(--text-3); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-purple { background: var(--purple-soft); color: var(--purple); }

/* 空状态与提示 */
.empty-tip { color: var(--muted); font-size: 12.5px; text-align: center; padding: 18px 8px; }
.detail-empty, .precheck-empty, .value-empty, .permission-panel {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 40px 20px; color: var(--muted); text-align: center;
}
.detail-empty p, .precheck-empty p, .value-empty p { font-size: 12.5px; max-width: 380px; }
.empty-icon { width: 38px; height: 38px; opacity: 0.4; }
.permission-panel { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius); padding: 80px 24px; }
.permission-panel h2 { font-size: 17px; color: var(--text); }

/* 列表 */
.list { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; }
.list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); transition: border-color 0.16s, background 0.16s, transform 0.12s;
  text-align: left;
}
.list-item:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.list-main { min-width: 0; }
.list-title { font-size: 13px; font-weight: 600; color: var(--text); }
.list-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.list-side { display: flex; align-items: center; gap: 8px; flex: none; }

/* 内联表单 / 字段 */
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.inline-form .input, .inline-form .select { flex: 1 1 180px; width: auto; min-width: 130px; }
.field { margin-bottom: 14px; }
.field label, .field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.field-row { margin-bottom: 12px; }
.field-row .field-label { margin-bottom: 6px; }
.field-col { display: flex; flex-direction: column; }
.input-wrap { position: relative; }
.input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--muted); pointer-events: none;
}
.input-wrap .input { padding-left: 38px; }
.form-error {
  margin: 4px 0 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--danger-soft); color: var(--danger);
  font-size: 12.5px; border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
}

/* ------------------------------ 登录页 ------------------------------ */
.login-view {
  position: relative; min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 28px 18px; overflow: hidden;
  background:
    radial-gradient(1100px 600px at 8% -10%, #4c2a86 0%, transparent 60%),
    radial-gradient(900px 520px at 105% 108%, #3a2168 0%, transparent 62%),
    linear-gradient(160deg, #1b1130 0%, #241844 45%, #17102a 100%);
}
.login-glow { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; pointer-events: none; }
.login-glow-a {
  width: 520px; height: 520px; background: #7c3aed; top: -180px; right: -120px;
}
.login-glow-b {
  width: 460px; height: 460px; background: #c026d3; bottom: -200px; left: -140px; opacity: 0.35;
}
.login-grid {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.32;
  background-image: linear-gradient(rgba(157, 143, 190, 0.12) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(157, 143, 190, 0.12) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 72%);
}
.login-card {
  position: relative; z-index: 1; width: 100%; max-width: 424px;
  background: color-mix(in srgb, #ffffff 97%, transparent);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 22px; padding: 32px 32px 24px;
  box-shadow: 0 40px 90px -30px rgba(20, 12, 34, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.06);
  animation: card-in 0.5s var(--ease) both;
}
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(0.985); } to { opacity: 1; transform: none; } }
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #7c3aed, #4c1d95);
  border: 1px solid rgba(221, 214, 254, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 18px -10px rgba(76, 29, 149, 0.7);
}
.brand-mark span { color: var(--gold); font-size: 21px; font-weight: 700; line-height: 1; }
.brand-mark-lg { width: 52px; height: 52px; border-radius: 15px; }
.brand-mark-lg span { font-size: 26px; }
.login-title { font-size: 23px; letter-spacing: 2px; color: #201639; }
.login-subtitle { font-size: 11.5px; color: #8d80ad; letter-spacing: 0.6px; margin-top: 3px; }
.login-form { margin-bottom: 18px; }
.login-form .field label { color: #4a3f63; }
.login-form .input {
  height: 44px; border-color: #e8e1f8; background: #fbf9ff; color: #231937;
}
.login-form .input:focus { background: #fff; }
#login-submit { margin-top: 6px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.demo-accounts {
  border-top: 1px dashed #ebe4fa; padding-top: 15px; margin-top: 6px;
}
.demo-title { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; }
.demo-title span { font-size: 12px; font-weight: 650; color: #655988; }
.demo-title em { font-style: normal; font-size: 11px; color: #6b5f86; }
.demo-chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.demo-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 10px; border-radius: 9px; border: 1px solid #ebe4fa; background: #faf7ff;
  text-align: left; transition: all 0.16s var(--ease);
}
.demo-chip:hover { border-color: #d4c4f8; background: #f4effe; transform: translateY(-1px); }
.demo-chip strong { font-size: 12px; color: #231937; font-weight: 650; }
.demo-chip span { font-size: 10.5px; color: #6b5f86; font-family: var(--font-mono); }
.login-foot {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin-top: 18px; font-size: 10.8px; color: #6b5f86;
}
.login-foot .foot-icon { width: 12px; height: 12px; }

/* ------------------------------ 应用骨架 ------------------------------ */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 40;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #2a1d55 0%, #221744 60%, #1a1130 100%);
  border-right: 1px solid rgba(196, 181, 253, 0.16);
  color: var(--brand-text);
}
.sidebar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(420px 220px at 50% -40px, rgba(124, 58, 237, 0.22), transparent 70%);
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px 20px; position: relative; z-index: 1;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { color: #f5f1ff; font-size: 16px; letter-spacing: 1.6px; }
.brand-text span { color: var(--brand-muted); font-size: 10.5px; letter-spacing: 0.8px; }
.nav { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 3px; position: relative; z-index: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px; border-radius: 10px;
  color: var(--brand-muted); font-size: 13.5px; font-weight: 500;
  transition: background 0.18s, color 0.18s, transform 0.14s;
  position: relative; text-align: left;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: 0.9; }
.nav-item:hover {
  background: rgba(196, 181, 253, 0.14); color: #ffffff;
}
.nav-item.active {
  background: linear-gradient(100deg, rgba(167, 139, 250, 0.34), rgba(124, 58, 237, 0.14));
  color: #ffffff; font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(196, 181, 253, 0.42);
}
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 3px; background: var(--gold);
}
.nav-item .nav-badge { margin-left: auto; font-size: 10px; padding: 1px 6px; border-radius: 999px; background: rgba(221, 214, 254, 0.18); color: var(--gold); }
.sidebar-foot { padding: 14px 16px 18px; position: relative; z-index: 1; }
.sidebar-security {
  display: flex; gap: 9px; align-items: flex-start;
  padding: 11px 12px; border-radius: 10px;
  background: rgba(157, 143, 190, 0.08); border: 1px solid rgba(157, 143, 190, 0.12);
}
.sidebar-security .foot-icon { width: 15px; height: 15px; color: var(--gold); margin-top: 2px; flex: none; }
.sidebar-security strong { display: block; font-size: 11.5px; color: #d8cff0; font-weight: 600; }
.sidebar-security span { font-size: 10.5px; color: var(--brand-muted); }
.sidebar-mask { display: none; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid var(--border);
}
.menu-btn { display: none; }
.topbar-title { min-width: 0; }
.topbar-title h1 { font-size: 19px; letter-spacing: 0.3px; }
.topbar-title p { font-size: 11.5px; color: var(--text-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; position: relative; }
.model-chip {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); font-size: 12px; transition: all 0.18s var(--ease);
}
.model-chip:hover { border-color: var(--accent-border); background: var(--accent-soft); }
.model-chip .model-name { font-weight: 600; color: var(--text); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-chip .model-profile { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--text-3); font-family: var(--font-mono); }
.badge-dot {
  position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.user-chip {
  display: flex; align-items: center; gap: 9px;
  height: 40px; padding: 0 8px 0 4px; border-radius: 999px;
  border: 1px solid transparent; transition: background 0.18s, border-color 0.18s;
}
.user-chip:hover { background: var(--surface-3); border-color: var(--border); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), #7c3aed);
  color: #fff; font-size: 13px; font-weight: 700;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.25; text-align: left; }
.user-meta strong { font-size: 12.5px; color: var(--text); font-weight: 650; }
.user-meta span { font-size: 10.5px; color: var(--text-3); }
.user-caret { width: 14px; height: 14px; color: var(--muted); }
.user-menu {
  position: absolute; top: 50px; right: 0; z-index: 60; width: 210px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 6px; animation: pop-in 0.16s var(--ease);
}
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
.user-menu-head { padding: 9px 11px 10px; border-bottom: 1px solid var(--border); margin-bottom: 5px; display: flex; flex-direction: column; }
.user-menu-head strong { font-size: 13px; }
.user-menu-head span { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }
.user-menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 11px; border-radius: 8px; font-size: 13px; color: var(--text-2); }
.user-menu-item:hover { background: var(--danger-soft); color: var(--danger); }
.user-menu-item svg { width: 16px; height: 16px; }

.content { flex: 1; padding: 22px 24px 40px; max-width: 1560px; width: 100%; margin: 0 auto; }
.page { animation: page-in 0.26s var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ------------------------------ 对话页 ------------------------------ */
.chat-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 18px; height: calc(100vh - var(--topbar-h) - 62px); min-height: 520px; }
.session-pane {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.pane-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 10px; border-bottom: 1px solid var(--border); }
.pane-title { font-size: 12.5px; font-weight: 650; color: var(--text-2); letter-spacing: 0.4px; }
.session-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.session-item {
  position: relative; width: 100%; text-align: left;
  padding: 10px 32px 10px 11px; border-radius: 9px;
  transition: background 0.16s; border: 1px solid transparent;
}
.session-item:hover { background: var(--surface-3); }
.session-item.active { background: var(--accent-soft); border-color: var(--accent-border); }
.session-title { font-size: 12.8px; font-weight: 550; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-meta { font-size: 10.5px; color: var(--text-3); margin-top: 3px; display: flex; gap: 7px; }
.session-del {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center;
  color: var(--muted); opacity: 0; transition: all 0.16s;
}
.session-item:hover .session-del { opacity: 1; }
.session-del:hover { background: var(--danger-soft); color: var(--danger); }
.session-del svg { width: 13px; height: 13px; }
.session-empty { padding: 26px 14px; text-align: center; color: var(--muted); font-size: 12px; }

.chat-pane { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; }
.chat-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--border); flex: none;
}
.agent-picker { display: flex; gap: 5px; background: var(--surface-2); padding: 3px; border-radius: 10px; border: 1px solid var(--border); flex-wrap: wrap; }
.agent-chip {
  height: 29px; padding: 0 12px; border-radius: 7px;
  font-size: 12.2px; font-weight: 550; color: var(--text-3);
  transition: all 0.16s var(--ease); white-space: nowrap;
}
.agent-chip:hover { color: var(--text); background: var(--surface-3); }
.agent-chip.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-xs); font-weight: 650; }
.agent-chip:disabled { opacity: 0.4; cursor: not-allowed; }
#chat-session-id { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; }

.chat-messages { flex: 1; overflow-y: auto; padding: 20px 20px 10px; display: flex; flex-direction: column; gap: 18px; scroll-behavior: smooth; }
.welcome-panel { margin: auto; max-width: 620px; text-align: center; padding: 24px 12px; }
.welcome-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 22px; }
.welcome-title { font-size: 21px; letter-spacing: 0.5px; }
.welcome-desc { font-size: 12.5px; color: var(--text-3); max-width: 460px; }
.welcome-examples { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 20px; text-align: left; }
.example-card {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); transition: all 0.18s var(--ease);
}
.example-card:hover { border-color: var(--accent-border); background: var(--accent-soft); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.example-card strong { display: block; font-size: 12.5px; color: var(--text); margin-bottom: 2px; }
.example-card span { font-size: 11.5px; color: var(--text-3); line-height: 1.5; }

.msg { display: flex; gap: 11px; max-width: 100%; animation: msg-in 0.24s var(--ease) both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg-user { flex-direction: row-reverse; }
.msg-avatar {
  width: 30px; height: 30px; border-radius: 9px; flex: none; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; margin-top: 2px;
}
.msg-assistant .msg-avatar { background: linear-gradient(145deg, #382769, #201842); color: var(--gold); border: 1px solid rgba(221, 214, 254, 0.28); }
.msg-user .msg-avatar { background: linear-gradient(145deg, var(--accent), #7c3aed); color: #fff; }
.msg-avatar svg { width: 16px; height: 16px; }
.msg-body { min-width: 0; max-width: min(760px, 82%); display: flex; flex-direction: column; gap: 6px; }
.msg-user .msg-body { align-items: flex-end; }
.msg-meta { display: flex; align-items: center; gap: 7px; font-size: 10.5px; color: var(--text-3); flex-wrap: wrap; }
.msg-agent { font-weight: 650; color: var(--accent); }
.msg-bubble {
  padding: 12px 15px; border-radius: 12px; font-size: 13.5px; line-height: 1.72;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  word-break: break-word; min-width: 44px;
}
.msg-assistant .msg-bubble { border-top-left-radius: 4px; background: var(--surface); box-shadow: var(--shadow-xs); }
.msg-user .msg-bubble {
  border-top-right-radius: 4px; color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.msg-bubble.is-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.msg-bubble .md-body > *:first-child { margin-top: 0; }
.msg-bubble .md-body > *:last-child { margin-bottom: 0; }
.msg-bubble.is-streaming::after {
  content: ""; display: inline-block; width: 7px; height: 15px; margin-left: 2px;
  background: var(--accent); vertical-align: -2px; border-radius: 1px; animation: caret 1s steps(2) infinite;
}
@keyframes caret { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }

/* Markdown 渲染 */
.md-body p { margin: 0 0 9px; }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 { margin: 14px 0 7px; font-size: 14.5px; }
.md-body h1 { font-size: 17px; }
.md-body h2 { font-size: 16px; }
.md-body ul, .md-body ol { margin: 4px 0 10px; padding-left: 20px; }
.md-body li { margin: 2px 0; }
.md-body code {
  font-family: var(--font-mono); font-size: 12px; padding: 1px 5px;
  border-radius: 5px; background: var(--surface-3); color: color-mix(in srgb, var(--accent) 80%, var(--text));
}
.md-body pre {
  margin: 8px 0 10px; padding: 12px 14px; border-radius: 9px; overflow: auto;
  background: #1d1533; color: #e9e2fa; border: 1px solid rgba(157, 143, 190, 0.2);
}
.md-body pre code { background: transparent; color: inherit; padding: 0; font-size: 12px; line-height: 1.6; }
.md-body blockquote {
  margin: 8px 0; padding: 6px 12px; border-left: 3px solid var(--accent-border);
  background: var(--surface-2); border-radius: 0 8px 8px 0; color: var(--text-2);
}
.md-body table { border-collapse: collapse; margin: 8px 0 12px; width: 100%; font-size: 12.5px; }
.md-body th, .md-body td { border: 1px solid var(--border); padding: 6px 9px; text-align: left; }
.md-body th { background: var(--surface-2); font-weight: 650; }
.md-body hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.md-body a { font-weight: 500; }
.md-table-wrap { overflow-x: auto; }

/* 引用 / 工具 / 结构化结果 */
.msg-details { border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.msg-details summary {
  display: flex; align-items: center; gap: 7px; padding: 7px 11px;
  font-size: 11.5px; font-weight: 600; color: var(--text-2); cursor: pointer; list-style: none;
}
.msg-details summary::-webkit-details-marker { display: none; }
.msg-details summary svg { width: 13px; height: 13px; color: var(--muted); transition: transform 0.18s; }
.msg-details[open] summary svg { transform: rotate(90deg); }
.msg-details .details-body { padding: 4px 11px 11px; display: flex; flex-direction: column; gap: 8px; }
.cite-item { border-left: 2px solid var(--accent-border); padding: 5px 0 5px 10px; }
.cite-title { font-size: 12px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.cite-heading { font-size: 11px; color: var(--text-3); }
.cite-snippet { font-size: 11.5px; color: var(--text-2); margin-top: 3px; line-height: 1.6; }
.tool-call { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--surface); }
.tool-call-head { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.tool-call pre { margin: 5px 0 0; font-family: var(--font-mono); font-size: 11px; color: var(--text-3); white-space: pre-wrap; word-break: break-all; max-height: 180px; overflow: auto; }
.suggestion-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.suggestion-chip {
  padding: 5px 11px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--accent-border); color: var(--accent); background: var(--accent-soft);
  transition: all 0.16s var(--ease);
}
.suggestion-chip:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.typing { display: inline-flex; gap: 4px; padding: 3px 2px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: typing 1.2s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.45; } 30% { transform: translateY(-4px); opacity: 1; } }

.chat-composer { flex: none; padding: 10px 16px 16px; border-top: 1px solid transparent; }
.composer-box {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-2); padding: 10px 12px 8px;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.composer-box:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
#chat-input {
  width: 100%; border: none; background: transparent; resize: none;
  font-size: 13.5px; line-height: 1.65; color: var(--text);
  max-height: 160px; min-height: 26px; padding: 2px 2px 4px; outline: none;
}
#chat-input::placeholder { color: var(--muted); }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.composer-hint { display: inline-flex; align-items: center; gap: 5px; font-size: 10.8px; color: var(--muted); }
.composer-icon { width: 12px; height: 12px; }

/* ------------------------------ 报销预审 ------------------------------ */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  padding: 26px 18px; border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface-2); text-align: center; cursor: pointer;
  transition: all 0.2s var(--ease);
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.005); }
.dropzone.busy { pointer-events: none; opacity: 0.7; }
.drop-icon { width: 30px; height: 30px; color: var(--accent); opacity: 0.85; }
.drop-title { font-size: 13px; color: var(--text-2); font-weight: 550; }
.drop-title .link { color: var(--accent); font-weight: 650; }
.drop-hint { font-size: 11.5px; color: var(--text-3); }
.ocr-panel { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.ocr-loading { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2); font-size: 12.5px; }
.ocr-loading .spinner { border-color: color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent); }
.ocr-card { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.ocr-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 13px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.ocr-head strong { font-size: 12.5px; }
.ocr-head .head-meta { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--text-3); }
.confidence-bar { width: 74px; height: 5px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.confidence-fill { height: 100%; border-radius: 4px; background: var(--ok); }
.ocr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--border); }
.ocr-field { background: var(--surface); padding: 8px 13px; min-width: 0; }
.ocr-field .k { font-size: 10.8px; color: var(--text-3); display: flex; align-items: center; gap: 5px; }
.ocr-field .v { font-size: 12.8px; font-weight: 600; color: var(--text); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ocr-field .v.mono { font-family: var(--font-mono); font-size: 12px; }
.ocr-field.full { grid-column: span 2; }
.ocr-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 13px; background: var(--surface-2); border-top: 1px solid var(--border); flex-wrap: wrap; }
.ocr-warnings { font-size: 11.5px; color: var(--warn); display: flex; flex-direction: column; gap: 2px; }
.risk-badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.verify-box { margin-top: 8px; padding: 9px 12px; border-radius: 8px; background: var(--ok-soft); color: var(--ok); font-size: 12px; }

.precheck-summary { display: flex; align-items: center; gap: 16px; padding: 14px 16px; border-radius: var(--radius-sm); margin-bottom: 14px; }
.precheck-summary.pass { background: var(--ok-soft); border: 1px solid color-mix(in srgb, var(--ok) 25%, transparent); }
.precheck-summary.fail { background: var(--danger-soft); border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent); }
.precheck-verdict { font-size: 20px; font-weight: 750; letter-spacing: 0.5px; }
.precheck-summary.pass .precheck-verdict { color: var(--ok); }
.precheck-summary.fail .precheck-verdict { color: var(--danger); }
.precheck-metrics { display: flex; gap: 18px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-2); }
.precheck-metrics b { display: block; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }
.precheck-flags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 12px; }
.checks { display: flex; flex-direction: column; gap: 8px; max-height: 380px; overflow-y: auto; }
.check-item { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.check-item.sev-critical, .check-item.sev-high { border-color: color-mix(in srgb, var(--danger) 30%, transparent); background: var(--danger-soft); }
.check-item.sev-medium { border-color: color-mix(in srgb, var(--warn) 32%, transparent); background: var(--warn-soft); }
.check-icon { width: 17px; height: 17px; flex: none; margin-top: 2px; display: inline-flex; align-items: center; justify-content: center; }
.check-icon svg, .check-icon .ic { width: 100%; height: 100%; }
.chip .ic, .pill .ic { width: 12px; height: 12px; }
.list-side .ic { color: var(--muted); }
.sev-critical .check-icon, .sev-high .check-icon { color: var(--danger); }
.sev-medium .check-icon { color: var(--warn); }
.sev-low .check-icon { color: var(--info); }
.check-main { min-width: 0; }
.check-title { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 650; color: var(--text); flex-wrap: wrap; }
.check-msg { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.check-legal { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.check-suggest { font-size: 11.5px; color: var(--accent); margin-top: 3px; }
.ai-reason {
  margin-top: 12px; padding: 11px 13px; border-radius: 9px;
  background: var(--accent-soft); border: 1px solid var(--accent-border);
  font-size: 12px; color: var(--text-2); line-height: 1.7;
}
.ai-reason strong { color: var(--accent); }

/* ------------------------------ 报表分析 ------------------------------ */
.report-query-card { margin-bottom: 18px; }
.query-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.query-input { position: relative; flex: 1 1 320px; min-width: 220px; }
.query-input .input-icon { left: 12px; }
.query-input input {
  width: 100%; height: 42px; padding: 0 13px 0 38px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
.query-input input:focus { outline: none; border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.query-bar .select { flex: 0 1 165px; width: auto; height: 42px; }
.query-bar .btn { height: 42px; }
.query-tips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.query-tip { font-size: 11.5px; color: var(--text-3); padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; transition: all 0.16s; }
.query-tip:hover { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }
.report-hero-grid { display: grid; grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr); gap: 18px; margin-bottom: 18px; }
.value-card { display: flex; flex-direction: column; justify-content: center; min-height: 214px; }
.value-main { display: flex; flex-direction: column; gap: 4px; }
.value-label { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.value-number { font-size: 42px; font-weight: 750; letter-spacing: -1px; font-variant-numeric: tabular-nums; line-height: 1.15; color: var(--text); }
.value-number .unit { font-size: 16px; font-weight: 600; color: var(--text-3); margin-left: 6px; letter-spacing: 0; }
.value-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-3); margin-top: 8px; }
.value-caliber { margin-top: 14px; padding-top: 13px; border-top: 1px dashed var(--border); font-size: 12px; color: var(--text-2); line-height: 1.65; }
.value-sources { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chart-body { min-height: 214px; display: flex; align-items: center; justify-content: center; }
.explain-box { margin-top: 14px; font-size: 12.5px; color: var(--text-2); line-height: 1.75; }
.explain-box:empty { display: none; }
.metric-list .list-item { cursor: pointer; }

/* SVG 图表 */
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg text { font-family: var(--font-sans); font-size: 10.5px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.chart-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-2); }
.chart-legend-dot { width: 9px; height: 9px; border-radius: 3px; }
.chart-empty { color: var(--muted); font-size: 12.5px; padding: 30px; text-align: center; }

/* ------------------------------ 凭证 ------------------------------ */
.voucher-draft-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px dashed var(--border); }
.draft-title { font-size: 15px; font-weight: 700; }
.draft-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; display: flex; gap: 10px; flex-wrap: wrap; }
.entries-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 14px; }
.entries-table th { padding: 8px 10px; background: var(--surface-2); color: var(--text-3); font-size: 11px; font-weight: 650; border-bottom: 1px solid var(--border); text-align: left; }
.entries-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.entries-table .money { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); white-space: nowrap; }
.entries-table tfoot td { font-weight: 700; color: var(--text); background: var(--surface-2); border-bottom: none; }
.draft-checklist { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.vcheck { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--text-2); }
.vcheck svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.vcheck.pass svg { color: var(--ok); }
.vcheck.fail svg { color: var(--danger); }
.draft-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.warn-list { display: flex; flex-direction: column; gap: 3px; margin: 8px 0; font-size: 12px; color: var(--warn); }
.warn-list li { list-style: none; display: flex; gap: 6px; }
.warn-list svg { width: 13px; height: 13px; flex: none; margin-top: 3px; }
.manual-note { padding: 10px 12px; border-radius: 8px; background: var(--warn-soft); color: var(--warn); font-size: 11.8px; margin-bottom: 10px; }

/* ------------------------------ 知识库 ------------------------------ */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow-xs);
  display: flex; flex-direction: column; gap: 2px;
}
.stat-label { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.stat-label svg { width: 13px; height: 13px; }
.stat-value { font-size: 23px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -0.5px; }
.stat-hint { font-size: 11px; color: var(--muted); }
.search-result { display: flex; flex-direction: column; gap: 9px; margin-top: 4px; }
.hit-card { padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.hit-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hit-title { font-size: 12.5px; font-weight: 650; color: var(--text); }
.hit-heading { font-size: 11px; color: var(--text-3); }
.score-bar { width: 64px; height: 5px; background: var(--surface-3); border-radius: 4px; overflow: hidden; margin-left: auto; }
.score-fill { height: 100%; background: linear-gradient(90deg, var(--info), var(--accent)); border-radius: 4px; }
.hit-content { font-size: 12px; color: var(--text-2); line-height: 1.65; margin-top: 5px; }
.hit-score { font-size: 10.5px; font-family: var(--font-mono); color: var(--text-3); }
.search-miss { padding: 16px; border-radius: var(--radius-sm); background: var(--warn-soft); color: var(--warn); font-size: 12.5px; }

/* ------------------------------ 适配器 ------------------------------ */
.adapter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(248px, 1fr)); gap: 12px; }
.adapter-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px;
  background: var(--surface-2); display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.14s;
}
.adapter-card:hover { border-color: var(--accent-border); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.adapter-head { display: flex; align-items: center; gap: 8px; }
.adapter-name { font-size: 13.5px; font-weight: 700; color: var(--text); }
.adapter-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cap-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.cap-chip { font-size: 10.5px; padding: 2px 7px; border-radius: 5px; background: var(--surface-3); color: var(--text-3); font-family: var(--font-mono); }
.cap-chip.write { background: var(--warn-soft); color: var(--warn); }
.adapter-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; padding-top: 8px; border-top: 1px dashed var(--border); }
.health-line { font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.contract-list { display: flex; flex-direction: column; gap: 7px; max-height: 560px; overflow-y: auto; }
.contract-item { border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.contract-item summary { display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer; list-style: none; font-size: 12.5px; font-weight: 600; color: var(--text); }
.contract-item summary::-webkit-details-marker { display: none; }
.contract-item summary .chev { width: 14px; height: 14px; color: var(--muted); transition: transform 0.18s; margin-left: auto; }
.contract-item[open] summary .chev { transform: rotate(90deg); }
.kind-badge { font-size: 10px; padding: 1px 7px; border-radius: 5px; font-weight: 650; }
.kind-read { background: var(--info-soft); color: var(--info); }
.kind-write { background: var(--warn-soft); color: var(--warn); }
.kind-meta { background: var(--surface-3); color: var(--text-3); }
.contract-body { padding: 2px 12px 12px; font-size: 11.8px; color: var(--text-3); line-height: 1.7; }
.contract-body b { color: var(--text-2); font-weight: 600; }
.console-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.console-result { margin-top: 12px; }
.result-box { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.result-head { display: flex; align-items: center; gap: 9px; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12px; }
.result-head strong { color: var(--text); }
.result-pre { margin: 0; padding: 12px; background: #1d1533; color: #e6dcfb; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.65; overflow: auto; max-height: 300px; }

/* ------------------------------ 系统管理 ------------------------------ */
.model-hero {
  position: relative; overflow: hidden; margin-bottom: 18px; padding: 22px 24px;
  background: linear-gradient(135deg, #241a45 0%, #2e2158 55%, #201838 100%);
  border: 1px solid rgba(167, 139, 250, 0.22); color: #ece6fa;
  box-shadow: 0 22px 50px -30px rgba(24, 14, 44, 0.85);
}
.model-hero-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(600px 220px at 88% -30%, rgba(124, 58, 237, 0.35), transparent 70%),
    radial-gradient(420px 200px at 4% 120%, rgba(192, 38, 211, 0.28), transparent 70%);
}
.model-hero-head { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.model-hero-label { display: flex; align-items: center; gap: 7px; font-size: 11.5px; letter-spacing: 1px; color: #a89bc9; text-transform: uppercase; }
.model-hero-label .foot-icon { width: 14px; height: 14px; color: var(--gold); }
.model-hero-title { font-size: 25px; letter-spacing: 0.4px; margin-top: 6px; color: #f8f5ff; }
.model-hero-desc { font-size: 12.5px; color: #b1a4d3; margin-top: 5px; max-width: 700px; }
.model-hero-actions { display: flex; align-items: center; gap: 9px; }
.btn-ghost-light { background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.16); color: #e7dff9; }
.btn-ghost-light:hover { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.28); }
.profile-grid { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 11px; margin-top: 18px; }
.profile-card {
  position: relative; padding: 13px 14px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.045); border: 1px solid rgba(157, 143, 190, 0.16);
  transition: all 0.2s var(--ease); display: flex; flex-direction: column; gap: 7px;
}
.profile-card:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(157, 143, 190, 0.3); }
.profile-card.active { border-color: rgba(221, 214, 254, 0.55); background: linear-gradient(160deg, rgba(221, 214, 254, 0.14), rgba(255, 255, 255, 0.04)); box-shadow: 0 0 0 1px rgba(221, 214, 254, 0.2) inset; }
.profile-top { display: flex; align-items: center; gap: 8px; }
.profile-name { font-size: 13.5px; font-weight: 650; color: #f6f1ff; }
.profile-badge { margin-left: auto; font-size: 10px; padding: 1px 7px; border-radius: 999px; background: rgba(221, 214, 254, 0.18); color: var(--gold); font-weight: 650; }
.profile-meta { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: #a89bc9; }
.profile-meta code { font-family: var(--font-mono); font-size: 10.5px; color: #cec3e8; word-break: break-all; }
.profile-actions { display: flex; gap: 6px; margin-top: 3px; }
.profile-actions .btn { flex: 1; height: 29px; font-size: 11.8px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.16); color: #e7dff9; border-radius: 7px; }
.profile-actions .btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.18); }
.profile-actions .btn.is-active-btn { background: rgba(221, 214, 254, 0.16); color: var(--gold); border-color: rgba(221, 214, 254, 0.35); }
.profile-test-result { font-size: 11px; padding: 6px 8px; border-radius: 6px; background: rgba(15, 23, 42, 0.5); border: 1px solid rgba(157, 143, 190, 0.2); color: #cec3e8; line-height: 1.6; word-break: break-word; }
.profile-test-result.ok { color: #5fd3a6; border-color: rgba(53, 192, 139, 0.35); }
.profile-test-result.fail { color: #f6909a; border-color: rgba(242, 96, 108, 0.35); }
.model-hero-foot { position: relative; display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(157, 143, 190, 0.16); }
.role-routing { display: flex; gap: 8px; flex-wrap: wrap; }
.role-route { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: #b1a4d3; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(157, 143, 190, 0.14); }
.role-route b { color: #ece6fa; font-weight: 600; }
.role-route code { font-family: var(--font-mono); color: var(--gold); font-size: 10.5px; }
.usage-mini { display: flex; gap: 18px; flex-wrap: wrap; }
.usage-item { display: flex; flex-direction: column; }
.usage-item b { font-size: 16px; color: #f6f1ff; font-variant-numeric: tabular-nums; }
.usage-item span { font-size: 10.5px; color: #a89bc9; }
.audit-filters { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 11px; }
.audit-filters .input { flex: 1 1 120px; min-width: 100px; }
.audit-table-wrap { max-height: 420px; }
.audit-table-wrap td { font-size: 12px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 10px; font-size: 11.5px; color: var(--text-3); }
.eval-panel { display: flex; flex-direction: column; gap: 10px; }
.eval-state { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-2); padding: 10px 12px; background: var(--surface-2); border-radius: 8px; }
.eval-metrics { display: flex; flex-direction: column; gap: 5px; }
.eval-metric { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 12px; }
.eval-metric .target { font-family: var(--font-mono); font-size: 11px; color: var(--accent); }
.channel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.channel-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 7px; }
.channel-card .channel-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 650; }
.channel-desc { font-size: 11.5px; color: var(--text-3); line-height: 1.6; }
.channel-verify { font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }

/* ------------------------------ 抽屉 / 弹窗 / Toast ------------------------------ */
.drawer-root { position: fixed; inset: 0; z-index: 90; display: flex; justify-content: flex-end; }
.drawer-overlay { position: absolute; inset: 0; background: rgba(8, 15, 28, 0.5); backdrop-filter: blur(2px); animation: fade-in 0.18s; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: relative; width: min(430px, 94vw); height: 100%;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: drawer-in 0.26s var(--ease);
}
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0.6; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 16px; }
.drawer-head p { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 11px; }
.approval-card { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 7px; }
.approval-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.approval-title { font-size: 13px; font-weight: 650; color: var(--text); }
.approval-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px; color: var(--text-3); }
.approval-payload { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); background: var(--surface); border: 1px dashed var(--border); border-radius: 7px; padding: 8px 10px; max-height: 110px; overflow: auto; white-space: pre-wrap; word-break: break-all; }
.approval-actions { display: flex; gap: 7px; justify-content: flex-end; }

.modal-root { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 22px; }
.modal-overlay { position: absolute; inset: 0; background: rgba(8, 15, 28, 0.52); backdrop-filter: blur(2px); animation: fade-in 0.16s; }
.modal {
  position: relative; width: min(560px, 100%); max-height: 88vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); animation: modal-in 0.22s var(--ease); overflow: hidden;
}
.modal.modal-lg { width: min(760px, 100%); }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 18px 20px 13px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; }
.modal-head p { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 13px 20px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }

.toast-root { position: fixed; top: 78px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 9px; width: min(360px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); pointer-events: auto; animation: toast-in 0.24s var(--ease);
  border-left: 3px solid var(--info);
}
.toast.leaving { animation: toast-out 0.2s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(18px); } }
.toast-icon { width: 17px; height: 17px; flex: none; margin-top: 2px; }
.toast-body { min-width: 0; flex: 1; }
.toast-title { font-size: 12.5px; font-weight: 650; color: var(--text); }
.toast-message { font-size: 12px; color: var(--text-2); line-height: 1.55; margin-top: 1px; word-break: break-word; }
.toast-close { color: var(--muted); width: 20px; height: 20px; border-radius: 5px; flex: none; display: grid; place-items: center; }
.toast-close:hover { background: var(--surface-3); color: var(--text); }
.toast-close svg { width: 12px; height: 12px; }
.toast-success { border-left-color: var(--ok); }
.toast-success .toast-icon { color: var(--ok); }
.toast-error { border-left-color: var(--danger); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warn { border-left-color: var(--warn); }
.toast-warn .toast-icon { color: var(--warn); }
.toast-info { border-left-color: var(--info); }
.toast-info .toast-icon { color: var(--info); }

/* ------------------------------ 响应式 ------------------------------ */
@media (max-width: 1240px) {
  .grid-expense, .grid-voucher, .grid-adapter { grid-template-columns: minmax(0, 1fr); }
  .report-hero-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1080px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 272px; height: 100vh;
    transform: translateX(-104%); transition: transform 0.28s var(--ease); z-index: 80;
  }
  .app.sidebar-open .sidebar { transform: none; }
  .sidebar-mask { display: block; position: fixed; inset: 0; background: rgba(8, 15, 28, 0.45); z-index: 70; backdrop-filter: blur(2px); }
  .menu-btn { display: inline-flex; }
  .content { padding: 18px 16px 34px; }
  .topbar { padding: 0 16px; }
  .user-meta { display: none; }
  .user-caret { display: none; }
  .model-chip .model-name { max-width: 92px; }
}
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .session-pane { max-height: 210px; }
  .chat-pane { height: calc(100vh - var(--topbar-h) - 260px); min-height: 420px; }
  .topbar-title p { display: none; }
  .msg-body { max-width: 90%; }
  .welcome-examples { grid-template-columns: 1fr; }
  .value-number { font-size: 34px; }
  .head-actions .input { flex: 1 1 100%; }
  .demo-chips { grid-template-columns: 1fr; }
  .audit-filters .input { flex: 1 1 45%; }
}
@media (max-width: 560px) {
  .login-card { padding: 26px 22px 20px; border-radius: 18px; }
  .card { padding: 15px 15px; }
  .topbar-actions { gap: 4px; }
  .model-chip { display: none; }
  .page-title h1 { font-size: 17px; }
  .agent-picker { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .query-bar .select { flex: 1 1 100%; }
  .profile-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ocr-grid { grid-template-columns: 1fr; }
  .ocr-field.full { grid-column: span 1; }
  .composer-hint { display: none; }
  .model-hero { padding: 18px 16px; }
  .model-hero-title { font-size: 20px; }
}

/* 打印与减少动效 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ============================================================
   淡紫色主题 · 可读性增强
   （正文/次要文字加深、按钮白字保证、弱化文字不低于 4.5:1）
   ============================================================ */

/* 主文字：接近纯深紫黑，避免在浅紫底上发灰 */
body { color: var(--text); }
h1, h2, h3, h4, h5 { color: var(--text); }
strong, b { color: var(--text); font-weight: 650; }

/* 次要/辅助文字统一加深一档 */
:where(.list-sub, .card-sub, .hint, .help, .desc, .sub, .value-caliber, .empty-tip, .meta) {
  color: var(--text-3);
}

/* 弱化文字（时间戳、占位符、表头说明）≥ 4.5:1 */
:where(.muted, .text-muted, .text-3, time, small) { color: var(--muted); }

/* 按钮：主按钮白字 + 更强阴影；次按钮文字加深 */
.btn-primary, .btn-send, .btn-accent {
  color: #fff;
  text-shadow: 0 1px 1px rgba(49, 16, 92, 0.28);
  font-weight: 600;
}
.btn-soft { color: var(--accent-2); font-weight: 600; }
.btn-ghost { color: var(--text); }
button:disabled { opacity: 0.55; }

/* 链接与强调 */
a { color: var(--accent-2); }
a:hover { color: var(--accent); text-decoration: underline; }

/* 侧边栏：提高未选中项可读性（深紫底上的浅紫字） */
.sidebar .nav-item { color: var(--brand-muted); }
.sidebar .nav-item:hover, .sidebar .nav-item.active { color: #ffffff; }
.brand-text strong { color: #ffffff; }
.brand-text small, .brand-text span { color: #d9cdf5; }

/* 输入框：描边加深，聚焦更明显 */
input, select, textarea {
  border-color: var(--border-strong);
  color: var(--text);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent) !important;
}

/* 徽标/标签：浅底深字 */
.chip { color: var(--text-2); }
.chip-accent, .chip-brand { color: var(--accent-2); background: var(--accent-soft); border-color: var(--accent-border); }

/* 图表：坐标轴/图例文字加大加粗，浅紫底上更易读 */
.chart-svg text { font-size: 11.5px; font-weight: 400; }
.chart-legend-item { color: var(--text-2); font-weight: 500; }
.chart-empty { color: var(--text-3); }

/* 表格：表头与单元格文字提高对比 */
table th { color: var(--text-2); font-weight: 650; }
table td { color: var(--text); }

/* 深色主题下按钮用深色文字（浅紫底更清晰） */
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-send,
[data-theme="dark"] .btn-accent {
  color: #1a1129;
  text-shadow: none;
}

/* 登录卡片：白底深字，保证表单可读 */
.login-card { background: #ffffff; color: var(--text); }
.login-title { color: #1a1129; }
.login-subtitle { color: #635581; }
.login-view label, .login-form .field label { color: #463a5f; font-weight: 600; }

/* 演示账号小字 / 输入提示：由浅灰加深到可读紫灰 */
.demo-chips .span, .demo-chips .em, .demo-title em { color: var(--text-3); }
.composer-hint, .login-foot, .login-foot span { color: var(--text-3); }

/* 语义胶囊（成功/警告/危险/信息）：文字加深，底色保持柔和 */
.pill-ok, .pill-success, .kind-ok { color: var(--ok); }
.pill-warn, .pill-warning, .kind-warn { color: var(--warn); }
.pill-danger, .pill-error, .kind-danger { color: var(--danger); }
.pill-info, .kind-info { color: var(--info); }
