/* ============================================================
   瓷器VR识别系统 · 高级前端样式
   玻璃拟态 + 明/暗/跟随系统三主题 + 磁吸微交互
   纯原生 CSS，无任何第三方依赖
   ============================================================ */

:root {
  --bg: #f4f6fb;
  --bg-grad-1: #eef2fb;
  --bg-grad-2: #f7f9fd;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --glass-border: rgba(255, 255, 255, 0.65);
  --glass-shadow: 0 8px 32px rgba(31, 45, 80, 0.10);
  --text: #1b2440;
  --text-muted: #64708f;
  --text-faint: #98a2bd;
  --primary: #4f6ef7;
  --primary-soft: rgba(79, 110, 247, 0.12);
  --primary-2: #7c5cff;
  --success: #1fb574;
  --success-soft: rgba(31, 181, 116, 0.12);
  --warning: #f5a623;
  --warning-soft: rgba(245, 166, 35, 0.14);
  --danger: #ef4d5a;
  --danger-soft: rgba(239, 77, 90, 0.12);
  --info: #2bb6d6;
  --line: rgba(27, 36, 64, 0.08);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html[data-theme="dark"] {
  --bg: #0c1020;
  --bg-grad-1: #121733;
  --bg-grad-2: #0a0e1c;
  --surface: rgba(22, 28, 50, 0.62);
  --surface-solid: #161c32;
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --text: #eef1fb;
  --text-muted: #9aa3c4;
  --text-faint: #6b739a;
  --primary: #6b87ff;
  --primary-soft: rgba(107, 135, 255, 0.16);
  --primary-2: #9b7cff;
  --success: #2fd28a;
  --success-soft: rgba(47, 210, 138, 0.14);
  --warning: #ffb84d;
  --warning-soft: rgba(255, 184, 77, 0.16);
  --danger: #ff6b78;
  --danger-soft: rgba(255, 107, 120, 0.16);
  --info: #45c8e6;
  --line: rgba(255, 255, 255, 0.09);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 12% -10%, var(--bg-grad-1), transparent 55%),
    radial-gradient(1000px 600px at 100% 0%, var(--primary-soft), transparent 50%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}

a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-2); }

/* ------------------ 布局 ------------------ */
.app-shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 18px;
  background: var(--surface);
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 22px;
}
.brand .logo {
  width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 18px;
  box-shadow: 0 6px 18px var(--primary-soft);
}
.brand .title { font-weight: 800; font-size: 16px; letter-spacing: .5px; }
.brand .sub { font-size: 11px; color: var(--text-faint); }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 600; font-size: 14px;
  transition: all .25s var(--ease);
}
.nav a .ico { width: 20px; text-align: center; font-size: 16px; }
.nav a:hover { background: var(--primary-soft); color: var(--text); transform: translateX(2px); }
.nav a.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  box-shadow: 0 8px 20px var(--primary-soft);
}

.sidebar .spacer { flex: 1; }
.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 12px; border-radius: var(--radius-sm);
  background: var(--surface-solid);
  border: 1px solid var(--glass-border);
}
.user-card .avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; display: grid; place-items: center; font-weight: 700;
}
.user-card .meta { line-height: 1.25; overflow: hidden; }
.user-card .meta .nm { font-weight: 700; font-size: 13px; white-space: nowrap; }
.user-card .meta .rl { font-size: 11px; color: var(--text-faint); }

.content { padding: 30px 38px 60px; max-width: 1280px; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: 26px; margin: 0 0 4px; font-weight: 800; letter-spacing: .3px; }
.page-head .desc { color: var(--text-muted); font-size: 13px; }

/* ------------------ 玻璃卡片 ------------------ */
.glass {
  background: var(--surface);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
}
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.card-title { font-weight: 800; font-size: 15px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 980px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } .app-shell { grid-template-columns: 1fr; } .sidebar { display: none; } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } .content { padding: 20px 16px 50px; } }

/* ------------------ 统计卡 ------------------ */
.stat { padding: 20px; position: relative; overflow: hidden; }
.stat .k { font-size: 32px; font-weight: 800; letter-spacing: .5px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat .l { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.stat .spark { position: absolute; right: 14px; top: 14px; font-size: 22px; opacity: .35; }

/* ------------------ 按钮 / 磁吸 ------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--surface-solid); color: var(--text);
  font-weight: 700; font-size: 14px; cursor: pointer;
  white-space: nowrap;          /* 按钮文字始终单行显示 */
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), background .2s;
  will-change: transform;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(31,45,80,.14); }
