:root {
  --bg: #f4f2ef;
  --panel: #ffffff;
  --ink: #1d232b;
  --ink-2: #4a5360;
  --ink-3: #8a929c;
  --line: #e3dfd9;
  --line-2: #efece8;
  --iron: #a8471f;        /* 赤铁矿色，主强调色 */
  --iron-soft: #f6e7df;
  --slate: #26303b;
  --ok: #2f7d4f;
  --ok-soft: #e3f1e8;
  --warn: #b7791f;
  --warn-soft: #fbf0dc;
  --bad: #b83a3a;
  --bad-soft: #f8e3e3;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 24, 30, .06), 0 2px 8px rgba(20, 24, 30, .04);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Segoe UI", "Microsoft YaHei", "Noto Sans CJK SC", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 0 24px; height: 58px;
  background: var(--slate); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; cursor: pointer; }
.brand-mark { width: 26px; height: 26px; border-radius: 6px; background: linear-gradient(135deg, #c65a2e, #7a2f14); display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.brand-title { font-weight: 600; font-size: 15px; }
.brand-sub { font-size: 12px; color: #aab4bf; }
.nav { display: flex; gap: 4px; }
.nav a { white-space: nowrap; text-decoration: none; padding: 6px 12px; border-radius: 6px; color: #c9d1d9; }
.nav a.active, .nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.nav .badge { background: var(--iron); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
.spacer { flex: 1; }
.search { width: 240px; padding: 6px 10px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .15); background: rgba(255, 255, 255, .08); color: #fff; }
.search::placeholder { color: #9aa5b1; }
.langs { display: flex; border: 1px solid rgba(255, 255, 255, .2); border-radius: 6px; overflow: hidden; }
.langs button { background: none; border: 0; color: #c9d1d9; padding: 4px 9px; cursor: pointer; font-size: 12px; }
.langs button.on { background: #fff; color: var(--slate); font-weight: 600; }
.topbar .btn-link { background: none; border: 0; color: #aab4bf; cursor: pointer; font-size: 12px; }

/* ---------- 通用 ---------- */
main { padding: 20px 24px 60px; max-width: 1600px; margin: 0 auto; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #cfc9c1; background: #faf9f7; }
.btn.primary { background: var(--iron); border-color: var(--iron); color: #fff; }
.btn.primary:hover { background: #923c18; }
.btn.dark { background: var(--slate); border-color: var(--slate); color: #fff; }
.btn.ghost { border-color: transparent; background: none; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 3px 9px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: default; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.pill.iron { background: var(--iron-soft); color: var(--iron); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.high { background: var(--bad); } .dot.medium { background: var(--warn); } .dot.low { background: #9aa5b1; }
.bar { height: 5px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--iron); border-radius: 3px; }
.bar.ok > i { background: var(--ok); }
.empty { text-align: center; color: var(--ink-3); padding: 40px 10px; }
h2 { font-size: 18px; margin: 0; }
h3 { font-size: 14px; margin: 0 0 10px; color: var(--ink-2); font-weight: 600; }

/* ---------- 看板 ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.chips { display: flex; gap: 6px; }
.chip { padding: 4px 12px; border-radius: 16px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: 13px; }
.chip.on { background: var(--slate); color: #fff; border-color: var(--slate); }
.board { display: grid; grid-template-columns: repeat(var(--cols, 7), minmax(176px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #ebe7e2; border-radius: var(--radius); padding: 10px; min-height: 200px; display: flex; flex-direction: column; gap: 10px; }
.col.drop { outline: 2px dashed var(--iron); outline-offset: -2px; }
.col-head { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13px; color: var(--ink-2); padding: 2px 4px; }
.col-head .num { width: 20px; height: 20px; border-radius: 50%; background: var(--slate); color: #fff; display: grid; place-items: center; font-size: 11px; flex: none; }
.col-head .count { margin-left: auto; color: var(--ink-3); font-weight: 400; }
.col.inactive .col-head .num { background: #9aa5b1; }
.mcard { background: var(--panel); border-radius: 8px; padding: 12px; box-shadow: var(--shadow); cursor: pointer; border: 1px solid transparent; display: flex; flex-direction: column; gap: 8px; }
.mcard:hover { border-color: #d7cfc6; }
.mcard.dragging { opacity: .4; }
.mcard .t { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.mcard .meta { font-size: 12px; color: var(--ink-3); }
.mcard .stats { display: flex; gap: 10px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.mcard .next { overflow-wrap: anywhere; font-size: 12px; background: var(--line-2); border-radius: 6px; padding: 6px 8px; color: var(--ink-2); }
.mcard .next b { font-weight: 600; }
.mcard .next.overdue { background: var(--bad-soft); color: var(--bad); }
.mcard .next.today { background: var(--warn-soft); color: var(--warn); }

/* ---------- 待跟进 ---------- */
.todo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.todo-sec { padding: 16px; }
.todo-item { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-2); cursor: pointer; }
.todo-item:first-of-type { border-top: 0; }
.todo-item:hover .ti-title { color: var(--iron); }
.ti-date { width: 82px; flex: none; font-size: 12px; color: var(--ink-3); }
.ti-title { font-weight: 500; }

/* ---------- 矿厂详情 ---------- */
.d-head { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.d-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.d-title h2 { font-size: 22px; }
.d-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.stepper { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.step { position: relative; padding: 8px 6px 6px; text-align: center; cursor: pointer; border-radius: 6px; font-size: 12px; color: var(--ink-3); }
.step:hover { background: var(--line-2); }
.step .sbar { height: 6px; border-radius: 3px; background: var(--line); margin-bottom: 6px; }
.step.past .sbar { background: #d99a7c; }
.step.cur .sbar { background: var(--iron); }
.step.cur { color: var(--iron); font-weight: 600; }
.step.past { color: var(--ink-2); }
.stats-row { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; background: var(--line); border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.stat { background: var(--panel); padding: 10px 14px; }
.stat .v { font-size: 20px; font-weight: 600; }
.stat .v small { font-size: 12px; font-weight: 400; color: var(--ink-3); margin-left: 2px; }
.stat .l { font-size: 12px; color: var(--ink-3); }
.stat.warn .v { color: var(--warn); } .stat.bad .v { color: var(--bad); }
.d-body { display: grid; grid-template-columns: 340px 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.side { display: flex; flex-direction: column; gap: 16px; }
.side .card { padding: 16px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 6px 10px; font-size: 13px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; word-break: break-word; }
.focus textarea { width: 100%; min-height: 70px; resize: vertical; }
.focus label { display: block; font-size: 12px; color: var(--ink-3); margin: 10px 0 4px; }
.focus label:first-of-type { margin-top: 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs a { padding: 12px 14px; text-decoration: none; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--iron); font-weight: 600; }
.tabs a .n { font-size: 11px; color: var(--ink-3); margin-left: 3px; }
.tab-body { padding: 16px 18px 20px; }
.tab-tools { display: flex; gap: 8px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }

/* 进度清单 */
.stage-block { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.stage-block > summary { list-style: none; cursor: pointer; padding: 10px 14px; display: flex; align-items: center; gap: 10px; background: #faf9f7; }
.stage-block > summary::-webkit-details-marker { display: none; }
.stage-block.cur > summary { background: var(--iron-soft); }
.stage-block .sname { font-weight: 600; }
.stage-block .sbar-wrap { width: 120px; margin-left: auto; }
.task { display: flex; align-items: flex-start; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--line-2); }
.task input[type=checkbox] { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--ok); cursor: pointer; flex: none; }
.task .tt { flex: 1; }
.task.done .tt .tname { color: var(--ink-3); text-decoration: line-through; }
.task .tnote { font-size: 12px; color: var(--ink-2); margin-top: 2px; white-space: pre-wrap; }
.task .tmeta { display: flex; gap: 6px; align-items: center; font-size: 12px; flex: none; }
.task .tbtns { opacity: 0; transition: opacity .1s; display: flex; gap: 2px; }
.task:hover .tbtns { opacity: 1; }
.add-task { padding: 8px 14px; border-top: 1px solid var(--line-2); }

/* 沟通记录时间线 */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl { position: relative; padding: 0 0 18px; }
.tl .ic { position: absolute; left: -26px; top: 0; width: 20px; height: 20px; border-radius: 50%; background: var(--panel); border: 2px solid var(--line); display: grid; place-items: center; font-size: 10px; }
.tl .ic.email_sent, .tl .ic.email_received { border-color: #4a7bb7; }
.tl .ic.call, .tl .ic.video, .tl .ic.meeting { border-color: var(--ok); }
.tl .ic.partner_visit, .tl .ic.site_visit { border-color: var(--iron); }
.tl .head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tl .head .d { font-size: 12px; color: var(--ink-3); }
.tl .head .ttl { font-weight: 600; }
.tl .body { margin-top: 4px; white-space: pre-wrap; color: var(--ink-2); }
.tl .nx { margin-top: 6px; font-size: 12px; color: var(--iron); }
.tl .btns { margin-left: auto; opacity: 0; display: flex; gap: 2px; }
.tl:hover .btns { opacity: 1; }

/* 表格 */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 500; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.tbl td.num { font-variant-numeric: tabular-nums; }
.tbl tr:hover td { background: #fbfaf8; }
.tbl .acts { white-space: nowrap; text-align: right; }

/* ---------- 弹窗 ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(20, 24, 30, .45); display: grid; place-items: center; z-index: 100; padding: 20px; }
.modal { background: var(--panel); border-radius: 12px; width: min(640px, 100%); max-height: 90vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 16px; }
.modal-body { padding: 16px 20px; overflow-y: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form .full { grid-column: 1 / -1; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }
input[type=text], input[type=date], input[type=number], input[type=email], input[type=password], select, textarea {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--iron); box-shadow: 0 0 0 3px var(--iron-soft); }
textarea { min-height: 90px; resize: vertical; }

.menu { position: relative; }
.menu-list { position: absolute; right: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .12); min-width: 180px; padding: 4px; z-index: 30; }
.menu-list button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 12px; border-radius: 6px; cursor: pointer; }
.menu-list button:hover { background: var(--line-2); }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--slate); color: #fff; padding: 9px 18px; border-radius: 8px; z-index: 200; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }

/* 登录页 */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--slate); }
.login-card { width: 340px; padding: 28px; }
.login-card h1 { font-size: 18px; margin: 0 0 18px; }

@media (max-width: 1000px) {
  .d-body { grid-template-columns: minmax(0, 1fr); }
  .tab-body { overflow-x: auto; }
  .stats-row { grid-template-columns: repeat(3, 1fr); }
  .search { display: none; }
  .brand-sub { display: none; }
}
@media (max-width: 640px) {
  main { padding: 14px 12px 40px; }
  .topbar { padding: 0 12px; gap: 10px; }
  .brand-title, .brand > div:last-child { display: none; }
  .nav a { padding: 6px 8px; }
  .langs button { padding: 4px 6px; }
  #btn-new { font-size: 0; padding: 4px 10px; }
  #btn-new::before { content: '+'; font-size: 16px; }
  .board { grid-template-columns: repeat(var(--cols, 7), 240px); }
  .stepper { grid-template-columns: repeat(7, minmax(38px, 1fr)); }
  .step .sl { display: none; }
  .form { grid-template-columns: 1fr; }
}

/* 报价对比 */
.tbl.compare td { font-size: 12.5px; line-height: 1.5; }
.tbl.compare tr.bm-row td { background: var(--iron-soft); border-bottom: 2px solid #e6c7b8; }
.tbl.compare tr.inactive td { opacity: .6; }
.tbl.compare a { text-decoration: none; }
.tbl.compare a:hover { color: var(--iron); }
.toolbar .spacer { flex: 1; }

/* ---------- AI ---------- */
.ai-btn { background: linear-gradient(135deg, #3b4b5c, #26303b); color: #fff; border-color: rgba(255,255,255,.2); }
.ai-btn:hover { background: #3b4b5c; }
.ai-btn.on { background: #fff; color: var(--slate); }
.notice { background: var(--line-2); border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 12px; color: var(--ink-2); }
.notice.warn { background: var(--warn-soft); color: #7a5312; }
.notice a { color: var(--iron); font-weight: 600; }
.settings-card { padding: 20px 22px; max-width: 860px; }
.settings-card code { font-size: 12px; background: var(--line-2); padding: 1px 5px; border-radius: 4px; }
.badge-dot { background: var(--iron); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
.tabs a .badge-dot { color: #fff; }

.drop { display: block; border: 2px dashed var(--line); border-radius: 10px; padding: 18px; text-align: center; color: var(--ink-3); cursor: pointer; margin-bottom: 12px; background: #fcfbf9; }
.drop:hover, .drop.over { border-color: var(--iron); color: var(--iron); background: var(--iron-soft); }
.doc { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: #fff; }
.doc-head { display: flex; align-items: flex-start; gap: 10px; }
.doc-title { flex: 1; min-width: 0; }
.doc-title a { color: var(--ink-3); }
.doc-acts { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.doc-sum { margin-top: 8px; color: var(--ink-2); font-size: 13px; white-space: pre-wrap; }
.doc details { margin-top: 6px; }
.doc details ul { margin: 6px 0 0 0; padding-left: 20px; }
.doc-text { white-space: pre-wrap; font: 12px/1.6 ui-monospace, Menlo, Consolas, monospace; margin: 0; }
.sugg { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 8px; }
.sugg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.sugg-head .btn { margin-left: auto; }
.sugg-row { display: grid; grid-template-columns: auto 120px 1fr auto; gap: 8px 10px; align-items: start; padding: 6px 0; font-size: 13px; border-bottom: 1px solid var(--line-2); }
.sugg > .sugg-row:only-child { grid-template-columns: 150px 1fr auto; border-bottom: 0; }
.sugg-row.accepted { opacity: .55; }
.sugg-row.ignored { opacity: .35; text-decoration: line-through; }
.sugg-row .sk { color: var(--ink-2); font-weight: 600; }
.sugg-row .sq { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.sugg-row .sa { display: flex; gap: 4px; white-space: nowrap; }
.pill.ours { background: #e3ecf7; color: #2d5a8c; }
.pill.theirs { background: var(--iron-soft); color: var(--iron); }

.terms-tbl td { vertical-align: top; }
.terms-tbl tr.agreed td { background: #f3f9f5; }
.term-cell { position: relative; padding-right: 54px !important; }
.term-cell .tv { white-space: pre-wrap; }
.term-cell .ts { font-size: 11px; color: var(--ink-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 360px; }
.term-cell .tbtn { position: absolute; right: 2px; top: 4px; opacity: 0; display: flex; }
.term-cell:hover .tbtn { opacity: 1; }
.ok-btn { background: var(--ok-soft); color: var(--ok); border-color: #bfdcc9; }
.bm-box { background: var(--iron-soft); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; font-size: 13px; }
.bm-box summary { cursor: pointer; }

/* 对话抽屉 */
.chat { position: fixed; top: 58px; right: 0; bottom: 0; width: 440px; background: #fff; border-left: 1px solid var(--line); display: flex; flex-direction: column; z-index: 40; box-shadow: -6px 0 24px rgba(20,24,30,.08); }
body.chat-on main { margin-right: 440px; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); gap: 8px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: #faf9f7; }
.chat-empty { color: var(--ink-3); font-size: 13px; text-align: center; padding: 30px 10px 10px; }
.quick { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.quick .chip { text-align: left; border-radius: 8px; }
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 92%; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.6; word-break: break-word; }
.msg.user .bubble { background: var(--slate); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant .bubble { background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.bubble p { margin: 0 0 4px; }
.bubble .sp { height: 6px; }
.bubble ul, .bubble ol { margin: 2px 0 6px; padding-left: 20px; }
.bubble h3, .bubble h4, .bubble h5, .bubble h6 { margin: 8px 0 4px; font-size: 14px; }
.bubble pre { background: var(--line-2); padding: 8px; border-radius: 6px; white-space: pre-wrap; font-size: 12px; }
.bubble code { background: var(--line-2); padding: 0 4px; border-radius: 3px; font-size: 12px; }
.bubble .cite { color: var(--iron); font-size: 12px; }
.md-table { border-collapse: collapse; margin: 6px 0; font-size: 12px; }
.md-table th, .md-table td { border: 1px solid var(--line); padding: 4px 6px; text-align: left; vertical-align: top; }
.typing span { display: inline-block; width: 6px; height: 6px; margin: 0 2px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
.chat-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-input textarea { min-height: 44px; max-height: 160px; resize: vertical; }
@media (max-width: 1100px) { body.chat-on main { margin-right: 0; } .chat { width: min(440px, 100%); } }
@media (max-width: 640px) { .chat { width: 100%; } .sugg-row { grid-template-columns: auto 1fr; } }
@media (max-width: 640px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 8px 12px; row-gap: 6px; }
  .topbar .nav { order: 10; width: 100%; overflow-x: auto; }
  .chat { top: 0; z-index: 60; }
}

/* 按角色收起写入口；权限始终由服务端复核。 */
body[data-role="viewer"] :is(#btn-new, #btn-ai),
body[data-role="viewer"] #app :is(#btn-act, #btn-edit, #btn-edit2, #btn-del, #fx-save, #add-act, #add, #add-term, #paste, #drop, #analyze-all, #edit-bm, .add-task, [data-edit], [data-del], [data-apply], [data-ignore], [data-analyze], [data-agree]),
body[data-role="member"] #app :is(#btn-del, #edit-bm) { display: none !important; }
body[data-role="viewer"] .step { cursor: default; }
body[data-role="viewer"] #app :is(input[readonly], textarea[readonly]) { background: var(--bg); }
.login-card > input { margin: 6px 0 14px; }
#account { min-width: 0; max-width: 100%; color: var(--ink); }
#account-toggle { max-width: 100%; min-height: 32px; color: var(--slate); }
#account-toggle .account-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#account-toggle .pill { flex-shrink: 0; }
#account .menu-list { min-width: 190px; }
.timestamp { white-space: nowrap; font-variant-numeric: tabular-nums; }
.audit-card { margin-top: 20px; padding: 20px 22px; }
.audit-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
#audit-filter { width: auto; max-width: 100%; }
.audit-table { overflow-x: auto; margin-bottom: 14px; }
@media (max-width: 640px) {
  #account { flex-basis: 100%; display: flex; justify-content: flex-end; }
  #account .menu { max-width: 100%; }
  .audit-card { padding: 16px; }
}
#password-modal { z-index: 1000; }
#password-modal label { display: block; margin: 12px 0; }
