/* 合小维 — 界面样式
   取向：干净、留白、圆角，像苹果的系统界面；颜色上保留法律的庄重：藏青是主色，朱红（印章的颜色）只用在要紧的地方，金色只做细线点缀。
   界面文字用系统字体；大标题、品牌名和文书正文用宋体。改颜色只改最上面这一段。 */
:root {
  --navy: #14294b; /* 藏青：主色 */
  --navy-deep: #0c1c37;
  --navy-wash: rgba(20, 41, 75, 0.06);
  --navy-wash-2: rgba(20, 41, 75, 0.1);
  --crimson: #9d1f22; /* 朱红：只用在要紧的地方 */
  --crimson-wash: rgba(157, 31, 34, 0.08);
  --gold: #b08a4e; /* 金：细线点缀 */
  --gold-wash: rgba(176, 138, 78, 0.14);
  --bg: #f5f5f7;
  --surface: #ffffff;
  --field: #f2f2f5;
  --ink: #1d1d1f;
  --ink-2: #48484d;
  --ink-3: #6e6e73;
  --ink-4: #a1a1a6;
  --line: rgba(0, 0, 0, 0.08);
  --line-2: rgba(0, 0, 0, 0.14);
  --high: #b3261e;
  --high-wash: #fbeceb;
  --medium: #9a5600;
  --medium-wash: #fbf1df;
  --low: #1e7a4c;
  --low-wash: #e9f5ee;
  --del: #b3261e;
  --ins: #1e7a4c;
  --radius: 20px;
  --radius-m: 14px;
  --radius-s: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 10px 30px rgba(15, 23, 42, 0.06);
  --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.05), 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-pop: 0 2px 6px rgba(0, 0, 0, 0.06), 0 18px 48px rgba(15, 23, 42, 0.18);
  --ring: 0 0 0 4px rgba(20, 41, 75, 0.13);
  --serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.65 var(--sans);
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--navy); }
::selection { background: rgba(20, 41, 75, 0.18); }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.icon { display: inline-block; flex: none; vertical-align: -0.16em; stroke-width: 36px; }
.hint { color: var(--ink-3); font-size: 13px; }
.error { color: var(--high); font-size: 14px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 18px;
  background: var(--navy); color: #fff; font-size: 14px; font-weight: 500; white-space: nowrap; text-decoration: none;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
.btn:hover { background: var(--navy-deep); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; transform: none; }
.btn.tinted { background: var(--navy-wash-2); color: var(--navy); }
.btn.tinted:hover { background: rgba(20, 41, 75, 0.16); }
.btn.plain { background: transparent; color: var(--navy); padding: 0 12px; }
.btn.plain:hover { background: var(--navy-wash); }
.btn.small { height: 28px; padding: 0 12px; border-radius: 14px; font-size: 13px; }
.btn.large { height: 48px; padding: 0 46px; border-radius: 24px; font-size: 16px; font-weight: 600; letter-spacing: 0.08em; }
button.link { color: var(--navy); font-weight: 500; text-decoration: underline; text-decoration-color: rgba(20, 41, 75, 0.3); text-underline-offset: 3px; }
button.link:hover { text-decoration-color: currentColor; }
/* 只有一个图标的圆按钮 */
.round { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--navy-wash-2); color: var(--navy); transition: background 0.15s, color 0.15s, transform 0.1s; }
.round:hover { background: rgba(20, 41, 75, 0.16); }
.round:active { transform: scale(0.94); }
.round.send { background: var(--navy); color: #fff; }
.round.send:hover { background: var(--navy-deep); }
.round.quiet { width: 30px; height: 30px; background: transparent; color: var(--ink-4); }
.round.quiet:hover { background: var(--crimson-wash); color: var(--crimson); }

/* ---------- 表单 ---------- */
textarea, select, input[type="text"], input[type="password"] {
  border: 1px solid var(--line-2); border-radius: 12px; padding: 9px 12px; background: var(--surface); color: var(--ink); font-size: 15px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea:focus, select:focus, input[type="text"]:focus, input[type="password"]:focus { outline: none; border-color: var(--navy); box-shadow: var(--ring); }
textarea { width: 100%; min-height: 180px; margin-top: 14px; padding: 12px 14px; resize: vertical; line-height: 1.8; }
::placeholder { color: var(--ink-4); }
select { appearance: none; -webkit-appearance: none; padding-right: 34px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 512 512'%3E%3Cpath d='m112 184 144 144 144-144' fill='none' stroke='%236e6e73' stroke-width='52' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center; }

/* ---------- 页眉：半透明，贴在顶上 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; padding: 0 24px;
  background: rgba(255, 255, 255, 0.8); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { height: 30px; width: auto; display: block; }
.brand strong { font-family: var(--serif); font-size: 21px; font-weight: 700; letter-spacing: 0.14em; color: var(--navy); white-space: nowrap; }
.brand span { font-size: 12px; letter-spacing: 0.18em; color: var(--ink-3); padding-left: 10px; border-left: 1px solid var(--gold); white-space: nowrap; }
.topright { display: flex; align-items: center; gap: 14px; min-width: 0; }
.actions { display: flex; align-items: center; gap: 8px; }
.save-status { font-size: 12px; color: var(--ink-3); margin-right: 2px; white-space: nowrap; }
.userbar { position: relative; }
.user-chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 7px; border-radius: 17px; color: var(--ink-2); font-size: 14px; transition: background 0.15s; }
.user-chip:hover, .user-chip[aria-expanded="true"] { background: var(--navy-wash); }
.user-chip .icon:first-child { color: var(--navy); }
.user-chip .icon:last-child { color: var(--ink-4); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); min-width: 168px; padding: 6px; background: rgba(255, 255, 255, 0.96); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); animation: pop 0.14s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(0.98); } }
.menu a, .menu button { display: flex; align-items: center; gap: 9px; width: 100%; height: 36px; padding: 0 10px; border-radius: 9px; color: var(--ink); font-size: 14px; text-decoration: none; text-align: left; }
.menu a:hover, .menu button:hover { background: var(--navy-wash); }
.menu .icon { color: var(--ink-3); }

/* ---------- 登录 ---------- */
.auth-step { margin: auto; width: 100%; max-width: 400px; padding: 40px 20px; }
.auth-logo { text-align: center; margin-bottom: 22px; }
.auth-logo img { height: 84px; width: auto; }
.auth-logo p { margin: 10px 0 0; }
.auth-logo b { display: block; font-family: var(--serif); font-size: 28px; letter-spacing: 0.3em; text-indent: 0.3em; color: var(--navy); }
.auth-logo span { font-size: 13px; letter-spacing: 0.2em; color: var(--ink-3); }
.card { background: var(--surface); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.auth-card { display: flex; flex-direction: column; gap: 14px; padding: 30px 28px 24px; }
.auth-card h2 { margin: 0 0 2px; font-size: 20px; font-weight: 600; text-align: center; }
.auth-card label, .pw-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-3); }
.auth-card input, .pw-form input { height: 42px; }
.auth-card .btn.primary { height: 44px; border-radius: 22px; font-size: 16px; font-weight: 600; letter-spacing: 0.3em; text-indent: 0.3em; }
.auth-card .error { margin: 0; min-height: 1.2em; text-align: center; }
.auth-card .hint { margin: 0; text-align: center; }
.disclaimer { color: var(--ink-3); font-size: 12px; margin: 12px 0 0; text-align: center; }

/* ---------- 首页 ---------- */
.input-step { max-width: 860px; width: 100%; margin: 0 auto; padding: 0 20px 40px; }
.hero { text-align: center; padding: 56px 0 30px; }
.hero h1 { margin: 0; font-family: var(--serif); font-size: 36px; font-weight: 700; letter-spacing: 0.1em; line-height: 1.3; color: var(--navy); }
.hero h1 span { display: inline-block; margin: 0 0.5em; } /* 两句话各自不拆开，窄屏时在中间换行 */
.hero h1::after { content: ""; display: block; width: 44px; height: 2px; margin: 18px auto 0; border-radius: 1px; background: var(--gold); }
.lead { color: var(--ink-3); font-size: 16px; line-height: 1.75; max-width: 640px; margin: 18px auto 0; }
/* 语音通话的入口：前面是公司的 logo */
.call-start { display: inline-flex; align-items: center; gap: 10px; height: 48px; margin-top: 24px; padding: 0 22px 0 16px; border-radius: 24px;
  background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-s); font-size: 15px; font-weight: 600; color: var(--navy); transition: box-shadow 0.2s, transform 0.1s; }
.call-start:hover { box-shadow: 0 0 0 1px var(--line-2), 0 8px 24px rgba(20, 41, 75, 0.14); }
.call-start:active { transform: scale(0.98); }
.call-start img { height: 28px; width: auto; display: block; }
.call-start span { font-size: 13px; font-weight: 400; color: var(--ink-3); padding-left: 10px; border-left: 1px solid var(--line-2); }

.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.modes button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 16px 16px 15px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.55); box-shadow: 0 0 0 1px var(--line); transition: background 0.15s, box-shadow 0.15s;
}
.modes button:hover { background: var(--surface); }
.modes button .icon { color: var(--ink-3); margin-bottom: 6px; stroke-width: 30px; }
.modes button b { font-size: 16px; font-weight: 600; color: var(--ink); }
.modes button span { font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }
.modes button.active { background: var(--surface); box-shadow: 0 0 0 1.5px var(--navy), var(--shadow-s); }
.modes button.active .icon { color: var(--crimson); }
.modes button.active b { color: var(--navy); }

