* { box-sizing: border-box; }

:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e3e6ea;
  --text: #1f2329;
  --muted: #8a9099;
  --accent: #3a6ea5;
  --accent-soft: #eef4fa;
  --ok: #2f9e6f;
  --warn: #d99227;
  --bad: #d9534f;
}

body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #f0f1f3; border-radius: 6px; }
::-webkit-scrollbar-thumb { background: #c5c9d0; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #a7acb5; }

.topbar {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; margin: 0; font-weight: 600; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.engine-tip { margin-left: auto; font-size: 12px; color: var(--muted); }
.engine-tip.ok { color: var(--ok); }
.engine-tip.bad { color: var(--bad); }

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 190px;
  gap: 16px;
  padding: 16px 20px;
  height: calc(100vh - 60px);
  align-items: stretch;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  max-height: 100%;
  overflow: hidden;
}
.panel h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; flex: 0 0 auto; }

.inputs { overflow-y: auto; }

.field-label {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin: 10px 0 4px;
  font-weight: 600;
}
.field-label:first-of-type { margin-top: 0; }

input[type="text"], textarea, select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: #fff;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; line-height: 1.65; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.feishu-row { display: flex; gap: 6px; margin-top: 8px; }
.feishu-row input { flex: 1; min-width: 0; }

.mini {
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 7px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text);
  white-space: nowrap;
  font-family: inherit;
}
.mini:hover { background: #f4f6f8; }
.mini.accent { border-color: var(--accent); color: var(--accent); font-weight: 600; }
.mini.accent:hover { background: var(--accent-soft); }

.status-mini { font-size: 12px; color: var(--muted); min-height: 16px; margin-top: 4px; }
.status-mini.err { color: var(--bad); }
.status-mini.ok { color: var(--ok); }

.file-btn { display: inline-flex; align-items: center; user-select: none; }
.file-hint { font-size: 12px; color: var(--muted); align-self: center; }
.file-images { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.file-images img { width: 96px; height: 96px; object-fit: cover; border: 1px solid var(--border); border-radius: 6px; }

.step-btns { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; }
.step-sep {
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  padding: 4px 0;
  margin: 2px 0 1px;
  border-top: 1px dashed var(--border);
}
.step-btns button {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  text-align: left;
}
.step-btns button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.step-btns .primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.step-btns .primary:hover:not(:disabled) { background: #335f8d; color: #fff; }
.step-btns button:disabled { opacity: .45; cursor: not-allowed; }

.status { margin-top: 10px; font-size: 12.5px; color: var(--muted); min-height: 20px; }
.status.err { color: var(--bad); }
.status.ok { color: var(--ok); }

.adv { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.adv summary { cursor: pointer; font-weight: 600; }

/* 结果区 */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding-bottom: 8px; flex-wrap: wrap; }
.tab {
  border: 0; background: none; padding: 5px 10px; border-radius: 7px;
  cursor: pointer; font-size: 13px; color: var(--muted); font-family: inherit;
}
.tab:hover { background: #f2f4f7; color: var(--text); }
.tab.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.tab-actions { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.copy-tip { font-size: 12px; color: var(--ok); }

.report-body { flex: 1; overflow-y: auto; padding-top: 6px; min-height: 0; }
.placeholder { color: var(--muted); font-size: 13px; }

/* 审核平台：粘贴成稿输入框 */
.audit-box { border: 1px dashed var(--border); border-radius: 10px; padding: 12px 14px; margin: 10px 0;
  background: #fbfcfe; }
.audit-box-head { font-weight: 600; font-size: 13.5px; margin-bottom: 8px; color: var(--text); }
.audit-box #auditDraft { width: 100%; box-sizing: border-box; resize: vertical; font-family: inherit;
  font-size: 13px; line-height: 1.7; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; }
.audit-box-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

table.gen { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13px; }
table.gen th, table.gen td { border: 1px solid var(--border); padding: 7px 9px; text-align: left; vertical-align: top; }
table.gen th { background: #f4f6f9; font-weight: 600; white-space: nowrap; }
table.gen td.id { white-space: nowrap; font-weight: 600; color: var(--accent); }

.card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 10px 0;
  background: #fcfdfe;
}
.card.pick { border-color: var(--accent); background: var(--accent-soft); }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; flex-wrap: wrap; }
.card-no { font-weight: 700; color: var(--accent); }
.mech { font-size: 12px; background: #eef1f5; padding: 2px 7px; border-radius: 5px; color: #5a6572; }
.stars { color: var(--warn); font-size: 12px; }
.risk-low { color: var(--ok); font-size: 12px; }
.risk-mid { color: var(--warn); font-size: 12px; }
.risk-high { color: var(--bad); font-size: 12px; }
.chars { font-size: 11.5px; color: var(--muted); background: #f0f2f5; padding: 1px 6px; border-radius: 4px; }
.chars-bad { color: var(--warn); background: #fdf5e8; font-weight: 600; }
.card-body { font-size: 13.5px; line-height: 1.8; white-space: pre-wrap; }
.card-open { margin-top: 8px; padding: 7px 10px; background: #fffdf5; border-left: 3px solid var(--warn);
  font-size: 12.5px; color: #7a6533; }
.card-reason { margin-top: 7px; font-size: 12.5px; color: var(--muted); }
.pick-btn { margin-left: auto; }

.warn-chip { display: inline-block; background: #fdeaea; color: var(--bad);
  padding: 1px 6px; border-radius: 4px; font-size: 11.5px; margin-left: 4px; }

h3.sec { font-size: 14px; margin: 16px 0 6px; color: var(--text); }
.summary-line { padding: 9px 12px; background: #f7f9fb; border-radius: 8px; font-size: 13.5px; margin: 8px 0; }
ul.plain { margin: 6px 0; padding-left: 20px; font-size: 13.5px; }
ul.plain li { margin: 3px 0; }

/* Markdown 渲染 */
.md h1 { font-size: 20px; margin: 14px 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--accent); }
.md h2 { font-size: 16.5px; margin: 18px 0 8px; padding-left: 9px; border-left: 4px solid var(--accent); }
.md h3 { font-size: 14.5px; margin: 14px 0 6px; }
.md p { margin: 7px 0; }
.md ul { padding-left: 22px; margin: 7px 0; }
.md li { margin: 4px 0; }
.md code { background: #f2f4f7; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.md pre { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; }
.md pre code { background: none; }
.md table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 13px; }
.md th, .md td { border: 1px solid var(--border); padding: 6px 9px; text-align: left; }
.md th { background: #f4f6f9; }
.md blockquote { margin: 8px 0; padding: 8px 12px; background: #f8fafc;
  border-left: 3px solid #c7d7fe; color: #4a5563; }

.audit-item { border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; margin: 8px 0; font-size: 13px; }
.audit-item.must-fix { border-color: #f0c2c0; background: #fdf6f6; }
.audit-item .cat { font-size: 12px; color: var(--muted); font-weight: 600; }
.audit-item .fix { color: var(--ok); margin-top: 4px; }

.tone-banner { border-radius: 9px; padding: 10px 12px; margin: 8px 0; font-size: 13px; }
.tone-banner ul { margin: 6px 0 0; padding-left: 18px; }
.tone-banner li { margin: 2px 0; color: var(--muted); }
.tone-banner.tone-hit { border: 1px solid #f0c2c0; background: #fdf6f6; }
.tone-banner.tone-miss { border: 1px solid var(--border); background: #f7f8fa; }

/* 历史 */
.history { display: flex; flex-direction: column; min-height: 0; }
.history h2 { font-size: 14px; margin: 0 0 10px; font-weight: 600; }
.history ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.history li {
  padding: 7px 9px; border-bottom: 1px solid var(--border);
  cursor: pointer; font-size: 12.5px;
}
.history li:hover { background: #f4f6f8; }
.history li .t { color: var(--muted); font-size: 11px; }
