/* ==========================================================================
   强条管理维护系统 · 设计系统
   ========================================================================== */

:root {
  --font-sans: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;

  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-full: 999px;

  --sidebar-w: 268px;
  --header-h: 60px;

  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --dur: 0.22s;
}

/* ---------- 浅色主题 ---------- */
:root[data-theme="light"] {
  --bg: #f4f7fb;
  --bg-grad: radial-gradient(1200px 600px at 100% -10%, #e3f2ff 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 0%, #e6fbf5 0%, transparent 55%);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --sidebar-bg: rgba(255, 255, 255, 0.82);
  --border: #e6ebf2;
  --border-strong: #d5dde8;
  --text: #0f172a;
  --text-2: #475569;
  --muted: #8a99ad;
  --primary: #0284c7;
  --primary-hover: #0369a1;
  --primary-soft: #e0f2fe;
  --primary-text: #075985;
  --accent: #0d9488;
  --accent-soft: #ccfbf1;
  --danger: #e11d48;
  --danger-soft: #ffe4e6;
  --warn: #d97706;
  --warn-soft: #fef3c7;
  --ok: #059669;
  --ok-soft: #d1fae5;
  --purple: #7c3aed;
  --purple-soft: #ede9fe;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 16px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 24px 60px -12px rgba(15, 23, 42, 0.22);
  --mark-bg: #fde68a;
  --mark-text: #713f12;
}

/* ---------- 深色主题 ---------- */
:root[data-theme="dark"] {
  --bg: #0b1220;
  --bg-grad: radial-gradient(1100px 560px at 100% -10%, #12283f 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 0%, #0f2b2a 0%, transparent 55%);
  --surface: #111b2d;
  --surface-2: #16223a;
  --surface-3: #1b2942;
  --sidebar-bg: rgba(14, 22, 38, 0.78);
  --border: #22314d;
  --border-strong: #2f4066;
  --text: #e6edf8;
  --text-2: #a9b8d0;
  --muted: #6b7f9e;
  --primary: #38bdf8;
  --primary-hover: #7dd3fc;
  --primary-soft: #0c2f47;
  --primary-text: #7dd3fc;
  --accent: #2dd4bf;
  --accent-soft: #0d3b36;
  --danger: #fb7185;
  --danger-soft: #3f1d2a;
  --warn: #fbbf24;
  --warn-soft: #3a2c0d;
  --ok: #34d399;
  --ok-soft: #0d3a2c;
  --purple: #a78bfa;
  --purple-soft: #2b2350;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 20px -4px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.6);
  --mark-bg: #facc15;
  --mark-text: #1f1300;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--r-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }

/* ===================== 布局 ===================== */
.app { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  backdrop-filter: saturate(1.6) blur(14px);
  border-right: 1px solid var(--border);
  transition: width var(--dur) var(--ease), flex-basis var(--dur) var(--ease);
  z-index: 20;
}
.sidebar.collapsed { width: 72px; flex-basis: 72px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; }

.header {
  height: var(--header-h);
  flex: 0 0 var(--header-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  background: var(--sidebar-bg);
  backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
  z-index: 15;
}

.view {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 26px 30px 60px;
  scroll-behavior: smooth;
}
.view-inner { max-width: 1240px; margin: 0 auto; }

/* ===================== 品牌 ===================== */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 18px 14px;
  min-height: 60px;
}
.brand-logo {
  width: 34px; height: 34px;
  flex: 0 0 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #0ea5e9 55%, var(--accent));
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(2, 132, 199, 0.8);
}
.brand-text { min-width: 0; overflow: hidden; }
.brand-title { font-size: 14.5px; font-weight: 700; white-space: nowrap; }
.brand-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.sidebar.collapsed .brand-text { display: none; }
.sidebar.collapsed .brand { justify-content: center; padding: 18px 0 14px; }

/* ===================== 侧栏导航 ===================== */
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 10px; }
.nav-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.09em;
  color: var(--muted);
  padding: 14px 10px 6px;
  text-transform: uppercase;
}
.sidebar.collapsed .nav-label { text-align: center; padding: 14px 0 6px; }
.sidebar.collapsed .nav-label span { display: none; }
.sidebar.collapsed .nav-label::after { content: "···"; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  margin-bottom: 2px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.16s, color 0.16s, transform 0.16s;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-text);
  font-weight: 650;
}
.nav-item .icon { flex: 0 0 18px; display: grid; place-items: center; }
.nav-item .icon svg { width: 18px; height: 18px; }
.nav-item .label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .badge {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: var(--surface-3);
  padding: 1px 7px;
  border-radius: var(--r-full);
}
.nav-item.active .badge { background: rgba(255, 255, 255, 0.7); color: var(--primary-text); }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px 0; }
.sidebar.collapsed .nav-item .label,
.sidebar.collapsed .nav-item .badge { display: none; }

