:root {
  --bg: #ffffff;
  --bg-2: #f7f8fa;
  --panel: #ffffff;
  --panel-2: #f7f8fa;
  --line: #e7e9ec;
  --line-strong: #d8dce1;
  --text: #161616;
  --muted: #4b5563;
  --dim: #8b95a1;
  --teal: #0d9488;
  --teal-soft: rgba(13, 148, 136, 0.09);
  --blue: #2563eb;
  --amber: #b45309;
  --red: #b91c1c;
  --green: #047857;
  --radius: 16px;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 480px at 12% -10%, rgba(45, 212, 191, 0.13), transparent 60%),
    radial-gradient(800px 420px at 88% 0%, rgba(56, 189, 248, 0.10), transparent 60%),
    radial-gradient(700px 500px at 50% 110%, rgba(56, 189, 248, 0.06), transparent 60%),
    linear-gradient(180deg, #060d17 0%, #08111d 60%, #060d17 100%);
}

/* ---------- 顶栏 ---------- */
.topbar {
  max-width: 1440px;
  margin: 0 auto;
  padding: 22px 28px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 14px; }
.logo { width: 46px; height: 46px; filter: drop-shadow(0 0 14px rgba(45, 212, 191, 0.25)); }
.brand-text h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.brand-text h1 .dot { color: var(--teal); }
.brand-text h1 .sub { font-size: 13px; font-weight: 400; color: var(--muted); letter-spacing: 0.3px; }
.brand-text p { margin: 2px 0 0; color: var(--dim); font-size: 12.5px; }

.top-actions { display: flex; align-items: center; gap: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  font-size: 12px; color: var(--muted);
}
.pill.ghost { color: var(--dim); }
.dot-led { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px currentColor; }
.pill.ok .dot-led { background: var(--green); }
.pill.bad .dot-led { background: var(--red); }

/* ---------- 布局 ---------- */
.layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 6px 28px 8px;
  display: grid;
  grid-template-columns: minmax(380px, 0.86fr) minmax(420px, 1.14fr);
  gap: 18px;
  align-items: start;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  padding: 18px 18px 16px;
  box-shadow: 0 18px 44px -32px rgba(15, 23, 42, 0.35);
  min-height: 200px;
}

.input-panel { position: sticky; top: 12px; }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 14px; flex-wrap: wrap;
}
.panel-head h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: 0.4px; }
.panel-head h2::before { content: ""; display: inline-block; width: 3px; height: 13px; margin-right: 8px; border-radius: 2px; background: linear-gradient(180deg, var(--teal), transparent); vertical-align: -2px; }

/* ---------- 输入 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field.grow { flex: 1; }
.field label { font-size: 12px; color: var(--muted); letter-spacing: 0.2px; }
.field input, .field textarea {
  width: 100%;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 9px 11px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus, .field textarea:focus {
  border-color: rgba(45, 212, 191, 0.55);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.10);
}
.field input::placeholder, .field textarea::placeholder { color: #9ca3af; }
.field textarea { resize: vertical; min-height: 96px; line-height: 1.6; }
#desc { min-height: 150px; }
#extra { min-height: 46px; }

.field-row { display: grid; grid-template-columns: 1.3fr 0.8fr 0.8fr; gap: 10px; }

/* ---------- 闲鱼链接抓取 ---------- */
.fetch-bar {
  margin-bottom: 14px;
  padding: 11px 12px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(13, 148, 136, 0.05), rgba(37, 99, 235, 0.015));
}
.fetch-bar > label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.2px;
  margin-bottom: 7px;
}
.fetch-row { display: flex; gap: 8px; }
.fetch-row input {
  flex: 1;
  min-width: 0;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 9px 11px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.fetch-row input:focus {
  border-color: rgba(45, 212, 191, 0.55);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.10);
}
.fetch-row input::placeholder { color: #9ca3af; }
.fetch-row button {
  flex: none;
  padding: 0 18px;
  border-radius: 10px;
  border: 1px solid rgba(45, 212, 191, 0.45);
  background: var(--teal-soft);
  color: var(--teal);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
  white-space: nowrap;
}
.fetch-row button:hover { filter: brightness(1.15); }
.fetch-row button:active { transform: translateY(1px); }
.fetch-row button[disabled] { cursor: progress; filter: grayscale(0.4) brightness(0.8); }
.fetch-hint { margin-top: 6px; font-size: 11.5px; color: var(--dim); line-height: 1.5; }
.fetch-hint.ok { color: var(--teal); }
.fetch-hint.err { color: var(--red); }
.fetch-hint.busy { color: var(--amber); }
.fetch-hint code { font-family: var(--mono); font-size: 11px; color: var(--muted); }

/* 抓取回填后的字段高亮 */
@keyframes fieldFlash {
  0% { border-color: rgba(45, 212, 191, 0.9); box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.18); }
  100% { border-color: var(--line); box-shadow: none; }
}
.field.flashed input,
.field.flashed textarea { animation: fieldFlash 1.5s ease-out; }

