/* ============================================================
   招商合同台账智能核对助手 — 设计系统
   专业 · 现代 · 克制 · 有设计感的 AI 工作台
   ============================================================ */

:root {
  /* 中性色：slate 系（深色文字/浅色背景） */
  --c-bg: #f5f7fb;
  --c-bg-elev: #ffffff;
  --c-bg-soft: #eef1f6;
  --c-border: #e2e8f0;
  --c-border-strong: #cbd5e1;
  --c-text: #0f172a;
  --c-text-2: #334155;
  --c-text-3: #64748b;
  --c-text-4: #94a3b8;

  /* 主色：靛紫 */
  --c-primary: #4f46e5;
  --c-primary-2: #4338ca;
  --c-primary-soft: #eef2ff;
  --c-primary-border: #c7d2fe;

  /* 状态色（对应6种核验状态） */
  --st-consistent: #10b981; /* 🟢 一致 */
  --st-suggest:    #f59e0b; /* 🟡 建议核对 */
  --st-different:  #ef4444; /* 🔴 存在差异 */
  --st-conflict:   #a855f7; /* 🟣 合同冲突 */
  --st-unknown:    #94a3b8; /* ⚪ 无法判断 */
  --st-needs-match:#3b82f6; /* 🔵 待人工匹配 */

  --st-consistent-bg: #ecfdf5;
  --st-suggest-bg:    #fffbeb;
  --st-different-bg:  #fef2f2;
  --st-conflict-bg:   #faf5ff;
  --st-unknown-bg:    #f8fafc;
  --st-needs-match-bg:#eff6ff;

  /* 阴影 */
  --sh-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --sh-md: 0 4px 12px rgba(15, 23, 42, .06);
  --sh-lg: 0 12px 32px rgba(15, 23, 42, .08);
  --sh-pop: 0 8px 24px rgba(79, 70, 229, .18);

  /* 圆角 */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;

  --font: "Inter", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", Consolas, Menlo, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font: inherit; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ====================== 首屏加载 ====================== */
.boot-splash {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: linear-gradient(135deg, #f5f7fb 0%, #eef2ff 100%);
}
.boot-logo {
  width: 64px; height: 64px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: white;
  font-size: 30px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--sh-pop);
}
.boot-title { font-size: 18px; font-weight: 600; color: var(--c-text); }
.boot-sub { font-size: 13px; color: var(--c-text-3); }

/* ====================== App 容器 ====================== */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-header {
  height: 56px;
  background: var(--c-bg-elev);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(8px);
}
.app-brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 15px;
}
.brand-mark {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.brand-sub { color: var(--c-text-3); font-weight: 400; font-size: 12px; }
.app-header-spacer { flex: 1; }
.app-nav { display: flex; gap: 4px; }
.nav-item {
  padding: 7px 14px;
  border-radius: var(--r-sm);
  color: var(--c-text-2);
  font-size: 13px;
  transition: all .15s;
}
.nav-item:hover { background: var(--c-bg-soft); color: var(--c-text); }
.nav-item.active { background: var(--c-primary-soft); color: var(--c-primary); font-weight: 500; }
.app-main { flex: 1; padding: 32px; max-width: 1480px; margin: 0 auto; width: 100%; }

/* ====================== 通用按钮 ====================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500;
  transition: all .15s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--c-primary); color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--c-primary-2); box-shadow: var(--sh-pop); }
.btn-ghost {
  background: var(--c-bg-elev); color: var(--c-text-2);
  border-color: var(--c-border);
}
.btn-ghost:hover:not(:disabled) { background: var(--c-bg-soft); color: var(--c-text); }
.btn-danger { background: var(--st-different); color: white; }
.btn-danger:hover:not(:disabled) { background: #dc2626; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 6px; width: 30px; height: 30px; }

/* ====================== 卡片 ====================== */
.card {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.card-pad { padding: 24px; }
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.card-sub { color: var(--c-text-3); font-size: 12px; margin-bottom: 16px; }

/* ====================== 首页 ====================== */
.home-hero {
  text-align: center;
  padding: 48px 24px 32px;
}
.home-title {
  font-size: 30px; font-weight: 700;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
}
.home-sub {
  color: var(--c-text-3); font-size: 15px;
  max-width: 640px; margin: 0 auto 32px;
  line-height: 1.7;
}
.home-flow {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 36px;
}
.flow-step {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 16px 12px;
  text-align: center;
  position: relative;
  transition: all .2s;
}
.flow-step:hover { border-color: var(--c-primary-border); box-shadow: var(--sh-md); }
.flow-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--c-primary-soft); color: var(--c-primary);
  font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}