.sidebar-foot {
  padding: 10px 12px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stat-mini {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  padding: 2px 8px;
}
.stat-mini b { color: var(--text); font-variant-numeric: tabular-nums; }
.sidebar.collapsed .stat-mini { display: none; }
.collapse-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 8px; border: 1px solid var(--border);
  border-radius: var(--r-md); background: var(--surface); color: var(--text-2);
  cursor: pointer; font-size: 12.5px; transition: background 0.16s;
}
.collapse-btn:hover { background: var(--surface-3); }
.sidebar.collapsed .collapse-btn span { display: none; }

/* ===================== 顶部栏 ===================== */
.header-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.header-title h1 { font-size: 17px; white-space: nowrap; }
.header-title .crumb { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.header-spacer { flex: 1; }

.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.16s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); transform: translateY(-1px); }
.icon-btn svg { width: 17px; height: 17px; }

/* ===================== 通用组件 ===================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 18px 20px; }
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 14.5px; }
.card-head .desc { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.card-head .spacer { flex: 1; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: 13px; font-weight: 550;
  cursor: pointer; white-space: nowrap;
  transition: all 0.16s var(--ease);
}
.btn:hover { background: var(--surface-3); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn-primary {
  background: linear-gradient(180deg, var(--primary), var(--primary-hover));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 14px -8px var(--primary);
}
.btn-primary:hover { filter: brightness(1.07); background: var(--primary-hover); border-color: transparent; }
.btn-danger { color: var(--danger); border-color: transparent; background: var(--danger-soft); }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: transparent; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: var(--r-sm); }
.btn-xs { height: 24px; padding: 0 8px; font-size: 11.5px; border-radius: var(--r-sm); gap: 4px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.input, .select, .textarea {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.7; font-size: 13.5px; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.select { cursor: pointer; appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a99ad' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.field-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }

.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 8px; border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 600; line-height: 1.7;
  background: var(--surface-3); color: var(--text-2);
  white-space: nowrap;
}
.tag-primary { background: var(--primary-soft); color: var(--primary-text); }
.tag-accent { background: var(--accent-soft); color: var(--accent); }
.tag-danger { background: var(--danger-soft); color: var(--danger); }
.tag-warn { background: var(--warn-soft); color: var(--warn); }
.tag-ok { background: var(--ok-soft); color: var(--ok); }
.tag-purple { background: var(--purple-soft); color: var(--purple); }
.tag-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); }

.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 54px 20px; text-align: center; color: var(--muted);
}
.empty .icon-wrap {
  width: 56px; height: 56px; border-radius: var(--r-xl);
  display: grid; place-items: center;
  background: var(--surface-3); color: var(--muted);
}
.empty h4 { font-size: 14px; color: var(--text-2); }
.empty p { font-size: 12.5px; margin: 0; max-width: 340px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; }
table.tbl th {
  text-align: left; font-size: 12px; font-weight: 650; color: var(--muted);
  padding: 10px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
table.tbl td {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  vertical-align: top; font-size: 13px;
}
table.tbl tbody tr { transition: background 0.14s; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr:last-child td { border-bottom: 0; }
.cell-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ---------- 开关 ---------- */
.switch {
  position: relative; width: 38px; height: 21px; flex: 0 0 38px;
  border-radius: var(--r-full); border: 0; cursor: pointer;
  background: var(--border-strong); transition: background 0.2s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 17px; height: 17px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease);
}
.switch.on { background: var(--primary); }
.switch.on::after { transform: translateX(17px); }

