:root {
  --primary: #1677ff;        /* matches live site reference */
  --primary-active: #129bfe; /* company text-accent */
  --primary-bright: #296dff; /* company brand-500 */
  --primary-dark: #00329e;
  --primary-light: #eff4ff;
  --success: #17b26a;
  --warning: #f79009;
  --danger: #f04438;
  --text: #121619;           /* company text-primary */
  --text-secondary: #343a3f; /* company text-secondary */
  --text-tertiary: #697077;  /* company text-tertiary */
  --border: #e9ebf0;
  --border-light: #f0f0f0;
  --bg: #ffffff; /* flat white (was: linear-gradient(129deg,#f5fbff 11.03%,#fcfcfc 88.98%)) — original page is pure white, not blue-tinted */
  --card-bg: #ffffff;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  --shadow-card: 0 1px 2px -2px rgba(0,0,0,0.16), 0 3px 6px 0 rgba(0,0,0,0.12), 0 5px 12px 4px rgba(0,0,0,0.09);
  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.03), 0 1px 6px -1px rgba(0,0,0,0.02), 0 2px 4px 0 rgba(0,0,0,0.02);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--font);
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  height: 100%;
  overflow-x: hidden; /* avoid horizontal scroll from zoom rounding */
}

a { color: var(--primary); text-decoration: none; }