.btn:active { transform: translateY(0) scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border: none; box-shadow: 0 8px 22px var(--primary-soft); }
.btn-success { background: linear-gradient(135deg, var(--success), #16a34a); color: #fff; border: none; }
.btn-danger { background: linear-gradient(135deg, var(--danger), #dc2626); color: #fff; border: none; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 13px; font-size: 13px; }
/* hover 时保持按钮文字可辨识：避免被全局 a:hover 改成背景同色 */
.btn-primary:hover, .btn-primary:focus { color: #fff; filter: brightness(1.05); }
.btn-success:hover, .btn-success:focus { color: #fff; filter: brightness(1.05); }
.btn-danger:hover, .btn-danger:focus { color: #fff; filter: brightness(1.05); }
.btn-ghost:hover, .btn-ghost:focus { color: var(--text); background: var(--primary-soft); }
/* 显式覆盖全局 a:hover 对带色按钮的文字色干扰 */
.btn.btn-primary:hover, .btn.btn-success:hover, .btn.btn-danger:hover { color: #fff; }
.magnetic { transition: transform .3s var(--ease), box-shadow .25s var(--ease); }

/* ------------------ 表单 ------------------ */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 700; font-size: 13px; margin-bottom: 7px; color: var(--text); }
.input, .textarea, .select {
  width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface-solid);
  color: var(--text); font-size: 14px; font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.textarea { min-height: 220px; resize: vertical; font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; font-size: 13px; line-height: 1.7; }

/* 富文本编辑器容器（wangEditor v4） */
.rich-editor-wrap {
  width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface-solid); overflow: hidden;
}
.rich-editor-wrap .w-e-toolbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.rich-editor-wrap .w-e-text-container { background: var(--surface-solid); min-height: 340px; }
.rich-editor-wrap .w-e-text { color: var(--text); }
.rich-editor-wrap .w-e-text-placeholder { color: var(--text-muted); }
.rich-editor-wrap .placeholder { color: var(--text-muted); }


/* ------------------ 表格 ------------------ */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 13px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.tbl th:last-child, .tbl td:last-child { white-space: nowrap; text-align: right; } /* 操作列不换行、右对齐 */
.tbl td.status-cell { white-space: nowrap; width: 1%; vertical-align: middle; } /* 状态列不换行、不被挤压 */
.tbl th { font-weight: 700; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.tbl tbody tr { transition: background .18s; }
.tbl tbody tr:hover { background: var(--primary-soft); }
.tbl tbody tr:last-child td { border-bottom: none; }

/* ------------------ 徽章 / 状态 ------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 700; line-height: 1.6;
  white-space: nowrap;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.b-primary { background: var(--primary-soft); color: var(--primary); }
.b-success { background: var(--success-soft); color: var(--success); }
.b-warning { background: var(--warning-soft); color: var(--warning); }
.b-danger  { background: var(--danger-soft);  color: var(--danger); }
.b-info    { background: rgba(43,182,214,.14); color: var(--info); }
.b-muted   { background: rgba(120,130,160,.14); color: var(--text-muted); }

/* ------------------ 流程步骤 ------------------ */
.steps { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 10px; }
.step .num {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 14px;
  background: var(--surface-solid); border: 2px solid var(--line); color: var(--text-faint);
  transition: all .3s var(--ease);
}
.step.done .num { background: linear-gradient(135deg, var(--success), #16a34a); color: #fff; border-color: transparent; }
.step.current .num { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-color: transparent; box-shadow: 0 0 0 5px var(--primary-soft); }
.step .lbl { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.step.current .lbl, .step.done .lbl { color: var(--text); }
.step-line { flex: 1; height: 2px; min-width: 24px; background: var(--line); margin: 0 10px; }
.step-line.done { background: linear-gradient(90deg, var(--success), var(--primary)); }

/* ------------------ 留痕时间线 ------------------ */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl-item { position: relative; padding: 0 0 22px; }
.tl-item::before {
  content: ""; position: absolute; left: -22px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft);
}
.tl-item.ok::before { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.tl-item.back::before { background: var(--warning); box-shadow: 0 0 0 4px var(--warning-soft); }
.tl-item.reject::before { background: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }
.tl-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tl-title { font-weight: 700; font-size: 14px; }
.tl-meta { font-size: 12px; color: var(--text-faint); }
.tl-body { margin-top: 6px; font-size: 13px; color: var(--text-muted); }
.tl-body .quote { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; margin-top: 6px; color: var(--text-muted); font-style: italic; }

/* ------------------ diff 比对 ------------------ */
.diff-box { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-solid); }
.diff-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 700; }
.diff-stats { display: flex; gap: 14px; font-size: 12px; font-weight: 600; }
.diff-stats .add { color: var(--success); }
.diff-stats .del { color: var(--danger); }
.diff-lines { margin: 0; padding: 8px 0; font-family: "SFMono-Regular", Consolas, Menlo, monospace; font-size: 13px; line-height: 1.75; max-height: 460px; overflow: auto; }
.diff-line { display: flex; padding: 0 14px; white-space: pre-wrap; word-break: break-all; }
.diff-line .gutter { width: 30px; flex: none; color: var(--text-faint); text-align: right; padding-right: 12px; user-select: none; }
.diff-line.add { background: var(--success-soft); }
.diff-line.add .gutter { color: var(--success); }
.diff-line.del { background: var(--danger-soft); }
.diff-line.del .gutter { color: var(--danger); }
.diff-line .sign { width: 14px; flex: none; font-weight: 700; }
.diff-line.add .sign { color: var(--success); }
.diff-line.del .sign { color: var(--danger); }

/* 行内高亮 diff：只标出具体改动位置（字符级），不变部分原样显示 */
.diff-inline { margin: 0; padding: 10px 14px; font-family: "SFMono-Regular", Consolas, Menlo, monospace; font-size: 13px; line-height: 1.95; max-height: 460px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.diff-inline del { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; border-radius: 3px; padding: 0 1px; }
.diff-inline ins { background: var(--success-soft); color: var(--success); text-decoration: none; border-radius: 3px; padding: 0 1px; }

/* diff 文本/HTML 渲染双视图 */
.diff-box .diff-toggle { margin: 10px 14px 12px; }
.diff-view.diff-html { padding: 0 14px 14px; }
.html-compare { display: flex; gap: 14px; flex-wrap: wrap; }
.hc-col { flex: 1 1 320px; min-width: 260px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-solid); overflow-x: auto; }
.hc-h { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }

/* 富文本渲染容器（详情单版本 / HTML 比对预览） */
.content-render, .hc-col { line-height: 1.8; font-size: 15px; color: var(--text); }
.content-render p, .hc-col p { margin: 0 0 10px; }
.content-render h1, .hc-col h1 { font-size: 22px; }
.content-render h2, .hc-col h2 { font-size: 19px; }
.content-render h3, .hc-col h3 { font-size: 16px; }
.content-render img, .hc-col img { max-width: 100%; border-radius: 8px; margin: 6px 0; }
.content-render a, .hc-col a { color: var(--primary); text-decoration: underline; }
.content-render table, .hc-col table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.content-render td, .content-render th, .hc-col td, .hc-col th { border: 1px solid var(--line); padding: 6px 9px; }
.content-render blockquote, .hc-col blockquote { margin: 8px 0; padding: 6px 14px; border-left: 3px solid var(--primary); background: var(--primary-soft); border-radius: 0 8px 8px 0; }

/* HTML 修订对比：保留富文本格式，行内标红(删)/绿(增) */
.hc-col .rev-pane { line-height: 1.9; font-size: 15px; color: var(--text); }
.hc-col .rev-pane p { margin: 0 0 10px; }
.hd-del { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; border-radius: 3px; padding: 0 1px; }
.hd-ins { background: var(--success-soft); color: var(--success); text-decoration: none; border-radius: 3px; padding: 0 1px; }
.diff-legend { display: flex; gap: 16px; align-items: center; padding: 8px 14px 2px; font-size: 12px; font-weight: 700; flex-wrap: wrap; }
.diff-legend .lg-ins { color: var(--success); }
.diff-legend .lg-del { color: var(--danger); }

/* ------------------ 工具类 ------------------ */
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mt { margin-top: 18px; }
.mt-lg { margin-top: 28px; }
.mb { margin-bottom: 14px; }
.tag-list { display: flex; gap: 8px; flex-wrap: wrap; }
.empty { text-align: center; padding: 50px 20px; color: var(--text-faint); }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* ------------------ 主题切换 ------------------ */
.theme-switch { display: inline-flex; background: var(--surface-solid); border: 1px solid var(--glass-border); border-radius: 999px; padding: 3px; gap: 2px; }
.theme-switch button { border: none; background: transparent; color: var(--text-muted); width: 34px; height: 30px; border-radius: 999px; cursor: pointer; font-size: 15px; transition: all .2s var(--ease); }
.theme-switch button.on { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; }

/* ------------------ 登录页 ------------------ */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 410px; padding: 38px 34px; }
.login-card .brand { justify-content: center; padding: 0 0 22px; }
.login-card h1 { text-align: center; font-size: 22px; margin: 0 0 4px; }
.login-card .sub { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 26px; }
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.alert-err { background: var(--danger-soft); color: var(--danger); }
.alert-ok { background: var(--success-soft); color: var(--success); }

/* 进入动画 */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.fade-up { animation: fadeUp .5s var(--ease) both; }
.fade-up:nth-child(2) { animation-delay: .05s; }
.fade-up:nth-child(3) { animation-delay: .1s; }
.fade-up:nth-child(4) { animation-delay: .15s; }

/* 顶部条 */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.topbar .crumb { font-size: 13px; color: var(--text-faint); }

/* ------------------ 审核版本 / 比对 ------------------ */
.sub-head { font-size: 14px; font-weight: 800; color: var(--text); margin-bottom: 10px; }
.review-ver-list { display: flex; flex-direction: column; gap: 8px; }
.rv-item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 12px; background: var(--surface-solid); border: 1px solid var(--glass-border); border-radius: var(--radius-sm); }
.rv-item .rv-name { font-weight: 700; font-size: 13px; }
.btn-xs { padding: 5px 11px; font-size: 12px; border-radius: 9px; }
.diff-picker select { min-width: 200px; }

/* ---------- 渐变文字（品牌强调） ---------- */
.gradient-text {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}
