/* ==========================================================================
   智管 Agent · 前端样式（原生 CSS，无外部依赖）
   设计语言：现代深色 SaaS（Linear / Vercel 质感）
   ========================================================================== */

/* ---------- 设计令牌 ---------- */
:root {
  --bg: #0a0a0f;
  --bg-elev: #101018;
  --surface: #13131c;
  --surface-2: #191925;
  --surface-3: #1f1f2d;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e9e9f0;
  --text-2: #a3a3b2;
  --text-3: #6f6f81;
  --accent: #6a6cff;
  --accent-2: #8b5cf6;
  --accent-soft: rgba(106, 108, 255, 0.14);

  --green: #34d399;   --green-bg: rgba(52, 211, 153, 0.13);
  --amber: #fbbf24;   --amber-bg: rgba(251, 191, 36, 0.13);
  --red: #f87171;     --red-bg: rgba(248, 113, 113, 0.13);
  --blue: #60a5fa;    --blue-bg: rgba(96, 165, 250, 0.13);
  --gray: #9ca3af;    --gray-bg: rgba(156, 163, 175, 0.12);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --sidebar-w: 232px;
  --topbar-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, "Microsoft YaHei", monospace;
}

/* ---------- 基础重置 ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
#app { display: flex; height: 100vh; min-height: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; color: var(--text); }
::selection { background: rgba(106, 108, 255, 0.35); }

/* 滚动条 */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 布局骨架 ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.view { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 26px 30px 60px; scroll-behavior: smooth; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  gap: 4px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 16px;
  color: var(--text);
}
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(106, 108, 255, 0.4);
}
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: 0.3px; }
.brand-sub { font-size: 11px; color: var(--text-3); margin-top: -2px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-group-label { font-size: 11px; color: var(--text-3); padding: 12px 10px 4px; letter-spacing: 0.6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--text-2); font-size: 13.5px; font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.nav-item svg { flex-shrink: 0; opacity: 0.85; }
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--text);
  border-color: rgba(106, 108, 255, 0.28);
}
.nav-item.active svg { color: var(--accent); opacity: 1; }

.side-foot { border-top: 1px solid var(--border); padding: 12px 8px 4px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.side-user-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.side-user-role { font-size: 11.5px; color: var(--text-3); }

/* ---------- 顶栏 ---------- */
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 15, 0.75);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.topbar-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-user { display: flex; align-items: center; gap: 9px; }

/* 头像 */
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #3d3f8f, #6a6cff);
  color: #fff; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.avatar.lg { width: 40px; height: 40px; font-size: 16px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text); font-size: 13px; font-weight: 600;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: rgba(255, 255, 255, 0.22); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(180deg, #7a7cff, #5d5fe8);
  border-color: rgba(122, 124, 255, 0.5);
  color: #fff;
}
.btn-primary:hover { background: linear-gradient(180deg, #8b8dff, #6a6cf5); }
.btn-danger { background: var(--red-bg); border-color: rgba(248, 113, 113, 0.35); color: var(--red); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.2); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn-lg { padding: 10px 18px; font-size: 14px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; background: transparent;
  color: var(--text-2); transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.icon-btn.danger:hover { background: var(--red-bg); color: var(--red); }

/* ---------- 表单 ---------- */
.input, select.input, textarea.input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text-3); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236f6f81' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
textarea.input { resize: vertical; min-height: 60px; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.form-label .req { color: var(--red); margin-left: 2px; }
.form-hint { font-size: 12px; color: var(--text-3); }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-item {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-elev);
  font-size: 12.5px; cursor: pointer; color: var(--text-2);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  user-select: none;
}
.checkbox-item:has(input:checked) {
  border-color: var(--accent); color: var(--text);
  background: var(--accent-soft);
}
.checkbox-item input { accent-color: var(--accent); }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; line-height: 1.7;
  white-space: nowrap;
}
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green  { color: var(--green); background: var(--green-bg); }
.badge-amber  { color: var(--amber); background: var(--amber-bg); }
.badge-red    { color: var(--red);   background: var(--red-bg); }
.badge-blue   { color: var(--blue);  background: var(--blue-bg); }
.badge-gray   { color: var(--gray);  background: var(--gray-bg); }
.badge-accent { color: var(--accent); background: var(--accent-soft); }

/* ---------- 进度条 ---------- */
.progress { display: flex; flex-direction: column; gap: 5px; }
.progress-label { font-size: 12px; color: var(--text-2); display: flex; justify-content: space-between; }
.progress-track { width: 100%; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; transition: width 0.5s ease; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.15s;
}
.card.hoverable:hover { border-color: var(--border-strong); }
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 16px 18px 0;
}
.card-title { font-size: 14.5px; font-weight: 700; }
.card-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.card-actions { display: flex; gap: 8px; align-items: center; }
.card-body { padding: 14px 18px 18px; }