.flow-label { font-size: 12px; font-weight: 500; color: var(--c-text-2); }
.flow-desc { font-size: 11px; color: var(--c-text-4); margin-top: 4px; line-height: 1.5; }

.home-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 920px; margin: 0 auto;
}
.home-action {
  background: var(--c-bg-elev);
  border: 1px dashed var(--c-border-strong);
  border-radius: var(--r-lg);
  padding: 28px;
  text-align: center;
  transition: all .2s;
  cursor: pointer;
}
.home-action:hover { border-color: var(--c-primary); border-style: solid; box-shadow: var(--sh-md); }
.home-action.done { border-style: solid; border-color: var(--st-consistent); background: var(--st-consistent-bg); }
.action-icon {
  width: 44px; height: 44px;
  border-radius: var(--r-md);
  background: var(--c-primary-soft); color: var(--c-primary);
  font-size: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.action-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.action-desc { color: var(--c-text-3); font-size: 12px; margin-bottom: 16px; }
.action-meta { font-size: 11px; color: var(--c-text-4); }

/* ====================== DropZone ====================== */
.dropzone {
  border: 2px dashed var(--c-border-strong);
  border-radius: var(--r-md);
  padding: 32px 16px;
  text-align: center;
  color: var(--c-text-3);
  background: var(--c-bg-soft);
  transition: all .15s;
  cursor: pointer;
}
.dropzone:hover, .dropzone.hover {
  border-color: var(--c-primary);
  background: var(--c-primary-soft);
  color: var(--c-primary);
}
.dz-icon { font-size: 32px; margin-bottom: 8px; opacity: .7; }
.dz-text { font-size: 13px; }
.dz-hint { font-size: 11px; color: var(--c-text-4); margin-top: 4px; }

/* ====================== 状态徽章 ====================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px; font-weight: 500;
  white-space: nowrap;
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.b-consistent { background: var(--st-consistent-bg); color: #047857; }
.b-consistent .dot { background: var(--st-consistent); }
.b-suggest    { background: var(--st-suggest-bg);    color: #b45309; }
.b-suggest .dot    { background: var(--st-suggest); }
.b-different  { background: var(--st-different-bg);  color: #b91c1c; }
.b-different .dot  { background: var(--st-different); }
.b-conflict   { background: var(--st-conflict-bg);   color: #7e22ce; }
.b-conflict .dot   { background: var(--st-conflict); }
.b-unknown    { background: var(--st-unknown-bg);    color: #475569; }
.b-unknown .dot    { background: var(--st-unknown); }
.b-needs-match{ background: var(--st-needs-match-bg); color: #1d4ed8; }
.b-needs-match .dot{ background: var(--st-needs-match); }

/* ====================== 概况栏 ====================== */
.summary-bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.summary-cell {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 14px 16px;
}
.sc-num { font-size: 22px; font-weight: 700; color: var(--c-text); }
.sc-num.accent { color: var(--c-primary); }
.sc-label { font-size: 11px; color: var(--c-text-3); margin-top: 2px; }

/* ====================== 筛选条 ====================== */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 12px 16px;
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  margin-bottom: 16px;
}
.filter-chip {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--c-bg-soft);
  color: var(--c-text-2);
  font-size: 12px;
  border: 1px solid transparent;
}
.filter-chip:hover { background: var(--c-border); }
.filter-chip.active { background: var(--c-primary); color: white; }
.filter-chip .cnt { opacity: .8; margin-left: 4px; }