/* App shell */
.app-shell { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.app-topbar {
  height: 56px; background: #fff; border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between; padding: 0 16px 0 28px;
  flex-shrink: 0;
}
.app-topbar-left { display: flex; align-items: center; gap: 16px; flex: 1; }
.app-logo {
  display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 22px; color: #0a2540; letter-spacing: -1px;
}
.app-logo svg, .app-logo img { height: 46px; width: auto; display: block; }
.app-logo .badge-u {
  width: 20px; height: 20px; border-radius: 50%; background: #1677ff; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; margin-left: 4px;
}

.top-nav { display: flex; align-items: center; gap: 10px; padding: 3px; border-radius: 8px; }
.top-nav-item {
  position: relative; height: 33px; padding: 4px 16px; border-radius: 6px;
  display: flex; align-items: center; gap: 4px; color: var(--text-secondary);
  font-size: 14px; font-weight: 500; cursor: pointer; transition: .2s; border: none; background: transparent;
}
.top-nav-item:hover { color: var(--primary); background: #f3f5f7; }
.top-nav-item.active { color: var(--primary-active); }
.top-nav-item.active::after {
  content: ''; position: absolute; bottom: -11px; left: 30%; width: 40%; height: 2px;
  border-radius: 2px; background: var(--primary-active);
}
.top-nav-arrow { font-size: 10px; opacity: .6; }

.app-topbar-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.user-profile {
  display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px 4px 4px;
  border-radius: 20px; transition: .2s;
}
.user-profile:hover { background: #f3f5f7; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(157deg, #5F6C90 12.46%, #393D49 85.12%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500;
}
.user-name { font-size: 14px; color: var(--text-secondary); }
.user-arrow { font-size: 10px; color: #999; }

/* 运行状态按钮（topbar 右上角，纯色不透明） v1.68.106 */
.run-status-btn{
  display:inline-flex;align-items:center;gap:6px;
  height:30px;padding:0 12px;border-radius:7px;
  background:#129bff;opacity:1;
  color:#fff;font-size:13px;font-weight:500;border:none;
  cursor:pointer;transition:.18s ease;box-shadow:0 1px 3px rgba(18,155,255,.25);
}
.run-status-btn:hover{background:#0e8ae6;opacity:1;box-shadow:0 2px 6px rgba(18,155,255,.35);}
.run-status-btn:active{transform:translateY(1px);}
.run-status-btn.is-on{background:#0d7acc;opacity:1;box-shadow:0 0 0 3px rgba(18,155,255,.25) inset;}
.run-status-btn svg{width:14px;height:14px;display:block;transition:transform .2s ease;}
/* v0.235：未点击时 hover 才旋转（1 圈/秒） */
.run-status-btn:not(.is-on):hover svg{animation:v235-spin 1s linear infinite;}
.run-status-btn.is-on svg{animation:v235-spin 1.4s linear infinite;}
@keyframes v235-spin{from{transform:rotate(0deg);}to{transform:rotate(360deg);}}
.run-status-btn .rs-pulse{width:7px;height:7px;border-radius:50%;background:#52c41a;box-shadow:0 0 0 0 rgba(82,196,26,.7);margin-left:2px;animation:rs-pulse 1.4s ease-in-out infinite;}
@keyframes rs-pulse{0%,100%{box-shadow:0 0 0 0 rgba(82,196,26,.7);}50%{box-shadow:0 0 0 6px rgba(82,196,26,0);}}

/* Dropdowns */
.top-nav-item { position: relative; }
.dropdown-menu {
  position: absolute; top: 38px; left: 0; min-width: 150px; background: #fff;
  border: 1px solid #f0f0f0; border-radius: 8px; box-shadow: 0 6px 24px rgba(0,0,0,0.08);
  display: none; z-index: 100; padding: 6px 0;
}
.top-nav-item:hover .dropdown-menu { display: block; }
/* 透明桥接：hover 时扩展 .top-nav-item 的可悬停区域，覆盖与下拉之间的 10px 间隙，
   避免鼠标下移时下拉消失（min-width 与下拉一致，宽度覆盖整个下拉） */
.top-nav-item::after {
  content: ''; position: absolute; top: 100%; left: 0;
  width: 100%; min-width: 150px; height: 12px; display: none;
}
.top-nav-item:hover::after { display: block; }
.dropdown-item { padding: 9px 16px; color: #333; font-size: 13px; white-space: nowrap; display: block; }
.dropdown-item:hover { background: #f5f7fa; color: var(--primary); }

.app-content { flex: 1; overflow: auto; background: var(--bg); }

/* Page layout */
.page-container { padding: 24px 48px; max-width: none; margin: 0; }
.page-header { margin-bottom: 20px; display: flex; align-items: flex-start; justify-content: space-between; }
.page-title { font-size: 24px; font-weight: 700; margin: 0 0 6px; color: #111; }
.page-subtitle { color: var(--text-tertiary); font-size: 13px; }
.page-actions { display: flex; gap: 10px; }

/* Tabs */
.tabs { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.tab {
  height: 34px; padding: 0 16px; border-radius: 6px; display: flex; align-items: center;
  font-size: 14px; color: var(--text-secondary); cursor: pointer; background: transparent; border: none;
}
.tab:hover { background: #f0f0f0; }
.tab.active { background: #f0f0f0; color: var(--text-secondary); }
.sub-tab { color: var(--text-secondary); font-size: 14px; padding: 0 12px 8px; border-bottom: 2px solid transparent; cursor: pointer; }
.sub-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.sub-tabs { display: flex; gap: 12px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }

/* Cards */
.card {
  background: var(--card-bg); border-radius: var(--radius-md); border: 1px solid var(--border-light);
  padding: 20px;
}
.card-flat { border: 1px solid var(--border); border-radius: var(--radius-md); background: #fff; padding: 16px; }
.card-hover { transition: background .2s, border-color .2s, box-shadow .2s; cursor: pointer; position: relative; }
.card-hover:hover { box-shadow: var(--shadow-card); background: radial-gradient(circle at 0% 0%, #c9deff 0%, #ffffff 35%); border-color: #91caff; }

/* hover-only "设为快捷应用" action in card bottom-right */
.app-card-quick { position: absolute; right: 16px; bottom: 12px; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--primary); opacity: 0; transition: opacity .15s ease; pointer-events: none; }
.app-card-quick svg { width: 14px; height: 14px; }
.card-hover:hover .app-card-quick { opacity: 1; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--border);
  background: #fff; color: var(--text); cursor: pointer; font-size: 14px; transition: .2s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { height: 28px; padding: 0 12px; font-size: 13px; }
.btn-ghost { background: transparent; border-color: transparent; }

/* Inputs / search */
.input {
  height: 34px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; outline: none; transition: .2s; width: 100%;
}
.input:focus { border-color: var(--primary); }
.search-box {
  display: flex; align-items: center; gap: 8px; width: 240px; height: 34px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: #fff;
}
.search-box input { border: none; outline: none; flex: 1; font-size: 14px; background: transparent; }

/* Tables */
.table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; border-radius: 8px; }
.table th, .table td { padding: 14px 12px; border-bottom: 1px solid var(--border-light); text-align: left; }
.table th { color: var(--text-secondary); font-weight: 600; background: #fafafa; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f5f7fa; }
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 4px;
  font-size: 12px; background: #f6ffed; color: #52c41a; border: 1px solid #b7eb8f;
}
.tag-blue { background: #e6f4ff; color: #1677ff; border-color: #91d5ff; }
.tag-orange { background: #fff7e6; color: #fa8c16; border-color: #ffd591; }
.tag-red { background: #fff1f0; color: #ff4d4f; border-color: #ffa39e; }

/* App cards grid */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.app-card { display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.app-card-header { display: flex; align-items: center; gap: 12px; }
.app-icon {
  width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  background: #e6f4ff; color: #1677ff; font-size: 20px; flex-shrink: 0;
}
.app-icon img { width: 26px; height: 26px; }
.app-card-title { font-size: 15px; font-weight: 600; color: #111; }
.app-card-sub { font-size: 12px; color: var(--text-tertiary); }
.app-card-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

/* Tool cards */
.tool-card { display: flex; gap: 14px; padding: 16px; }
.tool-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tool-icon svg { width: 24px; height: 24px; }
.tool-title { font-size: 15px; font-weight: 600; color: #111; margin-bottom: 2px; }
.tool-name { font-size: 12px; color: var(--text-tertiary); margin-bottom: 6px; }
.tool-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.tool-tags { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tool-tag { font-size: 12px; color: var(--text-tertiary); }

/* Login page */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #e6f4ff 0%, #f0f9ff 50%, #e6f7ff 100%);
  position: relative; overflow: hidden;
}
.login-illustration {
  position: absolute; left: 0; top: 0; bottom: 0; width: 55%;
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  position: relative; z-index: 2; width: 420px; margin-left: 55%;
  background: rgba(255,255,255,0.95); border-radius: 16px; padding: 44px 48px;
  box-shadow: 0 16px 48px rgba(0, 100, 200, 0.12);
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.login-brand .logo-text { font-size: 26px; font-weight: 800; color: #0a2540; letter-spacing: -1px; }
.login-title { font-size: 22px; font-weight: 600; margin-bottom: 28px; color: #111; }
.login-form .field { margin-bottom: 18px; }
.login-form label { display: block; font-size: 14px; color: #333; margin-bottom: 8px; }
.login-form label .required { color: #f56c6c; margin-left: 2px; }
.login-form input[type="text"], .login-form input[type="password"] {
  width: 100%; height: 44px; padding: 0 16px; border: 1px solid #e0e6ed;
  border-radius: 8px; font-size: 14px; background: #f8fafc; transition: .2s;
}
.login-form input:focus { outline: none; border-color: var(--primary); background: #fff; }
.login-form .hint { font-size: 12px; color: #999; margin-top: 4px; }
.login-form .submit-btn {
  width: 100%; height: 48px; margin-top: 22px; border: none; border-radius: 8px;
  background: var(--primary); color: #fff; font-size: 16px; font-weight: 500; cursor: pointer; transition: .2s;
}
.login-form .submit-btn:hover { background: var(--primary-dark); }
.login-form .submit-btn:disabled { background: #a0cfff; cursor: not-allowed; }
.login-form .agree { display: flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 13px; color: #666; }
.login-form .agree input { width: 14px; height: 14px; }

/* Chat home page */
.chat-layout { display: flex; flex: 1; overflow: hidden; }
.chat-sidebar {
  width: 0; padding: 0; border-right: none; background: #fff; flex-shrink: 0;
  display: flex; flex-direction: column; overflow: hidden;
  transition: width .3s ease, padding .3s ease;
}
.chat-sidebar.expanded {
  width: 260px; padding: 16px 0; border-right: 1px solid var(--border-light);
}
.chat-sidebar-top { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 8px; }
.chat-sidebar-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 6px; cursor: pointer; color: #1f2e4d; font-size: 13px; }
.chat-sidebar-item:hover { background: #f3f5f7; }
.chat-sidebar-label { padding: 8px 16px; font-size: 12px; color: #636e83; display: flex; justify-content: space-between; align-items: center; }
.chat-history-month { padding: 4px 16px; font-size: 12px; color: #697077; font-weight: 500; }
.chat-history-item { padding: 8px 16px; font-size: 13px; color: #1f2e4d; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.chat-history-item:hover { background: #f3f5f7; }
.chat-main {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 20px 20px calc(80px + env(safe-area-inset-bottom, 0px)); background: radial-gradient(ellipse 30% 25% at 50% 50%, #e6f4ff 0%, #f5fbff 40%, #ffffff 75%); position: relative;
  overflow-y: auto; overflow-x: hidden;
  transition: background .35s ease;
}
/* 对话中：背景纯白，hero / conversation / input 严格自上而下三段式排列
   → 任何一段的高度变化都不会影响其他两段的 Y 坐标，彻底消除「输入框上移」
   → v0.117：bottom padding 叠加 iOS 安全区，确保对话中/对话后输入框位置一致 */
.chat-main.is-conversing {
  background: #ffffff;
  justify-content: flex-start;
  overflow: hidden;
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
}
.chat-main.is-conversing .chat-footer { color: #a0a4aa; background: linear-gradient(to top, rgba(255,255,255,0.98) 60%, rgba(255,255,255,0)); }
/* hero 隐藏时保留占位高度（visibility:hidden 占空间），使 chat-input Y 坐标在进入对话时不发生位移 */
.chat-hero.is-hidden { visibility: hidden; pointer-events: none; }
/* 让 chat-input-block（包含 conversation + input-card）成为 flex column 容器 */
.chat-main.is-conversing .chat-input-block { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; width: 100%; max-width: 800px; }
/* 对话区内部滚动 + 自适应高度（flex:1 填充 hero 与 input 之间的剩余空间） */
.chat-main.is-conversing .chat-conversation {
  flex: 1 1 0; min-height: 0; width: 100%;
  overflow-y: auto; scrollbar-gutter: stable; overscroll-behavior: contain;
  padding: 0 4px 8px;
}
/* 对话输入框在 is-conversing 时 margin-top:auto 贴底，确保不与 conversation 抢空间 */
.chat-main.is-conversing .chat-input-card { margin-top: 12px; flex: 0 0 auto; }
/* 本体图不完整 · 红色报错横幅 */
.home-opm-error { position: fixed; top: 72px; left: 50%; transform: translateX(-50%) translateY(-8px); z-index: 9999; display: none; align-items: center; gap: 8px; padding: 10px 18px; background: #fff1f0; border: 1px solid #ffa39e; color: #cf1322; border-radius: 8px; font-size: 13px; font-weight: 600; box-shadow: 0 6px 18px rgba(207,19,34,.18); opacity: 0; transition: opacity .2s ease, transform .2s ease; }
.home-opm-error.show { display: flex; opacity: 1; transform: translateX(-50%) translateY(0); }
.chat-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 32px; position: relative; }
.chat-hero::after {
  content: ''; position: absolute; left: 50%; bottom: -34px; transform: translateX(-50%);
  width: 520px; height: 72px; border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(22, 119, 255, 0.07) 0%, rgba(22, 119, 255, 0.03) 45%, transparent 72%);
  pointer-events: none; z-index: -1;
}
.hero-avatar-wrap { position: relative; display: inline-block; }
.chat-hero img { height: 60px; width: 60px; border-radius: 0; display: block; }
.hero-sparkle { position: absolute; top: -2px; right: -4px; line-height: 1; transform: rotate(12deg); }
.chat-hero-title { font-size: 32px; font-weight: 600; color: #111; line-height: 1; }
.chat-input-card {
  width: 100%; max-width: 800px; background: #fff; border: 1px solid #e5e5e5; border-radius: 20px;
  box-shadow: 4px 4px 25px rgba(112, 114, 176, 0.12); padding: 16px; display: flex; flex-direction: column; gap: 10px;
}
.chat-input-card textarea {
  width: 100%; min-height: 48px; border: none; outline: none; resize: none; font-size: 16px; color: #333; font-family: var(--font); background: transparent;
}
.chat-input-card textarea::placeholder { color: #bbb; }
.chat-input-actions { display: flex; align-items: center; justify-content: space-between; }
.chat-input-block { width: 100%; max-width: 800px; display: flex; flex-direction: column; gap: 10px; }
.chat-input-attachments { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 2px; }
.chat-input-attachments[hidden] { display: none; }
.chat-input-attachments .chat-active-pdf { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 8px; background: #f5f9ff; border: 1px solid #d6e8ff; border-radius: 8px; max-width: 100%; position: relative; overflow: hidden; transition: filter .25s ease, border-color .25s ease; }
.chat-input-attachments .chat-active-pdf-name { font-size: 12.5px; color: var(--text, #121619); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.chat-input-pdf-remove { width: 18px; height: 18px; border: none; background: rgba(0,0,0,.04); color: #697077; font-size: 14px; line-height: 1; border-radius: 50%; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; transition: background-color .15s ease, color .15s ease; }
.chat-input-pdf-remove:hover { background: #ff4d4f; color: #fff; }
/* PDF 加载状态 */
.chat-active-pdf.is-loading { filter: brightness(.95) contrast(.99); border-color: #69b1ff; pointer-events: none; }
.chat-pdf-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(22,119,255,.08); opacity: 0; transition: opacity .2s ease; pointer-events: none; }
.chat-active-pdf.is-loading .chat-pdf-progress { opacity: 1; }
.chat-pdf-progress-bar { height: 100%; background: linear-gradient(90deg, #69b1ff, #1677ff, #69b1ff); background-size: 200% 100%; width: 0%; border-radius: 1px; transition: width 90ms linear; animation: pdf-progress-shimmer 1.4s linear infinite; }
@keyframes pdf-progress-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.chat-pdf-loading-text { display: none; font-size: 11px; color: #1677ff; margin-left: 4px; font-weight: 500; letter-spacing: .2px; animation: pdf-loading-blink 1.1s ease-in-out infinite; min-width: 56px; }
.chat-active-pdf.is-loading .chat-pdf-loading-text { display: inline; }
@keyframes pdf-loading-blink { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }
.chat-pdf-icon-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 20px; height: 20px; }
.chat-pdf-icon-spinner { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(255,255,255,.88); border-radius: 3px; }
.chat-active-pdf.is-loading .chat-pdf-icon-spinner { display: flex; }
.chat-pdf-icon-spinner::after { content: ''; width: 10px; height: 10px; border: 1.5px solid rgba(22,119,255,.25); border-top-color: #1677ff; border-radius: 50%; animation: pdf-spin .85s linear infinite; }
@keyframes pdf-spin { to { transform: rotate(360deg); } }
.chat-active-state { display: none; flex-direction: column; gap: 10px; padding: 12px 16px; background: #f5f9ff; border: 1px solid #d6e8ff; border-radius: 12px; }
.chat-active-state.is-show { display: flex; }
.chat-active-pdf { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; background: #fff; border: 1px solid #e0e0e0; border-radius: 8px; align-self: flex-start; max-width: 100%; }
.chat-active-pdf-icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex-shrink: 0; }
.chat-active-pdf-name { font-size: 13px; color: var(--text, #121619); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-active-text { font-size: 14px; color: var(--text, #121619); line-height: 1.6; }
.chat-source { display: inline-flex; align-items: center; gap: 6px; color: #1677ff; font-size: 13px; cursor: pointer; padding: 4px 10px; border-radius: 6px; transition: background-color .18s ease, color .18s ease, border-color .18s ease; user-select: none; background: #ffffff; border: 1px solid #91caff; }
.chat-source:hover, .chat-source.active { background-color: #e6f4ff; color: #0958d9; border-color: #69b1ff; }
.chat-source img { transition: filter .18s ease; }
.chat-source:hover img, .chat-source.active img { filter: brightness(0.9) saturate(1.15); }
.chat-source-wrap { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.chat-source-picker { display: none; position: absolute; top: calc(100% + 6px); left: 0; flex-direction: column; gap: 2px; background: #ffffff; border: 1px solid #f0f0f0; border-radius: 8px; padding: 4px; box-shadow: 0 4px 12px rgba(0,0,0,.06); min-width: 160px; z-index: 10; }
.chat-source-picker.open { display: flex; }
.chat-source-picker-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-secondary, #343a3f); padding: 6px 10px; border-radius: 6px; cursor: pointer; transition: background-color .15s ease, color .15s ease; user-select: none; }
.chat-source-picker-item:hover { background-color: #f5f7fa; }
.chat-source-picker-item.active { color: var(--primary, #1677ff); background-color: #e6f4ff; }
.chat-source-icon { width: 18px; height: 18px; object-fit: contain; border-radius: 4px; flex-shrink: 0; }
.chat-source-chip { display: none; align-items: center; gap: 6px; font-size: 13px; color: var(--text, #121619); background: #f5f7fa; border: 1px solid #f0f0f0; border-radius: 8px; padding: 4px 6px 4px 8px; user-select: none; }
.chat-source-chip.is-show { display: inline-flex; }
.chat-source-chip-icon { width: 18px; height: 18px; object-fit: contain; flex-shrink: 0; color: var(--text-secondary, #343a3f); }
.chat-source-chip-name { color: var(--text, #121619); }
.chat-source-chip-close { width: 18px; height: 18px; border: none; background: transparent; color: #999; font-size: 16px; line-height: 1; border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; transition: background-color .15s ease, color .15s ease; }
.chat-source-chip-close:hover { background: #e5e7ea; color: #333; }
.chat-send-btn {
  width: 40px; height: 40px; border-radius: 50%; background: #cfeafe; border: none;
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background-color .2s ease, transform .15s ease;
}
.chat-send-btn.is-active { background: var(--primary, #1677ff); }
.chat-send-btn.is-active:hover { background: var(--primary-active, #129bfe); }
.chat-send-btn:active { transform: scale(0.96); }
.chat-send-btn svg { fill: #fff; stroke: none; }
.chat-send-btn:not(.is-active) svg { fill: #ffffff; opacity: .9; }

/* home 对话流（chat-conversation） */
.chat-conversation { display: flex; flex-direction: column; gap: 14px; padding: 0 4px 8px; }
.conv-msg { display: flex; gap: 10px; align-items: flex-start; }
.conv-msg.conv-user { justify-content: flex-end; }
.conv-avatar { width: 32px; height: 32px; border-radius: 8px; overflow: hidden; flex-shrink: 0; background: #e6f4ff; }
.conv-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.conv-bubble { max-width: 78%; border-radius: 12px; padding: 10px 14px; font-size: 13.5px; line-height: 1.65; box-shadow: 0 1px 2px rgba(0,0,0,.04); position: relative; }
.conv-bubble-user { background: #e6f0fa; color: #1a2236; border: 1px solid #d6e4f5; }
.conv-bubble-user .chat-active-pdf { background: rgba(255,255,255,.7); border: 1px solid #cfdcef; }
.conv-bubble-user .chat-active-pdf-name { color: #1a2236; }
.conv-bubble-user .conv-txt { color: #1a2236; }
.conv-bubble-user .conv-meta { color: #5b6478; }
.conv-bubble-ai { background: #fff; color: var(--text, #121619); border: 1px solid var(--border-light, #f0f0f0); }
.conv-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; color: var(--text-tertiary, #697077); }
.conv-name { font-weight: 600; color: var(--text-secondary, #343a3f); }
.conv-time { font-weight: 400; }
.conv-txt { color: var(--text, #121619); white-space: pre-wrap; word-break: break-word; }
.conv-txt:empty { display: none; }

/* AI 对话气泡右上角 ×：结束本次对话并重置驾驶舱（两端同步） */
.conv-msg-close {
  position: absolute;
  top: 4px;
  right: 6px;
  width: 20px;
  height: 20px;
  line-height: 18px;
  text-align: center;
  font-size: 16px;
  font-weight: 400;
  color: #94a3b8;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity .18s ease, color .18s ease, background .18s ease, border-color .18s ease;
  user-select: none;
  z-index: 2;
}
.conv-bubble-ai:hover .conv-msg-close { opacity: .85; }
.conv-msg-close:hover {
  opacity: 1 !important;
  color: #ef4444;
  background: #fef2f2;
  border-color: #fecaca;
}
.conv-msg-close:active { transform: scale(.92); }

/* 对话气泡淡入 + 上滑（更丝滑的出现） */
.conv-msg-enter { animation: conv-msg-in .38s cubic-bezier(.22, .61, .36, 1) both; }
.conv-msg.conv-user.conv-msg-enter { animation: conv-msg-in-right .38s cubic-bezier(.22, .61, .36, 1) both; }
@keyframes conv-msg-in {
  0% { opacity: 0; transform: translateY(8px) scale(.985); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes conv-msg-in-right {
  0% { opacity: 0; transform: translateY(8px) translateX(6px) scale(.985); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) translateX(0) scale(1); }
}

/* 思考中（3 个跳点 + 文字） */
.conv-thinking-dots { display: inline-flex; align-items: center; gap: 5px; padding: 2px 0 1px; color: var(--text-tertiary, #697077); font-size: 12.5px; }
.conv-thinking-dots i { width: 6px; height: 6px; border-radius: 50%; background: #91caff; display: inline-block; animation: conv-think-bounce 1.05s ease-in-out infinite; }
.conv-thinking-dots i:nth-child(2) { animation-delay: .18s; }
.conv-thinking-dots i:nth-child(3) { animation-delay: .36s; }
.conv-thinking-text { margin-left: 4px; font-size: 12.5px; color: var(--text-tertiary, #697077); animation: conv-thinking-fade 1.4s ease-in-out infinite; }
@keyframes conv-think-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .4; }
  30% { transform: translateY(-4px); opacity: 1; }
}
@keyframes conv-thinking-fade { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }

/* 上传完成后的 PDF：可点击 + 提示 */
.chat-active-pdf.is-uploaded { cursor: pointer; border-color: #91caff; }
.chat-active-pdf.is-uploaded:hover { border-color: #1677ff; background-color: #f0f7ff; }
.chat-active-pdf.is-uploaded::after { content: '点击预览'; position: absolute; bottom: -18px; left: 0; font-size: 10.5px; color: #1677ff; opacity: 0; transition: opacity .2s ease; pointer-events: none; }
.chat-active-pdf.is-uploaded:hover::after { opacity: 1; }

/* 步骤面板（steps） */
.conv-steps { margin-top: 8px; background: #f5f9ff; border: 1px solid #d6e8ff; border-radius: 8px; padding: 10px 12px; }
.conv-steps-title { font-size: 12.5px; font-weight: 600; color: var(--text-secondary, #343a3f); margin-bottom: 8px; }
.conv-steps-list { display: flex; flex-direction: column; gap: 6px; }
.conv-step-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text, #121619); transition: opacity 200ms ease, transform 200ms ease; opacity: 0.78; }
.conv-step-item.done { opacity: 1; }
.conv-step-item .conv-step-name { transition: color 200ms ease; color: var(--text-tertiary, #6c757d); }
.conv-step-item.done .conv-step-name { color: var(--text, #121619); font-weight: 500; }
.conv-step-dot { width: 16px; height: 16px; border-radius: 50%; background: #e6f4ff; color: var(--primary, #1677ff); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background 220ms ease, color 220ms ease, transform 220ms cubic-bezier(.34,1.56,.64,1); }
.conv-step-item.done .conv-step-dot { background: #1677ff; color: #fff; transform: scale(1.08); }

/* 候选选项（candidates） */
.conv-candidates { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.conv-cand-opt { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text, #121619); transition: background-color .15s ease, border-color .15s ease; }
.conv-cand-opt:hover { background: #f5f7fa; }
.conv-cand-opt.is-checked { background: #e6f4ff; border-color: #91caff; color: var(--primary, #1677ff); }
.conv-radio { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid #d0d4d9; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: border-color .15s ease; }
.conv-cand-opt.is-checked .conv-radio { border-color: var(--primary, #1677ff); }
.conv-radio-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary, #1677ff); transform: scale(0); transition: transform .15s ease; }
.conv-cand-opt.is-checked .conv-radio-dot { transform: scale(1); }
.conv-candidates-hint { font-size: 12px; color: var(--text-tertiary, #697077); padding: 4px 2px 0; }

/* 列表（list） */
.conv-list { margin-top: 8px; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 14px; }
.conv-list-title { font-size: 13px; font-weight: 600; color: var(--text-secondary, #343a3f); margin-bottom: 6px; }
.conv-list-items { margin: 0; padding-left: 18px; color: var(--text, #121619); font-size: 13px; line-height: 1.75; }
.conv-list-items li { margin-bottom: 2px; }

/* 表格（table） */
.conv-table { margin-top: 8px; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 14px; }
.conv-table-title { font-size: 13px; font-weight: 600; color: var(--text-secondary, #343a3f); margin-bottom: 2px; }
.conv-table-subtitle { font-size: 11.5px; color: var(--text-tertiary, #697077); margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.conv-table-grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.conv-table-grid tr { border-bottom: 1px dashed #eef0f3; }
.conv-table-grid tr:last-child { border-bottom: none; }
.conv-table-k { color: var(--text-tertiary, #697077); padding: 5px 8px 5px 0; width: 92px; vertical-align: top; }
.conv-table-v { color: var(--text, #121619); padding: 5px 0; word-break: break-word; }

/* 按钮组（actions） */
.conv-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
/* 动作按钮（table-with-actions 等） */
.conv-action-btn { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 14px; border-radius: 6px; background: #fff; border: 1px solid #d0d4d9; color: var(--text, #121619); font-size: 13px; cursor: pointer; transition: .15s ease; }
.conv-action-btn:hover { border-color: var(--primary, #1677ff); color: var(--primary, #1677ff); }
.conv-action-btn.primary { background: var(--primary, #1677ff); border-color: var(--primary, #1677ff); color: #fff; }
.conv-action-btn.primary:hover { background: var(--primary-active, #129bfe); border-color: var(--primary-active, #129bfe); color: #fff; }
.conv-action-btn.is-selected { background: #e6f4ff; border-color: #91caff; color: var(--primary, #1677ff); }
.conv-action-btn:disabled { opacity: .5; cursor: default; }
/* 浅蓝边框导出按钮（image#6 风格） */
.conv-action-btn.is-export { background: #f0f7ff; border: 1.5px solid #91caff; color: var(--primary, #1677ff); font-weight: 500; }
.conv-action-btn.is-export:hover { background: #e6f4ff; border-color: var(--primary, #1677ff); color: var(--primary, #129bfe); }
.conv-action-btn.is-export.is-selected { background: #e6f4ff; border-color: var(--primary, #1677ff); color: var(--primary, #1677ff); }
.conv-action-btn.is-export .conv-btn-ic { stroke: currentColor; }
.conv-actions-export { display: flex; gap: 10px; flex-wrap: wrap; }
.conv-confirm-btn { margin-top: 4px; align-self: flex-end; height: 28px; padding: 0 14px; border-radius: 6px; background: #fff; border: 1px solid #d0d4d9; color: var(--text, #121619); font-size: 12.5px; cursor: pointer; transition: .15s ease; }
.conv-confirm-btn:hover:not(:disabled) { border-color: var(--primary, #1677ff); color: var(--primary, #1677ff); }
.conv-confirm-btn:disabled { opacity: .5; cursor: not-allowed; }

/* 详情（detail） */
.conv-detail { margin-top: 8px; background: #fafbfc; border: 1px solid #eef0f3; border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-secondary, #343a3f); }
.conv-detail-row { padding: 2px 0; }

/* ============ 简报新增结构：reuse / form / detail-block / table-with-actions ============ */

/* 物料资料输入（reuse） */
.conv-reuse { margin-top: 8px; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 14px; }
.conv-reuse-title { font-size: 13px; font-weight: 600; color: var(--text-secondary, #343a3f); margin-bottom: 6px; }
.conv-reuse-text { font-size: 13px; color: var(--text, #121619); line-height: 1.65; margin-bottom: 8px; }
.conv-reuse .conv-table-grid { margin-bottom: 6px; }
.conv-reuse-hint { font-size: 12px; color: var(--text-tertiary, #697077); padding: 6px 2px 4px; }
.conv-reuse-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.conv-reuse-action-btn { height: 28px; padding: 0 14px; border-radius: 6px; background: #fff; border: 1px solid #d0d4d9; color: var(--text, #121619); font-size: 12.5px; cursor: pointer; transition: .15s ease; }
.conv-reuse-action-btn:hover { border-color: var(--primary, #1677ff); color: var(--primary, #1677ff); }
.conv-reuse-action-btn.is-selected { background: #e6f4ff; border-color: #91caff; color: var(--primary, #1677ff); }

/* 表格内"复用"按钮（蓝色填充） */
.conv-reuse-btn { height: 26px; padding: 0 14px; border-radius: 4px; background: var(--primary, #1677ff); border: 1px solid var(--primary, #1677ff); color: #fff; font-size: 12px; font-weight: 500; cursor: pointer; transition: background-color .15s ease, border-color .15s ease, transform .1s ease; }
.conv-reuse-btn:hover { background: var(--primary-active, #129bfe); border-color: var(--primary-active, #129bfe); }
.conv-reuse-btn:active { transform: scale(0.97); }
.conv-reuse-btn.is-selected { background: #0958d9; border-color: #0958d9; }

/* 属性补齐（form） */
.conv-form { margin-top: 8px; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px 14px; }
.conv-form-title { font-size: 13px; font-weight: 600; color: var(--text-secondary, #343a3f); margin-bottom: 6px; }
.conv-form-text { font-size: 13px; color: var(--text, #121619); line-height: 1.65; margin-bottom: 10px; }
.conv-form-fields { display: flex; flex-direction: column; gap: 8px; }
.conv-form-group { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 6px 0; border-bottom: 1px dashed #eef0f3; flex-wrap: wrap; }
.conv-form-group:last-child { border-bottom: none; }
.conv-form-label { color: var(--text-tertiary, #697077); min-width: 96px; flex-shrink: 0; }
.conv-radio-group { display: inline-flex; align-items: center; gap: 18px; flex: 1; min-width: 0; }
.conv-radio-opt { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; user-select: none; }
.conv-radio { width: 14px; height: 14px; border-radius: 50%; border: 1.4px solid #c0c4cc; background: #fff; display: inline-flex; align-items: center; justify-content: center; transition: border-color .15s ease; }
.conv-radio-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary, #1677ff); transform: scale(0); transition: transform .15s ease; }
.conv-radio-opt.is-checked .conv-radio { border-color: var(--primary, #1677ff); }
.conv-radio-opt.is-checked .conv-radio-dot { transform: scale(1); }
.conv-radio-label { color: var(--text, #121619); font-size: 13px; }
.conv-form-select { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: #f0f1f3; border: 1px solid #e5e7eb; border-radius: 6px; color: var(--text-secondary, #343a3f); font-size: 13px; }
.conv-form-select-arrow { flex-shrink: 0; }
.conv-form-field { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 6px 0; border-bottom: 1px dashed #eef0f3; }
.conv-form-field:last-child { border-bottom: none; }
.conv-form-input { flex: 1; min-width: 0; height: 28px; padding: 0 10px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 13px; color: var(--text, #121619); background: #fafbfc; transition: border-color .15s ease, background-color .15s ease; }
.conv-form-input:hover { border-color: #c0c4cc; background: #fff; }
.conv-form-input:focus { outline: none; border-color: var(--primary, #1677ff); background: #fff; box-shadow: 0 0 0 2px rgba(22,119,255,.12); }
.conv-form-confirm { margin-top: 12px; height: 32px; padding: 0 18px; border-radius: 6px; background: var(--primary, #1677ff); border: 1px solid var(--primary, #1677ff); color: #fff; font-size: 13px; font-weight: 500; cursor: pointer; transition: .15s ease; }
.conv-form-confirm:hover { background: var(--primary-active, #129bfe); border-color: var(--primary-active, #129bfe); }
.conv-form-confirm.is-selected { background: #1677ff; opacity: .85; }

/* detail-block（多行文本详情） */
.conv-detail-block { margin-top: 8px; }
.conv-detail-title { font-size: 13px; font-weight: 600; color: var(--text-secondary, #343a3f); margin-bottom: 6px; }
.conv-detail-rows { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--text-secondary, #343a3f); }
.conv-detail-rows .conv-detail-row { padding: 3px 0; border-bottom: 1px dashed #f0f2f5; }
.conv-detail-rows .conv-detail-row:last-child { border-bottom: none; }

/* table-with-actions（最终物料全部完成：表格+按钮） */
.conv-table-actions { margin-top: 8px; }
.conv-table-actions-title { font-size: 13px; font-weight: 600; color: var(--text-secondary, #343a3f); margin-bottom: 6px; }
.conv-table-actions .conv-table-grid { margin-bottom: 8px; }
.conv-table-actions .conv-actions { margin-top: 4px; }

/* toast 提示 */
.conv-toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(8px); padding: 8px 16px; background: rgba(0,0,0,.78); color: #fff; font-size: 13px; border-radius: 18px; opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 9999; }
.conv-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 终止按钮（对话时显示） */
.chat-stop-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.chat-stop-btn {
  width: 40px; height: 40px; border-radius: 50%; background: var(--primary, #1677ff); border: none;
  display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background-color .2s ease, transform .15s ease;
  box-shadow: 0 2px 8px rgba(22,119,255,.25);
}
.chat-stop-btn:hover { background: var(--primary-active, #129bfe); }
.chat-stop-btn:active { transform: scale(0.96); }
.chat-stop-btn svg { fill: #fff; stroke: none; }
.chat-stop-btn rect { fill: #fff; }
.chat-stop-tooltip {
  position: absolute; bottom: calc(100% + 10px); right: 0; padding: 6px 10px; background: #2c2c2c; color: #fff;
  font-size: 12px; line-height: 1; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none;
  transform: translateY(4px); transition: opacity .15s ease, transform .15s ease; box-shadow: 0 2px 6px rgba(0,0,0,.15);
  z-index: 60;
}
.chat-stop-tooltip::after {
  content: ''; position: absolute; right: 14px; bottom: -4px; width: 8px; height: 8px; background: #2c2c2c; transform: rotate(45deg);
}
.chat-stop-wrap:hover .chat-stop-tooltip { opacity: 1; transform: translateY(0); }

.chat-footer { position: sticky; bottom: 0; left: 0; right: 0; text-align: center; color: #a0a4aa; font-size: 11.5px; padding: 6px 12px 8px; background: linear-gradient(to top, rgba(255,255,255,0.95) 60%, rgba(255,255,255,0)); pointer-events: none; z-index: 5; }
.chat-main { padding-bottom: 8px; }
.chat-toggle {
  position: absolute; left: 20px; top: 76px; width: 16px; height: 16px; z-index: 50; cursor: pointer;
}
.chat-toggle img { display: block; width: 16px; height: 16px; opacity: .7; transition: .2s; }
.chat-toggle:hover img { opacity: 1; }

/* Two-column (ontology) */
.two-col { display: flex; flex: 1; overflow: hidden; }
.left-panel { width: 260px; background: #fff; border-right: 1px solid var(--border-light); padding: 16px; overflow-y: auto; flex-shrink: 0; }
.left-panel-title { font-size: 15px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }
.left-panel-sub { font-size: 12px; color: var(--text-tertiary); margin-bottom: 14px; }
.tree-search { margin-bottom: 12px; }
.tree-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.tree-item:hover { background: #f3f5f7; }
.tree-item.active { background: #e6f4ff; color: #1677ff; }
.right-panel { flex: 1; overflow-y: auto; padding: 24px; background: #fff; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat-card { background: #f5f7fa; border-radius: 10px; padding: 20px; }
.stat-label { font-size: 13px; color: var(--text-tertiary); margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 600; color: #1677ff; display: flex; align-items: center; gap: 8px; }
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px; color: var(--text-tertiary); }
.empty-state svg { width: 80px; height: 80px; margin-bottom: 16px; opacity: .5; }

/* Dropdown action menu */
.action-menu {
  position: relative; display: inline-block;
}
.action-menu-btn { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border: 1px solid var(--border); border-radius: 6px; background: #fff; cursor: pointer; font-size: 14px; }
.action-menu-content {
  position: absolute; top: 40px; left: 0; min-width: 180px; background: #fff; border: 1px solid #f0f0f0; border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.08); display: none; z-index: 100; padding: 6px 0;
}
.action-menu:hover .action-menu-content { display: block; }
.action-menu-item { padding: 9px 14px; font-size: 13px; color: #333; cursor: pointer; display: flex; align-items: center; gap: 8px; }
.action-menu-item:hover { background: #f5f7fa; color: #1677ff; }

/* Filters row */
.filter-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.filter-left { display: flex; align-items: center; gap: 12px; }
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-label { font-size: 13px; color: var(--text-secondary); }
.select {
  height: 34px; padding: 0 28px 0 12px; border: 1px solid var(--border); border-radius: 6px; background: #fff; font-size: 14px; color: #333; appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23666' fill='none' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer;
}

/* Org card */
.org-card { width: 320px; border: 1px solid var(--border); border-radius: 12px; padding: 20px; background: #fff; position: relative; overflow: hidden; }
.org-card::before {
  content: ''; position: absolute; top: -30px; right: -30px; width: 80px; height: 80px; border-radius: 50%;
  background: #e6f4ff; opacity: .6;
}
.org-icon { width: 40px; height: 40px; border-radius: 8px; background: #e6f4ff; display: flex; align-items: center; justify-content: center; color: #1677ff; margin-bottom: 12px; }
.org-title { font-size: 16px; font-weight: 600; margin-bottom: 10px; color: #111; }
.org-meta { font-size: 13px; color: var(--text-tertiary); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.org-btn { margin-top: 14px; width: 100%; height: 36px; border-radius: 6px; background: #111; color: #fff; border: none; cursor: pointer; font-size: 13px; display: flex; align-items: center; justify-content: center; gap: 6px; }

/* Section heading with arrow */
.section-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* User profile dropdown menu */
.user-profile { position: relative; }
.user-menu {
  position: absolute; top: 46px; right: 0; min-width: 220px; background: #fff;
  border: 1px solid #f0f0f0; border-radius: 10px; box-shadow: 0 6px 24px rgba(0,0,0,0.10);
  z-index: 200; padding: 6px; display: none;
}
.user-menu.open { display: block; }
.user-menu-header { display: flex; align-items: center; gap: 10px; padding: 10px 10px 12px; border-bottom: 1px solid #f2f2f2; margin-bottom: 6px; }
.user-menu-header .user-avatar { width: 36px; height: 36px; font-size: 14px; }
.user-menu-header .um-name { font-size: 14px; font-weight: 600; color: #1f2e4d; }
.user-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 12px; border-radius: 6px; font-size: 13px; color: #333; cursor: pointer; }
.user-menu-item:hover { background: #f5f7fa; color: var(--primary); }
.user-menu-item .um-ver { color: #b0b0b0; font-size: 12px; }
.user-menu-sep { height: 1px; background: #f2f2f2; margin: 6px 0; }
.user-menu-item.danger { color: #ff4d4f; }
.user-menu-item.danger:hover { background: #fff1f0; color: #ff4d4f; }

/* Modal system */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000;
  display: none; align-items: flex-start; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  margin-top: 100px; width: 800px; max-width: calc(100vw - 40px); max-height: calc(100vh - 160px);
  background: #fff; border-radius: 8px; box-shadow: 0 6px 16px rgba(0,0,0,0.08), 0 3px 6px -4px rgba(0,0,0,0.12), 0 9px 28px 8px rgba(0,0,0,0.05);
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-lg { width: 900px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 24px;
  border-bottom: 1px solid #f0f0f0; flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 600; color: #1f2e4d; }
.modal-close { width: 28px; height: 28px; border: none; background: transparent; cursor: pointer; color: #999; font-size: 18px; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: #f5f5f5; color: #333; }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 24px; border-top: 1px solid #f0f0f0; flex-shrink: 0; }

/* Account modal */
.account-top { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.account-avatar { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(157deg, #5F6C90 12.46%, #393D49 85.12%); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 500; }
.account-name { font-size: 18px; font-weight: 600; color: #1f2e4d; }
.account-badges { display: flex; gap: 32px; margin-bottom: 24px; padding: 16px 20px; background: #f7f9fb; border-radius: 8px; }
.account-badge .ab-label { font-size: 12px; color: #8a94a6; margin-bottom: 4px; }
.account-badge .ab-value { font-size: 14px; color: #1f2e4d; font-weight: 500; }
.account-section-title { font-size: 14px; font-weight: 600; color: #1f2e4d; margin: 20px 0 12px; }
.account-field { display: flex; align-items: center; padding: 12px 0; border-bottom: 1px solid #f2f2f2; font-size: 14px; }
.account-field .af-label { width: 120px; color: #8a94a6; flex-shrink: 0; }
.account-field .af-value { color: #1f2e4d; flex: 1; }
.account-field .af-hint { color: #8a94a6; font-size: 13px; flex: 1; }
.account-int { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border: 1px solid #eef0f3; border-radius: 8px; margin-top: 6px; }
.account-int .ai-title { font-size: 13px; font-weight: 600; color: #1f2e4d; }
.account-int .ai-desc { font-size: 12px; color: #8a94a6; margin-top: 2px; }

/* Settings modal fields */
.setting-block { margin-bottom: 20px; }
.setting-block-title { font-size: 14px; font-weight: 600; color: #1f2e4d; margin-bottom: 10px; }
.setting-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.setting-row .sr-label { width: 120px; font-size: 13px; color: #4a5568; flex-shrink: 0; }

/* About modal */
.about-version { font-size: 14px; color: #1f2e4d; margin-bottom: 16px; }
.about-version b { font-weight: 600; }
.about-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.about-table th { text-align: left; padding: 10px 12px; background: #f7f9fb; color: #4a5568; font-weight: 600; border: 1px solid #eef0f3; white-space: nowrap; }
.about-table td { padding: 10px 12px; border: 1px solid #eef0f3; color: #4a5568; vertical-align: top; line-height: 1.7; }

/* Help toast */
.toast-box { text-align: center; padding: 24px 16px 8px; }
.toast-box .tb-msg { font-size: 15px; color: #1f2e4d; margin-bottom: 4px; }

/* Screen adaptation / responsive */
@media (max-width: 1199px) {
  .app-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
  .page-container { padding: 20px 24px; }
}
@media (max-width: 991px) {
  .page-container { padding: 16px 20px; }
  .app-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
  .chat-input-card { max-width: 100%; margin: 0 16px; }
  .two-col { flex-direction: column; }
  .left-panel { width: 100%; border-right: none; border-bottom: 1px solid var(--border-light); }
}
@media (max-width: 767px) {
  .app-topbar { padding: 0 12px; height: 48px; }
  .top-nav { display: none; }
  .page-container { padding: 12px 16px; }
  .app-grid, .stats-grid { grid-template-columns: 1fr; }
  .filter-row { flex-direction: column; align-items: flex-start; }
  .chat-sidebar.expanded { width: 220px; }
  .chat-hero-title { font-size: 22px; }
}