/* ---------- 分段控件 ---------- */
.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--surface-3); border-radius: var(--r-md);
}
.segmented button {
  border: 0; background: transparent; cursor: pointer;
  padding: 5px 13px; border-radius: var(--r-sm);
  font-size: 12.5px; font-weight: 550; color: var(--text-2);
  transition: all 0.16s; white-space: nowrap;
}
.segmented button.active {
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm); font-weight: 650;
}

/* ---------- 模态框 ---------- */
.mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 20px 20px; overflow-y: auto;
  animation: fade 0.18s var(--ease);
}
.modal {
  width: 100%; max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  animation: pop 0.22s var(--ease);
  margin-bottom: 20px;
}
.modal.wide { max-width: 800px; }
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 17px 20px; border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 15.5px; flex: 1; }
.modal-head .desc { font-size: 12px; color: var(--muted); }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 15px; max-height: 62vh; overflow-y: auto; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 9px;
  padding: 14px 20px; border-top: 1px solid var(--border);
  background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl);
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.985); } }

/* ---------- Toast ---------- */
.toast-root {
  position: fixed; z-index: 200; bottom: 24px; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column-reverse; gap: 10px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 16px; border-radius: var(--r-full);
  background: var(--text); color: var(--surface);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.24s var(--ease);
}
.toast.ok { background: var(--ok); color: #fff; }
.toast.err { background: var(--danger); color: #fff; }
.toast svg { width: 16px; height: 16px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(0.96); } }

/* ===================== 页面：概览 ===================== */
.page-head { margin-bottom: 20px; }
.page-head h2 { font-size: 22px; letter-spacing: -0.02em; }
.page-head p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat-card {
  position: relative; overflow: hidden;
  padding: 16px 18px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .k { font-size: 12.5px; color: var(--muted); font-weight: 550; }
.stat-card .v { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; font-variant-numeric: tabular-nums; }
.stat-card .s { font-size: 11.5px; color: var(--muted); }
.stat-card .bar {
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--primary);
}
.stat-card.c2 .bar { background: var(--accent); }
.stat-card.c3 .bar { background: var(--purple); }
.stat-card.c4 .bar { background: var(--warn); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.dist-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.dist-row .name { width: 130px; flex: 0 0 130px; font-size: 13px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dist-row .track { display: block; flex: 1; height: 8px; border-radius: var(--r-full); background: var(--surface-3); overflow: hidden; }
.dist-row .fill { display: block; height: 100%; border-radius: var(--r-full); background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 0.5s var(--ease); }
.dist-row .num { width: 34px; text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-2); }

.quick-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.quick-link {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); cursor: pointer; text-align: left;
  transition: all 0.16s var(--ease);
}
.quick-link:hover { border-color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.quick-link .ic { width: 30px; height: 30px; flex: 0 0 30px; border-radius: var(--r-sm);
  display: grid; place-items: center; background: var(--surface-3); color: var(--primary); }
.quick-link .t { font-size: 13px; font-weight: 600; }
.quick-link .d { font-size: 11.5px; color: var(--muted); }

/* ===================== 页面：检索 ===================== */
.search-hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-xl);
  padding: 30px 30px 26px;
  margin-bottom: 18px;
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.1), rgba(13, 148, 136, 0.1));
  border: 1px solid var(--border);
}
.search-hero h2 { font-size: 21px; }
.search-hero p { margin: 6px 0 18px; color: var(--text-2); font-size: 13px; }