/* ====================== 差异卡片 ====================== */
.diff-card {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  margin-bottom: 10px;
  transition: box-shadow .15s;
}
.diff-card:hover { box-shadow: var(--sh-md); }
.diff-card.s-consistent { border-left-color: var(--st-consistent); }
.diff-card.s-suggest    { border-left-color: var(--st-suggest); }
.diff-card.s-different  { border-left-color: var(--st-different); }
.diff-card.s-conflict   { border-left-color: var(--st-conflict); }
.diff-card.s-unknown    { border-left-color: var(--st-unknown); }
.diff-card.s-needs-match{ border-left-color: var(--st-needs-match); }

.dc-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.dc-field { font-size: 14px; font-weight: 600; color: var(--c-text); }
.dc-body {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px; align-items: center;
  padding: 10px 0;
  border-top: 1px dashed var(--c-border);
  border-bottom: 1px dashed var(--c-border);
  margin-bottom: 10px;
}
.dc-val { font-size: 13px; }
.dc-val-label { color: var(--c-text-4); font-size: 11px; margin-bottom: 3px; }
.dc-val-text { color: var(--c-text); font-weight: 500; word-break: break-all; }
.dc-val-text.old { color: var(--c-text-3); text-decoration: line-through; }
.dc-arrow { color: var(--c-text-4); font-size: 16px; }
.dc-evidence {
  background: var(--c-bg-soft);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--c-text-2);
  margin-bottom: 10px;
  border-left: 2px solid var(--c-primary-border);
}
.dc-evidence-src { font-weight: 600; color: var(--c-text); }
.dc-evidence-loc { color: var(--c-text-3); margin-left: 8px; }
.dc-evidence-text {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--c-text-2);
  margin-top: 6px;
  white-space: pre-wrap;
  line-height: 1.6;
}
.dc-reason { font-size: 12px; color: var(--c-text-3); margin-bottom: 10px; line-height: 1.6; }
.dc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dc-decision {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  margin-left: auto;
}
.d-confirm { background: var(--st-consistent-bg); color: #047857; }
.d-keep { background: var(--st-suggest-bg); color: #b45309; }
.d-skip { background: var(--st-unknown-bg); color: #475569; }

/* ====================== 商铺详情三栏 ====================== */
.shop-detail {
  display: grid;
  grid-template-columns: 220px 1fr 520px;
  gap: 16px;
  min-height: calc(100vh - 56px - 64px);
}
.sd-col { display: flex; flex-direction: column; gap: 12px; }
.sd-section {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.sd-section-head {
  padding: 10px 14px;
  font-size: 12px; font-weight: 600;
  color: var(--c-text-2);
  background: var(--c-bg-soft);
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
}
.file-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border);
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
}
.file-item:last-child { border-bottom: none; }
.file-item:hover { background: var(--c-bg-soft); }
.file-item.active { background: var(--c-primary-soft); color: var(--c-primary); }
.file-type-tag {
  font-size: 10px; padding: 2px 6px; border-radius: 4px;
  background: var(--c-bg-soft); color: var(--c-text-3);
}

/* ====================== 证据查看器 ====================== */
.evidence-viewer {
  display: flex; flex-direction: column;
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
  min-height: 400px;
}
.ev-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg-soft);
  font-size: 12px; color: var(--c-text-2);
  display: flex; align-items: center; justify-content: space-between;
}
.ev-canvas-wrap {
  flex: 1;
  overflow: auto;
  background: #525659;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 16px;
  position: relative;
}
.ev-canvas-wrap.docx { background: var(--c-bg-soft); padding: 24px; }
.ev-empty {
  display: flex; align-items: center; justify-content: center;
  color: var(--c-text-4); font-size: 13px;
  height: 100%; min-height: 320px;
}
.ev-page {
  background: white;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  position: relative;
}
.ev-page canvas { display: block; }
.ev-highlight {
  position: absolute;
  background: rgba(250, 204, 21, .35);
  border: 1.5px solid #f59e0b;
  border-radius: 2px;
  pointer-events: none;
}
.ev-para-highlight {
  background: rgba(250, 204, 21, .35);
  border-left: 3px solid #f59e0b;
  padding: 2px 4px;
  border-radius: 2px;
}

