/* 法律AI助手 · 界面样式（A 风格：稳重典雅——墨蓝、暖白、宋体标题、少量金色） */
:root {
  --ink: #17233a;
  --ink-2: #22324f;
  --navy: var(--ink);
  --navy-2: var(--ink-2);
  --text: #232b38;
  --muted: #586070;
  --line: #e6dfd0;
  --line-strong: #d3c9b3;
  --bg: #f6f3ec;
  --card: #fffefb;
  --gold: #b8935a;
  --gold-deep: #8a6a2b;
  --gold-soft: #f5eedd;
  --brand: var(--gold-deep);
  --brand-soft: var(--gold-soft);
  --ok: #2f6b4f;
  --ok-soft: #e9f1ea;
  --warn: #96630f;
  --warn-soft: #f8efd8;
  --danger: #a33b2e;
  --danger-soft: #f8e8e4;
  --radius: 6px;
  --serif: "Source Han Serif SC", "Noto Serif SC", "Songti SC", "STZhongsong", "SimSun", serif;
  --sans: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  font: 16px/1.75 var(--sans);
  color: var(--text);
  background: var(--bg);
}
a { color: var(--brand); text-decoration: none; }
h1, h2, h3 { line-height: 1.4; margin: 0; }
::selection { background: #e9dcbd; }

/* 小图标（线条） */
.ico { display: inline-flex; vertical-align: -2px; margin-right: 5px; }
.ico svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- 侧边栏 ---------- */
#nav {
  width: 216px;
  flex: none;
  background: var(--ink);
  color: #9aa7bd;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: sticky;
  top: 0;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 26px 22px 22px; color: #f3ead7; }
.brand strong { display: block; font-family: var(--serif); font-size: 17px; font-weight: 600; letter-spacing: 2px; }
.brand small { color: #7f8da6; font-size: 13px; letter-spacing: 1px; }
.brand-mark {
  width: 34px; height: 34px; flex: none; border: 1px solid var(--gold); border-radius: 2px;
  display: grid; place-items: center; font-family: var(--serif); font-weight: 600; font-size: 18px; color: #e6cf9f;
}
#nav-links { flex: 1; overflow-y: auto; padding: 4px 0; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
.nav-group { font-size: 13px; color: #66758f; padding: 16px 24px 4px; letter-spacing: 3px; }
/* 醒目的板块标题（企业端的“企业法务”“人力资源”）：金色宋体、带图标、浅金色底，上面留出间隔。别的分组仍是上面的小字 */
.nav-group.major {
  display: flex; align-items: center; gap: 8px; margin: 18px 12px 5px; padding: 7px 11px; border-radius: 4px;
  background: rgba(184, 147, 90, .16); color: #ecd9ac; font-family: var(--serif); font-size: 15.5px; font-weight: 600; letter-spacing: 4px;
}
.nav-group.major .ico { margin: 0; }
.nav-group.major .ico svg { width: 16px; height: 16px; }
.nav-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 22px; border-left: 2px solid transparent; color: #a9b4c7; font-size: 14px; letter-spacing: .5px;
  transition: color .15s, background .15s;
}
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .04); }
.nav-item.active { color: #fff; border-left-color: var(--gold); background: rgba(255, 255, 255, .06); }
.nav-badge { background: var(--gold); color: var(--ink); border-radius: 9px; font-size: 12px; padding: 0 7px; line-height: 18px; font-weight: 600; }
#nav-foot { padding: 14px 22px 16px; font-size: 13px; color: #7f8da6; border-top: 1px solid rgba(255, 255, 255, .08); }
#nav-foot .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; background: var(--gold); }
#nav-foot .dot.on { background: #6fbf8f; }
.nav-user { display: block; color: #f3ead7; }
.nav-user b { display: block; font-size: 14px; font-weight: 600; letter-spacing: 1px; }
.nav-user small { display: block; color: #8b98b0; font-size: 13px; margin-top: 2px; line-height: 1.5; word-break: break-all; }
.nav-foot-row { display: flex; gap: 16px; margin-top: 8px; }
.nav-foot-row a, button.link { color: #a9b4c7; font: inherit; font-size: 13px; background: none; border: 0; padding: 0; cursor: pointer; }
.nav-foot-row a:hover, button.link:hover { color: #fff; }
.nav-model { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, .06); }

/* ---------- 登录、注册（整屏，不显示侧栏） ---------- */
body.auth #nav { display: none; }
body.auth #main { padding: 0; }
/* 三个端各有各的样子（方向二）：整页深色，主视觉在旁边，登录卡片浮在上面。
   .auth-visual 用 sticky 始终停在窗口的垂直正中：注册页的表单很长、卡片比窗口高时，旁边的大标题不会跟着跑到很下面 */
.auth-wrap { min-height: 100vh; display: flex; justify-content: center; align-items: center; gap: 72px; padding: 48px 44px; background: var(--ink); color: #a9b4c7; }
.auth-visual { position: sticky; top: 48px; align-self: flex-start; min-height: calc(100vh - 96px); display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.auth-kicker { color: #d9c08c; font-size: 13.5px; letter-spacing: 4px; }
.auth-note { margin-top: 30px; font-size: 13.5px; letter-spacing: 1px; color: #66758f; }
.auth-card { width: min(420px, 100%); flex: none; background: var(--bg); color: var(--text); border-radius: 8px; padding: 34px 36px 30px; box-shadow: 0 28px 70px rgba(0, 0, 0, .3); }

/* 企业端：墨蓝 */
.auth-company .auth-visual { flex: 0 1 520px; }
.auth-quote { font-family: var(--serif); font-size: 40px; font-weight: 600; line-height: 1.5; letter-spacing: 3px; color: #f3ead7; margin: 18px 0 30px; }
.auth-sample { max-width: 460px; background: #22324f; border-left: 2px solid var(--gold); padding: 16px 20px; color: #cdd6e4; font-size: 14.5px; line-height: 1.9; }
.auth-cite { margin-left: 6px; color: #e6cf9f; border-bottom: 1px solid var(--gold); font-size: 13.5px; }
.auth-sample small { display: block; margin-top: 8px; color: #8b98b0; font-size: 13.5px; }

/* 律所端：墨绿，竖排标题 + 信笺 + 一二三 */
.auth-firm { gap: 0; background: #1c2e29; color: #9db3ab; }
.auth-vtitle { writing-mode: vertical-rl; align-self: center; font-family: var(--serif); font-size: 32px; font-weight: 600; letter-spacing: 16px; color: #f3ead7; padding: 16px 40px 0; border-right: 1px solid var(--gold); }
.auth-firm .auth-card { margin: 0 48px; border-radius: 0; border-top: 3px solid var(--gold); }
.auth-steps { list-style: none; margin: 22px 0 0; padding: 0; font-size: 14.5px; line-height: 2.7; letter-spacing: 1px; white-space: nowrap; }
.auth-steps b { font-family: var(--serif); font-weight: 600; color: #d9c08c; margin-right: 16px; }
.auth-firm .auth-note { color: #6f8a81; }

/* 平台端：石墨色加细网格，像一个控制台 */
.auth-platform {
  background-color: #2a2724; color: #aaa49b;
  background-image: linear-gradient(#35312d 1px, transparent 1px), linear-gradient(90deg, #35312d 1px, transparent 1px); background-size: 34px 34px;
}
.auth-platform .auth-visual { flex: 0 1 460px; }
.auth-mono { font-family: Consolas, "SF Mono", Menlo, monospace; font-size: 13.5px; letter-spacing: 3px; color: #8f897f; }
.auth-big { font-size: 46px; font-weight: 600; letter-spacing: 6px; color: #fff; margin: 6px 0 20px; line-height: 1.3; }
.auth-platform .auth-note { color: #7d766c; }
/* 平台端的卡片是深色的：把卡片里用到的颜色变量换成深色底上的值，里面的标题、说明、输入框、按钮跟着变 */
.auth-platform .auth-card {
  --ink: #fff; --ink-2: #e9e5dc; --text: #ece8e0; --muted: #aaa49b; --line: #57514a; --line-strong: #6a635a; --brand: #e7d3a4; --gold-deep: #e7d3a4;
  background: #3b3733; border: 1px solid #57514a; border-radius: 4px; box-shadow: 0 28px 70px rgba(0, 0, 0, .35);
}
.auth-platform .auth-card input[type="text"], .auth-platform .auth-card input[type="password"] { background: #2a2724; border-color: #57514a; color: #fff; }
.auth-platform .auth-card input:focus { border-color: #aaa49b; box-shadow: 0 0 0 3px rgba(255, 255, 255, .08); }
.auth-platform .auth-card ::placeholder { color: #8f897f; }
.auth-platform .auth-card .btn:not(.ghost) { color: #2a2724; font-weight: 600; }
.auth-platform .auth-card .btn.ghost { color: #ece8e0; }
.auth-platform .auth-card a.btn.ghost:hover { color: #fff; }

/* 卡片最下面的“用户协议 · 隐私政策” */
.auth-legal { margin: 22px 0 0; text-align: center; font-size: 13.5px; color: var(--muted); letter-spacing: .5px; }
.auth-legal a { color: var(--muted); }
.auth-legal a:hover { color: var(--brand); text-decoration: underline; }

/* 登录页整页是深色的：提示条换成浅色才看得见（报错的红色不变） */
body.auth .toast:not(.error) { background: #f6f3ec; color: #17233a; }

/* 窗口窄：旁边的主视觉收成卡片上方的一小段，卡片居中 */
@media (max-width: 1000px) {
  .auth-wrap, .auth-firm { flex-direction: column; gap: 28px; padding: 36px 20px 48px; }
  .auth-visual { position: static; min-height: 0; align-self: center; text-align: center; flex: none !important; }
  .auth-quote { font-size: 26px; margin: 10px 0 0; }
  .auth-sample, .auth-extra, .auth-visual .auth-note { display: none; }
  .auth-vtitle { writing-mode: horizontal-tb; font-size: 26px; letter-spacing: 10px; padding: 0 0 12px; border-right: 0; border-bottom: 1px solid var(--gold); }
  .auth-firm .auth-card { margin: 0; }
  .auth-big { font-size: 32px; margin: 4px 0 8px; }
}
.auth-card h1 { font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--ink); letter-spacing: 2px; }
.auth-sub { color: var(--muted); font-size: 14px; margin: 8px 0 26px; }
.auth-card .btn.block { margin-top: 6px; }
.auth-card .btn.block + .btn.block { margin-top: 10px; }
.auth-alt { color: var(--muted); font-size: 13.5px; margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--line); line-height: 1.9; }
.code-row { display: flex; gap: 10px; }
.code-row input { flex: 1; min-width: 0; }
.code-row .btn { min-width: 112px; justify-content: center; letter-spacing: 0; }
.agree { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--muted); margin: 2px 0 16px; cursor: pointer; }
.agree input { margin-top: 5px; }

/* 名称—内容 对照表（我的账号、企业审核弹窗） */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--text); }
.auth-card .kv { margin-bottom: 26px; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* ---------- 主区域 ---------- */
#main { flex: 1; min-width: 0; padding: 40px 48px 64px; }
.page { max-width: 920px; margin: 0 auto; }
.page-head { margin-bottom: 24px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.page-head h1 { font-family: var(--serif); font-size: 25px; font-weight: 600; color: var(--ink); letter-spacing: 1px; }
.page-head p { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.page-head .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px; }
.card + .card { margin-top: 16px; }
.card h3 { font-family: var(--serif); font-size: 16px; font-weight: 600; color: var(--ink); margin-bottom: 12px; letter-spacing: .5px; }

.grid { display: grid; gap: 16px; }
.grid > .card { margin-top: 0; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1200px) {
  #main { padding: 32px 32px 56px; }
}
@media (max-width: 900px) {
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  #main { padding: 18px 16px 40px; }
}
/* 平板宽度（761–900）：侧栏缩成 64 像素宽的一条。再窄就是手机版面（见文件末尾），侧栏整个收起 */
@media (min-width: 761px) and (max-width: 900px) {
  #nav { width: 64px; }
  .brand { padding: 20px 15px 16px; }
  .brand span:last-child, .nav-group:not(.major), #nav-foot { display: none; }
  /* 侧栏只有 64 像素宽：两个板块标题保留，缩成一行小字，不带图标 */
  .nav-group.major { justify-content: center; margin: 12px 1px 3px; padding: 4px 0; font-size: 11.5px; letter-spacing: 0; white-space: nowrap; }
  .nav-group.major .ico { display: none; }
  .nav-item { font-size: 12px; padding: 8px 4px; justify-content: center; text-align: center; letter-spacing: 0; }
  .nav-note { display: none; }
}

.feature-card { display: block; color: inherit; transition: border-color .15s, background .15s; }
.feature-card:hover { border-color: var(--gold); background: #fff; }
.feature-card .tag { font-size: 13.5px; color: var(--gold-deep); letter-spacing: 2px; }
.feature-card h3 { margin: 6px 0 6px; font-size: 18px; }
.feature-card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.7; }

.stat { display: flex; gap: 36px; flex-wrap: wrap; }
.stat div b { display: block; font-family: Georgia, var(--serif); font-size: 26px; font-weight: 400; color: var(--ink); line-height: 1.3; }
.stat div span { color: var(--muted); font-size: 13.5px; }

.notice { border-radius: 4px; padding: 10px 16px; font-size: 14px; margin-bottom: 16px; }
.notice.warn { background: var(--warn-soft); color: #6d4a0c; border: 1px solid #ecd9a8; }
.notice.info { background: var(--gold-soft); color: #5d4a22; border: 1px solid #e6d7b3; }
.notice.ok { background: var(--ok-soft); color: #23523c; border: 1px solid #c9dfd0; }

/* ---------- 表单 ---------- */
label.field { display: block; margin-bottom: 16px; }
label.field > span { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
label.field > small { display: block; color: var(--muted); font-size: 13.5px; margin-top: 5px; }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 4px; padding: 9px 12px;
  font: inherit; color: inherit; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
::placeholder { color: #a9a596; }
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23, 35, 58, .08); }
input[type="checkbox"] { accent-color: var(--ink); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--ink); border-radius: 4px;
  padding: 8px 20px; font: inherit; font-size: 14px; letter-spacing: 1px; cursor: pointer; background: var(--ink); color: #f6eedc;
  white-space: nowrap; flex: none; transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn.ghost:hover { border-color: var(--ink); color: var(--ink); background: transparent; }
.btn.small { padding: 4px 12px; font-size: 13.5px; letter-spacing: .5px; }
.btn.block { display: flex; width: 100%; justify-content: center; padding: 10px 20px; }
a.btn:hover { color: #f6eedc; }
a.btn.ghost:hover { color: var(--ink); }
.btn.danger { background: transparent; color: var(--danger); border-color: transparent; }
.btn.danger:hover { background: var(--danger-soft); border-color: #e8cfc9; }
.modal-foot .btn.danger { border-color: #e8cfc9; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  border: 1px solid var(--line-strong); background: transparent; border-radius: 4px; padding: 6px 14px; font: inherit; font-size: 13.5px;
  cursor: pointer; color: var(--text); transition: border-color .15s, color .15s;
}
.chip:hover { border-color: var(--gold); color: var(--gold-deep); }

.badge { display: inline-block; font-size: 13px; border-radius: 2px; padding: 0 7px; line-height: 21px; white-space: nowrap; border: 1px solid transparent; }
.badge.gray { background: #f1ede3; color: #5f6672; }
.badge.blue { background: transparent; border-color: var(--line-strong); color: var(--ink); }
/* 状态标签全站只用三种颜色（D-022 A3），颜色只表示“轮到谁”：要我处理（实底红）、等对方（灰色描边）、已完成（绿） */
.badge.todo { background: #c8372d; color: #fff; border-color: #c8372d; font-weight: 600; }
.badge.wait { background: transparent; color: #586070; border-color: #b3ad9f; }
.badge.done { background: var(--ok-soft); color: var(--ok); border-color: #c9dfd0; }
/* 知识库材料的状态另用一组中性色，不和上面三种混：已审核（墨色描边）、示例待审（沙色）；企业自备见下面的 .badge.co */
.badge.kb-ok { background: #fff; color: var(--ink); border-color: var(--ink); }
.badge.kb-pending { background: #efe9da; color: #6b5a2e; border-color: #e0d6bd; }
/* “演示”小标签：内置的演示单位和演示账号（D-019），紫灰色描边，和别的状态标签都不一样 */
.badge.demo { margin-left: 8px; background: #f3eef7; color: #5b3f7a; border-color: #cdb9e0; font-weight: 400; letter-spacing: 1px; }
/* 企业自备（企业自己放进知识库的材料）：蓝灰色，和“已审核”的绿、“示例待审”的黄区别开 */
.badge.co { background: #e7edf5; color: #2f4a73; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }

/* ---------- 对话 ---------- */
.thread { display: flex; flex-direction: column; gap: 18px; margin: 20px 0; }
.turn { border-radius: var(--radius); padding: 22px 28px; border: 1px solid var(--line); background: var(--card); }
.turn.user { background: transparent; border: 0; border-left: 2px solid var(--gold); border-radius: 0; padding: 2px 0 2px 20px; }
.turn-role { font-size: 13.5px; color: var(--muted); letter-spacing: 2px; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.turn-role .badge { letter-spacing: 0; }
.turn.user .text { white-space: pre-wrap; word-break: break-word; font-family: var(--serif); font-size: 17px; font-weight: 500; color: var(--ink); line-height: 1.7; }
.attach { display: inline-block; margin-top: 8px; font-size: 13.5px; border: 1px solid var(--line-strong); border-radius: 4px; padding: 2px 10px; color: var(--text); }
.mask-note { margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.mask-note summary { cursor: pointer; }
.mask-note table { margin-top: 6px; border-collapse: collapse; }
.mask-note td { padding: 1px 12px 1px 0; }

.md { word-break: break-word; line-height: 1.85; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: 24px 0 8px; color: var(--ink); }
.md h1, .md h2, .md h3 { font-family: var(--serif); font-weight: 600; letter-spacing: .5px; }
.md h1 { font-size: 20px; } .md h2 { font-size: 18px; } .md h3 { font-size: 16.5px; } .md h4 { font-size: 15px; }
.md p { margin: 8px 0; }
.md strong { color: var(--ink); }
.md ul, .md ol { padding-left: 22px; margin: 8px 0; }
.md li { margin: 4px 0; }
.md blockquote { margin: 12px 0; padding: 10px 16px; border-left: 2px solid var(--gold); background: #faf6ea; color: #4d4126; }
.md blockquote p { margin: 2px 0; }
.md table { border-collapse: collapse; margin: 12px 0; font-size: 14px; display: block; overflow-x: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 12px; text-align: left; vertical-align: top; }
.md th { background: #f7f3e9; color: var(--ink); }
.md code { background: #f1ede3; border-radius: 3px; padding: 1px 5px; font-size: 13.5px; }
.md pre { background: #f7f3e9; border: 1px solid var(--line); border-radius: 4px; padding: 12px; overflow-x: auto; white-space: pre-wrap; }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.cite {
  display: inline-block; font-size: 13.5px; line-height: 16px; padding: 0 2px; margin: 0 3px; letter-spacing: .5px;
  color: var(--gold-deep); border-bottom: 1px solid var(--gold); cursor: pointer; vertical-align: 1px; font-weight: 600;
  transition: background .15s;
}
.cite:hover { background: var(--gold-soft); }
.cursor::after { content: "▍"; color: var(--gold); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* 等待时的三步进度 */
.md.waiting.cursor::after { content: none; }
.md .steps { list-style: none; margin: 2px 0; padding: 0; font-size: 14px; }
.md .steps li { display: flex; align-items: center; gap: 10px; margin: 0; padding: 5px 0; color: #a3a69f; }
.md .steps li.done { color: var(--text); }
.md .steps li.active { color: var(--ink); font-weight: 600; }
.step-mark { width: 16px; height: 16px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-strong); }
.steps li.done .step-mark { border-color: var(--gold); color: var(--gold-deep); }
.step-mark .ico { margin: 0; }
.step-mark .ico svg { width: 10px; height: 10px; stroke-width: 2.6; }
.steps li.active .step-mark { border-color: var(--gold); border-top-color: transparent; animation: spin .9s linear infinite; }
.steps li.active .step-label::after { content: "……"; font-weight: 400; }
.step-note { color: var(--muted); font-weight: 400; font-size: 13.5px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .steps li.active .step-mark { animation: none; border-top-color: var(--gold); } }

.turn-foot { margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13.5px; }
.sources { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin-bottom: 12px; }
.sources > span.label { color: var(--muted); flex-basis: 100%; }
.source {
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 10px; cursor: pointer; background: transparent; color: var(--text);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: border-color .15s;
}
.source:hover { border-color: var(--gold); }
.source b { color: var(--gold-deep); font-weight: 600; margin-right: 6px; }
.source.pending::after { content: "待审"; margin-left: 8px; font-size: 12.5px; color: var(--warn); }
.source.own::after { content: "企业自备"; margin-left: 8px; font-size: 12.5px; color: #2f4a73; }
.disclaimer { color: var(--muted); font-size: 13.5px; margin-top: 12px; }
.sources-note { color: var(--warn); font-size: 13.5px; margin: -4px 0 12px; }
.btn.ghost:disabled:hover { border-color: var(--line-strong); color: var(--text); }
.turn-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.turn-actions-right { margin-left: auto; display: flex; gap: 8px; }
.foot-handoff { display: inline-flex; align-items: center; gap: 12px; }
.foot-hint { color: var(--gold-deep); font-size: 13.5px; }
.btn.handoff-btn:not(.ghost) { padding: 6px 18px; font-size: 13.5px; }

.composer { position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 78%, transparent); padding: 14px 0 16px; }
.composer-box { display: flex; gap: 10px; align-items: flex-end; background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 8px 8px 8px 16px; transition: border-color .15s, box-shadow .15s; }
.composer-box:focus-within { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23, 35, 58, .08); }
.composer-box textarea { border: 0; padding: 6px 0; min-height: 30px; max-height: 180px; box-shadow: none !important; resize: none; }
.thread-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; font-size: 13.5px; color: var(--muted); flex-wrap: wrap; }

/* ---------- 工作台的输入框 ---------- */
.ask-card { padding: 26px 28px 22px; border-color: var(--line-strong); }
.ask-title { font-family: var(--serif); font-size: 21px; font-weight: 600; color: var(--ink); letter-spacing: 1px; margin-bottom: 14px; }
.ask-card textarea { min-height: 92px; font-size: 15.5px; line-height: 1.8; }
.ask-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
.ask-row .btn:last-child { margin-left: auto; padding: 8px 28px; }
.ask-file { color: var(--muted); font-size: 13.5px; }
.ask-choose { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.ask-choose-label { color: var(--muted); font-size: 13.5px; }
.chip.on { border-color: var(--gold); color: var(--gold-deep); background: var(--gold-soft); }
.section-label { font-size: 13.5px; color: var(--muted); letter-spacing: 3px; margin: 26px 0 10px; }

/* ---------- 待确认事实的小表单 ---------- */
.facts-form { margin: 10px 0 14px; padding: 14px 18px 16px; background: #faf6ea; border-left: 2px solid var(--gold); }
.facts-title { font-size: 13.5px; color: var(--gold-deep); letter-spacing: 3px; margin-bottom: 6px; }
.facts-row { display: block; margin: 10px 0 12px; }
.facts-row > span { display: block; font-size: 14px; line-height: 1.7; color: var(--text); margin-bottom: 5px; }
.facts-row b { font-weight: 600; color: var(--ink); margin-right: 6px; }
.facts-row input { padding: 7px 11px; }
.facts-hint { color: var(--muted); font-size: 13.5px; }

/* ---------- 长回答的目录 ---------- */
.page:has(.turn.has-toc):not(:has(.card .turn.has-toc)) { max-width: 1100px; }
.turn.has-toc { display: grid; grid-template-columns: 200px minmax(0, 1fr); column-gap: 30px; }
.turn.has-toc > * { grid-column: 2; }
.turn.has-toc > .toc {
  grid-column: 1; grid-row: 1 / span 6; align-self: start; position: sticky; top: 24px;
  max-height: calc(100vh - 150px); overflow-y: auto; scrollbar-width: thin;
  border-right: 1px solid var(--line); padding-right: 14px; margin-right: -8px;
}
.toc-title { font-size: 13.5px; color: var(--gold-deep); letter-spacing: 3px; margin-bottom: 8px; }
.toc-item {
  display: block; width: 100%; text-align: left; border: 0; border-left: 2px solid transparent; background: none; cursor: pointer;
  font: inherit; font-size: 13.5px; line-height: 1.5; color: var(--muted); padding: 4px 0 4px 10px; margin: 1px 0;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; transition: color .15s, border-color .15s;
}
.toc-item.lv1 { padding-left: 22px; }
.toc-item.lv2, .toc-item.lv3 { padding-left: 34px; font-size: 13.5px; }
.toc-item:hover { color: var(--ink); }
.toc-item.on { color: var(--ink); font-weight: 600; border-left-color: var(--gold); }
.md h1, .md h2, .md h3, .md h4 { scroll-margin-top: 20px; }
/* 放不下的情况不显示目录：窗口窄、右侧原文栏开着、会话嵌在卡片里（律所端复核工作台） */
.card .turn.has-toc { display: block; }
.card .toc { display: none; }
@media (max-width: 1150px) {
  .turn.has-toc { display: block; }
  .toc { display: none; }
}
@media (max-width: 1640px) {
  body.has-side .turn.has-toc { display: block; }
  body.has-side .toc { display: none; }
}

/* ---------- 出处右侧栏 ---------- */
#doc-side {
  width: 420px; flex: none; height: 100vh; position: sticky; top: 0; display: flex; flex-direction: column;
  background: var(--card); border-left: 1px solid var(--line-strong); animation: side-in .18s ease-out;
}
@keyframes side-in { from { opacity: 0; transform: translateX(16px); } }
.side-head { padding: 22px 24px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.side-kicker { font-size: 13.5px; color: var(--gold-deep); letter-spacing: 2px; margin-bottom: 4px; }
.side-head h2 { font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--ink); letter-spacing: .5px; line-height: 1.5; }
.side-head .meta { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.side-body { flex: 1; overflow-y: auto; padding: 18px 24px 24px; }
.side-foot { padding: 12px 24px; border-top: 1px solid var(--line); }
.cite.on { background: var(--gold); border-bottom-color: var(--gold); color: #fff; }
.source.on { border-color: var(--gold); background: var(--gold-soft); }
body.has-side #main { padding-left: 32px; padding-right: 32px; }
/* 窗口中等宽度：原文栏打开时先把左边的菜单收起来，给回答和原文腾地方；关掉原文栏菜单就回来 */
@media (min-width: 941px) and (max-width: 1240px) {
  body.has-side #nav { display: none; }
  #doc-side { width: 400px; }
}
/* 窗口再窄：原文栏浮在页面右边，不再把正文挤窄 */
@media (max-width: 940px) {
  #doc-side { position: fixed; right: 0; z-index: 40; width: min(420px, 88vw); box-shadow: -16px 0 48px rgba(18, 26, 42, .2); }
}
@media (prefers-reduced-motion: reduce) { #doc-side { animation: none; } }

/* ---------- 方向卡 ---------- */
.lock { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 12px 0; margin: 2px 0 20px; font-size: 13.5px; line-height: 1.7; }
.lock.out { border: 0; border-left: 2px solid var(--warn); background: var(--warn-soft); padding: 12px 16px; }
.lock-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lock-title { font-weight: 600; color: var(--gold-deep); letter-spacing: 1px; margin-right: 4px; }
.lock.out .lock-title { color: #6d4a0c; }
.lock-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.lock-toggle { border: 0; background: none; padding: 0; font: inherit; font-size: 13.5px; color: var(--gold-deep); cursor: pointer; }
.lock-toggle:hover { text-decoration: underline; }
.lock-hint { color: var(--muted); font-size: 13.5px; }
.lock-detail { margin-top: 4px; }
.lock-row { display: flex; gap: 10px; margin-top: 6px; color: #4a5260; }
.lock.out .lock-row { color: #5c4514; }
.lock-label { flex: none; width: 6.5em; color: var(--muted); }
.lock-row ol { margin: 0; padding-left: 18px; }
.lock-note { color: var(--muted); font-size: 13.5px; }
.status { color: var(--muted); }

.issue-option { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px; margin-bottom: 8px; cursor: pointer; transition: border-color .15s; }
.issue-option:hover { border-color: var(--gold); }
.issue-option input { margin-top: 6px; }
.issue-option b { display: block; font-weight: 600; color: var(--ink); }
.issue-option small { color: var(--muted); }
.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field > small { display: block; color: var(--muted); font-size: 13.5px; margin-top: 5px; }
.issue-group { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-bottom: 6px; }
.issue-group > small { width: 2.5em; color: var(--muted); }
.issue-check { display: inline-flex; align-items: center; gap: 5px; font-size: 13.5px; cursor: pointer; }

/* ---------- 表格 ---------- */
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; font-weight: 400; color: #3d4654; font-size: 13.5px; letter-spacing: 1px; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
table.list td { padding: 12px 10px; border-bottom: 1px solid #efe9db; vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: #faf7ef; }
table.list .sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters select { width: auto; min-width: 120px; }
.filters input { flex: 1; min-width: 200px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- 弹窗与提示 ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(18, 26, 42, .5); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal { background: var(--card); border-radius: 8px; width: min(780px, 100%); max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 24px 64px rgba(18, 26, 42, .28); }
.modal-head { padding: 20px 26px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.modal-head h2 { font-family: var(--serif); font-size: 18px; font-weight: 600; color: var(--ink); letter-spacing: .5px; }
.modal-head .meta { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.modal-body { padding: 20px 26px; overflow-y: auto; }
.modal-foot { padding: 14px 26px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal-x { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.modal-x:hover { color: var(--ink); }
.doc-text { white-space: pre-wrap; word-break: break-word; font-size: 14.5px; line-height: 1.9; }

#toast-root { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 99; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #f6eedc; border-radius: 4px; padding: 8px 18px; font-size: 14px; letter-spacing: .5px; box-shadow: 0 8px 24px rgba(18, 26, 42, .22); }
.toast.error { background: var(--danger); color: #fff; }

.lawyer-reply { background: var(--ok-soft); border: 1px solid #c9dfd0; border-radius: 4px; padding: 10px 16px; white-space: pre-wrap; }

/* ---------- 把文件拖进来（fileDrop）：拖动经过能接收的区域时，盖一层“松手即可上传” ---------- */
.drop-zone { position: relative; }
.drop-zone.drop-on::after {
  content: attr(data-drop-label); position: absolute; inset: -6px; z-index: 5; display: grid; place-items: center;
  background: rgba(255, 254, 251, .92); border: 2px dashed var(--gold); border-radius: var(--radius);
  font-family: var(--serif); font-size: 17px; letter-spacing: 2px; color: var(--gold-deep); pointer-events: none;
}

/* ---------- 第三方公开判决库（文书查）：相似公开判决、案号核验。虚线框，和回答、知识库出处区别开 ---------- */
.ext-box { margin: 0 0 14px; padding: 12px 16px 10px; border: 1px dashed var(--line-strong); border-radius: var(--radius); background: #faf8f1; font-size: 14px; }
.ext-last .ext-box { margin: 16px 0 0; }
.ext-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.ext-head b { font-family: var(--serif); font-size: 15px; color: var(--ink); letter-spacing: .5px; }
.ext-notice { color: var(--warn); font-size: 13.5px; }
.ext-scope { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.ext-tail { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.ext-empty { color: var(--muted); font-size: 13.5px; margin: 8px 0 4px; }
.case-item { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.case-item summary { cursor: pointer; margin-left: 16px; }
.case-item summary::marker { color: var(--gold); }
.case-title { color: var(--text); }
.case-item summary:hover .case-title { color: var(--gold-deep); }
.case-meta { display: block; color: var(--muted); font-size: 13.5px; }
.case-part { margin: 8px 0 0 16px; font-size: 13.5px; line-height: 1.8; white-space: pre-wrap; }
.case-part small { display: block; color: var(--muted); font-size: 13.5px; letter-spacing: 1px; }
.case-item .btn { margin: 10px 0 4px 16px; }
.check-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.check-no { color: var(--text); }
.check-note { color: var(--muted); font-size: 13.5px; }

/* 工作台：功能卡片按“企业法务”“人力资源”分成两块，每块一个小标题（和左侧栏的板块标题对应） */
.home-block { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; font-family: var(--serif); font-size: 16.5px; font-weight: 600; letter-spacing: 3px; color: var(--ink); }
.home-block::after { content: ""; flex: 1; height: 1px; background: var(--line-strong); margin-left: 6px; }
.home-block .ico { margin: 0; color: var(--gold-deep); }
.home-block .ico svg { width: 17px; height: 17px; }
.section-label + .home-block { margin-top: 10px; }

/* ==================== 手机版面（D-022 A1）：宽度 760 以内 ====================
   侧栏收起；屏幕底部固定四个按钮（最常用的三项 + “更多”，app.js 的 renderTabbar）；正文占满整屏。
   “更多”打开的就是原来的侧栏，铺满整屏。 */
#tabbar { display: none; }
@media (max-width: 760px) {
  #nav { display: none; }
  body.nav-open #nav { display: flex; position: fixed; inset: 0 0 58px 0; width: auto; height: auto; z-index: 47; }
  body.nav-open.super-acting #nav { top: 52px; height: auto; }
  body.nav-open { overflow: hidden; }
  #main { padding: 16px 14px 84px; }
  body.auth #main { padding: 0; }

  #tabbar {
    display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 48; height: 58px;
    background: var(--card); border-top: 1px solid var(--line-strong); box-shadow: 0 -4px 16px rgba(18, 26, 42, .06);
  }
  body.auth #tabbar { display: none; }
  #tabbar .tab {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; background: transparent; color: var(--muted); font: 12.5px/1.2 var(--sans); cursor: pointer; padding: 0;
  }
  #tabbar .tab .ico { margin: 0; }
  #tabbar .tab .ico svg { width: 21px; height: 21px; }
  #tabbar .tab.on { color: var(--ink); font-weight: 600; box-shadow: inset 0 2px 0 var(--gold); }
  #tabbar .tab b { position: absolute; top: 5px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: #c8372d; color: #fff; font: 600 11.5px/17px var(--sans); text-align: center; }

  /* 各页面在手机上的收紧 */
  .page-head { margin-bottom: 16px; padding-bottom: 12px; }
  .page-head h1 { font-size: 21px; }
  .page-head .row { flex-wrap: wrap; }
  .card { padding: 14px; }
  .turn { padding: 16px 14px; }
  .turn.user { padding: 2px 0 2px 12px; }
  .turn.user .text { font-size: 16px; }
  .composer { bottom: 58px; padding: 10px 0 12px; }
  .ask-card { padding: 16px 14px; }
  .ask-row { flex-wrap: wrap; }
  .turn-actions { flex-wrap: wrap; gap: 10px; }
  .lock-head { flex-wrap: wrap; }
  .filters select, .filters input { min-width: 0; flex: 1 1 46%; }
  /* 表格放不下时在卡片里左右滑，不把整页撑宽 */
  .card:has(> table.list), .card > div:has(> table.list) { overflow-x: auto; }
  table.list { min-width: 640px; } /* 再窄的话，字号加大后“内容”一栏一行只剩四五个字；宽一点，在卡片里左右滑 */
  .modal-mask { padding: 8px; align-items: end; }
  .modal { max-height: 92vh; }
  .modal-head { padding: 14px 16px 12px; }
  .modal-body { padding: 14px 16px; }
  .modal-foot { padding: 12px 16px; flex-wrap: wrap; }
  #toast-root { top: 10px; width: calc(100vw - 24px); }
  /* 总管理员的提示条在手机上放两行：规则在 ends.css 末尾（要排在那里的基本规则后面才生效） */
}

/* 登录页：短信能用时，登录框上面并排的两个选项“密码登录”“验证码登录”（D-022 B4） */
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; margin: 0 0 22px; border-bottom: 1px solid var(--line-strong); }
.auth-tab { border: 0; background: transparent; padding: 9px 0 8px; font: inherit; font-size: 15.5px; letter-spacing: 2px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.auth-tab:hover { color: var(--ink); }
.auth-tab.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--gold); }
.auth-card h1 + .auth-tabs { margin-top: 20px; }