.searchbar {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 6px 4px 16px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.searchbar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft), var(--shadow-md);
}
.searchbar .ic { color: var(--muted); display: grid; place-items: center; }
.searchbar input {
  flex: 1; height: 46px; border: 0; outline: 0; background: transparent;
  font-size: 15.5px; color: var(--text);
}
.searchbar input::placeholder { color: var(--muted); }
.search-clear {
  width: 24px; height: 24px; border: 0; border-radius: 50%;
  background: var(--surface-3); color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
}
.search-clear:hover { background: var(--danger-soft); color: var(--danger); }

.filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
  margin-top: 16px;
}
.filter-bar .select { width: auto; min-width: 130px; height: 32px; font-size: 12.5px; }
.filter-bar .lb { font-size: 12px; color: var(--muted); }

.result-meta { display: flex; align-items: center; gap: 10px; margin: 20px 0 12px; }
.result-meta .n { font-size: 13.5px; font-weight: 650; }
.result-meta .n em { font-style: normal; color: var(--primary); }
.result-meta .spacer { flex: 1; }

mark {
  background: var(--mark-bg); color: var(--mark-text);
  padding: 0 2px; border-radius: 3px; font-weight: 650;
}

.clause-list { display: flex; flex-direction: column; gap: 12px; }

.clause-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s;
  animation: rise 0.26s var(--ease) backwards;
}
.clause-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.clause-top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.clause-code {
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 700;
  padding: 2px 8px; border-radius: var(--r-sm);
  background: var(--primary-soft); color: var(--primary-text);
  white-space: nowrap;
}
.clause-title { font-size: 14.5px; font-weight: 650; flex: 1; line-height: 1.5; }
.clause-body {
  font-size: 13.5px; line-height: 1.85; color: var(--text-2);
  margin: 6px 0 12px;
  padding-left: 11px;
  border-left: 2px solid var(--border-strong);
}
.clause-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding-top: 10px; border-top: 1px dashed var(--border);
  font-size: 12px; color: var(--muted);
}
.clause-foot .std { font-weight: 600; color: var(--text-2); }
.clause-foot .spacer { flex: 1; }
.score-pill {
  font-size: 11px; font-variant-numeric: tabular-nums;
  padding: 1px 8px; border-radius: var(--r-full);
  background: var(--surface-3); color: var(--muted);
}
.snippet { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

/* ===================== 页面：管理列表 ===================== */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 9px;
  margin-bottom: 16px;
}
.toolbar .spacer { flex: 1; }
.toolbar .input { width: 240px; height: 34px; }
.toolbar .select { width: auto; min-width: 130px; height: 34px; }

.clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.mono { font-family: var(--font-mono); }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.text-sm { font-size: 12.5px; }
.right { text-align: right; }
.row { display: flex; align-items: center; gap: 8px; }
.wrap { flex-wrap: wrap; }
.w-full { width: 100%; }

.pager { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px 0 4px; }
.pager .info { font-size: 12.5px; color: var(--muted); }

/* ===================== 提示词配置 ===================== */
.prompt-preview {
  font-family: var(--font-mono);
  font-size: 12.5px; line-height: 1.85;
  white-space: pre-wrap; word-break: break-word;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  max-height: 460px; overflow-y: auto;
}
.var-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.var-chip {
  font-family: var(--font-mono); font-size: 11.5px;
  padding: 3px 9px; border-radius: var(--r-full);
  background: var(--purple-soft); color: var(--purple);
  border: 1px solid transparent; cursor: pointer;
  transition: all 0.16s;
}
.var-chip:hover { border-color: var(--purple); }

.kv-list { display: flex; flex-direction: column; gap: 10px; }
.kv-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border);
}
.kv-item .name { font-weight: 600; font-size: 13px; min-width: 120px; }
.kv-item .desc { font-size: 12px; color: var(--muted); flex: 1; }
.kv-item .sw { flex: 0 0 auto; }