.field-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); }
.field-meta #descCount { color: var(--teal); }

.case-chips { display: flex; align-items: center; gap: 6px; }
.chip-label { font-size: 11.5px; color: var(--dim); margin-right: 2px; }
.chip {
  border: 1px solid var(--line);
  background: rgba(45, 212, 191, 0.06);
  color: var(--muted);
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.chip:hover { border-color: rgba(45, 212, 191, 0.5); color: var(--teal); }
.chip.active { background: var(--teal-soft); border-color: rgba(45, 212, 191, 0.6); color: var(--teal); }

.actions { display: flex; gap: 10px; align-items: stretch; margin-top: 4px; }
.primary-btn {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: none; border-radius: 11px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #0d9488, #0f766e);
  color: #ffffff;
  font-family: inherit; font-size: 14px; font-weight: 700;
  letter-spacing: 0.4px;
  cursor: pointer;
  box-shadow: 0 10px 26px -12px rgba(13, 148, 136, 0.5);
  transition: transform 0.12s, filter 0.15s;
}
.primary-btn:hover { filter: brightness(1.06); }
.primary-btn:active { transform: translateY(1px); }
.primary-btn[disabled] { cursor: progress; filter: grayscale(0.35) brightness(0.85); }
.primary-btn .btn-kbd {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  border: 1px solid rgba(4, 34, 42, 0.35); border-radius: 5px;
  padding: 1px 5px; opacity: 0.7;
}
.ghost-btn {
  border: 1px solid var(--line); border-radius: 11px;
  background: transparent; color: var(--muted);
  padding: 0 16px; font-family: inherit; font-size: 13px;
  cursor: pointer; transition: all 0.15s;
}
.ghost-btn:hover { border-color: var(--line-strong); color: var(--text); }

/* ---------- 报告 ---------- */
.report-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.meta { font-size: 11px; color: var(--dim); }
.icon-btn {
  border: 1px solid var(--line); border-radius: 8px;
  background: transparent; color: var(--muted);
  font-size: 11.5px; padding: 4px 9px; cursor: pointer;
  font-family: inherit; transition: all 0.15s;
}
.icon-btn:hover:not([disabled]) { border-color: rgba(45, 212, 191, 0.5); color: var(--teal); }
.icon-btn[disabled] { opacity: 0.4; cursor: default; }

.empty-state { padding: 34px 18px 20px; text-align: center; color: var(--muted); }
.empty-art svg { width: 190px; height: 132px; }
.empty-title { font-size: 15px; color: var(--text); margin: 6px 0 16px; letter-spacing: 0.3px; }
.empty-steps { list-style: none; margin: 0 auto; padding: 0; max-width: 360px; text-align: left; display: grid; gap: 8px; }
.empty-steps li {
  font-size: 12.5px; color: var(--dim);
  padding: 8px 12px; border: 1px dashed var(--line); border-radius: 10px;
  display: flex; gap: 10px;
}
.empty-steps li b { color: var(--teal); font-weight: 600; min-width: 32px; }

.loading-state { padding: 26px 10px 10px; text-align: center; }
.scanner {
  position: relative; width: 100%; max-width: 520px; height: 6px;
  margin: 0 auto 26px; border-radius: 999px; overflow: hidden;
  background: rgba(45, 212, 191, 0.08); border: 1px solid var(--line);
}
.scanner span {
  position: absolute; top: 0; bottom: 0; width: 38%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, var(--teal), var(--blue), transparent);
  animation: scan 1.5s ease-in-out infinite;
}
@keyframes scan { 0% { left: -40%; } 100% { left: 105%; } }
.stages { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.stage {
  font-size: 12px; color: var(--dim);
  padding: 4px 11px; border-radius: 999px;
  border: 1px solid var(--line); transition: all 0.3s;
}
.stage.done { color: var(--teal); border-color: rgba(13, 148, 136, 0.45); background: var(--teal-soft); }
.stage.active { color: #ffffff; background: var(--teal); border-color: var(--teal); animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.loading-tip { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); }

.stream-preview {
  margin: 18px auto 4px;
  max-width: 100%;
  max-height: 340px;
  overflow: hidden;
  text-align: left;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: #374151;
  white-space: pre-wrap;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.2), #000 18%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,.2), #000 18%);
}
.stream-preview::after { content: "▍"; color: var(--teal); animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

.report { animation: rise 0.35s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

#reportBadge { margin-bottom: 10px; }
.badge-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; border-radius: 10px;
  font-size: 13.5px; font-weight: 700; letter-spacing: 0.4px;
  border: 1px solid;
}
.badge .b-dot { width: 8px; height: 8px; border-radius: 50%; }
.badge.high { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
.badge.high .b-dot { background: var(--red); box-shadow: 0 0 9px rgba(185, 28, 28, 0.5); }
.badge.mid { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.badge.mid .b-dot { background: var(--amber); box-shadow: 0 0 9px rgba(180, 83, 9, 0.5); }
.badge.low { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.badge.low .b-dot { background: var(--blue); box-shadow: 0 0 9px rgba(37, 99, 235, 0.5); }
.badge.none { color: #047857; background: #ecfdf5; border-color: #a7f3d0; }
.badge.none .b-dot { background: var(--green); box-shadow: 0 0 9px rgba(4, 120, 87, 0.5); }

/* ---------- Markdown ---------- */
.markdown { font-size: 13.5px; color: #1f2937; }
.markdown h1 {
  font-size: 17px; margin: 2px 0 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--line); letter-spacing: 0.3px;
}
.markdown h2 {
  font-size: 14.5px; margin: 22px 0 10px; color: var(--teal);
  display: flex; align-items: center; gap: 8px;
}
.markdown h2::before { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--teal); box-shadow: 0 0 8px rgba(13, 148, 136, 0.6); }
.markdown h3 { font-size: 13.5px; margin: 16px 0 8px; color: #334155; }
.markdown p { margin: 8px 0; }
.markdown strong { color: #111827; }
.markdown em { color: #334155; }
.markdown code {
  font-family: var(--mono); font-size: 12px;
  background: rgba(13, 148, 136, 0.07); border: 1px solid rgba(13, 148, 136, 0.16);
  border-radius: 5px; padding: 1px 5px; color: #0f766e;
}
.markdown a { color: var(--blue); text-decoration: none; border-bottom: 1px dashed rgba(37, 99, 235, 0.4); }
.markdown ul, .markdown ol { margin: 8px 0; padding-left: 22px; }
.markdown li { margin: 4px 0; }
.markdown blockquote {
  margin: 10px 0; padding: 8px 14px;
  border-left: 3px solid rgba(13, 148, 136, 0.5);
  background: rgba(13, 148, 136, 0.05);
  border-radius: 0 8px 8px 0;
  color: #374151;
}
.markdown hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.markdown table {
  width: 100%; border-collapse: collapse; margin: 10px 0 14px;
  font-size: 12.5px; display: block; overflow-x: auto;
}
.markdown th, .markdown td {
  border: 1px solid var(--line);
  padding: 7px 10px; text-align: left; vertical-align: top;
}
.markdown th { background: rgba(13, 148, 136, 0.06); color: var(--teal); font-weight: 600; white-space: nowrap; }
.markdown tr:nth-child(even) td { background: #fafbfc; }
.markdown td:first-child { color: var(--muted); white-space: nowrap; }
.markdown table td:nth-child(2), .markdown table td:nth-child(3) { color: #1f2937; }

/* 风险清单里给「高/中/低」上色（由 app.js 后处理） */
.sev-high { color: var(--red); }
.sev-mid { color: var(--amber); }
.sev-low { color: var(--blue); }

.error-box {
  margin-top: 12px; padding: 12px 14px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  border-radius: 10px; color: #b91c1c; font-size: 12.5px;
}

.hidden { display: none !important; }

/* ---------- 页脚 ---------- */
.footer {
  max-width: 1440px; margin: 0 auto; padding: 10px 28px 26px;
  font-size: 11.5px; color: var(--dim);
}
.footer p { margin: 4px 0; }
.footer b { color: var(--muted); font-weight: 600; }
.footer .muted { color: #46607a; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; padding: 4px 18px 8px; }
  .input-panel { position: static; }
  .topbar { padding: 18px 18px 10px; }
  .footer { padding: 8px 18px 22px; }
}

@media (max-width: 640px) {
  .field-row { grid-template-columns: 1fr; }
  .actions { flex-direction: column; }
  .ghost-btn { padding: 9px 16px; }
}

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d3d8de; border-radius: 8px; border: 2px solid #ffffff; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 审计存档 · 前后对比 ---------- */
.pill-btn { cursor: pointer; font: inherit; color: var(--muted); background: none; border: 1px solid var(--line); transition: 0.18s; }
.pill-btn:hover { color: var(--teal); border-color: rgba(45, 212, 191, 0.5); }
.pill-btn span { color: var(--teal); font-variant-numeric: tabular-nums; }

.card-zone { margin-top: 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel-2); animation: rise 0.3s ease-out; }
.card-zone-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-zone-head h3 { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: 0.3px; }
.card-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; max-height: 108px; overflow-y: auto; }
.card-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line); background: #ffffff; color: var(--muted); font-size: 11.5px; }
.card-chip.latest { border-color: rgba(13, 148, 136, 0.45); color: var(--text); box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.1); }
.card-chip .c-time { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.card-chip.latest .c-time { color: var(--muted); }
.c-badge { padding: 1px 6px; border-radius: 5px; font-size: 10.5px; line-height: 1.6; }
.c-badge.high { color: #b91c1c; background: #fef2f2; }
.c-badge.mid { color: #b45309; background: #fffbeb; }
.c-badge.low { color: #1d4ed8; background: #eff6ff; }
.c-badge.none { color: #047857; background: #ecfdf5; }
.c-badge.unknown { color: var(--dim); background: #f3f4f6; }
.card-tip { margin: 9px 0 0; font-size: 11px; color: var(--dim); line-height: 1.5; }

.compare-panel { margin-top: 14px; border-radius: 12px; border: 1px solid rgba(37, 99, 235, 0.25); background: linear-gradient(180deg, rgba(37, 99, 235, 0.04), transparent 55%); animation: rise 0.3s ease-out; }
.compare-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.compare-head span { font-size: 12.5px; color: var(--blue); font-weight: 600; letter-spacing: 0.3px; }
#compareBody { padding: 4px 14px 12px; max-height: 560px; overflow: auto; }
#compareState { padding: 0 14px 10px; }

/* ---------- 存档弹层 ---------- */
.modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; }
.modal-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(4px); }
.modal-box { position: relative; width: min(960px, 94vw); max-height: 84vh; display: flex; flex-direction: column; border-radius: 16px; border: 1px solid var(--line-strong); background: #ffffff; box-shadow: 0 24px 80px rgba(15, 23, 42, 0.25); animation: rise 0.22s ease-out; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 14px; color: var(--text); }
.modal-body { display: grid; grid-template-columns: 310px 1fr; min-height: 0; flex: 1; }
.archive-list { border-right: 1px solid var(--line); overflow: auto; padding: 8px; }
.archive-item { display: block; width: 100%; text-align: left; padding: 9px 10px; margin-bottom: 6px; border-radius: 9px; border: 1px solid transparent; background: #f7f8fa; color: var(--muted); cursor: pointer; font: inherit; transition: 0.15s; }
.archive-item:hover { border-color: var(--line); color: var(--text); }
.archive-item.active { border-color: rgba(45, 212, 191, 0.45); background: var(--teal-soft); color: var(--text); }
.archive-item .a-time { display: block; font-family: var(--mono); font-size: 10.5px; color: var(--dim); }
.archive-item .a-title { display: block; font-size: 12px; margin: 3px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archive-item .a-meta { display: flex; gap: 8px; align-items: center; font-size: 10.5px; color: var(--dim); }
.archive-view { overflow: auto; padding: 10px 18px 18px; }
.archive-empty { padding: 26px 10px; text-align: center; color: var(--dim); font-size: 12px; line-height: 1.7; }

@media (max-width: 720px) {
  .modal-body { grid-template-columns: 1fr; }
  .archive-list { border-right: none; border-bottom: 1px solid var(--line); max-height: 190px; }
}