/* ---------- 页面头 ---------- */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin-bottom: 22px; flex-wrap: wrap;
}
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -0.3px; }
.page-sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- 网格 ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.col-span-2 { grid-column: span 2; }

/* ---------- 空态 / 加载态 / 错误态 ---------- */
.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 46px 20px; color: var(--text-3); text-align: center;
}
.empty-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-3);
}
.empty-text { font-size: 13.5px; max-width: 320px; }
.empty-action { margin-top: 4px; }

.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 60px 0; color: var(--text-3); font-size: 13.5px; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 60px 20px; color: var(--text-2); text-align: center;
}
.error-box .error-icon { color: var(--red); }

.skeleton { border-radius: 8px; background: linear-gradient(90deg, rgba(255,255,255,0.05), rgba(255,255,255,0.09), rgba(255,255,255,0.05)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Toast ---------- */
.toast-root {
  position: fixed; top: 18px; right: 18px; z-index: 2000;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  min-width: 240px; max-width: 380px;
  padding: 10px 14px; border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  font-size: 13px; color: var(--text);
  opacity: 0; transform: translateY(-8px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: auto;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-icon { flex-shrink: 0; font-size: 15px; line-height: 1; }
.toast-success .toast-icon { color: var(--green); }
.toast-error .toast-icon { color: var(--red); }
.toast-warning .toast-icon { color: var(--amber); }
.toast-info .toast-icon { color: var(--accent); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(4, 4, 10, 0.68);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  max-height: 88vh;
  display: flex; flex-direction: column;
  animation: popIn 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  overflow: hidden;
}
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 0;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-foot { padding: 0 20px 18px; }
.modal-foot-row { display: flex; justify-content: flex-end; gap: 10px; padding-top: 16px; }
.confirm-msg { font-size: 13.5px; color: var(--text-2); line-height: 1.7; }

/* ---------- 凭证预览弹层（图片 / PDF / OFD） ---------- */
.ev-preview-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(4, 4, 10, 0.72);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn 0.18s ease;
}
.ev-preview-modal {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  width: min(920px, 94vw);
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: popIn 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.ev-preview-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.ev-preview-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ev-preview-x {
  flex-shrink: 0;
  width: 28px; height: 28px; border: none; border-radius: 8px;
  background: transparent; color: var(--text-3); cursor: pointer;
  font-size: 15px; line-height: 1;
}
.ev-preview-x:hover { background: var(--surface-2); color: var(--text); }
.ev-preview-body {
  flex: 1 1 auto; overflow: auto; padding: 16px 18px;
  background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  min-height: 220px;
}
.ev-preview-img {
  max-width: 100%; max-height: 68vh; border-radius: 8px;
  background: #fff; box-shadow: var(--shadow); display: block;
}
.ev-preview-frame {
  width: 100%; height: 64vh; min-height: 420px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.ev-preview-ofd {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  width: 100%;
}
.ev-preview-ofd canvas {
  max-width: 100%; height: auto; border-radius: 4px;
  background: #fff; box-shadow: var(--shadow);
}
.ev-preview-loading { color: var(--text-3); font-size: 13px; padding: 40px 0; }
.ev-preview-notice {
  width: 100%; padding: 8px 12px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-2); font-size: 12.5px; line-height: 1.6;
}
.ev-preview-msg { color: var(--text-2); font-size: 13px; padding: 8px 0; text-align: center; }
.ev-preview-error {
  color: var(--red); font-size: 13px; padding: 8px 0; text-align: center; line-height: 1.7;
}
.ev-preview-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
@media (max-width: 640px) {
  .ev-preview-modal { width: 100%; max-width: 100vw; border-radius: 0; max-height: 100vh; }
  .ev-preview-overlay { padding: 0; }
  .ev-preview-frame { min-height: 320px; }
}

/* ==========================================================================
   登录页
   ========================================================================== */
.login-page {
  flex: 1 1 auto;          /* 撑满 #app 的 flex 行，避免被挤压到左侧 */
  width: 100%;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 30px 16px;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(106, 108, 255, 0.16), transparent 60%),
    radial-gradient(800px 420px at 90% 110%, rgba(139, 92, 246, 0.12), transparent 60%),
    var(--bg);
}
.login-card {
  width: 420px; max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 34px 32px 28px;
  box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-title { font-size: 22px; font-weight: 800; letter-spacing: 0.2px; }
.login-sub { font-size: 13px; color: var(--text-3); margin-bottom: 24px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.login-error {
  font-size: 12.5px; color: var(--red);
  background: var(--red-bg); border: 1px solid rgba(248, 113, 113, 0.3);
  padding: 8px 12px; border-radius: 8px; display: none;
}
.login-error.show { display: block; }
.login-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-3); font-size: 12px; margin: 22px 0 14px;
}
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.demo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.demo-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 12px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text); font-size: 12.5px; text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.demo-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.demo-btn .demo-name { font-weight: 600; }
.demo-btn .demo-role { font-size: 11px; color: var(--text-3); }

/* ==========================================================================
   对话页
   ========================================================================== */
.chat-view { padding: 0; display: flex; flex-direction: column; }
.chat-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-top {
  padding: 16px 26px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-head { display: flex; align-items: center; gap: 10px; }
.chat-head .chat-title { font-size: 16px; font-weight: 700; }
.chat-hint { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }
.template-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 12px 0 14px;
}
.template-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text-2); font-size: 12px;
  transition: all 0.15s;
}
.template-chip:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); }
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 22px 26px;
  display: flex; flex-direction: column; gap: 18px;
}
.msg { display: flex; gap: 12px; max-width: 860px; }
.msg-avatar {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.msg-assistant .msg-avatar {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}
.msg-user { align-self: flex-end; flex-direction: row-reverse; }
.msg-user .msg-avatar { background: var(--surface-3); color: var(--text-2); }
.msg-body { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.msg-user .msg-body { align-items: flex-end; }
.msg-bubble {
  padding: 10px 14px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.7;
  word-break: break-word;
}
.msg-assistant .msg-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}
.msg-user .msg-bubble {
  background: linear-gradient(180deg, rgba(106, 108, 255, 0.9), rgba(93, 95, 232, 0.9));
  color: #fff; border-top-right-radius: 4px;
}
.msg-time { font-size: 11px; color: var(--text-3); padding: 0 4px; }

/* 系统动作回执 */
.actions-receipt {
  margin-top: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: 10px;
  padding: 9px 12px;
  max-width: 480px;
}
.receipt-title {
  font-size: 11px; font-weight: 700; color: var(--text-3);
  letter-spacing: 0.6px; margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.receipt-title::before { content: "⚡"; }
.receipt-list { display: flex; flex-wrap: wrap; gap: 6px; }
.receipt-item {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border);
}
.receipt-item.ok { color: var(--green); background: var(--green-bg); border-color: rgba(52, 211, 153, 0.3); }
.receipt-item.fail { color: var(--red); background: var(--red-bg); border-color: rgba(248, 113, 113, 0.3); }

/* 欢迎语 */
.welcome-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.welcome-chip {
  font-size: 12px; padding: 5px 12px; border-radius: 8px;
  border: 1px dashed var(--border-strong);
  color: var(--text-2); background: transparent;
  transition: all 0.15s;
}
.welcome-chip:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* 打字指示 */
.typing-dots { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing-dots i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-3);
  animation: bounce 1.2s infinite;
}
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }

.msg-error {
  border: 1px solid rgba(248, 113, 113, 0.35) !important;
  background: var(--red-bg) !important;
  color: var(--red) !important;
}

/* 输入区 */
.chat-composer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 14px 26px 18px;
  background: var(--bg);
}
.composer-box {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 10px 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer-box textarea {
  flex: 1; border: none; background: transparent; outline: none;
  resize: none; color: var(--text); font-size: 14px; line-height: 1.6;
  max-height: 160px; min-height: 24px;
}
.composer-box textarea::placeholder { color: var(--text-3); }
.composer-send {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #7a7cff, #5d5fe8);
  border: none; color: #fff;
  transition: opacity 0.15s, transform 0.05s;
}
.composer-send:hover:not(:disabled) { opacity: 0.9; }
.composer-send:active:not(:disabled) { transform: scale(0.96); }
.composer-send:disabled { opacity: 0.4; cursor: not-allowed; }
.composer-hint { font-size: 11.5px; color: var(--text-3); margin-top: 8px; padding-left: 4px; }

/* ==========================================================================
   仪表盘
   ========================================================================== */
.dash-section-title {
  font-size: 13px; font-weight: 700; color: var(--text-2);
  letter-spacing: 0.5px; margin: 26px 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.dash-section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat-card {
  display: flex; align-items: center; gap: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-icon {
  width: 42px; height: 42px; border-radius: 11px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.stat-icon.green { background: var(--green-bg); color: var(--green); }
.stat-icon.amber { background: var(--amber-bg); color: var(--amber); }
.stat-icon.red { background: var(--red-bg); color: var(--red); }
.stat-icon.blue { background: var(--blue-bg); color: var(--blue); }
.stat-icon.accent { background: var(--accent-soft); color: var(--accent); }
.stat-value { font-size: 21px; font-weight: 800; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-3); }

/* KPI 摘要区 */
.kpi-summary { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: stretch; }
.kpi-donut-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 18px; }
.kpi-donut-card .kpi-donut-title { font-size: 13px; color: var(--text-2); font-weight: 600; }
.hbar-card { padding: 18px 20px; }
.hbar-card .hbar-title { font-size: 13px; color: var(--text-2); font-weight: 600; margin-bottom: 12px; }

/* 目标卡片（仪表盘精简版） */
.goal-mini-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 17px;
  display: flex; flex-direction: column; gap: 10px;
}
.goal-mini-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.goal-mini-title { font-size: 14px; font-weight: 700; }
.goal-mini-meta { font-size: 12px; color: var(--text-3); display: flex; gap: 10px; flex-wrap: wrap; }

/* 项目健康卡片 */
.project-card {
  display: flex; flex-direction: column; gap: 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 15px 17px;
  cursor: pointer; transition: border-color 0.15s, transform 0.1s;
}
.project-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.project-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.project-card-name { font-size: 14.5px; font-weight: 700; }
.project-card-meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-3); flex-wrap: wrap; }
.project-card-meta span { display: inline-flex; align-items: center; gap: 5px; }

