/* ===== 设计变量（与原站一致） ===== */
:root {
  --Bg-Primary: #EAF3FB;
  --Bg-Primary-hover: #D8EAF7;
  --Bg-Secondary: #EAF3FB;
  --Labels-Primary: #000000e5;
  --Labels-Primary-hover: #000000b8;
  --Labels-Secondary: #0000008c;
  --Labels-Tertiary: #00000059;
  --Labels-Quaternary: #0000002e;
  --Separators-S1: #0000000f;
  --Fills-F1: #FFFFFF99;
  --Fills-F1-hover: #FFFFFFCC;
  --Fills-F2: #D8EAF799;
  --Fills-F3: #D8EAF7CC;
  --Fills-F3-hover: #C5DFF2;
  --Fills-F4: #B8D2E7;
  --Colors-KMBlue: #5385C5;
  --Colors-Red: #ef4444;
  --Others-KMBlue10: #4f46e514;
  --Others-KMBlue10-hover: #4f46e524;
  --MaskBg-Base: #0006;
  --chat-input-max-width: 768px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  color: var(--Labels-Primary);
  background: var(--Bg-Secondary);
  font-size: 14px;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; outline: none; }
a { color: var(--Colors-KMBlue); text-decoration: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #0002; border-radius: 4px; }

/* ===== 登录页 ===== */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: #f2f2f4; }
.login-card { display: flex; width: 880px; max-width: 100%; min-height: 560px; background: #fff; border-radius: 20px; overflow: hidden; box-shadow: 0 12px 48px rgba(0,0,0,.10); }
.login-left { flex: 1; background: #8FB8DA; color: #15324B; padding: 40px 36px; display: flex; flex-direction: column; }
.login-left .chip { display: inline-flex; align-items: center; gap: 8px; background: #ffffff14; border: 1px solid #ffffff22; border-radius: 999px; padding: 6px 14px; font-size: 13px; color: #e5e5ea; width: fit-content; }
.login-left .chip img { width: 18px; height: 18px; border-radius: 5px; object-fit: cover; }
.login-left h1 { font-size: 34px; margin: 26px 0 14px; }
.login-left p { color: #a1a1aa; line-height: 1.8; font-size: 14px; }
.login-left .tags { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.login-left .tags span { background: #ffffff10; border-radius: 10px; padding: 12px; font-size: 13px; color: #d4d4d8; }
.login-right { flex: 1.1; padding: 44px 48px; display: flex; flex-direction: column; align-items: center; }
.login-right .logo { width: 56px; height: 56px; border-radius: 14px; object-fit: cover; }
.login-right h2 { font-size: 22px; margin: 14px 0 6px; }
.login-right .sub { color: var(--Labels-Secondary); font-size: 13px; margin-bottom: 26px; }
.login-tabs { display: flex; width: 100%; background: var(--Fills-F2); border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.login-tabs button { flex: 1; padding: 8px; border-radius: 8px; font-size: 14px; color: var(--Labels-Secondary); }
.login-tabs button.active { background: #fff; color: var(--Labels-Primary); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.login-form { width: 100%; display: flex; flex-direction: column; gap: 12px; }
.login-form input[type=text], .login-form input[type=password], .login-form input[type=email] {
  width: 100%; border: 1px solid var(--Separators-S1); background: var(--Fills-F1);
  border-radius: 12px; padding: 13px 15px; font-size: 14px;
  background: #fff;
}
.login-form input:focus { border-color: var(--Colors-KMBlue); background: #fff; }
.captcha-row { display: flex; gap: 10px; }
.captcha-row input { flex: 1; }
.captcha-img { width: 110px; height: 44px; border-radius: 8px; cursor: pointer; border: 1px solid var(--Separators-S1); background: #f1f5f9; }
.login-submit { margin-top: 6px; background: #5385C5; color: #fff; border-radius: 10px; padding: 12px; font-size: 15px; font-weight: 600; }
.login-submit:hover { opacity: .88; }
.login-submit:disabled { opacity: .5; cursor: not-allowed; }
.login-link { margin-top: 16px; font-size: 13px; }
.login-error { color: var(--Colors-Red); font-size: 13px; min-height: 18px; }

/* ===== 主框架 ===== */
.layout { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 260px; flex-shrink: 0; background: var(--Bg-Primary); border-right: .5px solid var(--Separators-S1);
  display: flex; flex-direction: column; height: 100vh; transition: margin-left .25s cubic-bezier(.4,0,.2,1);
}
.layout.collapsed .sidebar { margin-left: -260px; }
.sidebar-header { border-bottom: .5px solid var(--Separators-S1); height: 50px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.sidebar-logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; cursor: pointer; }
.sidebar-logo img { width: 22px; height: 22px; border-radius: 6px; object-fit: cover; }
.icon-btn { width: 28px; height: 28px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: var(--Labels-Tertiary); }
.icon-btn:hover { background: var(--Fills-F2); color: var(--Labels-Primary); }
.sidebar-body { flex: 1; overflow-y: auto; padding: 10px 10px 16px; display: flex; flex-direction: column; }
.credits-bar { background: var(--Fills-F1); border-radius: 8px; display: flex; align-items: center; justify-content: space-between; padding: 6px 10px; margin-bottom: 8px; cursor: pointer; }
.credits-bar-info { display: flex; align-items: center; gap: 4px; color: var(--Labels-Secondary); font-size: 13px; white-space: nowrap; }
.credits-bar-info svg { width: 14px; height: 14px; flex-shrink: 0; }
.credits-bar-value { color: var(--Labels-Primary); font-weight: 600; font-size: 14px; }
.credits-bar-btn { color: #fff; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 4px; padding: 2px 10px; font-size: 12px; }
.credits-bar-btn:hover { opacity: .85; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 14px; color: var(--Labels-Primary); width: 100%; text-align: left; }
.nav-item:hover { background: var(--Fills-F2); }
.nav-item.active { background: var(--Fills-F3); font-weight: 600; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.history-label { display: flex; align-items: center; gap: 6px; color: var(--Labels-Tertiary); font-size: 12px; padding: 14px 10px 6px; white-space: nowrap; }
.history-label svg { width: 13px; height: 13px; flex-shrink: 0; }
.history-list { display: flex; flex-direction: column; gap: 2px; }
.history-item { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--Labels-Primary); }
.history-item:hover { background: var(--Fills-F2); }
.history-item.active { background: var(--Fills-F3); }
.history-item .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.history-item .t::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: #22c55e; flex-shrink: 0; }
.history-item .del { opacity: 0; color: var(--Labels-Tertiary); flex-shrink: 0; border-radius: 4px; padding: 2px; }
.history-item:hover .del { opacity: 1; }
.history-item .del:hover { color: var(--Colors-Red); background: var(--Fills-F3); }
.sidebar-user { border-top: .5px solid var(--Separators-S1); padding: 10px 12px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.sidebar-user:hover { background: var(--Fills-F1); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg,#667eea,#764ba2); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.sidebar-user .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--Labels-Secondary); }

.main { flex: 1; overflow-y: auto; position: relative; background: var(--Bg-Primary); }

/* ===== 工作台首页 ===== */
.home { max-width: 860px; margin: 0 auto; padding: 56px 24px 80px; }
.home-center { text-align: center; margin-bottom: 26px; }
.home-center .hero-icon { width: 46px; height: 46px; margin: 0 auto 10px; color: var(--Labels-Primary); }
.home-center h1 { font-size: 20px; font-weight: 700; }
.home-center .sub { color: var(--Labels-Secondary); font-size: 13px; margin-top: 6px; }
.home-banner { display: flex; justify-content: center; margin-bottom: 22px; }
.home-banner img { max-width: 460px; width: 100%; border-radius: 16px; }

.chat-input-card {
  max-width: var(--chat-input-max-width); margin: 0 auto; background: #fff;
  border: 1px solid var(--Separators-S1); border-radius: 20px; padding: 14px 16px 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,.05);
}
.chat-input-card textarea { width: 100%; border: none; resize: none; font-size: 15px; min-height: 44px; background: transparent; }
.chat-input-card textarea::placeholder { color: var(--Labels-Quaternary); }
.chat-input-bar { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.chat-input-bar .spacer { flex: 1; }
.attach-btn { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--Separators-S1); display: flex; align-items: center; justify-content: center; color: var(--Labels-Secondary); }
.attach-btn svg { width: 15px; height: 15px; }
.attach-btn:hover { background: var(--Fills-F2); }
.icon-btn svg { width: 16px; height: 16px; }
.mode-pill { display: inline-flex; align-items: center; gap: 5px; background: var(--Others-KMBlue10); color: var(--Colors-KMBlue); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; }
.mode-pill svg { width: 14px; height: 14px; }
.cost-hint { color: var(--Labels-Tertiary); font-size: 12px; }
.model-switch { position: relative; display: inline-flex; align-items: center; gap: 5px; background: var(--Fills-F2); color: var(--Labels-Secondary); border: 1px solid var(--Separators-S1); border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; user-select: none; }
.model-switch .model-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.model-switch .model-dot.on { background: #1E6B4F; }
.model-switch .model-dot.off { background: #F59E0B; }
.model-switch .caret { font-size: 9px; opacity: .6; }
.model-menu { display: none; position: absolute; bottom: calc(100% + 6px); left: 0; min-width: 150px; background: #fff; border: 1px solid var(--Separators-S1); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; z-index: 50; }
.model-menu.open { display: block; }
.model-opt { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 7px; font-size: 12px; color: var(--Labels-Primary); cursor: pointer; }
.model-opt small { color: var(--Labels-Tertiary); font-weight: 400; margin-left: 2px; }
.model-opt:hover { background: var(--Fills-F2); }
.model-opt.active { background: var(--Others-KMBlue10); color: var(--Colors-KMBlue); }
.send-btn { width: 34px; height: 34px; border-radius: 50%; background: #5385C5; color: #fff; display: flex; align-items: center; justify-content: center; }
.send-btn:hover { opacity: .85; }
.send-btn:disabled { background: var(--Fills-F4); color: #fff; cursor: not-allowed; }
.send-btn svg { width: 16px; height: 16px; }

.tpl-tabs { display: flex; justify-content: center; gap: 20px; margin: 26px 0 18px; }
.tpl-tabs button { font-size: 13px; color: var(--Labels-Secondary); padding: 4px 2px; position: relative; }
.tpl-tabs button.active { color: var(--Labels-Primary); font-weight: 600; }
.tpl-tabs button.active::after { content: ''; position: absolute; left: 20%; right: 20%; bottom: -4px; height: 2px; border-radius: 2px; background: var(--Labels-Primary); }
.tpl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.tpl-card { text-align: center; }
.tpl-thumb { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--Separators-S1); aspect-ratio: 4/3; background: #f6f6f8; cursor: pointer; }
.tpl-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.tpl-thumb:hover img { transform: scale(1.03); }
.tpl-thumb .mask { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #0009; opacity: 0; transition: opacity .2s; display: flex; align-items: center; justify-content: center; gap: 8px; }
.tpl-thumb:hover .mask { opacity: 1; }
.tpl-thumb .mask button { background: #fff; color: var(--Labels-Primary); border-radius: 8px; padding: 7px 16px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.tpl-thumb .selected-mask { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: #0007; display: flex; align-items: center; justify-content: center; gap: 6px; color: #fff; font-size: 13px; font-weight: 600; }
.tpl-thumb.selected { outline: 2px solid var(--Colors-KMBlue); outline-offset: 2px; }
.tpl-name { margin-top: 8px; font-size: 13px; color: var(--Labels-Primary); }

.case-section { margin-top: 30px; }
.case-title { font-size: 13px; color: var(--Labels-Tertiary); margin-bottom: 12px; }
.case-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.case-card { border-radius: 10px; overflow: hidden; background: #e9f0ec; cursor: pointer; }
.case-card img { width: 100%; aspect-ratio: 4/2.6; object-fit: cover; display: block; }
.case-card .n { text-align: center; font-size: 13px; padding: 10px 0 4px; background: #fff; }
.case-card.dark { background: #1c1c22; }

/* ===== 会话页 ===== */
.chat-page { display: flex; flex-direction: column; height: 100vh; }
.chat-scroll { flex: 1; overflow-y: auto; }
.chat-inner { max-width: var(--chat-input-max-width); margin: 0 auto; padding: 20px 24px 30px; }
.msg-user { display: flex; justify-content: flex-end; margin-bottom: 18px; }
.msg-user .bubble { background: var(--Fills-F3); border-radius: 16px 16px 4px 16px; padding: 10px 16px; font-size: 15px; max-width: 80%; }
.msg-assistant { display: flex; gap: 10px; margin-bottom: 16px; }
.assistant-avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg,#667eea,#764ba2); display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; }
.assistant-avatar svg { width: 16px; height: 16px; color: #fff; }
.assistant-body { flex: 1; min-width: 0; }
.assistant-text { font-size: 14.5px; line-height: 1.85; white-space: pre-wrap; margin: 8px 0; }
.assistant-text strong { font-weight: 700; }

.think-card { border-left: 2px solid var(--Fills-F4); margin: 8px 0; padding: 2px 0 2px 12px; color: var(--Labels-Secondary); font-size: 13px; cursor: pointer; }
.think-card .th-title { display: flex; align-items: center; gap: 6px; color: var(--Labels-Tertiary); }
.th-title svg { width: 13px; height: 13px; flex-shrink: 0; }
.think-card .th-body { margin-top: 6px; line-height: 1.7; display: none; }
.think-card.open .th-body { display: block; }

.step-card { border: 1px solid var(--Separators-S1); border-radius: 10px; margin: 8px 0; overflow: hidden; background: #fff; }
.step-head { display: flex; align-items: center; gap: 8px; padding: 9px 12px; cursor: pointer; font-size: 13px; color: var(--Labels-Secondary); }
.step-head:hover { background: var(--Fills-F1); }
.step-head svg.tool { width: 15px; height: 15px; color: var(--Labels-Tertiary); }
.step-head .tool-name { color: var(--Labels-Primary); }
.step-head .step-label { color: var(--Labels-Tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-head .chev { margin-left: auto; transition: transform .2s; color: var(--Labels-Quaternary); }
.step-card.open .step-head .chev { transform: rotate(180deg); }
.step-detail { display: none; padding: 4px 12px 12px; }
.step-card.open .step-detail { display: block; }
.req-block { background: var(--Fills-F1); border-radius: 8px; padding: 8px 12px; margin-top: 8px; }
.req-block .req-label { font-size: 12px; color: var(--Labels-Tertiary); margin-bottom: 4px; }
.req-block pre { font-family: 'SF Mono', Consolas, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-all; color: var(--Labels-Primary); margin: 0; }
.step-running .step-head::after { content: ''; width: 12px; height: 12px; border: 2px solid var(--Colors-KMBlue); border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; margin-left: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

.file-card { display: flex; align-items: center; gap: 12px; border: 1px solid var(--Separators-S1); border-radius: 12px; padding: 12px 14px; margin: 8px 0; background: #fff; }
.file-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.file-icon { width: 38px; height: 38px; border-radius: 9px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.file-icon.pptd { background: #fff1e6; color: #ea580c; }
.file-icon.json { background: #eef2ff; color: #4f46e5; }
.file-icon.pptx { background: #fef2f2; color: #dc2626; }
.file-icon.xlsx { background: #ecfdf5; color: #059669; }
.file-icon.docx { background: #eff6ff; color: #2563eb; }
.file-icon.pdf  { background: #fef2f2; color: #dc2626; }
.file-icon.md { background: #f5f3ff; color: #7c3aed; }
.file-icon svg { width: 20px; height: 20px; }
/* p105：预览弹窗内的辅助说明（如「转版 PDF · A4」） */
.pv-hint { font-size: 12px; color: #94A3B8; }
.file-meta { flex: 1; min-width: 0; }
.file-meta .fn { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta .fk { font-size: 12px; color: var(--Labels-Tertiary); margin-top: 2px; }
.file-actions { display: flex; gap: 8px; }
.file-actions button { border: 1px solid var(--Separators-S1); background: var(--Fills-F1); border-radius: 8px; padding: 6px 14px; font-size: 13px; }
.file-actions button:hover { background: var(--Fills-F3); }

.chat-bottom { flex-shrink: 0; background: linear-gradient(to top, #fff 70%, transparent); padding: 8px 24px 4px; }
.chat-bottom .chat-input-card { border-radius: 22px; }
.chat-disclaimer { text-align: center; color: var(--Labels-Quaternary); font-size: 11px; padding: 6px 0 8px; }
.scroll-bottom-btn { position: absolute; right: 24px; bottom: 130px; width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 1px solid var(--Separators-S1); box-shadow: 0 2px 8px rgba(0,0,0,.1); display: flex; align-items: center; justify-content: center; color: var(--Labels-Secondary); z-index: 5; }

/* ===== 弹窗 ===== */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--MaskBg-Base); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 16px; width: 400px; max-width: calc(100vw - 40px); padding: 24px; position: relative; animation: pop .18s ease-out; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }
.modal h3 { font-size: 17px; }
.modal .modal-sub { color: var(--Labels-Secondary); font-size: 13px; margin: 8px 0 16px; }
.modal input { width: 100%; border: 1px solid var(--Separators-S1); background: var(--Fills-F1); border-radius: 10px; padding: 11px 14px; font-size: 14px; }
.modal input:focus { border-color: var(--Colors-KMBlue); background: #fff; }
.modal-btns { display: flex; gap: 10px; margin-top: 18px; }
.modal-btns button { flex: 1; padding: 10px; border-radius: 10px; font-size: 14px; }
.modal-btns .cancel { background: var(--Fills-F2); }
.modal-btns .cancel:hover { background: var(--Fills-F3); }
.modal-btns .ok { background: #8b83f0; color: #fff; font-weight: 600; }
.modal-btns .ok:hover { background: var(--Colors-KMBlue); }
.modal-btns .ok:disabled { background: var(--Fills-F4); cursor: not-allowed; }
.modal-close { position: absolute; top: 14px; right: 14px; }
.redeem-icon { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg,#667eea,#764ba2); display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.redeem-icon svg { width: 22px; height: 22px; color: #fff; }
.credits-current { color: var(--Labels-Secondary); font-size: 13px; padding-bottom: 10px; border-bottom: 1px solid var(--Separators-S1); margin-bottom: 6px; }
.credit-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--Separators-S1); }
.credit-row:last-child { border-bottom: none; }
.credit-row .reason { font-size: 14px; }
.credit-row .at { font-size: 12px; color: var(--Labels-Tertiary); margin-top: 3px; }
.credit-row .delta { font-weight: 700; font-size: 15px; }
.credit-row .delta.plus { color: #16a34a; }
.credit-row .delta.minus { color: var(--Colors-Red); }
.tpl-preview-img { width: 100%; border-radius: 10px; border: 1px solid var(--Separators-S1); margin: 12px 0; }
.modal-error { color: var(--Colors-Red); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* toast */
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); background: #141419; color: #fff; border-radius: 10px; padding: 10px 20px; font-size: 14px; z-index: 200; animation: pop .2s; }

@media (max-width: 900px) {
  .tpl-grid, .case-grid { grid-template-columns: repeat(2, 1fr); }
  .login-left { display: none; }
}

/* ---------- 生成进度 / 排队可视化 ---------- */
.gen-status { padding: 6px 2px; }
.gen-stage { font-size: 14px; font-weight: 600; color: var(--Labels-Primary); margin-bottom: 8px; }
.queue-line { font-size: 13px; color: var(--Labels-Secondary); margin-bottom: 10px; }
.gen-progress { position: relative; height: 8px; border-radius: 6px; background: var(--Fills-F1); overflow: hidden; }
.gen-bar { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: linear-gradient(90deg, #4f46e5, #22c55e); transition: width .4s ease; }
.gen-pct { position: absolute; right: 0; top: -22px; font-size: 12px; color: var(--Labels-Tertiary); }
.gen-progress { margin-bottom: 18px; }

/* ---------- 分步折叠式书写进度 ---------- */
.gen-group { margin: 6px 0 4px; border-radius: 10px; border: 1px solid var(--Fills-F1, #eef0f4); overflow: hidden; background: #fff; }
.gen-group-head { cursor: pointer; padding: 8px 12px; font-size: 13px; font-weight: 600; color: var(--Labels-Primary, #1e293b); display: flex; align-items: center; gap: 8px; user-select: none; background: var(--Fills-F1, #f6f7fa); }
.gen-group-head:hover { background: #eef0f4; }
.gen-chev { display: inline-block; transition: transform .2s ease; color: #4f46e5; font-size: 12px; }
.gen-group.open .gen-chev { transform: rotate(90deg); }
.gen-group-count { margin-left: auto; font-size: 11px; color: var(--Labels-Tertiary, #64748b); background: #fff; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--Fills-F1, #eef0f4); }
.gen-group-body { display: none; padding: 8px 12px 8px 30px; border-top: 1px solid var(--Fills-F1, #eef0f4); background: #fafbfc; }
.gen-group.open .gen-group-body { display: block; }
.gen-step { padding: 3px 0; font-size: 13px; color: var(--Labels-Secondary, #475569); line-height: 1.5; }
.gen-step::before { content: '·'; color: #94a3b8; margin-right: 6px; }
.gen-row { padding: 8px 12px; margin: 5px 0; border-radius: 8px; background: #fff; border: 1px solid var(--Fills-F1, #eef0f4); font-size: 13px; color: var(--Labels-Primary); display: flex; align-items: center; gap: 8px; animation: genRowIn .4s ease; transition: border-color .3s, box-shadow .3s; }
.gen-icon { color: #4f46e5; font-size: 14px; flex-shrink: 0; }
.gen-row-latest { border-color: #4f46e5; box-shadow: 0 0 0 2px rgba(79,70,229,.12); background: linear-gradient(90deg, #f8f9ff 0%, #fff 60%); }
@keyframes genRowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Floating fallback：当 chat 视图未建立时，自动挂在 document.body 上 */
.agent-card-fb {
  position: fixed;
  top: 80px;
  right: 24px;
  width: 380px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(79,70,229,.18), 0 0 0 1px rgba(79,70,229,.12);
  z-index: 9999;
  padding: 14px 16px 12px;
  font-size: 13px;
  color: var(--Labels-Primary, #1e293b);
  animation: agentFbIn .3s ease;
}
.agent-card-fb .agent-fb-hint {
  background: linear-gradient(90deg, #fff7ed, #fff);
  border: 1px solid #fed7aa;
  color: #c2410c;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 8px;
  margin-bottom: 10px;
}
.agent-card-fb .agent-task-head { display: flex; align-items: center; gap: 8px; padding: 4px 0 10px; border-bottom: 1px solid var(--Fills-F1, #eef0f4); margin-bottom: 10px; }
.agent-card-fb .agent-task-dot { color: #4f46e5; font-size: 14px; }
.agent-card-fb .agent-task-title { font-size: 14px; font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-card-fb .agent-task-tag { background: #eef0ff; color: #4f46e5; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.agent-card-fb .agent-queue { background: #fff7ed; color: #9a3412; font-size: 12px; padding: 6px 10px; border-radius: 8px; margin-bottom: 8px; }
.agent-card-fb .agent-status { font-size: 13px; color: var(--Labels-Secondary); margin: 8px 0; }
.agent-card-fb .agent-progress { height: 6px; background: var(--Fills-F1, #eef0f4); border-radius: 3px; overflow: hidden; }
.agent-card-fb .agent-bar { height: 100%; background: linear-gradient(90deg, #4f46e5, #7c3aed); transition: width .35s ease; }
.agent-card-fb .agent-pct { font-size: 11px; color: var(--Labels-Tertiary); margin-top: 4px; text-align: right; }
.agent-card-fb .agent-tool { border: 1px solid var(--Fills-F1); border-radius: 10px; margin: 6px 0; background: #fff; overflow: hidden; }
.agent-card-fb .agent-tool-head { padding: 8px 12px; cursor: pointer; display: flex; align-items: center; gap: 8px; background: var(--Fills-F1); font-size: 13px; font-weight: 600; }
.agent-card-fb .agent-tool-body { display: none; padding: 8px 12px; border-top: 1px solid var(--Fills-F1); background: #fafbfc; }
.agent-card-fb .agent-tool.open .agent-tool-body { display: block; }
.agent-card-fb .agent-tool.open .agent-chev { transform: rotate(90deg); }
.agent-card-fb .agent-tool-latest { border-color: #4f46e5; box-shadow: 0 0 0 2px rgba(79,70,229,.12); }
.agent-card-fb .agent-chev { transition: transform .2s ease; color: #4f46e5; }
.agent-card-fb .agent-tool-icon { color: #4f46e5; }
.agent-card-fb .agent-tool-label { flex: 1; }
.agent-card-fb .agent-box-wrap { margin: 4px 0; }
.agent-card-fb .agent-box-label { font-size: 11px; color: var(--Labels-Tertiary); margin-bottom: 2px; font-weight: 600; }
.agent-card-fb .agent-box { background: #fff; border: 1px solid var(--Fills-F1); border-radius: 6px; padding: 6px 8px; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all; color: var(--Labels-Secondary); }
.agent-card-fb .file-card { background: #f8fafc; border: 1px solid var(--Fills-F1); border-radius: 8px; padding: 8px 10px; margin-top: 6px; display: flex; align-items: center; gap: 8px; }
.agent-card-fb .file-card .fn { font-weight: 600; font-size: 12px; }
.agent-card-fb .file-card .fk { font-size: 11px; color: var(--Labels-Tertiary); }
.agent-card-fb .file-card .file-actions { margin-left: auto; }
.agent-card-fb .file-card button { background: #fff; border: 1px solid var(--Fills-F1); border-radius: 6px; padding: 3px 8px; font-size: 11px; cursor: pointer; }
@keyframes agentFbIn { from { opacity: 0; transform: translateY(-8px) scale(.96); } to { opacity: 1; transform: none; } }
@media (max-width: 720px) { .agent-card-fb { width: calc(100vw - 32px); right: 16px; top: 70px; } }

/* ===== 工具调用链式进度（Kimi Agent 风格：顶层任务卡 + 可折叠 Request/Response 工具子卡） ===== */
.agent-card {
  margin: 4px 0 8px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--Separators-S1);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.agent-task-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--Separators-S1);
  margin-bottom: 10px;
}
.agent-task-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--Colors-KMBlue);
  flex-shrink: 0;
}
.agent-task-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--Labels-Primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-task-tag {
  font-size: 11px;
  color: var(--Colors-KMBlue);
  background: var(--Others-KMBlue10);
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}
.agent-tools {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.agent-tool {
  border: 1px solid var(--Fills-F1);
  border-radius: 10px;
  background: #fafbfc;
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.agent-tool-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--Labels-Primary);
}
.agent-tool-head:hover { background: #f3f4f7; }
.agent-tool-icon { color: var(--Colors-KMBlue); font-size: 14px; flex-shrink: 0; }
.agent-tool-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-chev {
  color: var(--Labels-Tertiary);
  font-size: 11px;
  flex-shrink: 0;
  transition: transform 0.2s;
}
.agent-tool-body {
  display: none;
  padding: 4px 12px 12px 34px;
  border-top: 1px solid var(--Fills-F1);
  background: #fff;
}
.agent-tool.open .agent-tool-body { display: block; }
.agent-tool.open {
  background: #fff;
  border-color: var(--Colors-KMBlue);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.08);
}
.agent-tool-latest { animation: agentToolIn 0.45s ease; }
@keyframes agentToolIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.agent-box-wrap { margin-top: 8px; }
.agent-box-label {
  font-size: 11px;
  color: var(--Labels-Tertiary);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}
.agent-box {
  font-size: 12.5px;
  color: var(--Labels-Secondary);
  background: #f6f7fa;
  border: 1px solid var(--Fills-F1);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}
.agent-req .agent-box { background: #fff; }
.agent-resp .agent-box {
  background: #f0f4ff;
  border-color: #e0e7ff;
  color: var(--Labels-Primary);
}
.agent-queue {
  font-size: 12px;
  color: var(--Labels-Secondary);
  margin: 8px 2px 6px;
}
.agent-status {
  font-size: 13px;
  color: var(--Labels-Primary);
  margin: 10px 2px 6px;
  font-weight: 500;
}
.agent-progress {
  position: relative;
  height: 6px;
  border-radius: 4px;
  background: var(--Fills-F1);
  overflow: hidden;
  margin: 6px 2px 0;
}
.agent-bar {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, #4f46e5, #22c55e);
  transition: width 0.5s ease;
}
.agent-pct {
  text-align: right;
  font-size: 11px;
  color: var(--Labels-Tertiary);
  margin-top: 3px;
}

/* ===== 附件上传（回形针菜单） ===== */
.chat-input-card { position: relative; }
.attach-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.attach-chips:empty { display: none; margin: 0; }
.att-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--Fills-F1); border: 1px solid var(--Separators-S1); border-radius: 8px; padding: 4px 8px; font-size: 12px; max-width: 240px; }
.att-chip.uploading { opacity: .55; }
.att-chip .att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; font-weight: 500; }
.att-chip .att-size { color: var(--Labels-Tertiary); flex-shrink: 0; }
.att-chip button { color: var(--Labels-Tertiary); font-size: 14px; line-height: 1; padding: 0 2px; border-radius: 4px; }
.att-chip button:hover { color: var(--Colors-Red); }
.attach-menu { display: none; position: absolute; left: 14px; bottom: 52px; background: #fff; border: 1px solid var(--Separators-S1); border-radius: 14px; box-shadow: 0 10px 32px rgba(0,0,0,.14); padding: 6px; z-index: 60; min-width: 158px; animation: pop .15s ease-out; }
.attach-menu.open { display: block; }
.attach-menu-item { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 9px; font-size: 13.5px; color: var(--Labels-Primary); cursor: pointer; }
.attach-menu-item:hover { background: var(--Fills-F2); }
.attach-menu-item svg { width: 16px; height: 16px; color: var(--Labels-Secondary); flex-shrink: 0; }
.att-chips-static { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.att-chip.static { background: #fff; cursor: default; }

/* 常用语 / 专业数据库 弹窗 */
.phrase-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.phrase-item { text-align: left; background: var(--Fills-F1); border: 1px solid var(--Separators-S1); border-radius: 10px; padding: 11px 14px; font-size: 14px; }
.phrase-item:hover { background: var(--Others-KMBlue10); border-color: #c7d2fe; color: var(--Colors-KMBlue); }
.db-loading { min-height: 80px; }
.db-empty { padding: 26px 10px; text-align: center; color: var(--Labels-Tertiary); font-size: 13px; }
.db-row { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-bottom: 1px solid var(--Separators-S1); cursor: pointer; border-radius: 8px; }
.db-row:hover { background: var(--Fills-F1); }
.db-row:last-child { border-bottom: none; }
.db-icon { color: var(--Colors-KMBlue); display: flex; }
.db-icon svg { width: 18px; height: 18px; }
.db-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 500; }
.db-meta { color: var(--Labels-Tertiary); font-size: 12px; flex-shrink: 0; }
.db-add { background: var(--Others-KMBlue10); color: var(--Colors-KMBlue); border-radius: 8px; padding: 5px 12px; font-size: 12.5px; font-weight: 600; flex-shrink: 0; }
.db-row:hover .db-add { background: var(--Colors-KMBlue); color: #fff; }

/* ---------- PPT 模板大窗预览（参考站式） ---------- */
.tplv-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: var(--MaskBg-Base); display: flex; align-items: center; justify-content: center; z-index: 120; animation: pop .18s ease-out; }
.tplv-card { background: #fff; border-radius: 14px; width: min(860px, 94vw); height: min(88vh, 900px); display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 18px 60px rgba(0,0,0,.22); }
.tplv-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 10px; flex-shrink: 0; }
.tplv-name { font-size: 17px; font-weight: 700; color: var(--Labels-Primary); }
.tplv-meta { font-size: 12px; color: var(--Labels-Tertiary); margin-top: 4px; }
.tplv-actions { display: flex; align-items: center; gap: 12px; }
.tplv-use { padding: 9px 18px; border: none; border-radius: 20px; background: #111; color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; }
.tplv-use:hover { background: #333; }
.tplv-close { width: 30px; height: 30px; border: none; border-radius: 50%; background: var(--Fills-F2); color: var(--Labels-Secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.tplv-close:hover { background: var(--Fills-F3); color: var(--Labels-Primary); }
.tplv-tabs { padding: 0 20px; border-bottom: 1px solid var(--Separators-S1); flex-shrink: 0; }
.tplv-tabs button { border: none; background: none; font-size: 13px; padding: 8px 2px; margin-right: 16px; color: var(--Labels-Tertiary); cursor: default; border-bottom: 2px solid transparent; }
.tplv-tabs button.active { color: var(--Labels-Primary); font-weight: 600; border-bottom-color: var(--Labels-Primary); }
.tplv-body { flex: 1; overflow-y: auto; background: #f7f7f5; padding: 18px 22px; }
.tplv-body::-webkit-scrollbar { width: 8px; }
.tplv-body::-webkit-scrollbar-thumb { background: #d6d6d2; border-radius: 4px; }
.tplv-body::-webkit-scrollbar-track { background: transparent; }
.tplv-page { position: relative; margin-bottom: 16px; border-radius: 10px; overflow: hidden; box-shadow: 0 2px 10px rgba(0,0,0,.08); background: #fff; }
.tplv-page img { width: 100%; display: block; }
.tplv-pageno { position: absolute; left: 10px; bottom: 10px; min-width: 24px; text-align: center; padding: 2px 7px; border-radius: 12px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; }
.tplv-desc { color: var(--Labels-Secondary); font-size: 13px; text-align: center; padding: 6px 0 4px; }

/* —— 实时生成过程（2026-08-31）：蹦卡动画 + 每页 16:9 预览窗口 + 底部悬浮状态条 —— */
.agent-tool.tool-enter { animation: toolEnter 0.4s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes toolEnter {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.agent-page-prev { position: relative; margin-top: 10px; border: 1px solid var(--Fills-F1); border-radius: 12px; background: #fff; overflow: hidden; box-shadow: 0 4px 18px rgba(0, 0, 0, 0.07); }
.agent-page-prev .prev-tag { position: absolute; top: 8px; left: 8px; z-index: 2; background: rgba(17, 24, 39, 0.72); color: #fff; font-size: 11px; line-height: 1; padding: 4px 9px; border-radius: 6px; backdrop-filter: blur(4px); }
.agent-page-prev .prev-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; }
.agent-page-prev .prev-frame iframe { position: absolute; top: 0; left: 0; width: 960px; height: 540px; border: 0; transform-origin: 0 0; background: #fff; }
.agent-page-prev .prev-note { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9; font-size: 12px; color: var(--Labels-Tertiary); background: #fafbfc; }


/* 流式生成过程（2026-08-31）：工具卡内模型输出逐字实时展示 */
.agent-stream .agent-stream-body { padding: 10px 14px 12px 34px; }
.agent-stream-txt { margin: 0; font-family: ui-monospace, SFMono-Regular, Consolas, 'Courier New', monospace; font-size: 12px; line-height: 1.7; color: #5a6472; white-space: pre-wrap; word-break: break-all; max-height: 100px; overflow-y: auto; user-select: none; -webkit-user-select: none; cursor: default; overscroll-behavior: contain; touch-action: pan-y; }
.agent-stream-txt::after { content: '▍'; color: #4f7cff; animation: streamBlink 0.9s steps(1) infinite; }
@keyframes streamBlink { 50% { opacity: 0; } }
.agent-stream-icon { animation: streamPulse 1.2s ease-in-out infinite; }
@keyframes streamPulse { 50% { opacity: 0.35; } }

/* p34 模板可编辑角标：12 页可编辑小角标 + 模板名旁页数标签 + 预览窗头徽章 */
.tpl-thumb { position: relative; }
.tpl-badge {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; font-size: 11px; line-height: 1;
  color: #ffffff; background: linear-gradient(135deg, #18a058, #16a085);
  border-radius: 999px; box-shadow: 0 2px 6px rgba(0,0,0,.18);
  pointer-events: none;
}
.tpl-badge.muted { background: rgba(0,0,0,.45); font-weight: normal; }
.tpl-badge svg { width: 11px; height: 11px; }
.tpl-name .tpl-pages {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  font-size: 11px; color: var(--Labels-Tertiary, #99a1ab);
  background: rgba(0,0,0,.04); border-radius: 999px;
}
.tplv-badge {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 10px; padding: 3px 10px;
  font-size: 12px; line-height: 1.2;
  color: #18a058; background: rgba(24,160,88,.1);
  border: 1px solid rgba(24,160,88,.25); border-radius: 999px;
  vertical-align: middle;
}
.tplv-badge svg { width: 12px; height: 12px; }
/* p34 模板可编辑角标 end */

/* ===== p89 协议弹窗闸门（注册 / 登录 / 卡密登录 强制勾选确认）===== */
.legal-modal { width: 486px; }
.legal-modal h3 { font-size: 18px; }
.legal-modal .modal-sub { color: var(--Labels-Secondary); font-size: 13px; margin: 8px 0 14px; }
.legal-scroll {
  max-height: 40vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--Fills-F1, #F9FAFB); border: 1px solid var(--Separators-S1, #EEF0F4);
  border-radius: 12px 12px 0 0; padding: 14px 16px 6px; font-size: 12.5px; line-height: 1.78;
  color: #4B5563; text-align: left;
  /* 底部渐隐 + 细滚动条：让「还有内容可滚动」一眼可见，避免看起来像被裁断 */
  mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent 100%);
}
.legal-scroll::-webkit-scrollbar { width: 6px; }
.legal-scroll::-webkit-scrollbar-thumb { background: #D6DAE3; border-radius: 3px; }
.legal-scroll::-webkit-scrollbar-track { background: transparent; }
.legal-scroll p { margin: 0 0 9px; }
.legal-scroll p:last-child { margin-bottom: 14px; }
.legal-scroll b { color: #1F2937; }
/* 条款链接放在滚动区之外 —— 必须始终可见、可点，否则用户无法实际查阅协议 */
.legal-links {
  display: flex; flex-wrap: wrap; gap: 6px 14px; text-align: left;
  padding: 10px 16px; margin: 0;
  background: var(--Fills-F1, #F9FAFB); border: 1px solid var(--Separators-S1, #EEF0F4);
  border-top: 1px dashed var(--Separators-S1, #E5E7EB);
  border-radius: 0 0 12px 12px; font-size: 12.5px;
}
.legal-links a { color: var(--Colors-KMBlue, #4F46E5); text-decoration: none; font-weight: 500; }
.legal-links a:hover { text-decoration: underline; }
.legal-tick {
  display: flex; gap: 10px; align-items: flex-start; margin: 13px 0 0;
  font-size: 12.5px; line-height: 1.65; color: #374151; cursor: pointer; text-align: left;
}
.legal-tick input { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 2px; cursor: pointer; }
.legal-modal .modal-btns { margin-top: 16px; }
@keyframes legalShake {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-9px); }
  36% { transform: translateX(8px); }
  54% { transform: translateX(-6px); }
  72% { transform: translateX(4px); }
  88% { transform: translateX(-2px); }
}
.legal-modal.shake { animation: legalShake .44s ease-in-out; }
/* p89 协议弹窗闸门 end */

/* ══════════════════════════════════════════════════════════════════════════
   p120：大纲核对卡片（两阶段流水线的前端）
   ══════════════════════════════════════════════════════════════════════════
   设计对齐参考站与本站设计变量：浅灰底卡 + 左侧层级编号轴 + 主按钮用品牌蓝。
   兼容手机/iPad：行高与点击区 ≥ 32px，输入框在编辑态才出现（只读态是纯文本，便于快速核对）。
*/
#ol-host { margin: 12px 0; }
.ol-card {
  background: var(--Fills-F1);
  border: 1px solid var(--Separators-S1);
  border-radius: 14px;
  padding: 14px 14px 12px;
}
.ol-card.ol-editing {
  background: var(--Bg-Primary);
  border-color: var(--Others-KMBlue10-hover);
  box-shadow: 0 2px 14px var(--Others-KMBlue10);
}
.ol-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--Labels-Secondary);
  margin-bottom: 10px; line-height: 1.5;
}
.ol-badge {
  flex: 0 0 auto;
  background: var(--Colors-KMBlue); color: #fff;
  font-size: 11px; padding: 2px 8px; border-radius: 999px; line-height: 1.6;
}
.ol-body { display: flex; flex-direction: column; gap: 4px; }
.ol-row { display: flex; align-items: center; gap: 10px; min-height: 36px; }
.ol-no {
  flex: 0 0 54px; text-align: right;
  font-size: 12px; color: var(--Labels-Tertiary);
  font-variant-numeric: tabular-nums;
}
.ol-title { flex: 1 1 auto; font-size: 14px; color: var(--Labels-Primary); line-height: 1.5; word-break: break-word; }
.ol-section .ol-title { font-weight: 600; }
.ol-directory .ol-title, .ol-ending .ol-title { color: var(--Labels-Tertiary); }
/* p147e：编辑态里「自动生成、不开放改字」的行（当前=目录页）的标题位 ——
   用一句说明替代重复的词（后端给的目录行 title 就是「目录」）：
   既消除「[目录] 目录」的同词重复，又解释了「为什么不能改」，
   比原来那个额外的「只读」胶囊信息量更大、也更少视觉噪音。 */
.ol-title-auto { color: var(--Labels-Tertiary); font-size: 13px; }
/* p147e：撤销条 —— 仅在真有可撤销操作时渲染（按需出现，平时完全不占位）。
   刻意不做成整行宽按钮：撤销是次要的补救入口，不该与主 CTA「完成并生成」抢注意力。 */
.ol-undobar { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.ol-undo {
  padding: 7px 12px;
  border: 1px solid var(--Fills-F4); background: var(--Bg-Primary);
  border-radius: 9px; color: var(--Labels-Secondary);
  font-size: 12.5px; font-family: inherit; cursor: pointer;
}
.ol-undo:active { background: var(--Fills-F1-hover); }
.ol-undo:disabled { opacity: .55; cursor: default; }
.ol-undo-n { font-size: 11.5px; color: var(--Labels-Tertiary); }
/* 注：.ol-addbar / .ol-add 在 OL_ALLOW_ADD=false 时不会被渲染；样式保留，
   这样把开关改回 true 即可完整恢复「+ 添加章节 / + 添加子项」的旧行为。 */
.ol-cover .ol-title { font-weight: 600; font-size: 15px; }
.ol-item { padding-left: 16px; }
.ol-input {
  flex: 1 1 auto; min-width: 0;
  font-size: 14px; font-family: inherit; color: var(--Labels-Primary);
  padding: 8px 10px; border: 1px solid var(--Fills-F4);
  border-radius: 9px; background: var(--Bg-Primary);
}
.ol-input:focus { outline: none; border-color: var(--Colors-KMBlue); box-shadow: 0 0 0 3px var(--Others-KMBlue10); }
.ol-tools { flex: 0 0 auto; display: flex; gap: 4px; }
.ol-tb {
  width: 30px; height: 30px; font-size: 13px; line-height: 1;
  border: 1px solid var(--Fills-F4); background: var(--Bg-Primary);
  border-radius: 8px; color: var(--Labels-Secondary); cursor: pointer;
}
.ol-tb:active { background: var(--Fills-F1-hover); }
.ol-tb-del { color: var(--Colors-Red); }
.ol-addbar { display: flex; gap: 8px; margin-top: 10px; }
.ol-add {
  flex: 1; padding: 9px;
  border: 1px dashed var(--Fills-F4); background: transparent;
  border-radius: 9px; color: var(--Colors-KMBlue);
  font-size: 13px; font-family: inherit; cursor: pointer;
}
.ol-actions { display: flex; gap: 10px; margin-top: 12px; }
.ol-btn {
  flex: 1; padding: 12px; border-radius: 10px;
  border: 1px solid var(--Fills-F4); background: var(--Bg-Primary);
  color: var(--Labels-Primary); font-size: 14px; font-family: inherit; cursor: pointer;
}
.ol-btn:active { background: var(--Fills-F1-hover); }
.ol-btn.ol-primary { background: var(--Colors-KMBlue); border-color: var(--Colors-KMBlue); color: #fff; font-weight: 600; }
.ol-btn.ol-primary:active { background: #4338ca; border-color: #4338ca; }
.ol-btn:disabled { opacity: .55; cursor: default; }
.ol-foot { margin-top: 9px; font-size: 11.5px; color: var(--Labels-Tertiary); text-align: center; }
@media (max-width: 420px) {
  .ol-no { flex-basis: 44px; font-size: 11px; }
  .ol-title, .ol-input { font-size: 13.5px; }
}

/* ══════════════════════════════════════════════════════════════════════════
   p126：PPT 生成选项（风格 / 页数 / 场景）
   ══════════════════════════════════════════════════════════════════════════
   设计要求：三行横向 chip，选中态用品牌色淡底 + 主色描边（不用整块填充，避免三行同时抢眼）；
   手机/iPad 上横向可滑动（nowrap + overflow-x），不换行挤压输入框。
*/
.ppt-opts { margin: 10px 0 2px; display: flex; flex-direction: column; gap: 7px; }
.opt-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.opt-label {
  flex: 0 0 auto; width: 30px;
  font-size: 12px; color: var(--Labels-Tertiary); letter-spacing: .5px;
}
.opt-chips {
  flex: 1 1 auto; min-width: 0;
  display: flex; gap: 6px; flex-wrap: nowrap;
  overflow-x: auto; overflow-y: hidden;
  padding-bottom: 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.opt-chips::-webkit-scrollbar { display: none; }
.opt-chip {
  flex: 0 0 auto;
  padding: 5px 11px;
  border: 1px solid var(--Fills-F3);
  background: var(--Bg-Primary);
  border-radius: 999px;
  font-size: 12.5px; line-height: 1.5;
  font-family: inherit; color: var(--Labels-Secondary);
  white-space: nowrap; cursor: pointer;
}
.opt-chip:active { background: var(--Fills-F1); }
.opt-chip.active {
  background: var(--Fills-F1);
  border-color: var(--Colors-KMBlue);
  color: var(--Colors-KMBlue);
  font-weight: 600;
}
.ppt-promise {
  margin: 2px 0 0 38px; color: var(--Labels-Tertiary); font-size: 11.5px; line-height: 1.55;
}
.resume-intake { display: grid; gap: 10px; }
.resume-hero-card { background: linear-gradient(135deg,#f7f8ff,#f4fbff); border: 1px solid #dfe4f4; border-radius: 18px; padding: 14px; }
.resume-dropzone { border: 1.5px dashed #9aa7d7; border-radius: 14px; padding: 22px 18px; display: grid; place-items: center; text-align: center; gap: 7px; cursor: pointer; transition: .18s; background: rgba(255,255,255,.7); }
.resume-dropzone:hover,.resume-dropzone.over { border-color: var(--Colors-KMBlue); background: #fff; box-shadow: 0 8px 28px rgba(79,70,229,.09); transform: translateY(-1px); }
.resume-dropzone b { font-size: 17px; color: var(--Labels-Primary); }
.resume-dropzone span { font-size: 12.5px; color: var(--Labels-Secondary); }
.resume-dropzone button { margin-top: 3px; border: 0; border-radius: 999px; padding: 8px 18px; background: var(--Colors-KMBlue); color: #fff; font-weight: 600; }
.resume-dropzone small { color: var(--Labels-Tertiary); }
.resume-flow { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 13px; color: var(--Labels-Secondary); font-size: 11.5px; }
.resume-flow span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.resume-flow b { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: #e7e9ff; color: var(--Colors-KMBlue); font-size: 10px; }
.resume-flow i { width: 20px; height: 1px; background: #cfd5e6; }
.resume-tone { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--Labels-Tertiary); }
.resume-tone button { border: 1px solid var(--Fills-F3); border-radius: 999px; padding: 5px 10px; background: #fff; color: var(--Labels-Secondary); cursor: pointer; }
.resume-tone button.active { color: var(--Colors-KMBlue); border-color: var(--Colors-KMBlue); background: var(--Others-KMBlue10); font-weight: 600; }
.resume-intake-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.resume-intake-head div { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.resume-intake-head b { font-size: 14px; color: var(--Labels-Primary); }
.resume-intake-head span { font-size: 12px; color: var(--Labels-Tertiary); }
.resume-intake-head button { border: 1px solid var(--Colors-KMBlue); color: var(--Colors-KMBlue); background: var(--Bg-Primary); border-radius: 999px; padding: 6px 11px; cursor: pointer; font-size: 12px; white-space: nowrap; }
.resume-intake > input { width: 100%; box-sizing: border-box; padding: 11px 13px; border: 1px solid var(--Fills-F3); border-radius: 12px; font: inherit; outline: none; }
.resume-intake > input:focus { border-color: var(--Colors-KMBlue); box-shadow: 0 0 0 3px rgba(79,70,229,.08); }
.resume-checks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; color: var(--Labels-Tertiary); font-size: 11.5px; }
.resume-checks i { font-style: normal; color: var(--Labels-Secondary); background: var(--Fills-F1); padding: 3px 8px; border-radius: 999px; }
.resume-checks em { margin-left: auto; font-style: normal; color: #8a5a00; }
@media (max-width: 420px) {
  .opt-label { width: 26px; font-size: 11.5px; }
  .opt-chip { padding: 4px 9px; font-size: 12px; }
  .ppt-promise { margin-left: 0; }
  .resume-intake-head div { display: block; }
  .resume-intake-head span { display: block; margin-top: 3px; }
  .resume-checks em { width: 100%; margin-left: 0; }
  .resume-flow { flex-wrap: wrap; }
  .resume-flow i { display: none; }
}

/* ══════════ p132 手机端适配（≤720px）══════════ */
.m-topbar { display: none; }
.m-mask { display: none; }
@media (max-width: 720px) {
  .layout { display: block; position: relative; height: 100vh; height: 100dvh; overflow: hidden; }
  /* 侧栏 → 抽屉 */
  .sidebar {
    position: fixed; z-index: 90; left: 0; top: 0; bottom: 0; width: min(78vw, 300px);
    transform: translateX(-102%); transition: transform .25s cubic-bezier(.4,0,.2,1);
    box-shadow: 6px 0 28px rgba(0,0,0,.16); margin-left: 0 !important;
  }
  .layout.m-open .sidebar { transform: translateX(0); }
  .m-mask { display: block; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.35); z-index: 80; opacity: 0; pointer-events: none; transition: opacity .2s; } // p132b：inset 旧内核不支持，四向显式
  .layout.m-open ~ .m-mask, .layout.m-open .m-mask { opacity: 1; pointer-events: auto; }
  body > .m-mask.show { opacity: 1; pointer-events: auto; }
  /* 顶栏（汉堡） */
  .m-topbar {
    display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 10px 0 8px;
    background: var(--Bg-Primary, #fff); border-bottom: .5px solid var(--Separators-S1, #e5e6eb);
    position: sticky; top: 0; z-index: 70;
  }
  .m-topbar .m-burger { width: 38px; height: 38px; border: none; background: transparent; font-size: 20px; cursor: pointer; color: var(--Labels-Primary); border-radius: 10px; }
  .m-topbar .m-burger:active { background: var(--Fills-F1, #f2f3f5); }
  .m-topbar .m-title { font-weight: 700; font-size: 15px; flex: 1; text-align: center; }
  .m-topbar .m-ghost { width: 38px; }
  /* 主区全宽 */
  .main { width: 100% !important; max-width: 100% !important; height: calc(100vh - 50px); height: calc(100dvh - 50px); overflow-y: auto; overflow-x: hidden; padding-bottom: env(safe-area-inset-bottom); } // p132b：dvh 双写兜底（旧 iOS/微信 X5 不识别 dvh → 主区高度塌陷 = 「卡死」）
  /* 选项 chips 换行（原横向溢出） */
  .opt-chips { flex-wrap: wrap !important; overflow-x: visible !important; row-gap: 8px; }
  .opt-row { flex-wrap: wrap; }
  .opt-label { width: 100%; margin-bottom: 2px; }
  /* home 双栏 → 竖排 */
  .home-center, .home-hero, .home-right, .home-main { width: 100% !important; max-width: 100% !important; }
  .home-banner img { max-width: 100%; height: auto !important; }
  .tpl-grid, .case-grid { grid-template-columns: repeat(2, 1fr) !important; }
  /* 输入卡 / 步骤卡不留水平溢出 */
  .chat-input-card { width: 100% !important; max-width: 100% !important; box-sizing: border-box; }
  .chat-bottom { padding: 8px 10px calc(10px + env(safe-area-inset-bottom)) !important; }
  .tool-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
  .agent-card-fb, .agent-card { width: calc(100vw - 24px) !important; right: 12px !important; left: 12px !important; }
  /* 大标题不再竖排挤字 */
  .hero-icon + h1, .home-center h1 { font-size: 24px !important; line-height: 1.3 !important; }
  .history-item, .nav-item { max-width: 100%; }
  /* 步骤/预览卡内容不横向溢出 */
  .msg-assistant, .msg-user, .assistant-body { max-width: 100% !important; }
  pre, code, table { max-width: 100%; overflow-x: auto; }
  body { font-size: 14px; }
  .chat-inner { padding: 14px 12px 22px; }
  .msg-user .bubble { max-width: 92%; padding: 10px 12px; font-size: 14px; }
  .msg-assistant { gap: 6px; }
  .assistant-body { min-width: 0; overflow-wrap: anywhere; }
  .file-card { padding: 10px; gap: 8px; align-items: flex-start; }
  .file-actions { flex-wrap: wrap; gap: 6px; }
  .file-actions button { min-height: 36px; padding: 7px 10px; }
  .chat-bottom { position: sticky; bottom: 0; z-index: 20; background: linear-gradient(to top, #fff 82%, rgba(255,255,255,.92)); }
  .chat-input-card textarea { min-height: 42px; max-height: 34vh; font-size: 16px; }
  .attach-btn, .send-btn { width: 40px; height: 40px; min-width: 40px; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-width: none; max-height: 88dvh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 20px 16px calc(18px + env(safe-area-inset-bottom)); }
  .modal-btns { position: sticky; bottom: -20px; padding: 12px 0 0; background: #fff; }
  .resume-dropzone { padding: 20px 12px; }
  .resume-dropzone b { font-size: 16px; }
  .resume-flow { justify-content: flex-start; overflow-x: auto; padding-bottom: 3px; }
  .resume-intake-head { align-items: flex-start; }
  .resume-intake-head button { min-height: 36px; }
  .tpl-tabs { justify-content: flex-start; overflow-x: auto; white-space: nowrap; gap: 18px; padding: 0 4px 4px; }
  .tpl-grid, .case-grid { gap: 10px !important; }
  .chat-page { height: 100%; min-height: 0; }
}

/* ══════════ p136 手机端流畅度 + 退出键 ══════════ */
.m-topbar .m-logout {
  min-width: 54px; height: 34px; padding: 0 12px; border-radius: 9px;
  border: 1px solid var(--Separators-S1, #e5e6eb); background: transparent;
  color: var(--Labels-Secondary, #4e5969); font-size: 13px; font-family: inherit; cursor: pointer;
}
.m-topbar .m-logout:active { background: var(--Fills-F1, #f2f3f5); transform: scale(.97); }
@media (max-width: 720px) {
  /* 滚动惯性 + 阻断滚动穿透（抽屉滚动不再带动主区） */
  .main, .sidebar-body { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  /* 图片先占位再加载：避免 34 张案例图同时解码造成的首屏卡顿与布局抖动 */
  .case-card img { aspect-ratio: 16 / 10; object-fit: cover; background: var(--Fills-F1, #f2f3f5); }
  .tpl-thumb img, .case-card img, .home-banner img { content-visibility: auto; }
  /* 触控目标不小于 34px（手指点得中） */
  .opt-chip { min-height: 34px; display: inline-flex; align-items: center; }
  .nav-item { min-height: 42px; }
  .m-logout { min-height: 34px; }
  /* 退出入口常驻抽屉底部（原被 1174px 内容挤出屏幕，要滚到底才看得到） */
  .sidebar-user { position: sticky; bottom: 0; z-index: 5; background: var(--Bg-Primary, #fff); box-shadow: 0 -6px 16px rgba(0,0,0,.05); }
}

/* p136：侧栏账号名防溢出（卡密账号名较长） */
.sidebar-user .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* p136：遮罩不覆盖顶栏 —— 原来 mask(z80) 盖住 topbar(z70)，抽屉打开后点汉堡关不掉（真机表现：点了没反应） */
@media (max-width: 720px) {
  .m-mask { top: 50px; }
  .m-topbar { z-index: 85; }          /* 顶栏在遮罩之上：汉堡始终可点 */
  .m-topbar .m-menu-open .m-burger, .layout.m-open .m-topbar .m-burger { color: var(--Labels-Primary, #1d2129); }
}

/* p136b：抽屉打开时顶栏（含汉堡/退出）必须在最上层 —— 侧栏 z90 会盖住顶栏 z85，
   实测点击汉堡被侧栏 logo 拦截（intercepts pointer events） */
@media (max-width: 720px) {
  .m-topbar { z-index: 95; }
  .layout.m-open .sidebar { padding-top: 50px; }
}

/* ══════════ p137 交互反馈与流畅度（网页端 + 手机端通用）══════════ */
/* 提交中：按钮立刻降透明 —— 用户高频连点时能第一眼看到「已经点上了」，而不是以为没反应继续点 */
.send-btn.sending { opacity: .5; cursor: progress; }
.send-btn:disabled { cursor: not-allowed; }
/* 去掉触屏 300ms 点击延迟判定（移动端「点了没反应」的经典来源之一） */
button, .nav-item, .history-item, .opt-chip, .case-card, .tpl-thumb, .attach-menu-item { touch-action: manipulation; }
/* 视口外的图片与卡片跳过渲染，减轻主线程（案例墙/模板墙图多时效果明显，桌面同样受益） */
.case-card img, .tpl-thumb img { content-visibility: auto; contain-intrinsic-size: 180px 120px; }
/* 生成期高频重绘的进度卡：隔离布局影响范围，避免每次都触发整页 reflow */
.agent-card, .agent-card-fb { contain: layout style; }
/* Owner-authenticated quality feedback; compact and keyboard accessible. */
.quality-feedback { display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin:14px 0;padding:12px;border:1px solid #e5e7eb;border-radius:10px;font-size:13px; }
.quality-feedback button,.quality-feedback select { background:#fff;color:#334155;border:1px solid #cbd5e1;border-radius:6px;padding:6px 10px;font:inherit; }
.quality-feedback button { cursor:pointer; }
.quality-feedback button:focus-visible,.quality-feedback select:focus-visible { outline:2px solid #4f46e5;outline-offset:2px; }
.quality-feedback button:disabled { opacity:.5;cursor:wait; }
.quality-feedback small { flex-basis:100%;color:#64748b;line-height:1.5; }