.dict-list { display: flex; flex-wrap: wrap; gap: 8px; }
.dict-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 6px 5px 12px; border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 12.5px;
}
.dict-chip .x {
  width: 18px; height: 18px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
}
.dict-chip .x:hover { background: var(--danger-soft); color: var(--danger); }
.dict-chip .dot { width: 8px; height: 8px; border-radius: 50%; }

/* ===================== 页面：AI 问答 ===================== */
.chat-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-h) - 96px);
  min-height: 420px;
}
.chat-head {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  border-bottom: 0;
  flex: 0 0 auto;
}
.chat-logo {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  box-shadow: 0 6px 14px -6px var(--primary);
}
.chat-head a { font-weight: 600; }

.msg-list {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  scroll-behavior: smooth;
}
.msg { display: flex; gap: 10px; margin-bottom: 18px; }
.msg:last-child { margin-bottom: 4px; }
.msg .bubble {
  max-width: 78%;
  padding: 11px 15px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.85;
  word-break: break-word;
  white-space: pre-wrap;
  animation: rise 0.24s var(--ease);
}
.msg-user { justify-content: flex-end; }
.msg-user .bubble {
  background: linear-gradient(180deg, var(--primary), var(--primary-hover));
  color: #fff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 6px 14px -8px var(--primary);
}
.msg-ai .bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.ai-avatar {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 9px; display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
}
.ai-text { min-height: 22px; }

.msg-refs { margin-top: 10px; }
.refs-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 650; color: var(--muted);
  margin-bottom: 6px;
}
.refs-list { display: flex; flex-wrap: wrap; gap: 6px; }
.ref-chip {
  display: inline-flex; align-items: center; gap: 7px;
  max-width: 100%;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  background: var(--surface);
  cursor: pointer;
  font-size: 11.5px;
  transition: all 0.15s;
}
.ref-chip:hover { border-color: var(--primary); background: var(--primary-soft); }
.ref-chip .mono { font-weight: 700; color: var(--primary-text); }
.ref-chip .ref-title { max-width: 180px; color: var(--text-2); }
.ref-chip .ref-score { color: var(--muted); font-size: 10.5px; }
.msg-notice {
  display: flex; align-items: flex-start; gap: 6px;
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 11.5px;
  line-height: 1.7;
  white-space: normal;
}

.typing { display: inline-flex; gap: 4px; padding: 5px 0; }
.typing i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--muted);
  animation: blink 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.chat-welcome {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 36px 16px 24px; gap: 8px;
}
.chat-welcome .icon-wrap {
  width: 54px; height: 54px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
  margin-bottom: 4px;
}
.chat-welcome h4 { font-size: 15.5px; }
.chat-welcome p { margin: 0; font-size: 12.5px; color: var(--muted); max-width: 420px; }
.sample-list {
  display: flex; flex-direction: column; gap: 7px;
  margin-top: 14px; width: 100%; max-width: 480px;
}
.sample-q {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  text-align: left;
  transition: all 0.16s;
}
.sample-q:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-text); }
.sample-q svg { flex: 0 0 13px; color: var(--muted); }

.chat-input-wrap { flex: 0 0 auto; padding-top: 12px; }
.chat-input {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 10px 10px 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.chat-input:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-soft);
}
.chat-input textarea {
  flex: 1;
  border: 0; outline: 0; resize: none;
  background: transparent;
  font-size: 14px; line-height: 1.6;
  color: var(--text);
  max-height: 150px;
  padding: 6px 0;
  font-family: inherit;
}
.chat-input textarea::placeholder { color: var(--muted); }

/* ===================== 响应式 ===================== */
@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar.collapsed { width: var(--sidebar-w); flex-basis: var(--sidebar-w); transform: translateX(-100%); }
  .view { padding: 20px 16px 60px; }
  .field-row { grid-template-columns: 1fr; }
  .toolbar .input { width: 100%; }
}