/* ====================== 表单 ====================== */
.field { margin-bottom: 14px; }
.field-label { display: block; font-size: 12px; color: var(--c-text-2); margin-bottom: 5px; font-weight: 500; }
.input, .select, .textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  background: var(--c-bg-elev);
  color: var(--c-text);
  font-size: 13px;
  transition: border-color .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--c-primary);
  box-shadow: 0 0 0 3px var(--c-primary-soft);
}

/* ====================== 模态框 ====================== */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 24px;
}
.modal {
  background: var(--c-bg-elev);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-lg);
  width: 100%; max-width: 480px;
  max-height: 90vh; overflow: auto;
}
.modal-head {
  padding: 18px 24px;
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-body { padding: 24px; }
.modal-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--c-border);
  display: flex; justify-content: flex-end; gap: 8px;
  background: var(--c-bg-soft);
}

/* ====================== Toast ====================== */
.toast-wrap {
  position: fixed; top: 70px; right: 24px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-left: 3px solid var(--c-primary);
  border-radius: var(--r-sm);
  padding: 12px 16px;
  box-shadow: var(--sh-md);
  font-size: 13px;
  min-width: 280px;
  max-width: 360px;
}
.toast.success { border-left-color: var(--st-consistent); }
.toast.error { border-left-color: var(--st-different); }
.toast.warn { border-left-color: var(--st-suggest); }

/* ====================== 空状态 ====================== */
.empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--c-text-4);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; opacity: .5; }
.empty-text { font-size: 13px; }

/* ====================== 进度 ====================== */
.progress {
  height: 6px;
  background: var(--c-bg-soft);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--c-primary);
  border-radius: 3px;
  transition: width .3s ease;
}
.progress-text { font-size: 12px; color: var(--c-text-3); margin-top: 6px; }

/* ====================== 标签 / chip ====================== */
.chip {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 4px;
  font-size: 11px; background: var(--c-bg-soft); color: var(--c-text-2);
  margin-right: 4px;
}

/* ====================== 列表 ====================== */
.list-row {
  display: flex; align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--c-border);
  cursor: pointer;
  transition: background .15s;
}
.list-row:hover { background: var(--c-bg-soft); }
.list-row:last-child { border-bottom: none; }

/* ====================== 工具样式 ====================== */
.row { display: flex; gap: 12px; }
.col { flex: 1; }
.between { display: flex; justify-content: space-between; align-items: center; }
.center { display: flex; align-items: center; }
.gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 12px; } .text-xs { font-size: 11px; }
.text-3 { color: var(--c-text-3); } .text-4 { color: var(--c-text-4); }
.mono { font-family: var(--font-mono); }
.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ====================== 警告条 ====================== */
.notice {
  padding: 10px 14px;
  border-radius: var(--r-sm);
  font-size: 12px;
  display: flex; align-items: center; gap: 8px;
}
.notice-info { background: var(--c-primary-soft); color: var(--c-primary-2); }
.notice-warn { background: var(--st-suggest-bg); color: #b45309; }
.notice-danger { background: var(--st-different-bg); color: #b91c1c; }

/* ====================== 响应式 ====================== */
@media (max-width: 1280px) {
  .shop-detail { grid-template-columns: 200px 1fr 460px; }
  .home-flow { grid-template-columns: repeat(3, 1fr); }
  .summary-bar { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .home-flow, .home-actions, .summary-bar { grid-template-columns: 1fr; }
  .shop-detail { grid-template-columns: 1fr; }
  .app-main { padding: 16px; }
}