/* 风险条目 */
.risk-item {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.risk-item-main { flex: 1; min-width: 0; }
.risk-item-title { font-size: 13.5px; font-weight: 600; }
.risk-item-detail { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.risk-item-meta { font-size: 11.5px; color: var(--text-3); margin-top: 4px; display: flex; gap: 10px; flex-wrap: wrap; }
/* 深链定位高亮：从企微推送链接点进来时标记目标单据 */
.risk-item.is-focused { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(106,108,255,.18); }

/* 报销发票分块（审批详情弹窗内：每张发票一个独立卡片，识别字段 / 填报回答两段） */
.ticket-list { display: flex; flex-direction: column; gap: 10px; }
.ticket-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.ticket-card-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13px;
}
.ticket-card-no {
  font-size: 11px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border-radius: 999px;
  padding: 1px 8px; flex-shrink: 0;
}
.ticket-card-title {
  font-weight: 600; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ticket-card-amount { margin-left: auto; font-weight: 700; color: var(--text); flex-shrink: 0; }
.ticket-card-block {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.ticket-card-label { font-size: 11.5px; font-weight: 600; color: var(--text-3); letter-spacing: .04em; }
.ticket-card-lines { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--text-2); }
.ticket-card-line { line-height: 1.55; word-break: break-word; }
.ticket-card-key { color: var(--text); font-weight: 600; margin-right: 4px; }
.ticket-card-more { color: var(--text-3); }

/* 报销凭证上传区（审批页 · 发起审批 → 报销）：拖拽框 + 已选文件列表 */
.evidence-block { display: flex; flex-direction: column; gap: 10px; }
.dropzone {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 12px 14px;
  transition: border-color .15s ease, background-color .15s ease;
}
.dropzone-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-inner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.evidence-input { display: none; }
.evidence-list { display: flex; flex-direction: column; gap: 8px; }
.evidence-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.evidence-thumb {
  width: 44px; height: 44px; object-fit: cover; flex-shrink: 0;
  border-radius: 6px; border: 1px solid var(--border); background: #fff;
}
.evidence-thumb-file {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-3);
}
.evidence-meta { flex: 1; min-width: 140px; }
.evidence-name {
  font-size: 13px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.evidence-sub { font-size: 11.5px; color: var(--text-3); }
/* 失败原因会写进徽章，允许换行避免撑破行布局 */
.evidence-item .badge { max-width: 100%; white-space: normal; line-height: 1.4; }

/* 动态时间线 */
.timeline { display: flex; flex-direction: column; }
.timeline-item {
  display: flex; gap: 13px; padding: 9px 0;
  border-bottom: 1px dashed var(--border);
}
.timeline-item:last-child { border-bottom: none; }
.timeline-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); margin-top: 7px; flex-shrink: 0;
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.timeline-text { font-size: 13px; flex: 1; }
.timeline-meta { font-size: 12px; color: var(--text-3); white-space: nowrap; }

/* 个人工作台 */
.work-log-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 2px; border-bottom: 1px dashed var(--border);
}
.work-log-item:last-child { border-bottom: none; }
.work-log-main { flex: 1; min-width: 0; }
.work-log-title { font-size: 13px; font-weight: 600; }
.work-log-sub { font-size: 12px; color: var(--text-3); }
.work-log-hours {
  font-size: 12px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); padding: 3px 9px; border-radius: 999px;
}

.kpi-mini-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 2px; border-bottom: 1px dashed var(--border);
}
.kpi-mini-item:last-child { border-bottom: none; }
.kpi-mini-main { flex: 1; min-width: 0; }
.kpi-mini-title { font-size: 13px; font-weight: 600; }
.kpi-mini-sub { font-size: 12px; color: var(--text-3); }
.kpi-mini-donut { flex-shrink: 0; }

/* ==========================================================================
   目标页
   ========================================================================== */