.composer { margin-top: 14px; }
.dropzone { border: 1.5px dashed var(--line-2); border-radius: var(--radius-m); padding: 22px 20px; text-align: center; background: #fafafc; transition: border-color 0.15s, background 0.15s; }
.dropzone > .icon { color: var(--ink-4); stroke-width: 28px; margin-bottom: 2px; }
.dropzone.over { border-color: var(--navy); background: var(--navy-wash); }
.dropzone p { margin: 4px 0; }
.file-name { font-weight: 600; color: var(--low); }
#questionInput { margin-top: 0; min-height: 220px; }
.row { display: flex; gap: 14px; margin-top: 16px; align-items: flex-end; flex-wrap: wrap; }
.row.end { justify-content: center; align-items: center; flex-direction: column; gap: 10px; margin-top: 24px; }
.row label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--ink-3); }
.row .grow { flex: 1; min-width: 220px; }
.notice { margin-top: 30px; padding-top: 4px; }

/* 历史记录：一组一组的列表 */
.history { margin-top: 34px; }
.history h2 { margin: 0 0 8px 14px; font-size: 13px; font-weight: 500; color: var(--ink-3); }
.history-list { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-s); overflow: hidden; }
.history-row { display: flex; align-items: center; gap: 12px; padding: 0 12px 0 14px; min-height: 50px; cursor: pointer; transition: background 0.12s; }
.history-row + .history-row { border-top: 1px solid var(--line); }
.history-row:hover { background: #fafafc; }
.history-row .tag { display: inline-flex; align-items: center; gap: 5px; flex: none; width: 88px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.history-row .tag .icon { color: var(--navy); }
.history-row .tag.contract .icon, .history-row .tag.document .icon { color: var(--crimson); }
.history-row .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row time { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.history-row .round.quiet { opacity: 0; }
.history-row:hover .round.quiet, .history-row .round.quiet:focus-visible { opacity: 1; }
.history-row > .icon { color: var(--ink-4); }

/* ---------- 处理中 ---------- */
.loading-step { margin: auto; text-align: center; padding: 40px; }
.loading-step h2 { margin: 0 0 6px; font-size: 20px; font-weight: 600; }
.loading-step .btn { margin-top: 14px; }
.spinner { width: 38px; height: 38px; margin: 0 auto 20px; border-radius: 50%; border: 3px solid var(--navy-wash-2); border-top-color: var(--navy); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 结果页 ---------- */
.result-step { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 480px; }
.doc-pane { display: flex; flex-direction: column; min-height: 0; background: #ecedf1; }
.pane-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 0 28px; height: 44px; flex: none; background: rgba(255, 255, 255, 0.72); border-bottom: 1px solid var(--line); font-size: 14px; }
.pane-head strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend { display: flex; gap: 10px; align-items: center; font-size: 13px; flex: none; }
/* 正文像一页纸 */
.doc {
  flex: 1; overflow: auto; width: min(100% - 48px, 900px); margin: 22px auto; padding: 52px 64px; background: #fff; border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 12px 34px rgba(15, 23, 42, 0.08); font-family: var(--serif); font-size: 16px; line-height: 2;
}
.doc p { margin: 0 0 8px; text-align: justify; }
.doc p.title { text-align: center; font-weight: 700; font-size: 21px; letter-spacing: 0.2em; color: var(--navy); margin-bottom: 14px; }
del { color: var(--del); text-decoration: line-through; background: var(--high-wash); border-radius: 3px; }
ins { color: var(--ins); text-decoration: underline; background: var(--low-wash); border-radius: 3px; }
.doc del, .doc ins { cursor: pointer; }
.doc .pending { opacity: 0.75; }
.doc .focus { outline: 2px solid var(--gold); outline-offset: 1px; }

.side-pane { display: flex; flex-direction: column; min-height: 0; background: var(--bg); border-left: 1px solid var(--line); }
.side-head { flex: none; background: var(--surface); border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.summary { padding: 18px 20px 12px; }
.summary h3 { margin: 0 0 8px; font-size: 19px; font-weight: 600; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.summary p { margin: 0; font-size: 14px; color: var(--ink-2); }
.summary ul { margin: 8px 0 0; padding-left: 18px; font-size: 13px; color: var(--ink-3); }
.summary .outcome { color: var(--ink); font-weight: 600; font-size: 14px; }
.summary .check { margin-top: 8px; color: var(--ink-3); }
.badge { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 1px 9px; white-space: nowrap; flex: none; }
.badge.high { background: var(--high-wash); color: var(--high); }
.badge.medium { background: var(--medium-wash); color: var(--medium); }
.badge.low { background: var(--low-wash); color: var(--low); }
.badge.field { background: var(--navy-wash-2); color: var(--navy); }

/* 标签页：分段控件 */
.tabs { display: flex; gap: 2px; margin: 0 20px; padding: 3px; background: rgba(118, 118, 128, 0.12); border-radius: 10px; }
.tabs button { flex: 1; height: 30px; border-radius: 8px; font-size: 13px; color: var(--ink-2); white-space: nowrap; transition: background 0.15s; }
.tabs button:hover { color: var(--ink); }
.tabs button.active { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }
.tabs b { font-weight: 500; font-size: 12px; color: var(--ink-3); }
.tab-body { flex: 1; overflow: auto; padding: 16px 20px 20px; min-height: 0; }
.tab-body h5 { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.tab-body h5:first-child { margin-top: 0; }

.item { background: var(--surface); border-radius: var(--radius-m); box-shadow: 0 0 0 1px var(--line); padding: 16px; margin-bottom: 12px; font-size: 14px; }
.item.focus { box-shadow: 0 0 0 2px var(--gold); }
.item h4 { margin: 0 0 8px; font-size: 15.5px; font-weight: 600; display: flex; gap: 8px; align-items: flex-start; line-height: 1.5; }
.item h4 .badge { margin-top: 2px; }
.item blockquote { margin: 8px 0; padding: 6px 12px; border-left: 2px solid var(--gold); color: var(--ink-2); font-size: 13.5px; font-family: var(--serif); background: #fafafc; border-radius: 0 8px 8px 0; }
.item dl { margin: 0; }
.item dt { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-top: 12px; }
.item dd { margin: 2px 0 0; }
.item .diff { margin: 8px 0; padding: 10px 12px; background: #fafafc; border-radius: var(--radius-s); white-space: pre-wrap; font-family: var(--serif); font-size: 14.5px; line-height: 1.9; }
.item .ops { display: flex; gap: 8px; margin-top: 12px; align-items: center; flex-wrap: wrap; }
.item.accepted { box-shadow: 0 0 0 1px var(--line), inset 3px 0 0 var(--low); }
.item.rejected { opacity: 0.55; }
.item.deadline { box-shadow: 0 0 0 1px var(--line), inset 3px 0 0 var(--crimson); }
.item.deadline p { margin: 0; color: var(--ink-2); }
.state { font-size: 12px; color: var(--ink-3); margin-left: auto; }
.bulk { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.steps { margin: 0 0 10px; padding-left: 22px; font-size: 14px; }
.steps li { margin-bottom: 6px; }

/* 法律依据的条文 */
.cites { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.cite { font-size: 13px; padding: 6px 10px; border-radius: var(--radius-s); }
.cite .icon { margin-right: 5px; }
.cite.ok { background: var(--low-wash); color: var(--low); }
.cite.ok summary { cursor: pointer; font-weight: 600; list-style: none; }
.cite.ok summary::-webkit-details-marker { display: none; }
.cite.ok summary::after { content: "看原文"; float: right; font-weight: 400; font-size: 12px; opacity: 0.7; }
.cite.ok[open] summary::after { content: "收起"; }
.cite.ok .law-text { color: var(--ink); white-space: pre-wrap; margin: 8px 0 2px; font-family: var(--serif); font-size: 14px; line-height: 1.9; }
.cite.ok .hint { margin: 6px 0 0; }
.cite.bad { background: var(--medium-wash); color: var(--medium); }
.cite.bad b { font-weight: 600; }
.cite.bad span { display: block; margin-top: 2px; }

/* 对话 */
.chat { display: flex; flex-direction: column; padding: 0; }
.chat-log { flex: 1; overflow: auto; padding: 18px 20px 8px; }
.chat-log > .hint { margin: 0 0 12px; }
.msg { margin-bottom: 10px; padding: 9px 14px; white-space: pre-wrap; font-size: 14.5px; line-height: 1.7; max-width: 88%; width: fit-content; border-radius: 18px; }
.msg.user { background: var(--navy); color: #fff; margin-left: auto; border-bottom-right-radius: 6px; }
.msg.assistant { background: var(--surface); box-shadow: 0 0 0 1px var(--line); border-bottom-left-radius: 6px; }
.msg.error { color: var(--high); }
/* 语音通话里说的话 */
.msg.voice::before { content: "通话"; display: block; font-size: 11px; line-height: 1.4; opacity: 0.55; letter-spacing: 0.08em; }
.chat-log .cites { margin: -4px 0 12px; max-width: 88%; }
.chat-form { display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: var(--surface); border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; height: 38px; border-radius: 19px; padding: 0 16px; background: var(--field); border-color: transparent; }
.chat-form input:focus { background: var(--surface); }
.chat-form input:disabled { opacity: 0.6; }
.chat-notice { margin: 0; padding: 0 14px 10px; background: var(--surface); text-align: center; font-size: 12px; color: var(--ink-3); }

/* 只有审合同才显示的元素；法律咨询没有文件，只留对话 */
body:not([data-mode="contract"]) .contract-only { display: none !important; }
body[data-mode="ask"] .doc-pane { display: none; }
body[data-mode="ask"] .result-step { grid-template-columns: minmax(0, 860px); justify-content: center; }
body[data-mode="ask"] .side-pane { border-right: 1px solid var(--line); }
body[data-mode="ask"] .msg { font-size: 15px; }

/* ---------- 起草文书 ---------- */
body:not([data-mode="draft"]) .draft-only { display: none !important; }
/* 起草文书的需求框不用语音输入（生成后的修改对话框可以用） */
body[data-mode="draft"] .no-draft { display: none !important; }
.doc .heading { font-weight: 700; margin-top: 14px; }
.doc .blank { background: #fdf3d6; color: var(--crimson); border-radius: 3px; }
.doc table { width: 100%; border-collapse: collapse; margin: 6px 0 16px; font-size: 15px; line-height: 1.6; }
.doc th, .doc td { border: 1px solid #555; padding: 6px 10px; text-align: left; vertical-align: top; }
.doc th { background: #f5f5f7; }
.doc .table-title { font-weight: 700; margin: 12px 0 4px; }
/* 预览里直接编辑 */
.doc .para { margin: 0 0 8px; }
.doc [contenteditable="plaintext-only"], .doc [contenteditable="true"] { outline: none; border-radius: 4px; cursor: text; transition: background 0.12s; }
.doc [contenteditable="plaintext-only"]:hover, .doc [contenteditable="true"]:hover { background: #f6f7fa; }
.doc [contenteditable="plaintext-only"]:focus, .doc [contenteditable="true"]:focus { background: #f6f8fc; box-shadow: 0 0 0 2px rgba(20, 41, 75, 0.22); }
/* 模型刚改过的地方 */
.doc .changed { background: #fff6d6; box-shadow: -6px 0 0 #fff6d6, 6px 0 0 #fff6d6; border-left: 3px solid var(--gold); }
.doc th.changed, .doc td.changed { border-left: 1px solid var(--gold); }
body[data-mode="draft"] .dropzone { padding: 16px; }
.dz-lead { margin: 0 0 6px; }

/* 上传已有文件后，左边预览、右边写修改要求 */
body.has-upload .input-step { max-width: 1280px; }
body.has-upload .draft-work { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: stretch; margin-top: 12px; }
body.has-upload .draft-work #questionInput { min-height: 0; height: 62vh; align-self: end; } /* 和左边的预览上下对齐 */
.upload-preview { display: flex; flex-direction: column; min-width: 0; }
.upload-preview-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 13px; margin-bottom: 6px; }
.upload-preview-bar b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.upload-preview-bar .hint { flex: none; margin: 0; }
.doc.preview { flex: none; width: auto; height: 62vh; margin: 0; padding: 26px 30px; font-size: 15px; line-height: 1.9; box-shadow: 0 0 0 1px var(--line-2); border-radius: 12px; }
.doc.preview p.title { font-size: 18px; }
.doc.preview .quotable { cursor: pointer; border-radius: 4px; }
.doc.preview .quotable:hover { background: #f3f5fa; box-shadow: 0 0 0 3px #f3f5fa; }
.doc.preview .quoted { animation: quoted 1.2s ease-out; }
@keyframes quoted { from { background: #f3e2b3; box-shadow: 0 0 0 3px #f3e2b3; } to { background: transparent; box-shadow: none; } }

/* ---------- 联网查询公司信息 ---------- */
.company { margin-top: 14px; }
.company-search { display: flex; gap: 8px; align-items: center; }
.company-search input { flex: 1; min-width: 0; }
.company-search .btn { height: 36px; border-radius: 18px; }
.company-result { font-size: 14px; }
.company-result table { width: 100%; border-collapse: collapse; margin: 10px 0 6px; }
.company-result th { width: 9em; text-align: left; font-weight: 400; color: var(--ink-3); padding: 3px 8px 3px 0; vertical-align: top; white-space: nowrap; }
.company-result td { padding: 3px 0; word-break: break-all; }
.company-result p { margin: 6px 0; }
.company-result .ok { color: var(--low); font-size: 12px; }
.company-result .warn { color: var(--medium); font-size: 13px; }
.company-result .ok .icon, .company-result .warn .icon { margin-right: 3px; }
.tab-body .company { margin: 0 0 14px; }
.company-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 10px; }
.company-option { display: flex; flex-direction: column; align-items: flex-start; text-align: left; padding: 8px 12px; border-radius: var(--radius-s); background: #fafafc; box-shadow: 0 0 0 1px var(--line); }
.company-option:hover { background: var(--surface); box-shadow: 0 0 0 1px var(--line-2); }
.company-option.active { background: var(--surface); box-shadow: 0 0 0 1.5px var(--navy); }
.company-option span { font-size: 12px; color: var(--ink-3); word-break: break-all; }
.chat-log .sources { margin: -4px 0 12px; max-width: 88%; }
.company-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.company-profile { margin-top: 10px; }
.profile-summary { font-weight: 600; }
.profile-list { list-style: none; margin: 8px 0; padding: 0; }
.profile-list li { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--line); line-height: 1.6; }
.profile-tag { flex: none; font-size: 12px; font-weight: 600; padding: 0 7px; border-radius: 999px; background: var(--field); color: var(--ink-2); }
.profile-list li.bad .profile-tag { background: var(--high-wash); color: var(--high); }
.profile-list li.good .profile-tag { background: var(--low-wash); color: var(--low); }
.profile-text { word-break: break-all; }
.profile-date { color: var(--ink-3); }
.profile-list a { font-size: 12px; white-space: nowrap; }

/* ---------- 语音输入 ---------- */
.voice-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.voice-row .hint { flex: 1; min-width: 200px; }
button.voice { user-select: none; -webkit-user-select: none; touch-action: none; }
.voice-row button.voice, .voice-row button.pill { display: inline-flex; align-items: center; gap: 6px; flex: none; height: 36px; padding: 0 16px 0 12px; border-radius: 18px; background: var(--navy-wash-2); color: var(--navy); font-size: 14px; font-weight: 500; transition: background 0.15s; }
.voice-row button.voice:hover, .voice-row button.pill:hover { background: rgba(20, 41, 75, 0.16); }
button.voice.recording, .voice-row button.voice.recording { background: var(--crimson); color: #fff; animation: voice-pulse 1.2s ease-in-out infinite; }
@keyframes voice-pulse { 50% { box-shadow: 0 0 0 7px rgba(157, 31, 34, 0.18); } }
button.voice.waiting { opacity: 0.6; }
.voice-hint { margin: 0; padding: 0 14px 6px; background: var(--surface); }
.voice-hint:empty { display: none; }
.voice-meter { display: inline-block; width: 48px; height: 6px; border-radius: 3px; background: var(--field); vertical-align: middle; overflow: hidden; }
.voice-meter i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--crimson); transition: width 0.1s linear; }
.voice-meter i.muted { background: var(--ink-4); }

/* ---------- 修改密码的对话框 ---------- */
.pw-dialog { border: 0; border-radius: 20px; padding: 0; width: min(420px, 92vw); background: var(--surface); box-shadow: var(--shadow-pop); color: var(--ink); }
.pw-dialog::backdrop { background: rgba(0, 0, 0, 0.32); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.pw-form { display: flex; flex-direction: column; gap: 12px; padding: 24px 26px 22px; }
.pw-form h3 { margin: 0; font-size: 18px; font-weight: 600; }
.pw-form .hint { margin: 0; }
.pw-form .error { margin: 0; min-height: 1em; }
.pw-form .row.end { flex-direction: row; justify-content: flex-end; margin-top: 4px; }

/* ---------- 语音通话（全屏）：和其他页面是同一套颜色。浅色底，顶上和页眉一个样子，中间一颗藏青色的球 ---------- */
body.in-call { overflow: hidden; }
.call { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; color: var(--ink); font-size: 15px;
  background: radial-gradient(ellipse 90% 72% at 50% 38%, #ffffff 0%, #f7f7f9 46%, #eceef3 100%); animation: callIn 0.25s ease-out; }
@keyframes callIn { from { opacity: 0; } }
.call-top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; padding: 0 24px;
  background: rgba(255, 255, 255, 0.8); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
.call-top .brand .call-engine { letter-spacing: 0; color: var(--ink-4); border-left-color: var(--line-2); }
.call-clock { font-size: 13.5px; font-variant-numeric: tabular-nums; color: var(--ink-3); }
.call-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0 24px; min-height: 0; }
/* 画布比球大一圈，多出来的地方留给光晕和影子；下面的文字往上收，贴着球 */
.call-orb { --size: min(50vh, 440px); width: var(--size); height: var(--size); flex: none; position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.call-orb canvas { width: 100%; height: 100%; display: block; }
/* 球心的 logo：叠在画布上面，光带从它后面绕过去；跟着声音微微放大 */
.call-orb-logo { position: absolute; left: 50%; top: 50%; height: 15.5%; width: auto; transform: translate(-50%, -50%); pointer-events: none; transition: opacity 0.4s; }
.s-connecting .call-orb-logo, .s-ended .call-orb-logo { opacity: 0.35; }
/* 浏览器画不了上面那个泡泡时的简单样子：一个透明的圆，边上一圈淡淡的彩色 */
.call-orb-plain { position: absolute; inset: 22%; border-radius: 50%; transition: transform 0.08s linear, filter 0.4s;
  background: conic-gradient(from 210deg, #f6a6c8, #f5d48a, #a5e3b5, #8fd8ee, #9fb4f5, #cfa5f0, #f6a6c8);
  -webkit-mask: radial-gradient(circle, rgba(0, 0, 0, 0.03) 50%, rgba(0, 0, 0, 0.30) 86%, rgba(0, 0, 0, 0.62) 100%); mask: radial-gradient(circle, rgba(0, 0, 0, 0.03) 50%, rgba(0, 0, 0, 0.30) 86%, rgba(0, 0, 0, 0.62) 100%); }
.s-connecting .call-orb-plain, .s-ended .call-orb-plain { filter: grayscale(1); }
.s-recognizing .call-orb-plain, .s-thinking .call-orb-plain { animation: breathe 1.2s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.05); } }
.call-status { margin-top: calc(min(50vh, 440px) * -0.10); font-size: 15px; color: var(--ink-3); min-height: 24px; max-width: 640px; text-align: center; position: relative; }
.call-status.err { color: var(--high); }
.call-captions { margin-top: 20px; max-width: 760px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 12px; font-size: 19px; line-height: 1.65; }
.call-captions span { display: block; font-size: 12px; color: var(--ink-4); margin-bottom: 2px; letter-spacing: 0.06em; }
.call-captions p { margin: 0; }
.cap-user { color: var(--ink-3); }
.cap-bot { color: var(--ink); }
.call-hint { align-self: center; display: flex; align-items: center; gap: 10px; max-width: min(680px, calc(100% - 40px)); padding: 10px 10px 10px 16px; border-radius: 14px;
  background: var(--surface); box-shadow: 0 0 0 1px var(--line), var(--shadow-s); color: var(--ink-2); font-size: 13px; line-height: 1.55; }
.call-hint .hint-icon { color: var(--navy); }
.call-hint .hint-icon:empty { display: none; }
.call-hint button { display: grid; place-items: center; flex: none; color: var(--ink-3); font-size: 12.5px; padding: 5px; border-radius: 8px; }
.call-hint button:hover { color: var(--ink); background: var(--navy-wash); }
.call-hint .act { padding: 5px 12px; border-radius: 14px; background: var(--navy); color: #fff; font-weight: 500; white-space: nowrap; }
.call-hint .act:hover { background: var(--navy-deep); color: #fff; }
/* 认得你的声音：顶上的开关、记声音时的进度、没理会的别人的话 */
.call-me { margin-left: auto; margin-right: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.call-pill { display: inline-flex; align-items: center; gap: 7px; height: 30px; padding: 0 13px; border-radius: 15px; background: var(--navy-wash);
  color: var(--ink-2); font-size: 12.5px; white-space: nowrap; transition: background 0.15s, color 0.15s; }
.call-pill:hover { background: var(--navy-wash-2); }
.call-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-4); }
.call-pill.on { background: var(--navy); color: #fff; }
.call-pill.on:hover { background: var(--navy-deep); }
.call-pill.on .dot { background: #e3b862; }
.call-pill .n { padding-left: 8px; margin-left: 2px; border-left: 1px solid rgba(255, 255, 255, 0.28); color: rgba(255, 255, 255, 0.75); font-variant-numeric: tabular-nums; }
.call-pill.plain { background: transparent; color: var(--ink-3); padding: 0 8px; }
.call-pill.plain:hover { color: var(--navy); background: var(--navy-wash); }
.call-enroll { margin-top: 14px; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.call-enroll .bar { width: 220px; height: 6px; border-radius: 3px; background: rgba(0, 0, 0, 0.08); overflow: hidden; }
.call-enroll .bar i { display: block; height: 100%; border-radius: 3px; background: var(--navy); transition: width 0.4s ease-out; }
.call-enroll button { color: var(--ink-3); font-size: 12.5px; padding: 2px 6px; border-radius: 8px; }
.call-enroll button:hover { color: var(--navy); background: var(--navy-wash); }
.call-ignored { margin-top: 14px; font-size: 12.5px; color: var(--ink-3); max-width: 640px; text-align: center; }
.call-controls { display: flex; justify-content: center; align-items: center; gap: 18px; padding: 18px 0 14px; }
.call-btn { width: 60px; height: 60px; border-radius: 50%; background: var(--surface); color: var(--navy); box-shadow: 0 0 0 1px var(--line), var(--shadow-s);
  display: grid; place-items: center; transition: background 0.15s, transform 0.1s, color 0.15s, box-shadow 0.15s; }
.call-btn .icon { display: block; }
.call-btn:hover { box-shadow: 0 0 0 1px var(--line-2), 0 6px 18px rgba(20, 41, 75, 0.14); }
.call-btn:active { transform: scale(0.94); }
.call-btn.on { background: var(--navy); color: #fff; box-shadow: none; }
.call-btn.off { color: var(--ink-4); }
.call-btn.end { background: var(--crimson); color: #fff; box-shadow: 0 6px 18px rgba(157, 31, 34, 0.28); }
.call-btn.end:hover { background: #861a1d; box-shadow: 0 6px 20px rgba(157, 31, 34, 0.36); }
/* 男声 / 女声：和结果页的标签页一样的分段控件 */
.call-voice { display: flex; gap: 2px; height: 60px; padding: 4px; background: rgba(118, 118, 128, 0.12); border-radius: 30px; }
.call-voice button { color: var(--ink-2); padding: 0 20px; border-radius: 26px; font-size: 14px; transition: background 0.15s, color 0.15s; }
.call-voice button:hover { color: var(--ink); }
.call-voice button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }
.call-notice { margin: 0; padding: 0 20px 20px; text-align: center; font-size: 12px; color: var(--ink-3); }

/* ---------- 窄屏 ---------- */
@media (max-width: 1000px) {
  .result-step { grid-template-columns: 1fr; grid-template-rows: 50vh 1fr; }
  .side-pane { border-left: 0; border-top: 1px solid var(--line); }
  .doc { width: calc(100% - 20px); margin: 10px auto; padding: 24px; }
  .brand span { display: none; }
  body[data-mode="ask"] .result-step { grid-template-rows: 1fr; }
  .actions .btn { padding: 0 10px; }
}
@media (max-width: 760px) {
  .modes { grid-template-columns: repeat(2, 1fr); }
  .hero { padding: 36px 0 24px; }
  .hero h1 { font-size: 27px; }
  .topbar { padding: 0 14px; }
  .call-me { display: none; }
  .call-btn { width: 52px; height: 52px; }
  .call-voice { height: 52px; }
  .call-voice button { padding: 0 14px; }
  .history-row time { display: none; }
}
@media (max-width: 900px) {
  body.has-upload .draft-work { grid-template-columns: 1fr; }
  .doc.preview { height: 45vh; }
  body.has-upload .draft-work #questionInput { height: auto; min-height: 160px; }
}

/* ---------- 打印：只留文稿本身 ---------- */
@media print {
  .topbar, .side-pane, .pane-head, .voice-row, button.voice, .call { display: none !important; }
  html, body { height: auto; background: #fff; display: block; }
  .result-step { display: block; }
  .doc-pane { display: block; background: #fff; }
  .doc { overflow: visible; width: auto; margin: 0; padding: 0; border-radius: 0; box-shadow: none; }
  .doc .blank { background: none; color: inherit; }
  .doc [contenteditable]:hover, .doc [contenteditable]:focus { background: none; box-shadow: none; }
  .doc .changed { background: none; box-shadow: none; border-left: 0; }
}