.tab-row { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--border); padding: 4px; border-radius: 10px; width: fit-content; }
.tab-btn {
  padding: 6px 16px; border-radius: 7px; border: none;
  background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { background: var(--surface-3); color: var(--text); }

.goal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 13px;
}
.goal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.goal-title { font-size: 15.5px; font-weight: 700; line-height: 1.4; }
.goal-desc { font-size: 12.5px; color: var(--text-2); }
.goal-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.metric-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.metric-table th {
  text-align: left; color: var(--text-3); font-weight: 600;
  padding: 5px 8px; border-bottom: 1px solid var(--border);
}
.metric-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); }
.metric-table tr:last-child td { border-bottom: none; }
.metric-table .num { font-variant-numeric: tabular-nums; font-weight: 600; }
.goal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.deadline-text { font-size: 12px; color: var(--text-3); display: inline-flex; align-items: center; gap: 5px; }
.deadline-text.overdue { color: var(--red); }
.deadline-text.soon { color: var(--amber); }

.metric-editor { display: flex; flex-direction: column; gap: 8px; }
.metric-editor-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr 0.8fr 34px; gap: 8px; align-items: center; }
.metric-add-btn { align-self: flex-start; }

/* ==========================================================================
   项目页
   ========================================================================== */
.project-list-item {
  display: flex; align-items: center; gap: 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
  cursor: pointer; transition: border-color 0.15s;
}
.project-list-item:hover { border-color: var(--border-strong); }
.project-list-main { flex: 1; min-width: 0; }
.project-list-name { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.project-list-sub { font-size: 12.5px; color: var(--text-3); margin-top: 3px; display: flex; gap: 14px; flex-wrap: wrap; }
.project-list-progress { width: 180px; flex-shrink: 0; }

/* 项目详情 */
.detail-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 20px; flex-wrap: wrap;
}
.detail-title { font-size: 24px; font-weight: 800; letter-spacing: -0.3px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.detail-desc { font-size: 13px; color: var(--text-2); margin-top: 6px; max-width: 720px; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; font-size: 12.5px; color: var(--text-3); }
.detail-meta span { display: inline-flex; align-items: center; gap: 5px; }

.member-list { display: flex; flex-direction: column; }
.member-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 2px; border-bottom: 1px dashed var(--border);
}
.member-item:last-child { border-bottom: none; }
.member-name { font-size: 13.5px; font-weight: 600; }
.member-role { font-size: 12px; color: var(--text-3); }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  text-align: left; color: var(--text-3); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--border-strong);
  font-size: 12px; white-space: nowrap;
}
.data-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.12s; }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover { background: rgba(255, 255, 255, 0.03); }
.data-table .num { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   KPI 页
   ========================================================================== */
.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
  position: relative;
}
.kpi-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kpi-card-title { font-size: 14.5px; font-weight: 700; line-height: 1.4; }
.kpi-card-user { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.kpi-card-body { display: flex; align-items: center; gap: 16px; }
.kpi-card-donut { flex-shrink: 0; }
.kpi-values { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.kpi-value-row { display: flex; justify-content: space-between; align-items: baseline; }
.kpi-value-row .k { color: var(--text-3); font-size: 12px; }
.kpi-value-row .v { font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-card-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; border-top: 1px solid var(--border); padding-top: 11px; }

/* ==========================================================================
   报告页
   ========================================================================== */
.report-card {
  display: flex; flex-direction: column; gap: 11px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.report-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.report-card-title { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.report-period { font-size: 12.5px; color: var(--text-2); }
.report-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat-chip {
  font-size: 11.5px; color: var(--text-2);
  background: var(--bg-elev); border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 999px;
}
.report-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.report-doc { font-size: 13.5px; color: var(--text); }
.report-doc-head { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 14px; }
.report-doc-title { font-size: 18px; font-weight: 800; }
.report-doc-meta { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ---------- Markdown 渲染 ---------- */
.md { font-size: 13.5px; line-height: 1.75; word-break: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { font-weight: 700; line-height: 1.4; margin: 16px 0 8px; }
.md h1 { font-size: 17px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.md h2 { font-size: 15px; }
.md h3 { font-size: 14px; }
.md p { margin: 7px 0; }
.md ul, .md ol { margin: 7px 0; padding-left: 22px; }
.md li { margin: 3px 0; }
.md code {
  font-family: var(--mono); font-size: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 5px;
}
.md strong { color: #fff; font-weight: 700; }
.md hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.md table { border-collapse: collapse; margin: 8px 0; font-size: 12.5px; width: 100%; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.md th { background: var(--surface-2); font-weight: 600; }
.md blockquote { border-left: 3px solid var(--accent); padding: 2px 12px; color: var(--text-2); margin: 8px 0; }

/* ---------- AI 设置页 ---------- */
.settings-form { display: flex; flex-direction: column; gap: 16px; }
.settings-status { margin-bottom: 2px; }
.settings-engine { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.settings-note { font-size: 12.5px; color: var(--text-3); }
.settings-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.settings-result {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; line-height: 1.6;
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-elev);
  color: var(--text-2);
  min-height: 20px;
}
.settings-result:empty { display: none; }
.settings-result.ok { border-color: rgba(74, 222, 128, 0.35); background: rgba(74, 222, 128, 0.08); color: #86efac; }
.settings-result.err { border-color: rgba(248, 113, 113, 0.35); background: rgba(248, 113, 113, 0.08); color: #fca5a5; }
.settings-result.testing { color: var(--text-2); }
.settings-hint {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12.5px; color: var(--text-3); line-height: 1.7;
  padding-top: 4px;
}
.settings-hint svg { flex-shrink: 0; margin-top: 2px; }

/* ---------- 登录页双模式 ---------- */
.login-mode-row { text-align: center; margin: 14px 0 0; }
.login-mode-link {
  font-size: 12.5px; color: var(--accent);
  text-decoration: none; cursor: pointer;
}
.login-mode-link:hover { text-decoration: underline; }

/* ---------- 平台·API Key 明文展示 ---------- */
.key-cell { display: flex; align-items: center; gap: 6px; }
.key-mono {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-2);
  word-break: break-all;
  max-width: 280px;
}
.key-mono[data-show="1"] { color: var(--text); }
.key-eye { width: 24px; height: 24px; flex-shrink: 0; }

/* ---------- 平台·定价配置 ---------- */
.pricing-mode-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pricing-mode-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  background: var(--bg-elev);
  transition: border-color 0.15s, background 0.15s;
}
.pricing-mode-card:hover { border-color: var(--accent); }
.pricing-mode-card.active {
  border-color: var(--accent);
  background: rgba(106, 108, 255, 0.1);
}
.pricing-mode-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.pricing-mode-desc { font-size: 12.5px; color: var(--text-3); line-height: 1.6; }
.pricing-editor-wrap { display: flex; flex-direction: column; }
.tier-editor { display: flex; flex-direction: column; gap: 8px; }
.tier-editor-head, .tier-editor-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 40px;
  gap: 10px;
  align-items: center;
}
.tier-editor-head { font-size: 12px; color: var(--text-3); font-weight: 600; padding: 0 2px; }
.tier-editor-row.plan { grid-template-columns: 1.4fr 1fr 1fr 40px; }
.pricing-save-row { margin-top: 18px; display: flex; justify-content: flex-start; }

/* ---------- 企业计费·套餐 ---------- */
.plan-list { display: flex; flex-direction: column; gap: 10px; }
.plan-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; background: var(--bg-elev);
}
.plan-name { font-weight: 700; font-size: 14px; }
.plan-desc { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.plan-right { display: flex; align-items: center; gap: 14px; }
.plan-price { font-weight: 800; font-size: 16px; color: var(--accent); }
.plan-purchased { margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.plan-purchased-item {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12.5px; color: var(--text-2); padding: 4px 0;
}

/* ---------- 打印 ---------- */
.print-area { display: none; }
@media print {
  body.printing #app, body.printing #toast-root, body.printing #modal-root { display: none !important; }
  body.printing .print-area { display: block; color: #111; font-size: 13px; }
  body.printing .print-area .md code { background: #f0f0f0; color: #111; }
  body.printing .print-area .md strong { color: #111; }
  body.printing .print-area table th { background: #eee; }
  body.printing .print-area table th, body.printing .print-area table td { border-color: #bbb; }
}

/* ==========================================================================
   图表通用
   ========================================================================== */
.chart-donut, .chart-hbar, .chart-vbar, .chart-spark { display: block; width: 100%; height: auto; }
.chart-donut { max-width: 100%; }

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 1080px) {
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-summary { grid-template-columns: 1fr; }
}

@media (max-width: 920px) {
  .sidebar { width: 62px; padding: 14px 8px; }
  .brand { justify-content: center; padding: 6px 0 14px; }
  .brand-name, .brand-sub, .nav-item span, .side-user div { display: none; }
  .nav-item { justify-content: center; padding: 9px 0; }
  .nav-group-label { text-align: center; padding: 10px 0 2px; }
  .side-user { justify-content: center; padding: 6px 0; }
}

@media (max-width: 680px) {
  .view { padding: 18px 14px 48px; }
  .topbar { padding: 0 14px; }
  .topbar-name { display: none; }
  .grid-2, .grid-3, .grid-4, .stat-row { grid-template-columns: 1fr; }
  .col-span-2 { grid-column: span 1; }
  .demo-grid { grid-template-columns: 1fr; }
  .chat-messages { padding: 16px 14px; }
  .chat-top { padding: 12px 14px 0; }
  .chat-composer { padding: 10px 14px 14px; }
  .metric-editor-row { grid-template-columns: 1fr 1fr; }
  .project-list-progress { width: 100%; }
  .modal { width: 100% !important; max-width: 100vw; }
  .msg { max-width: 100%; }
}

/* ==========================================================================
   平台计费相关（追加）— 企业计费 / 平台控制台
   ========================================================================== */

/* 余额大卡片（企业计费页） */
.bill-balance {
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  background: linear-gradient(135deg, rgba(106, 108, 255, 0.16), rgba(106, 108, 255, 0.05));
  border: 1px solid rgba(106, 108, 255, 0.35);
  border-radius: var(--radius);
  padding: 20px 24px; margin-bottom: 16px;
}
.bill-balance-label { font-size: 12.5px; color: var(--text-2); }
.bill-balance-value {
  font-size: 30px; font-weight: 800; letter-spacing: -0.5px;
  color: var(--accent); font-variant-numeric: tabular-nums; margin-top: 4px;
}
.bill-balance-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* 资金流水金额（正绿负红） */
.tx-amount.positive { color: var(--green); font-weight: 700; }
.tx-amount.negative { color: var(--red); font-weight: 700; }

/* 配置/计费规则键值网格 */
.plat-meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 18px;
}
.plat-meta-item { display: flex; flex-direction: column; gap: 4px; }
.plat-meta-key { font-size: 12px; color: var(--text-3); }
.plat-meta-val { font-size: 13.5px; font-weight: 600; word-break: break-all; }

/* 测试连接 / 操作结果框 */
.plat-result {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border);
}
.plat-result-icon { flex-shrink: 0; margin-top: 1px; }
.plat-result-title { font-size: 14px; font-weight: 700; }
.plat-result-sub { font-size: 12.5px; opacity: 0.85; margin-top: 3px; word-break: break-all; }
.plat-result.ok { border-color: rgba(52, 211, 153, 0.4); background: rgba(52, 211, 153, 0.08); color: #86efac; }
.plat-result.err { border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.08); color: #fca5a5; }

/* 创建企业成功的一次性账号弹窗 */
.plat-cred { display: flex; flex-direction: column; gap: 10px; }
.plat-cred-tip {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12.5px; line-height: 1.7;
  padding: 10px 12px; border-radius: 10px;
  color: var(--amber);
  background: var(--amber-bg); border: 1px solid rgba(251, 191, 36, 0.3);
}
.plat-cred-tip svg { flex-shrink: 0; margin-top: 2px; }
.plat-cred-row {
  display: flex; justify-content: space-between; gap: 14px; align-items: center;
  background: var(--bg-elev); border: 1px solid var(--border);
  padding: 10px 14px; border-radius: 10px;
}
.plat-cred-key { font-size: 12.5px; color: var(--text-3); }
.plat-cred-val { font-size: 14px; font-weight: 700; font-family: var(--mono); }

/* 企业名称链接 */
.plat-link { color: var(--accent); cursor: pointer; font-weight: 600; text-decoration: none; }
.plat-link:hover { text-decoration: underline; }

/* 企业详情余额卡 */
.plat-balance {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 18px; min-width: 170px;
}
.plat-balance-label { font-size: 12px; color: var(--text-3); }
.plat-balance-value {
  font-size: 22px; font-weight: 800; color: var(--accent);
  font-variant-numeric: tabular-nums; margin-top: 3px;
}

/* 企业详情返回行 */
.plat-back-row { margin-bottom: 12px; }

/* 月度统计小格 */
.plat-stat-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.plat-stat-cell {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px;
}
.plat-stat-value { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.plat-stat-label { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

/* 平台管理员卡 */
.plat-admin { display: flex; align-items: center; gap: 12px; }
.plat-admin-name { font-size: 14.5px; font-weight: 700; }
.plat-admin-user { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* 表格行内操作 */
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* 企业列表管理员信息 */
.tenant-admin-name { font-size: 13px; font-weight: 600; }
.tenant-admin-user { font-size: 11.5px; color: var(--text-3); }

@media (max-width: 680px) {
  .plat-stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==========================================================================
   移动端体验 + 语音输入（追加）
   ========================================================================== */

/* 语音按钮 */
.composer-mic {
  flex-shrink: 0;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--text-2);
  border-radius: 10px; cursor: pointer;
}
.composer-mic:hover { background: var(--bg-elev); color: var(--text); }
.composer-mic.recording { color: #fff; background: var(--red); animation: mic-pulse 1.2s infinite; }
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(248, 113, 113, 0); }
}

/* 桌面图表 / 移动端简单图文 */
.chart-mobile { display: none; }
.mobile-kv {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 2px; border-bottom: 1px solid var(--border);
  font-size: 13px; color: var(--text-2);
}
.mobile-kv:last-child { border-bottom: none; }
.mobile-kv .num { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }

body { -webkit-tap-highlight-color: transparent; }

/* 手机（≤ 720px）：底部 Tab 导航 + 全屏聊天 + 简单图文 + 强化触控 */
@media (max-width: 720px) {
  #app { height: 100dvh; }

  /* 侧栏 → 底部 Tab 栏 */
  .sidebar {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    width: 100%; height: calc(58px + env(safe-area-inset-bottom));
    flex-direction: row; align-items: stretch;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    border-right: none; border-top: 1px solid var(--border);
    background: rgba(14, 14, 20, 0.96);
    backdrop-filter: blur(14px);
    z-index: 100;
  }
  .sidebar .brand, .sidebar .side-foot, .sidebar .nav-group-label { display: none; }
  .sidebar .nav { flex: 1; flex-direction: row; overflow: visible; gap: 2px; }
  .sidebar .nav-item {
    flex: 1; flex-direction: column; justify-content: center;
    gap: 3px; padding: 5px 0; font-size: 10.5px;
  }
  .sidebar .nav-item span { display: block !important; font-size: 10.5px; }

  .main { width: 100%; }
  .topbar { padding: 0 12px; }
  .topbar-title { font-size: 14px; }
  .view { padding: 14px 12px calc(86px + env(safe-area-inset-bottom)); }

  /* 聊天页：全屏沉浸（dvh 适配移动浏览器地址栏） */
  .chat-view { padding: 0; height: 100%; }
  .chat-view .chat-wrap { height: 100%; }
  .chat-view .chat-top { padding-bottom: 8px; }
  .chat-view .chat-composer {
    padding: 8px 10px calc(12px + env(safe-area-inset-bottom));
  }
  .chat-view .chat-messages { padding: 14px 12px 8px; }

  /* 图表降级 */
  .chart-desk { display: none !important; }
  .chart-mobile { display: block; }

  /* 通用移动端 */
  .template-row { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .data-table { display: block; overflow-x: auto; }
  .chat-composer { padding: 10px 12px calc(14px + env(safe-area-inset-bottom)); }
  .composer-hint { display: none; }
  .composer-box textarea { font-size: 15px; }
  .composer-send { width: 42px; height: 42px; }
  .composer-mic { width: 42px; height: 42px; }
  .pricing-mode-row { grid-template-columns: 1fr; }
  .tier-editor-head { display: none; }
  .tier-editor-row, .tier-editor-row.plan {
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--border); border-radius: 10px;
    padding: 10px; background: var(--bg-elev);
  }
  .tier-editor-row .icon-btn { position: absolute; right: 8px; top: 8px; }
  .tier-editor-row { position: relative; }
  .msg-bubble { font-size: 14px; }
  .welcome-chips { flex-wrap: wrap; }
  .btn-lg { padding: 11px 18px; }
  .stat-card { padding: 14px 16px; }
  .modal-foot-row { gap: 8px; }
  .login-card { padding: 26px 22px 22px; }
}

/* ---------- 微信绑定页 ---------- */
.wechat-code {
  font-family: var(--mono);
  font-size: 42px; font-weight: 800; letter-spacing: 10px;
  color: var(--accent); margin: 6px 0 10px;
}
.wechat-note { font-size: 13px; color: var(--text-2); line-height: 1.8; }
.wechat-steps { margin: 2px 0 2px 18px; font-size: 13px; color: var(--text-2); line-height: 2; }


/* ---------------- 企业状态开关（停用=灰 / 启用=绿） ---------------- */
.switch {
  position: relative; display: inline-flex; flex: none;
  width: 38px; height: 20px; vertical-align: middle;
}
.switch input {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer; z-index: 1;
}
.switch .slider {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--gray); transition: background 0.18s ease; pointer-events: none;
}
.switch .slider::before {
  content: ''; position: absolute; width: 16px; height: 16px;
  left: 2px; top: 2px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); transition: transform 0.18s ease;
}
.switch input:checked + .slider { background: var(--green); }
.switch input:checked + .slider::before { transform: translateX(18px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-wrap { display: inline-flex; align-items: center; gap: 6px; }
.switch-label { font-size: 12px; color: var(--text-3); user-select: none; }

/* 确认弹窗多行文案（删除保护期说明等）保留换行 */
.confirm-msg { white-space: pre-line; }
/* 回收站企业名（不可点击，弱化显示） */
.plat-link-muted { color: var(--text-2); font-weight: 600; }

/* 弹窗内错误提示（删除密码校验失败等，保持弹窗打开可重试） */
.form-error { color: var(--red); font-size: 12.5px; line-height: 1.6; margin-bottom: 8px; min-height: 0; }
.form-error:empty { display: none; }
