/* =============================================================
   律师个人案源管理系统 · 样式表 v3.1（原生 CSS，零依赖）
   设计基线：
     · 5 套皮肤靠 <html data-theme="..."> 切换，全部颜色走变量
     · 三层阴影（xs / md / lg）+ 统一 12px 圆角栅格
     · 主色走渐变，强调色（金）只用于「需要注意」的地方
     · 所有交互元素都有 hover / active / focus-visible 三态
   ============================================================= */

/* ============================================================
   1. 设计令牌
   ============================================================ */
:root {
  /* 主色（经典深蓝） */
  --primary: #185FA5;
  --primary-dark: #0C447C;
  --primary-deep: #082C52;
  --primary-soft: #E8F1FA;
  --primary-tint: #F4F8FC;

  /* 强调色 */
  --accent: #BA7517;
  --accent-soft: #FBF1E2;

  /* 侧栏 */
  --sidebar-bg: #0C447C;
  --sidebar-deep: #082C52;
  --sidebar-text: #E6F1FB;
  --sidebar-active: #185FA5;

  /* 背景与表面 */
  --body-bg: #F4F6F9;
  --card-bg: #FFFFFF;
  --surface-2: #FAFBFC;
  --glow: rgba(24, 95, 165, .07);

  /* 描边与文字 */
  --border: #E6E9EE;
  --border-strong: #D3D9E2;
  --text: #1B2027;
  --text-muted: #6B7280;
  --text-faint: #98A1AE;

  /* 语义色 */
  --success: #2F7A48;
  --success-soft: #EAF6EE;
  --warning: #B4761A;
  --warning-soft: #FDF3E2;
  --danger: #B03A3A;
  --danger-soft: #FCEDED;
  --info: #2F76C9;
  --info-soft: #EBF3FC;

  /* 圆角 */
  --radius-lg: 14px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  /* 阴影 */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px -2px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 10px -2px rgba(16, 24, 40, .08), 0 12px 26px -12px rgba(16, 24, 40, .14);
  --shadow-lg: 0 18px 44px -12px rgba(10, 30, 60, .26), 0 4px 12px -4px rgba(16, 24, 40, .10);

  /* 字体 */
  --font: "Microsoft YaHei", "微软雅黑", "PingFang SC", "Source Han Sans SC", "Noto Sans CJK SC", system-ui, sans-serif;
  --font-num: "DIN Alternate", "Segoe UI", ui-monospace, var(--font);

  --side-w: 224px;
  --ease: cubic-bezier(.4, 0, .2, 1);
}

[data-theme="ink"] {
  --primary: #0F6E56; --primary-dark: #0A5343; --primary-deep: #04342C;
  --primary-soft: #E4F4EF; --primary-tint: #F2FAF7;
  --accent: #BA7517; --accent-soft: #FBF1E2;
  --sidebar-bg: #0B4B3D; --sidebar-deep: #04342C; --sidebar-text: #E1F5EE; --sidebar-active: #0F6E56;
  --glow: rgba(15, 110, 86, .07);
}
[data-theme="rose"] {
  --primary: #993556; --primary-dark: #7A2743; --primary-deep: #5C1B31;
  --primary-soft: #FBECF1; --primary-tint: #FDF6F9;
  --accent: #BA7517; --accent-soft: #FBF1E2;
  --sidebar-bg: #72243E; --sidebar-deep: #4E1529; --sidebar-text: #FBEAF0; --sidebar-active: #993556;
  --glow: rgba(153, 53, 86, .07);
}
[data-theme="graphite"] {
  --primary: #4A4A46; --primary-dark: #33332F; --primary-deep: #232320;
  --primary-soft: #F0EFEA; --primary-tint: #F8F8F6;
  --accent: #8C6A2F; --accent-soft: #F5EFE3;
  --sidebar-bg: #33332F; --sidebar-deep: #1F1F1C; --sidebar-text: #F1EFE8; --sidebar-active: #4A4A46;
  --glow: rgba(74, 74, 70, .06);
}
[data-theme="violet"] {
  --primary: #534AB7; --primary-dark: #3E3690; --primary-deep: #26215C;
  --primary-soft: #EEEDFE; --primary-tint: #F7F6FE;
  --accent: #BA7517; --accent-soft: #FBF1E2;
  --sidebar-bg: #3A3380; --sidebar-deep: #26215C; --sidebar-text: #EEEDFE; --sidebar-active: #534AB7;
  --glow: rgba(83, 74, 183, .07);
}

/* ============================================================
   2. 基础重置
   ============================================================ */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  font-size: 14px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--body-bg);
  background-image:
    radial-gradient(1100px 460px at 6% -8%, var(--glow), transparent 62%),
    radial-gradient(900px 400px at 104% -6%, var(--accent-soft), transparent 58%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

a { color: var(--primary); text-decoration: none; transition: color .15s var(--ease); }
a:hover { color: var(--primary-dark); }
button, input, select, textarea { font-family: inherit; font-size: 14px; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -.01em; }
img, svg { display: block; }
[hidden] { display: none !important; }

::selection { background: var(--primary-soft); color: var(--primary-deep); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: #C7CFDA; border-radius: 8px;
  border: 3px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: #A9B4C2; background-clip: content-box; border: 3px solid transparent; }

/* 工具类 */
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; font-family: var(--font-num); }
.nowrap { white-space: nowrap; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.flex-1 { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.hide { display: none !important; }

/* ============================================================
   3. 登录页
   ============================================================ */
.login-page {
  position: fixed; inset: 0; z-index: 200; padding: 24px;
  display: none; align-items: center; justify-content: center;
  background:
    radial-gradient(820px 480px at 16% 6%, rgba(46, 124, 196, .55) 0%, transparent 62%),
    radial-gradient(680px 460px at 88% 96%, rgba(186, 117, 23, .22) 0%, transparent 62%),
    linear-gradient(158deg, #0B3E6E 0%, #082C52 52%, #051C34 100%);
  overflow: hidden;
}
.login-page.show { display: flex; }
/* 装饰：网格 + 光晕 */
.login-page::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 45%, #000 0%, transparent 72%);
  -webkit-mask-image: radial-gradient(circle at 50% 45%, #000 0%, transparent 72%);
}
.login-page::after {
  content: ''; position: absolute; width: 620px; height: 620px; border-radius: 50%;
  right: -180px; bottom: -260px; pointer-events: none;
  border: 1px solid rgba(255, 255, 255, .10);
  box-shadow: 0 0 0 60px rgba(255, 255, 255, .02), 0 0 0 130px rgba(255, 255, 255, .015);
}

.login-card {
  position: relative; z-index: 1;
  width: 392px; max-width: 100%; background: #fff;
  border-radius: 20px; padding: 34px 32px 26px;
  box-shadow: 0 32px 70px -20px rgba(2, 14, 30, .62), 0 2px 0 rgba(255, 255, 255, .6) inset;
  text-align: center;
  animation: cardIn .34s var(--ease) both;
}
.login-card::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px;
  border-radius: 20px 20px 0 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}
@keyframes cardIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }

.login-logo {
  width: 60px; height: 60px; margin: 2px auto 16px; border-radius: 18px;
  background: linear-gradient(145deg, var(--primary), var(--primary-deep));
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 24px -10px rgba(12, 68, 124, .75), inset 0 1px 0 rgba(255, 255, 255, .28);
}
.login-card h1 { font-size: 19px; letter-spacing: .2px; }
.login-card .sub { color: var(--text-muted); font-size: 12.5px; margin: 7px 0 24px; letter-spacing: .3px; }

.login-card .field { text-align: left; margin-bottom: 14px; }
.login-card .field label { display: block; font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; font-weight: 500; }
.login-card input {
  width: 100%; height: 44px; border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 0 13px; outline: none; background: var(--surface-2); color: var(--text);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
.login-card input::placeholder { color: var(--text-faint); }
.login-card input:focus {
  border-color: var(--primary); background: #fff;
  box-shadow: 0 0 0 4px var(--primary-soft);
}

.lg-btn {
  width: 100%; height: 46px; margin-top: 8px; font-size: 15px; letter-spacing: 6px;
  border-radius: 10px; font-weight: 600;
}
.login-err { color: var(--danger); font-size: 12.5px; min-height: 18px; text-align: left; padding-left: 2px; }
.login-tip { color: var(--success); font-size: 12.5px; min-height: 18px; }
.login-foot {
  margin-top: 18px; padding-top: 15px; border-top: 1px dashed var(--border);
  color: var(--text-muted); font-size: 12px; line-height: 1.75;
}
.login-foot b { color: var(--text); font-family: var(--font-num); }

/* ============================================================
   4. 布局与侧边栏
   ============================================================ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--side-w); flex: 0 0 var(--side-w);
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 60;
  display: flex; flex-direction: column;
  color: var(--sidebar-text);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-deep) 100%);
  box-shadow: 1px 0 0 rgba(255, 255, 255, .06) inset, 8px 0 28px -18px rgba(4, 18, 36, .55);
}
/* 侧栏顶部高光 */
.sidebar::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 180px; pointer-events: none;
  background: radial-gradient(220px 130px at 18% 0%, rgba(255, 255, 255, .14), transparent 70%);
}

.brand { position: relative; display: flex; align-items: center; gap: 11px; padding: 20px 16px 16px; }
.brand-mark {
  width: 36px; height: 36px; flex: 0 0 36px; border-radius: 11px;
  background: linear-gradient(145deg, rgba(255, 255, 255, .26), rgba(255, 255, 255, .08));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff;
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: 0 6px 14px -8px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand-text b { font-size: 15px; color: #fff; letter-spacing: .6px; }
.brand-text small { font-size: 11px; opacity: .6; letter-spacing: .3px; }

.nav { flex: 1; overflow-y: auto; padding: 4px 10px 18px; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .16); border-radius: 3px; }
.nav-group { margin-top: 12px; padding-top: 11px; border-top: 1px solid rgba(255, 255, 255, .10); }
.nav-flat { margin-top: 3px; }
.nav-flat:first-child { margin-top: 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 0 11px;
  border: 0; background: transparent; color: var(--sidebar-text); opacity: .82; cursor: pointer;
  border-radius: 9px; font-size: 13.8px; text-align: left; position: relative;
  transition: background .16s var(--ease), opacity .16s var(--ease), transform .16s var(--ease);
}
.nav-item:hover { background: rgba(255, 255, 255, .09); opacity: 1; }
.nav-item:active { transform: scale(.99); }
.nav-item.active {
  background: linear-gradient(100deg, rgba(255, 255, 255, .20), rgba(255, 255, 255, .09));
  color: #fff; opacity: 1; font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 4px 12px -8px rgba(0, 0, 0, .8);
}
.nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}
.nav-item .ni { width: 17px; height: 17px; flex: 0 0 17px; opacity: .88; }
.nav-item.active .ni { opacity: 1; }
.nav-item .arrow { margin-left: auto; transition: transform .22s var(--ease); opacity: .5; }
.nav-group.open > .nav-item .arrow { transform: rotate(90deg); opacity: .8; }

/* 侧栏悬停必须显式给亮色。
   全局 `a:hover { color: var(--primary-dark) }` 的选择器权重是 (0,1,1)，
   高于 `.nav-item` 的 (0,1,0)，一旦平铺菜单是 <a>，悬停时文字和图标（stroke=currentColor）
   都会被刷成 --primary-dark = #0C447C —— 与侧栏顶部底色完全同一个颜色，
   于是看起来就是"文字消失 / 颜色糊在一起"。这里用更高权重压回来。 */
.nav a:hover, .nav a:focus-visible,
.nav-item:hover, .nav-item:focus-visible,
.nav-sub a:hover, .nav-sub a:focus-visible { color: #fff; }
.nav-item:hover .ni,
.nav-sub a:hover::before { opacity: 1; }

.nav-sub { display: none; padding: 3px 0 4px; }
.nav-group.open > .nav-sub { display: block; animation: slideDown .18s var(--ease); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: none; } }

.nav-sub a {
  display: flex; align-items: center; gap: 8px; min-height: 36px;
  padding: 0 10px 0 42px; color: var(--sidebar-text); opacity: .72;
  border-radius: 8px; font-size: 13.2px; position: relative;
  transition: background .15s var(--ease), opacity .15s var(--ease), padding .15s var(--ease);
}
.nav-sub a::before {
  content: ''; width: 4px; height: 4px; border-radius: 50%;
  background: currentColor; opacity: .45; position: absolute; left: 27px;
  transition: transform .15s var(--ease), opacity .15s var(--ease);
}
.nav-sub a:hover { background: rgba(255, 255, 255, .08); opacity: 1; }
.nav-sub a:hover::before { transform: scale(1.4); opacity: .8; }
.nav-sub a.active {
  background: rgba(255, 255, 255, .13); color: #fff; opacity: 1; font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
}
.nav-sub a.active::before { background: var(--accent); opacity: 1; box-shadow: 0 0 8px var(--accent); }

.side-foot {
  position: relative; padding: 12px 16px 15px; border-top: 1px solid rgba(255, 255, 255, .1);
  font-size: 11.5px; opacity: .6; display: flex; align-items: center; gap: 8px;
}
.sync-dot {
  width: 7px; height: 7px; border-radius: 50%; background: #6FD39B; flex: 0 0 7px;
  box-shadow: 0 0 0 3px rgba(111, 211, 155, .18);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 3px rgba(111, 211, 155, .18); } 50% { box-shadow: 0 0 0 5px rgba(111, 211, 155, .06); } }

.sidebar-mask { display: none; position: fixed; inset: 0; background: rgba(8, 18, 32, .48); z-index: 55; backdrop-filter: blur(1px); }
.sidebar-mask.show { display: block; animation: fadeIn .18s var(--ease); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.main { flex: 1; margin-left: var(--side-w); min-width: 0; display: flex; flex-direction: column; }

/* ============================================================
   5. 顶栏
   ============================================================ */
.topbar {
  height: 60px; position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px; padding: 0 22px;
  background: rgba(255, 255, 255, .82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.crumb {
  font-weight: 700; font-size: 15px; letter-spacing: .2px;
  padding-left: 11px; position: relative;
}
.crumb::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 15px; border-radius: 2px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
}
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.icon-btn {
  width: 36px; height: 36px; border: 1px solid transparent; background: transparent;
  border-radius: 9px; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-muted); position: relative;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.icon-btn:hover { background: var(--primary-tint); color: var(--primary); border-color: var(--primary-soft); }
.icon-btn:active { transform: scale(.96); }

.dot-badge {
  position: absolute; top: 7px; right: 8px; width: 7px; height: 7px;
  background: var(--danger); border-radius: 50%; border: 1.5px solid #fff;
  box-shadow: 0 0 0 2px rgba(176, 58, 58, .16);
}

.user-menu { position: relative; }

/* ---------- 顶栏主题快捷换色 ---------- */
.theme-menu { position: relative; }
.theme-btn .theme-dot {
  position: absolute; right: 6px; bottom: 6px; width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(16, 24, 40, .13);
  transition: background .18s var(--ease);
}
.theme-drop { min-width: 0; width: 272px; padding: 10px; }
.theme-drop .td-hd {
  font-size: 11.5px; color: var(--text-muted); font-weight: 600; letter-spacing: .3px;
  padding: 1px 3px 8px;
}
.theme-drop .td-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.theme-drop .td-sw {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 6px 2px 7px; border: 1px solid transparent; background: transparent;
  border-radius: 9px; cursor: pointer;
  transition: background .14s var(--ease), border-color .14s var(--ease), transform .1s var(--ease);
}
.theme-drop .td-sw i {
  position: relative; display: block; width: 30px; height: 30px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3), 0 2px 6px -2px rgba(16, 24, 40, .45);
}
.theme-drop .td-sw span { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.theme-drop .td-sw:hover { background: var(--primary-tint); }
.theme-drop .td-sw:active { transform: scale(.95); }
.theme-drop .td-sw.on { background: var(--primary-soft); border-color: var(--primary-soft); }
.theme-drop .td-sw.on span { color: var(--primary-dark); font-weight: 700; }
.theme-drop .td-sw.on i::after {
  content: '✓'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; font-weight: 700; text-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}
.theme-drop .td-tip { font-size: 11px; color: var(--text-faint); margin-top: 8px; text-align: center; }

.user-btn {
  display: flex; align-items: center; gap: 8px; border: 1px solid transparent;
  background: transparent; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 10px;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.user-btn:hover { background: var(--primary-tint); border-color: var(--primary-soft); }
.avatar {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(145deg, var(--primary), var(--primary-dark)); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 4px 10px -6px rgba(12, 68, 124, .8), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.uname { font-size: 13.5px; color: var(--text); font-weight: 500; }

.dropdown {
  display: none; position: absolute; right: 0; top: 46px; min-width: 152px;
  background: #fff; border: 1px solid var(--border); border-radius: 11px;
  box-shadow: var(--shadow-lg); padding: 6px; z-index: 50;
}
.dropdown.show { display: block; animation: pop .14s var(--ease); }
.dropdown button {
  display: block; width: 100%; text-align: left; padding: 9px 11px; border: 0;
  background: transparent; border-radius: 7px; cursor: pointer; font-size: 13.5px;
  color: var(--text); transition: background .13s var(--ease), color .13s var(--ease);
}
.dropdown button:hover { background: var(--primary-tint); color: var(--primary); }

.content { padding: 20px 22px 44px; flex: 1; max-width: 1520px; width: 100%; }

/* ============================================================
   6. 卡片 / 页头
   ============================================================ */
.card {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden;
}
.card-hd {
  display: flex; align-items: center; gap: 10px; padding: 15px 18px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
  background: linear-gradient(180deg, #fff, var(--surface-2));
}
.card-hd h2 { font-size: 14.5px; letter-spacing: .1px; }
.card-hd .sub { font-size: 12px; color: var(--text-muted); }
.card-hd .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.card-bd { padding: 18px; }
.card-bd.tight { padding: 0; }

.page-hd { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-hd h1 { font-size: 21px; letter-spacing: -.2px; }
.page-hd .desc { color: var(--text-muted); font-size: 12.5px; margin-top: 5px; max-width: 720px; }
.page-hd .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.section-title {
  font-size: 13px; font-weight: 700; color: var(--text); margin: 0 0 12px;
  display: flex; align-items: center; gap: 8px; letter-spacing: .1px;
}
.section-title::before {
  content: ''; width: 3px; height: 14px; border-radius: 2px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
}
.section-divider {
  height: 1px; margin: 22px 0; border: 0;
  background: var(--border);
}
.case-section { margin-bottom: 18px; }
.case-section:last-child { margin-bottom: 0; }

/* ============================================================
   7. 按钮
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 15px; border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, #fff, #FCFCFD); color: var(--text);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 13.5px; font-weight: 500;
  white-space: nowrap; box-shadow: var(--shadow-xs);
  transition: border-color .15s var(--ease), color .15s var(--ease),
              box-shadow .15s var(--ease), transform .1s var(--ease), background .15s var(--ease);
}
.btn:hover { border-color: var(--primary); color: var(--primary); box-shadow: 0 2px 8px -2px rgba(16, 24, 40, .12); }
.btn:active { transform: translateY(1px); box-shadow: none; }

.btn.primary {
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  border-color: var(--primary-dark); color: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .14), inset 0 1px 0 rgba(255, 255, 255, .16),
              0 6px 14px -8px rgba(12, 68, 124, .9);
}
.btn.primary:hover {
  color: #fff; filter: brightness(1.07);
  box-shadow: 0 2px 4px rgba(16, 24, 40, .16), inset 0 1px 0 rgba(255, 255, 255, .18),
              0 10px 20px -10px rgba(12, 68, 124, .95);
}

.btn.ghost { background: transparent; border-color: transparent; color: var(--primary); box-shadow: none; }
.btn.ghost:hover { background: var(--primary-soft); box-shadow: none; }

.btn.danger { color: var(--danger); border-color: #E7C6C6; background: linear-gradient(180deg, #fff, #FFFAFA); }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

.btn.sm { height: 30px; padding: 0 11px; font-size: 12.5px; border-radius: 7px; }
.btn.xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; filter: none; }
.btn-group { display: inline-flex; gap: 6px; }

/* ============================================================
   8. 表单
   ============================================================ */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.one { grid-template-columns: 1fr; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.field label .req { color: var(--danger); margin-left: 3px; }

.field input, .field select, .field textarea {
  height: 38px; width: 100%; padding: 0 11px; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-faint); }
.field textarea { height: auto; min-height: 78px; padding: 9px 11px; line-height: 1.65; resize: vertical; }
.field select {
  appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 16px, calc(100% - 12px) 16px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: #C2CAD6; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft);
}
.field .hint { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }
.field .hint.warn { color: var(--warning); }

.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar input, .toolbar select {
  height: 36px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 0 11px; background: #fff; outline: none;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.toolbar select {
  appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ---------------- 搜索框 ----------------
   放大镜用 mask 而不是 CSS 画圆：mask 取的是形状，颜色跟随 color，
   这样聚焦时图标能和描边一起变主色。旧写法里 `input:focus::before` 是无效选择器
   （伪元素挂在 .search-box 上，不是 input），图标从来不会变色。 */
.search-box { position: relative; display: inline-flex; align-items: center; }
.search-box::before {
  content: ''; position: absolute; left: 11px; top: 50%; width: 14px; height: 14px;
  transform: translateY(-50%); background-color: currentColor; color: var(--text-faint);
  -webkit-mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.6-3.6'/%3E%3C/svg%3E") center / 14px no-repeat;
  mask: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.6-3.6'/%3E%3C/svg%3E") center / 14px no-repeat;
  pointer-events: none; transition: color .16s var(--ease);
}
.search-box:focus-within::before { color: var(--primary); }
.search-box input {
  width: 252px; height: 34px; padding: 0 30px 0 32px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  background: var(--card-bg); color: var(--text); font-size: 12.9px;
  outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
.search-box input::placeholder { color: var(--text-faint); }
.search-box input:hover { border-color: var(--text-faint); }
.search-box input:focus {
  border-color: var(--primary); background: var(--card-bg);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
/* 有内容时右上角出现一键清空（只在结构里带了按钮的页面生效） */
.search-box .sb-clr {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  display: none; align-items: center; justify-content: center;
  width: 19px; height: 19px; padding: 0; border: 1px solid transparent; border-radius: 50%;
  background: var(--surface-2); color: var(--text-muted); cursor: pointer;
  transition: background .13s var(--ease), color .13s var(--ease);
}
.search-box .sb-clr:hover { background: var(--border); color: var(--text); }
.search-box .sb-clr svg { width: 10px; height: 10px; }
.search-box.has-val .sb-clr { display: inline-flex; }
/* 「/」快捷键提示，聚焦或有内容后让位给清空按钮 */
.search-box .sb-kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-num); font-size: 10.5px; line-height: 1; padding: 3px 5px;
  border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px;
  color: var(--text-faint); background: var(--surface-2); pointer-events: none;
  transition: opacity .13s var(--ease);
}
.search-box:focus-within .sb-kbd, .search-box.has-val .sb-kbd { opacity: 0; }

/* 权限下拉（用户与权限页） */
select.perm-sel {
  height: 32px; border: 1px solid var(--border-strong); border-radius: var(--radius-xs);
  padding: 0 26px 0 9px; background-color: #fff; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
                    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 14px, calc(100% - 9px) 14px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
select.perm-sel:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); outline: none; }

/* ============================================================
   9. 表格
   ============================================================ */
.table-wrap { width: 100%; overflow-x: auto; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.tbl th, table.tbl td {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  text-align: left; vertical-align: middle;
}
table.tbl th {
  background: var(--surface-2); color: var(--text-muted);
  font-weight: 600; font-size: 12px; white-space: nowrap;
  letter-spacing: .3px; text-transform: none;
  border-bottom: 1px solid var(--border);
}
table.tbl tbody tr { transition: background .13s var(--ease); }
table.tbl tbody tr:nth-child(even) { background: #FCFDFE; }
table.tbl tbody tr:hover { background: var(--primary-tint); }
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl td.ops { white-space: nowrap; }
table.tbl td.ops .btn { margin-right: 2px; }
table.tbl .link { color: var(--primary); cursor: pointer; font-weight: 600; }
table.tbl .link:hover { text-decoration: underline; text-underline-offset: 3px; }
table.tbl tfoot td { background: var(--surface-2); font-weight: 700; }

.tbl-empty {
  padding: 52px 18px; text-align: center; color: var(--text-muted); font-size: 13.5px;
  background:
    radial-gradient(closest-side, var(--primary-tint), transparent) no-repeat center 26px / 88px 60px;
}
.tbl-empty .btn { margin-top: 14px; }

/* ============================================================
   10. 标签 / 徽标
   ============================================================ */
.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 9px;
  border-radius: 999px; font-size: 11.8px; white-space: nowrap; font-weight: 500;
  background: #F1F3F5; color: var(--text-muted);
  border: 1px solid transparent;
}
.tag.blue { background: var(--primary-soft); color: var(--primary-dark); border-color: rgba(24, 95, 165, .14); }
.tag.green { background: var(--success-soft); color: var(--success); border-color: rgba(47, 122, 72, .16); }
.tag.orange { background: var(--warning-soft); color: var(--warning); border-color: rgba(180, 118, 26, .18); }
.tag.red { background: var(--danger-soft); color: var(--danger); border-color: rgba(176, 58, 58, .16); }
.tag.gray { background: #F2F4F6; color: #6B7280; border-color: #E7EAEE; }
.tag.gold { background: var(--accent-soft); color: var(--accent); border-color: rgba(186, 117, 23, .18); }
/* 「上传备份还原」用紫色：和自动(绿)/手动(蓝)/还原前(橙)/关机(灰) 区分开 */
.tag.purple { background: #EEEDFE; color: #534AB7; border-color: rgba(83, 74, 183, .18); }

/* ============================================================
   11. 统计卡 / 看板
   ============================================================ */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }

.kpi {
  position: relative; overflow: hidden; cursor: pointer;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 17px 18px 16px; box-shadow: var(--shadow);
  transition: box-shadow .2s var(--ease), transform .2s var(--ease), border-color .2s var(--ease);
}
.kpi::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  opacity: .9;
}
.kpi::after {
  content: ''; position: absolute; right: -34px; top: -46px; width: 116px; height: 116px;
  border-radius: 50%; background: var(--primary-soft); opacity: .55;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: #DCE3EC; }
.kpi:hover::after { transform: scale(1.14); opacity: .8; }

.kpi .k-label { position: relative; font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.kpi .k-value {
  position: relative; font-size: 29px; font-weight: 700; line-height: 1.15;
  margin-top: 7px; letter-spacing: -.5px; font-family: var(--font-num); color: var(--text);
}
.kpi .k-sub { position: relative; font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }
.kpi .k-icon { position: absolute; right: 14px; top: 14px; opacity: .12; }

.kpi.accent::before { background: linear-gradient(180deg, var(--primary), var(--accent)); }
.kpi.accent .k-value { color: var(--primary); }
.kpi.gold::before { background: linear-gradient(180deg, var(--accent), #8C5A0F); }
.kpi.gold .k-value { color: var(--accent); }
.kpi.green::before { background: linear-gradient(180deg, #48A56A, var(--success)); }
.kpi.green .k-value { color: var(--success); }
.kpi.green::after { background: var(--success-soft); }
.kpi.red::before { background: linear-gradient(180deg, #CC5A5A, var(--danger)); }
.kpi.red .k-value { color: var(--danger); }
.kpi.red::after { background: var(--danger-soft); }

/* 分段控件（案件视图 / 待开庭 / 待办 / 统计区间 共用） */
.seg {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--body-bg); border: 1px solid var(--border);
  border-radius: 9px; max-width: 100%;
  /* 手机端项目多时要能横向滑动，否则最后几项会被直接裁掉 */
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  border: 0; background: transparent; height: 30px; padding: 0 13px;
  border-radius: 7px; cursor: pointer; color: var(--text-muted);
  font-size: 13px; font-weight: 500; white-space: nowrap; flex: 0 0 auto;
  transition: background .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease);
}
.seg button:hover { color: var(--primary); background: rgba(255, 255, 255, .7); }
.seg button.on {
  background: #fff; color: var(--primary); font-weight: 600;
  box-shadow: var(--shadow-xs), 0 1px 0 rgba(255, 255, 255, .9) inset;
}

/* 统计区间 */
.range-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 11px 14px; box-shadow: var(--shadow);
}
.range-bar .seg { border-color: transparent; }
.range-bar input[type=date] {
  height: 32px; border: 1px solid var(--border-strong); border-radius: var(--radius-xs);
  padding: 0 9px; background: #fff; outline: none;
}
.range-bar input[type=date]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* 双列栅格：按内容高度对齐，否则内容少的一侧会被邻卡拉长成「空心卡片」 */
.dual-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
/* 开庭 / 待办并排这一行强制等高：左边常常只有一场庭，右边十来条待办，
   不对齐的话左边卡下面会空出一大块，看着像页面没加载完 */
.dual-grid.dash-pair { align-items: stretch; }
/* 左列最后一张卡吃掉剩余高度，否则空白会露在卡片外面而不是卡片里面 */
.dual-grid.dash-pair .dash-col > .card:last-child { flex: 1 1 auto; }
/* 看板左列：多张卡片竖向堆叠，占住一列高度 */
.dash-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
/* 堆叠时用 gap 控间距，卡片自身不要再带下边距，否则变成 32px 一条大缝 */
.dash-col > .card { margin-bottom: 0; }

.list-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 2px;
  border-bottom: 1px dashed var(--border); font-size: 13.5px;
  transition: background .13s var(--ease);
}
.list-row:last-child { border-bottom: 0; }
.list-row .t { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .s { color: var(--text-muted); font-size: 12px; }

/* 开庭 / 待办 / 跟进统一成「标签 + 标题 + 说明行」两行结构：
   案名单独占一行，才不会被右侧的「时间 · 法院」挤成省略号 */
.list-row.dash-row { flex-wrap: wrap; row-gap: 2px; padding-top: 9px; padding-bottom: 9px; }
.list-row .dash-meta {
  flex: 1 1 100%; font-size: 11.5px; color: var(--text-muted);
  line-height: 1.45; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dash-more { font-size: 11.5px; color: var(--text-faint); padding: 9px 2px 0; }
.dash-more + .hear-legend { margin-top: 10px; }

/* 近期开庭：四档紧迫度配色。左侧竖色条 + 极浅底色，不抢正文又能一眼分级 */
.hear-row { position: relative; padding-left: 13px; border-radius: 7px; padding-right: 6px; }
.hear-row::before {
  content: ''; position: absolute; left: 0; top: 9px; bottom: 9px;
  width: 3px; border-radius: 2px; background: transparent;
}
.hear-d1 { background: rgba(176, 58, 58, .055); }
.hear-d1::before { background: #B03A3A; }
.hear-d2 { background: rgba(180, 118, 26, .055); }
.hear-d2::before { background: #C2802A; }
.hear-d3 { background: rgba(186, 117, 23, .035); }
.hear-d3::before { background: #D9A441; }
.hear-d4 { background: transparent; }
.hear-d4::before { background: #7EA8D4; }
.hear-row:hover { background: var(--surface-2); }

/* 图例兼筛选器：每档显示条数，点击只看该档，再点回到全部 */
.hear-legend {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 11px; border-top: 1px dashed var(--border);
  font-size: 11.5px; color: var(--text-muted);
}
.hear-legend .hl {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  border: 1px solid transparent; background: transparent; border-radius: 999px;
  padding: 3px 9px 3px 8px; font-family: inherit; font-size: 11.5px; color: var(--text-muted);
  transition: background .13s var(--ease), border-color .13s var(--ease), color .13s var(--ease);
}
.hear-legend .hl::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--border-strong); flex: none; }
.hear-legend .hl b { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.hear-legend .hl:hover { background: var(--surface-2); color: var(--text); }
.hear-legend .hl.on {
  background: #fff; border-color: var(--border-strong); color: var(--text);
  font-weight: 600; box-shadow: var(--shadow-xs);
}
.hear-legend .hl.zero { opacity: .45; }
.hear-legend .hl-all::before { background: var(--primary); }
.hear-legend .hl-d1::before { background: #B03A3A; }
.hear-legend .hl-d2::before { background: #C2802A; }
.hear-legend .hl-d3::before { background: #D9A441; }
.hear-legend .hl-d4::before { background: #7EA8D4; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-row .name { width: 118px; flex: 0 0 118px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-muted); }
.bar-row .bar { flex: 1; height: 8px; background: var(--body-bg); border-radius: 5px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(16, 24, 40, .05); }
.bar-row .bar i {
  display: block; height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  transition: width .4s var(--ease);
}
.bar-row .v { width: 42px; text-align: right; color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums; }

.trend { display: flex; align-items: flex-end; gap: 10px; height: 136px; padding: 8px 4px 0; }
.trend .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.trend .col i {
  width: 66%; max-width: 34px; min-height: 3px; border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  box-shadow: 0 -2px 6px -2px rgba(12, 68, 124, .3);
  transition: filter .15s var(--ease), transform .15s var(--ease);
}
.trend .col:hover i { filter: brightness(1.12); transform: scaleX(1.06); }
.trend .col span { font-size: 11px; color: var(--text-muted); }
.trend .col b { font-size: 11px; color: var(--text); font-weight: 700; font-family: var(--font-num); }

.fee-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px;
  background: var(--border); border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--border);
}
.fee-cell { background: #fff; padding: 16px 20px; }
.fee-cell .l { font-size: 12.5px; color: var(--text-muted); }
.fee-cell .v { font-size: 24px; font-weight: 700; margin-top: 5px; font-family: var(--font-num); letter-spacing: -.4px; line-height: 1.2; }
.fee-note { font-size: 11.5px; color: var(--text-muted); margin-top: 11px; line-height: 1.6; }

/* ============================================================
   12. 案件列表
   ============================================================ */
.case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(336px, 1fr)); gap: 14px; }

/* 卡片 / 列表 视图切换按钮（放在筛选行最右侧） */
.view-toggle {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px; flex: 0 0 auto;
  background: var(--body-bg); border: 1px solid var(--border); border-radius: 9px;
  margin-left: auto;
}
.view-toggle button {
  width: 30px; height: 28px; padding: 0; border: 0; border-radius: 7px; cursor: pointer;
  background: transparent; color: var(--text-faint);
  display: flex; align-items: center; justify-content: center;
  transition: background .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease);
}
.view-toggle button:hover { color: var(--primary); background: rgba(255, 255, 255, .75); }
.view-toggle button.on {
  background: var(--card-bg); color: var(--primary);
  box-shadow: 0 1px 3px rgba(16, 24, 40, .10), inset 0 0 0 1px var(--border);
}
.view-toggle svg { width: 15px; height: 15px; display: block; }
/* 搜索框和视图切换都在同一行时，两个 margin-left:auto 会把剩余空间对半分，
   搜索框就停在中间偏左的位置。这里把切换按钮的 auto 去掉，让全部余量落在搜索框前面，
   搜索框和切换按钮一起贴到最右边（也是用户说的「往右挪一些」）。 */
.card-hd .search-box.right + .view-toggle { margin-left: 6px; }

/* 案件类型筛选条（全部 / 民事 / 刑事 / 行政 / 非诉）：紧贴表头下方的第二行 */
.case-type-bar { padding: 12px 18px 0; }
.case-type-bar .seg { max-width: 100%; }

/* 列表视图表格：一行一案，尽量多列。屏幕不够宽时表格内部横向滚动，首列固定不丢案件名 */
.case-tbl-wrap { overflow-x: auto; overflow-y: hidden; }
/* 列表铺满卡片：表格自己每个格子已有 9px 内边距，再套一层 18px 白边等于白扔 36px 宽度，
   1366 屏就差这一点会滚起来。首列/末列单独补回来，和上面的筛选条左对齐。 */
.card-bd.list-tight { padding: 0; }
.card-bd.list-tight .case-tbl th:first-child,
.card-bd.list-tight .case-tbl td:first-child { padding-left: 18px; }
.card-bd.list-tight .case-tbl th:last-child,
.card-bd.list-tight .case-tbl td:last-child { padding-right: 18px; }
.case-tbl-wrap::-webkit-scrollbar { height: 11px; }
.case-tbl-wrap::-webkit-scrollbar-thumb {
  background: #B9C3D0; border-radius: 8px;
  border: 3px solid transparent; background-clip: content-box;
}
/* 列宽一律用百分比，表格宽度恒等于容器宽度 —— 不设固定 min-width，
   1300 / 1200 的笔记本（可用宽只有 900 上下）也能一屏看全 10 列，不会把
   「已收 / 合同」「未收」挤出可视区。真到 820px 以下才允许内部横向滚动。 */
.case-tbl { width: 100%; min-width: 820px; table-layout: fixed; font-size: 12.6px; }
/* 选择器必须写到 table.tbl.case-tbl 才压得住全局的 `table.tbl th, table.tbl td{padding:12px 14px}`，
   它的权重是 (0,1,2)，光写 .case-tbl th (0,1,1) 是压不过的 —— 表现在每行被 12px 撑到 90 多高，
   一屏只剩五六条。 */
table.tbl.case-tbl th, table.tbl.case-tbl td { padding: 8px; }
.case-tbl tbody tr { cursor: pointer; }
/* 宽表关掉斑马纹：首列要 sticky，需要固定的不透明底色，否则和隔行底色打架 */
.case-tbl tbody tr:nth-child(even) { background: transparent; }
/* 百分比合计 100%。金额两列（已收 / 合同、未收）已按需求撤掉，宽度让给
   名称、当事人、对方、案由、法院、待办这些真正要看文字的地方，并新增「收案 · 跟进」。
   钱的汇总统一去「收费财务」看，列表只留一行悬停摘要。 */
.case-tbl .col-name { width: 17%; }
.case-tbl .col-client { width: 10.5%; }
.case-tbl .col-opp { width: 9.5%; }
.case-tbl .col-matter { width: 12.5%; }
.case-tbl .col-court { width: 13%; }
.case-tbl .col-hearing { width: 8.5%; }
.case-tbl .col-status { width: 6.5%; }
.case-tbl .col-idle { width: 10%; }
.case-tbl .col-todo { width: 12.5%; }
/* 表格里的状态标签比别处的小一号：6.5% 的列宽塞「办理中」三个字，
   沿用全站 22px 高的胶囊会顶到隔壁金额列 */
.case-tbl td.col-status .tag { height: 20px; padding: 0 6px; font-size: 11px; }
/* 金额列左右内边距收紧 3px×2：宽表里这点余量正好够 ¥1,280,000 一行排完 */
.case-tbl th.col-money, .case-tbl td.col-money,
.case-tbl th.col-money2, .case-tbl td.col-money2 { padding-left: 5px; padding-right: 7px; }

/* 首列固定，横向滚动时不丢案件名 */
.case-tbl th.col-name, .case-tbl td.col-name {
  position: sticky; left: 0; z-index: 2; background: var(--card-bg);
  box-shadow: 1px 0 0 var(--border);
}
.case-tbl thead th.col-name { z-index: 3; background: var(--surface-2); }
.case-tbl tbody tr:hover td.col-name { background: var(--primary-tint); }

/* 名称类内容允许折两行，比硬截一半更有信息量（行高已被标题/电话撑起来，不额外占位）。
   裁剪一律作用在内层 div 上，绝不能改 td 的 display —— 那会让单元格退出表格布局、整列错位。 */
.case-tbl .ct-2l, .case-tbl td.col-court > div:first-child {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word; line-height: 1.42;
}
.case-tbl td.col-client > div {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.case-tbl .ct-subline { display: flex; align-items: center; gap: 6px; margin-top: 4px; min-width: 0; }
.case-tbl .ct-subline .tag { height: 17px; padding: 0 6px; font-size: 10.6px; }
.case-tbl .ct-title {
  font-weight: 600; line-height: 1.42; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.case-tbl .ct-no {
  font-family: var(--font-num); font-size: 11.6px; color: var(--text-muted);
  letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.case-tbl .ct-sub { font-size: 11.4px; color: var(--text-faint); margin-top: 3px; line-height: 1.4; }
.case-tbl .ct-unpaid { color: var(--danger); font-weight: 600; font-family: var(--font-num); }
.case-tbl .ct-amount { font-family: var(--font-num); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 「最近待办」两行：第一行事项（单行省略），第二行到期日 + 倒计 */
.case-tbl .ct-todo-t {
  display: block; line-height: 1.4; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.case-tbl .ct-todo-d { font-size: 11.2px; line-height: 1.4; margin-top: 2px; color: var(--text-faint); white-space: nowrap; }
.case-tbl .ct-todo .ct-more { margin-left: 3px; font-size: 10.4px; font-weight: 700; color: var(--accent); }
.case-tbl .ct-todo.is-over .ct-todo-t { color: var(--danger); }
.case-tbl .ct-todo.is-over .ct-todo-d { color: var(--danger); font-weight: 600; }
.case-tbl .ct-todo.is-today .ct-todo-d { color: var(--danger); font-weight: 600; }
.case-tbl .ct-todo.is-soon .ct-todo-d { color: var(--accent); font-weight: 600; }
.case-tbl .c-hearing { white-space: nowrap; font-size: 12.4px; }
.case-tbl .c-hearing b { display: block; font-weight: 500; }
.case-tbl .c-hearing i { display: block; font-style: normal; font-size: 11.2px; color: var(--text-faint); margin-top: 2px; }
.case-tbl .c-hearing.is-today, .case-tbl .c-hearing.is-today i { color: var(--danger); }
.case-tbl .c-hearing.is-today b { font-weight: 700; }
.case-tbl .c-hearing.is-soon, .case-tbl .c-hearing.is-soon i { color: var(--accent); }
.case-tbl .c-hearing.is-past, .case-tbl .c-hearing.is-past i { color: var(--text-faint); }
.case-tbl .ct-money b { font-family: var(--font-num); font-weight: 600; }
.case-tbl .ct-money .ct-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* 「收案 · 跟进」列：收案日期 / 多久没跟进 / 跟进与材料条数。
   15 天没动标橙、30 天标红 —— 律师最容易漏的就是这种「没人催就一直躺着」的案子 */
.case-tbl .ct-idle { line-height: 1.42; }
.case-tbl .ct-idle-d {
  font-family: var(--font-num); font-size: 11.6px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.case-tbl .ct-idle-g { font-size: 11.6px; color: var(--text-faint); white-space: nowrap; margin-top: 2px; }
.case-tbl .ct-idle-g.is-warm { color: var(--accent); font-weight: 600; }
.case-tbl .ct-idle-g.is-stale { color: var(--danger); font-weight: 600; }
.case-tbl .ct-idle-n {
  font-size: 10.9px; color: var(--text-faint); white-space: nowrap;
  margin-top: 2px; overflow: hidden; text-overflow: ellipsis;
}
.case-tbl .tag { white-space: nowrap; }
/* 法院列：第一行法院名最多折两行，后面「阶段」「案号」各压一行、超出省略。
   不压的话「侦查阶段（会见与取保）」这种长阶段名会折两行，整行被顶到 95px，
   一屏只剩五六条，就谈不上"一目了然"了。完整值都在 title 里，鼠标停一下就看见。 */
.case-tbl td.col-court > div + div {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* 法院列里的法院案号：(2026)晋0213民初1234号 这种长串，单独一行小字，允许断词 */
.case-tbl .ct-caseno {
  font-family: var(--font-num); font-size: 10.9px; color: var(--text-faint);
  line-height: 1.35; margin-top: 2px;
}
/* 当事人：姓名和「原告 / 被告」角标排同一行，电话放第二行。
   角标单独占一行会让这一列变成三行，整行高度被它拉起来。 */
.case-tbl .ct-crow { display: flex; align-items: center; gap: 4px; min-width: 0; }
.case-tbl .ct-cname {
  flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.case-tbl .ct-role {
  flex: 0 0 auto; display: inline-block; font-size: 10.2px; line-height: 1.45; padding: 0 4px;
  border-radius: 4px; background: var(--surface-2); color: var(--text-muted);
  max-width: 56%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.case-tbl .ct-closed { font-size: 10.9px; color: var(--text-faint); margin-top: 3px; line-height: 1.35; }

/* 企业名称可双击跳转查询平台（企查查/爱企查/天眼查/自定义）：
   虚线 + 手型 + 悬停变色，给个「这是能点」的暗示，又不喧宾夺主 */
.company-link {
  cursor: pointer;
  border-bottom: 1px dashed var(--primary, #185FA5);
  padding-bottom: 1px;
  transition: color .15s;
}
.company-link:hover {
  color: var(--primary, #185FA5);
  border-bottom-style: solid;
  border-bottom-color: var(--primary, #185FA5);
}

/* 诉讼费自动计算提示：标的额输入框下方实时展示分段明细 */
.court-fee-calc {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted, #888);
}
.court-fee-calc .cf-total {
  display: block;
  font-size: 12.5px;
  color: var(--text, #333);
}
.court-fee-calc .cf-total b {
  color: var(--primary, #185FA5);
  font-size: 14px;
}
.court-fee-calc .cf-detail {
  margin-top: 3px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
}
.court-fee-calc .cf-detail span {
  color: var(--text-faint, #aaa);
  white-space: nowrap;
}
.court-fee-calc .cf-note {
  color: var(--text-muted, #888);
}
.court-fee-calc .cf-tip {
  margin-top: 2px;
  color: var(--text-faint, #bbb);
  font-size: 11px;
}

/* 窄一点的笔记本（1366 / 1280 / 1200）字号与内边距各降一档：
   百分比列宽会跟着容器自动缩，这里只是把「字」也收一收，保证 10 列挤得下还不糊 */
@media (max-width: 1420px) {
  .case-tbl { font-size: 12.2px; }
  table.tbl.case-tbl th, table.tbl.case-tbl td { padding: 7px; }
  .case-tbl .c-hearing i { font-size: 11px; }
}
@media (max-width: 1180px) {
  .case-tbl { font-size: 11.8px; }
  table.tbl.case-tbl th, table.tbl.case-tbl td { padding: 6px; }
  .case-tbl .ct-sub, .case-tbl .ct-todo-d { font-size: 10.8px; }
  .case-tbl .c-hearing i { font-size: 10.4px; }
}

/* 窄屏紧凑行（列表视图在手机上的形态，不产生横向滚动） */
.case-mini { display: block; }
.case-mini .mi {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 2px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background .13s var(--ease);
}
.case-mini .mi:last-child { border-bottom: 0; }
.case-mini .mi:active { background: var(--primary-tint); }
.case-mini .mi-bd { flex: 1 1 auto; min-width: 0; }
.case-mini .mi-t { font-size: 13.6px; font-weight: 600; line-height: 1.45; color: var(--text); word-break: break-word; }
.case-mini .mi-s { font-size: 11.8px; color: var(--text-faint); margin-top: 4px; line-height: 1.45; }
.case-mini .mi-r { flex: 0 0 auto; min-width: 82px; text-align: right; }
.case-mini .mi-m { font-size: 11.6px; font-weight: 600; margin-top: 6px; color: var(--text-muted); }
.case-mini .mi-m.is-stale { color: var(--danger); }
.case-mini .mi-m2 { font-family: var(--font-num); font-size: 11.2px; color: var(--text-faint); }
.case-mini .mi-todo { font-size: 11px; color: var(--accent); margin-top: 4px; font-weight: 600; }
.case-mini .mi-hearing.is-today { color: var(--danger); font-weight: 600; }
.case-mini .mi-hearing.is-soon { color: var(--accent); font-weight: 600; }
.case-mini .mi-hearing.is-past { color: var(--text-faint); }

/* ---------------- 案件材料上传组件 ---------------- */
.docpick { display: block; }
.dp-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.dp-cat { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); }
.dp-cat select {
  height: 32px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 7px;
  font-size: 13px; background: var(--card-bg); color: var(--text);
}
.dp-hint { font-size: 11.8px; color: var(--text-faint); }
.dp-drop {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  background: var(--surface-2); padding: 20px 16px; text-align: center; cursor: pointer;
  color: var(--text-muted); transition: border-color .16s var(--ease), background .16s var(--ease), color .16s var(--ease);
}
.dp-drop:hover, .dp-drop:focus-visible { border-color: var(--primary); background: var(--primary-tint); color: var(--primary); outline: none; }
.dp-drop.over { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); border-style: solid; }
/* 全局 img,svg 是 display:block，这里要居中就得自己给 margin:auto */
.dp-drop svg { width: 26px; height: 26px; margin: 0 auto 7px; opacity: .85; }
.dp-drop-t { font-size: 13px; }
.dp-drop-t b { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.dp-drop-s { font-size: 11.8px; margin-top: 4px; opacity: .8; }
.dp-list { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.dp-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--card-bg);
}
.dp-item.is-err { border-color: var(--danger); background: var(--danger-soft); }
.dp-ic {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 8px; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 9.5px; font-weight: 700; letter-spacing: .2px; background: #7A8699;
}
.dp-ic.k-pdf { background: #C0392B; }
.dp-ic.k-word { background: #2563A8; }
.dp-ic.k-excel { background: #1E7A46; }
.dp-ic.k-ppt { background: #C1651A; }
.dp-ic.k-img { background: #7A4FA8; }
.dp-ic.k-zip { background: #6B6F76; }
.dp-meta { flex: 1 1 auto; min-width: 0; }
.dp-name { font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dp-sub2 { font-size: 11.4px; color: var(--text-faint); margin-top: 2px; }
.dp-st.up { color: var(--primary); margin-left: 6px; }
.dp-st.err { color: var(--danger); margin-left: 6px; }
.dp-item-cat {
  height: 30px; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 7px;
  font-size: 12.2px; background: var(--card-bg); color: var(--text); flex: 0 0 auto;
}
.dp-ops { display: flex; gap: 6px; flex: 0 0 auto; }
.dp-ops .btn { margin: 0; }
.dp-count { font-size: 11.8px; color: var(--text-muted); margin-top: 8px; }

/* 详情页「已归档材料」表格 */
.doc-name { max-width: 330px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-cat-sel {
  height: 28px; padding: 0 5px; border: 1px solid var(--border-strong); border-radius: 6px;
  font-size: 12.2px; background: var(--card-bg); color: var(--text); max-width: 118px;
}

/* 常用模板：列表里直接换分类 */
.tpl-cat-sel {
  height: 29px; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 6px;
  font-size: 12.4px; background: var(--card-bg); color: var(--text); max-width: 140px;
}

/* 常用模板：分类管理弹窗 */
.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2);
}
.cat-row .cat-name {
  flex: 1 1 auto; min-width: 0; height: 31px; padding: 0 9px;
  border: 1px solid var(--border-strong); border-radius: 7px;
  font-size: 13px; background: var(--card-bg); color: var(--text);
}
.cat-row .cat-used { flex: 0 0 auto; font-size: 11.8px; color: var(--text-faint); }
.cat-add { display: flex; gap: 8px; margin-top: 14px; }
.cat-add input {
  flex: 1 1 auto; min-width: 0; height: 34px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  font-size: 13px; background: var(--card-bg); color: var(--text);
}

.case-card {
  position: relative; overflow: hidden;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 15px 17px 13px; cursor: pointer;
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}
.case-card::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0); transform-origin: left; opacity: 0;
  transition: transform .28s var(--ease), opacity .28s var(--ease);
}
.case-card:hover { box-shadow: var(--shadow-md); border-color: #D8E1EC; transform: translateY(-2px); }
.case-card:hover::before { transform: scaleX(1); opacity: 1; }

.case-card .cc-top { display: flex; align-items: center; gap: 7px; margin-bottom: 9px; flex-wrap: wrap; }
.case-card .cc-no { font-size: 11.5px; color: var(--text-faint); font-family: var(--font-num); letter-spacing: .4px; }
.case-card h3 {
  font-size: 14.8px; line-height: 1.45; margin-bottom: 8px; font-weight: 700;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.case-card .cc-meta { font-size: 12.5px; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; }
.case-card .cc-meta .flex { gap: 12px; }
.case-card .cc-foot {
  display: flex; align-items: center; gap: 8px; margin-top: 11px; padding-top: 10px;
  border-top: 1px dashed var(--border); font-size: 12px; color: var(--text-muted); flex-wrap: wrap;
}
.case-card .cc-money { margin-left: auto; font-weight: 700; color: var(--primary); font-family: var(--font-num); font-size: 13px; }

.hearing-hot { color: var(--danger); font-weight: 700; }
.hearing-warn { color: var(--accent); font-weight: 600; }

/* ============================================================
   13. 案件详情
   ============================================================ */
.detail-hd {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #fff 0%, var(--primary-tint) 58%, var(--primary-soft) 100%);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 19px 21px 17px; margin-bottom: 14px;
}
.detail-hd::after {
  content: ''; position: absolute; right: -60px; top: -70px; width: 200px; height: 200px;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .9), transparent);
}
.detail-hd .dh-top { position: relative; display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.detail-hd h1 { font-size: 19.5px; line-height: 1.42; letter-spacing: -.2px; }
.detail-hd .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; font-size: 12.5px; color: var(--text-muted); }
.detail-hd .meta > span {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255, 255, 255, .78); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 11px;
  backdrop-filter: blur(4px);
}
.detail-hd .meta b { color: var(--text); font-weight: 600; }
.detail-hd .dh-actions { position: relative; margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.tabs {
  display: flex; gap: 4px; overflow-x: auto; padding: 6px;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 12px;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: transparent; padding: 9px 15px; font-size: 13.5px;
  color: var(--text-muted); cursor: pointer; white-space: nowrap; border-radius: var(--radius-sm);
  font-weight: 500; transition: background .15s var(--ease), color .15s var(--ease);
}
.tabs button:hover { background: var(--body-bg); color: var(--text); }
.tabs button.on {
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  color: #fff; font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .12), inset 0 1px 0 rgba(255, 255, 255, .14);
}
.tabs button.on::after { display: none; }
.tabs button .tag { margin-left: 5px; }

.tab-body {
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}

.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 20px; }
.info-item .k { font-size: 12px; color: var(--text-faint); margin-bottom: 3px; }
.info-item .v { font-size: 13.5px; word-break: break-word; color: var(--text); }
.info-item.full { grid-column: 1 / -1; }

.money-cards { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.money-card {
  position: relative; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 13px 15px; background: linear-gradient(180deg, #fff, var(--surface-2));
  transition: box-shadow .18s var(--ease), transform .18s var(--ease);
}
.money-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--border-strong);
}
.money-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.money-card .l { font-size: 12px; color: var(--text-muted); }
.money-card .v { font-size: 19px; font-weight: 700; font-family: var(--font-num); margin-top: 3px; letter-spacing: -.3px; }
.money-card.warn { background: linear-gradient(180deg, #fff, var(--warning-soft)); }
.money-card.warn::before { background: var(--warning); }
.money-card.warn .v { color: var(--warning); }
.money-card.good { background: linear-gradient(180deg, #fff, var(--success-soft)); }
.money-card.good::before { background: var(--success); }
.money-card.good .v { color: var(--success); }
.money-card:first-child::before { background: var(--primary); }

.sensitive { filter: blur(4px); transition: filter .2s var(--ease); cursor: pointer; }
.sensitive.show { filter: none; }

/* 阶段时间线 */
.stage-line { position: relative; padding-left: 24px; }
.stage-line::before {
  content: ''; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(180deg, var(--border-strong), var(--border)); border-radius: 1px;
}
.stage-item { position: relative; padding: 9px 0; display: flex; gap: 10px; align-items: flex-start; }
.stage-item::before {
  content: ''; position: absolute; left: -22px; top: 15px; width: 10px; height: 10px;
  border-radius: 50%; background: #fff; border: 2px solid var(--border-strong);
  box-shadow: 0 0 0 3px #fff;
  transition: border-color .2s var(--ease), background .2s var(--ease);
}
.stage-item.done::before { background: var(--success); border-color: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.stage-item .sn { font-weight: 600; font-size: 13.5px; }
.stage-item .sd { font-size: 12px; color: var(--text-muted); }

/* ============================================================
   14. 日历
   ============================================================ */
.cal-hd { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.cal-hd .ym { font-size: 18px; font-weight: 700; letter-spacing: -.3px; font-family: var(--font-num); }
.cal-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.cal-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }

.cal-dow {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--surface-2); border: 1px solid var(--border); border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
}
.cal-dow span { padding: 10px 0; text-align: center; font-size: 12.5px; color: var(--text-muted); font-weight: 600; }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  border-left: 1px solid var(--border); border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; background: #fff;
}
.cal-cell {
  min-height: 110px; padding: 7px; background: #fff;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  transition: background .15s var(--ease);
}
.cal-cell:hover { background: var(--primary-tint); }
.cal-cell.other { background: #FAFBFC; }
.cal-cell.other .d { color: var(--text-faint); opacity: .7; }
.cal-cell.today { background: var(--primary-soft); box-shadow: inset 0 0 0 1px rgba(24, 95, 165, .18); }
.cal-cell .d { font-size: 12.5px; color: var(--text-muted); margin-bottom: 5px; font-family: var(--font-num); font-weight: 600; }
.cal-cell.today .d {
  color: #fff; background: var(--primary); display: inline-flex;
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  align-items: center; justify-content: center; font-size: 11.5px;
}
.cal-ev {
  display: block; font-size: 11.5px; padding: 2px 6px; border-radius: 5px; margin-bottom: 3px;
  cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-left: 2px solid transparent; transition: filter .13s var(--ease), transform .13s var(--ease);
}
.cal-ev:hover { filter: brightness(.96); transform: translateX(1px); }
.cal-ev.hearing { background: var(--danger-soft); color: var(--danger); border-left-color: var(--danger); }
.cal-ev.todo { background: var(--info-soft); color: #1F5FA8; border-left-color: var(--info); }
.cal-ev.meeting { background: var(--success-soft); color: var(--success); border-left-color: var(--success); }
.cal-ev.stage { background: #F1F3F5; color: var(--text-muted); border-left-color: #9AA0A6; }
.cal-ev.pending { border: 1px dashed currentColor; }

/* 点某一天的弹窗：每条事项一张卡片，把开庭时间 / 法院 / 地点 / 当事人 / 对方 / 阶段 / 备注一次铺开 */
.cal-day-hd {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 0 0 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border);
}
.cal-day-hd b { font-family: var(--font-num); font-size: 15px; letter-spacing: .4px; }
.cal-day-hd > span:not(.tag) { font-size: 12.4px; color: var(--text-muted); }
.cal-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px 12px;
  margin-bottom: 10px; background: var(--card-bg); border-left: 3px solid var(--border-strong);
}
.cal-card:last-child { margin-bottom: 0; }
.cal-card.hearing { border-left-color: var(--danger); }
.cal-card.todo { border-left-color: var(--info); }
.cal-card.meeting { border-left-color: var(--success); }
.cal-card.stage { border-left-color: #9AA0A6; }
.cal-card-hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.cal-card-hd .cal-hm { font-family: var(--font-num); font-size: 14px; color: var(--text); letter-spacing: .3px; }
.cal-card-hd .cal-ttl {
  font-weight: 600; font-size: 13.6px; color: var(--text); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 18px; }
.cal-row { display: flex; gap: 8px; font-size: 12.6px; line-height: 1.55; min-width: 0; }
.cal-row .k { flex: 0 0 44px; color: var(--text-faint); }
.cal-row .v { flex: 1; min-width: 0; color: var(--text); word-break: break-word; }
.cal-no { font-family: var(--font-num); font-size: 11.4px; color: var(--text-faint); margin-left: 4px; }
.cal-sub { margin-top: 3px; display: flex; align-items: center; gap: 5px; }
.cal-sub .cal-no { margin-left: 0; }
.cal-sub .tag { height: 17px; padding: 0 6px; font-size: 10.4px; }
.cal-role {
  display: inline-block; font-size: 10.6px; padding: 0 5px; margin-left: 4px; border-radius: 4px;
  background: var(--surface-2); color: var(--text-muted); vertical-align: 1px;
}
.cal-card-ft { margin-top: 9px; display: flex; justify-content: flex-end; }
@media (max-width: 620px) {
  .cal-rows { grid-template-columns: 1fr; }
  .cal-card-hd .cal-ttl { flex: 1 0 100%; order: 3; white-space: normal; }
}

/* ============================================================
   15. 常用网址
   ============================================================ */
.site-group { margin-bottom: 24px; }
.site-group h3 {
  font-size: 12.5px; color: var(--text-muted); margin-bottom: 11px; font-weight: 600;
  display: flex; align-items: center; gap: 8px; letter-spacing: .3px;
}
.site-group h3::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); }
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.site-item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 13px 6px 11px; border-radius: var(--radius); cursor: pointer; text-align: center;
  border: 1px solid transparent;
  transition: background .16s var(--ease), box-shadow .16s var(--ease), border-color .16s var(--ease);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
/* 卡片本身不位移（原来 hover 时 translateY(-3px) 会让鼠标停在边缘时反复「移开→回弹」，表现为闪烁），
   抬升与缩放改由内部图标承担，命中区域始终不变 */
.site-item:hover {
  background: var(--card-bg); border-color: var(--border-strong); box-shadow: var(--shadow-md);
}
.site-icon {
  width: 48px; height: 48px; border-radius: 14px; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; letter-spacing: .5px;
  box-shadow: inset 0 -10px 18px -10px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .3), 0 6px 14px -8px rgba(16, 24, 40, .5);
  transition: transform .16s var(--ease), box-shadow .16s var(--ease);
}
/* 抬升只发生在图标上，卡片盒子不动 → 不会出现 hover 抖动 */
.site-item:hover .site-icon {
  transform: translateY(-3px) scale(1.05);
  box-shadow: inset 0 -10px 18px -10px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .3), 0 10px 18px -8px rgba(16, 24, 40, .55);
}
.site-item .n { font-size: 12.5px; color: var(--text); line-height: 1.35; }
.site-item .edit { position: absolute; }
.site-item .flex { opacity: 0; transition: opacity .15s var(--ease); }
.site-item:hover .flex { opacity: 1; }

/* 拖拽排序状态 */
.site-item[draggable="true"] { cursor: grab; }
.site-item.dragging { opacity: .35; cursor: grabbing; }
.site-item.drop-before::before,
.site-item.drop-after::before {
  content: ''; position: absolute; top: 4px; bottom: 4px; width: 3px; border-radius: 3px;
  background: var(--primary); box-shadow: 0 0 8px var(--primary);
}
.site-item.drop-before::before { left: -7px; }
.site-item.drop-after::before { right: -7px; }
.site-item.drop-before { background: var(--primary-tint); }
.site-item.drop-after { background: var(--primary-tint); }
.site-grid.drag-over { outline: 1px dashed var(--primary); outline-offset: 4px; border-radius: var(--radius); }
.site-item .grip {
  position: absolute; top: 5px; left: 6px; color: var(--text-faint); opacity: 0;
  transition: opacity .15s var(--ease); pointer-events: none;
}
.site-item:hover .grip { opacity: 1; }

/* ============================================================
   16. 主题选择
   ============================================================ */
/* 5 套皮肤固定一排放得下，避免出现「4 + 1」的孤行 */
.theme-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.theme-card {
  position: relative; border: 2px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; background: #fff;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), transform .16s var(--ease);
}
.theme-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.theme-card.on { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.theme-card .th-preview { height: 78px; display: flex; }
.theme-card .th-preview .a { width: 32%; }
.theme-card .th-preview .b { flex: 1; background: var(--body-bg); padding: 11px; display: flex; flex-direction: column; gap: 6px; }
.theme-card .th-preview .b i { display: block; height: 8px; border-radius: 3px; background: #fff; box-shadow: var(--shadow-xs); }
.theme-card .th-preview .b i:nth-child(2) { width: 70%; }
.theme-card .th-preview .b i:nth-child(3) { width: 45%; }
.theme-card .th-info { padding: 11px 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; row-gap: 3px; }
.theme-card .th-info b { font-size: 13.5px; }
.theme-card .th-info small { color: var(--text-muted); font-size: 11.5px; }
.theme-card .th-info .on-tag {
  margin-left: auto; font-size: 11px; color: #fff; font-weight: 700;
  background: var(--primary); border-radius: 999px; padding: 2px 9px;
}

/* ============================================================
   17. 弹窗 / 提示
   ============================================================ */
.modal {
  display: none; position: fixed; inset: 0; z-index: 120;
  align-items: center; justify-content: center; padding: 22px;
  background: rgba(14, 22, 34, .5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal.show { display: flex; animation: fadeIn .16s var(--ease); }
.modal-card {
  background: #fff; border-radius: var(--radius-lg); width: 740px; max-width: 100%;
  max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg); animation: pop .18s var(--ease);
  overflow: hidden;
}
.modal-card.sm { width: 430px; }
.modal-card.lg { width: 940px; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }

.modal-hd {
  padding: 15px 18px; display: flex; align-items: center; font-weight: 700; font-size: 15px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fff, var(--surface-2));
}
.modal-hd span { flex: 1; }
.modal-bd { padding: 18px; overflow-y: auto; }
.modal-ft {
  padding: 13px 18px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2);
}

.toast-wrap {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 300;
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  background: #1F2937; color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13px; box-shadow: 0 10px 26px -8px rgba(0, 0, 0, .4);
  animation: toastIn .2s var(--ease); max-width: 86vw;
  display: inline-flex; align-items: center; gap: 8px;
}
.toast.err { background: linear-gradient(180deg, #C24A4A, var(--danger)); }
.toast.ok { background: linear-gradient(180deg, #3A8D57, var(--success)); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.97); } to { opacity: 1; transform: none; } }

.tipbar {
  background: linear-gradient(180deg, #FFFDF8, var(--warning-soft));
  border: 1px solid #F0DDBB; color: #7A4E0C; border-radius: var(--radius);
  padding: 11px 15px; margin-bottom: 14px; display: flex; align-items: center;
  gap: 10px; font-size: 13px; flex-wrap: wrap;
}
.tipbar .btns { margin-left: auto; display: flex; gap: 8px; }

.notice {
  background: var(--info-soft); border: 1px solid #CFE2F8; color: #1F5FA8;
  border-radius: var(--radius-sm); padding: 10px 13px; font-size: 12.5px;
  margin-bottom: 14px; line-height: 1.65;
}
.notice.warn { background: var(--warning-soft); border-color: #F0DDBB; color: #7A4E0C; }
.notice.danger { background: var(--danger-soft); border-color: #F2CFCF; color: var(--danger); }

/* 手机传文件：倒计时徽标 + 链接展示框 */
.countdown { display: inline-flex; align-items: center; gap: 5px; background: var(--warning-soft); color: #7A4E0C; border-radius: 20px; padding: 3px 11px; font-size: 12px; font-weight: 600; }
.folder-path { word-break: break-all; }

/* 手机传文件：材料页整行入口（比藏在标题右侧的小按钮显眼得多） */
.mob-entry {
  display: flex; align-items: center; gap: 13px; cursor: pointer;
  padding: 13px 16px; margin-bottom: 14px;
  border: 1px solid #CFE0F2; border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #F6FAFF 0%, #EDF5FD 100%);
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.mob-entry:hover { border-color: var(--primary); box-shadow: 0 2px 10px rgba(24, 95, 165, .12); }
.mob-entry:active { transform: scale(.997); }
.mob-entry .me-ic {
  width: 42px; height: 42px; flex: none; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 21px;
  background: #fff; border: 1px solid #CFE0F2;
}
.mob-entry .me-t { flex: 1; min-width: 0; }
.mob-entry .me-t b { display: block; font-size: 13.8px; color: var(--primary-dark); margin-bottom: 1px; }
.mob-entry .me-t span { display: block; font-size: 12.2px; color: var(--text-muted); line-height: 1.5; }
.mob-entry .me-go {
  flex: none; font-size: 12.4px; font-weight: 600; color: var(--primary);
  padding: 5px 12px; border-radius: 999px; background: #fff; border: 1px solid #CFE0F2;
}
@media (max-width: 768px) {
  .mob-entry .me-t span { display: none; }
  .mob-entry .me-go { padding: 5px 9px; }
}

/* ============================================================
   数据备份
   ============================================================ */
/* 三种备份方式并排说明：用户最常问「立即生成快照到底算不算备份」 */
.bak-guide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.bak-way {
  background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; box-shadow: var(--shadow);
}
.bak-way .bw-hd { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.bak-way .bw-hd b { font-size: 13.4px; }
.bak-way p { font-size: 12.3px; line-height: 1.65; color: var(--text-muted); }
.bak-way code {
  font-family: var(--font-num); font-size: 11.4px; background: var(--surface-2);
  padding: 1px 4px; border-radius: 4px; color: var(--text);
}
.bak-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.4px; color: var(--text-muted);
  padding: 9px 11px; margin-bottom: 11px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.bak-meta b { font-family: var(--font-num); color: var(--text); font-size: 13px; }
.bak-meta .bak-total { margin-left: auto; font-family: var(--font-num); }
/* 文件名改成中文后（如「数据库备份-20261026-201133.db」），
   原来 max-width:0 + 省略号会把名字截得只剩一半，看不出是哪天的，
   所以改成允许换行、完整显示 */
.bak-tbl .bak-file {
  font-family: var(--font-num); font-size: 11.9px;
  word-break: break-all; line-height: 1.45;
}
.bak-tbl .bak-time { white-space: nowrap; font-family: var(--font-num); }
.bak-tbl .ops-h { width: 182px; }
.bak-tbl .ops { white-space: nowrap; }
/* 列宽只对「数据库快照」那张 5 列表生效。
   以前这三条是 .bak-tbl th:nth-child(n)，会连带把 JSON / 完整备份的
   「文件」列也压成 92px，中文文件名直接挤成三行。 */
.bak-tbl-db th:nth-child(1) { width: 92px; }
.bak-tbl-db th:nth-child(3) { width: 92px; }
.bak-tbl-db th:nth-child(4) { width: 156px; }
.bak-path { margin-top: 10px; word-break: break-all; }

/* 还原确认弹窗：破坏性操作要把后果摊开写清楚，不能只问一句「确定吗」 */
.restore-warn { font-size: 13.5px; line-height: 1.7; }
.rw-title { color: var(--danger); font-weight: 700; font-size: 14.5px; margin-bottom: 8px; }
.rw-sub { color: var(--text-muted); font-size: 12.5px; margin-bottom: 10px; word-break: break-all; }
.rw-tbl { width: 100%; border-collapse: collapse; margin-bottom: 12px; }
.rw-tbl td { padding: 5px 10px; border-bottom: 1px dashed var(--border); }
.rw-tbl td:first-child { color: var(--text-muted); width: 104px; white-space: nowrap; }
.rw-tbl td.num { text-align: right; font-family: var(--font-num); font-weight: 600; }
.rw-note {
  background: var(--warning-soft); border: 1px solid #F0DCB0; border-radius: 8px;
  padding: 10px 12px; font-size: 12.5px; color: #7A4E0C; line-height: 1.75;
}

/* 完整备份：保存位置选择框 */
.bak-dirbox {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: 12px 14px; margin-bottom: 14px;
}
.bak-dirbox .bd-label { display: flex; flex-direction: column; gap: 2px; margin-bottom: 9px; }
.bak-dirbox .bd-label b { font-size: 13px; }
.bak-dirbox .bd-row { display: flex; align-items: center; gap: 8px; }
.bak-dirbox .bd-row input {
  flex: 1; min-width: 0; height: 32px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card-bg); color: var(--text); font-family: var(--font-num); font-size: 12.5px;
}
.bak-dirbox .bd-row input:focus { outline: none; border-color: var(--primary); }
.bak-dirbox .bd-row .btn { flex: none; }
.bak-dirbox #backupDirState { margin-top: 7px; }
@media (max-width: 640px) {
  .bak-dirbox .bd-row { flex-wrap: wrap; }
  .bak-dirbox .bd-row input { flex-basis: 100%; }
}

/* 数据量概览里的四段体积 */
.bak-size-row {
  display: flex; flex-wrap: wrap; gap: 8px 22px;
  margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border);
  font-size: 12.4px; color: var(--text-muted);
}
.bak-size-row b { color: var(--text); font-family: var(--font-num); }
.bak-size-row .hi { margin-left: auto; }
.bak-size-row .hi b { color: var(--primary); }

@media (max-width: 900px) {
  .bak-guide { grid-template-columns: 1fr; }
}

/* ============================================================
   收费财务
   ============================================================ */
.fin-filter { margin-bottom: 14px; }
.fin-filter .card-hd { border-bottom: 0; padding-bottom: 13px; }
.fin-only { margin-left: 2px; white-space: nowrap; color: var(--text-muted); }
.fin-card { margin-bottom: 14px; }
.fin-card:last-of-type { margin-bottom: 14px; }

/* 六个汇总卡：金额比看板长，字号收小一点才不会顶出格子 */
.fin-kpi { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.fin-kpi .kpi { padding: 14px 15px 13px; }
.fin-kpi .kpi .k-value { font-size: 20px; letter-spacing: -.3px; margin-top: 6px; }
.fin-kpi .kpi .k-label { font-size: 12.2px; }
.fin-kpi .kpi .k-sub { font-size: 11px; }

/* 12 个月柱状：纯 CSS，不引图表库。柱子高度按当年最大值换算成百分比 */
.fin-bars { display: flex; align-items: flex-end; gap: 6px; height: 132px; padding-top: 16px; }
.fin-bars .fb {
  flex: 1; min-width: 0; height: 100%; position: relative;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
}
.fin-bars .fb-col {
  width: 74%; max-width: 42px; border-radius: 4px 4px 2px 2px;
  background: linear-gradient(180deg, var(--primary), var(--primary-dark));
  transition: filter .15s var(--ease);
}
.fin-bars .fb:hover .fb-col { filter: brightness(1.12); }
.fin-bars .fb-v {
  font-size: 10px; color: var(--text-faint); font-family: var(--font-num);
  height: 13px; line-height: 13px; white-space: nowrap;
}
.fin-bars .fb-m { font-size: 10.6px; color: var(--text-faint); font-family: var(--font-num); margin-top: 5px; }
.fin-bars .fb.is-zero .fb-col { height: 2px !important; background: var(--border); }

/* 明细表 */
.fin-tbl-wrap { overflow-x: auto; }
/* 940 → 880：1200 宽的笔记本可用宽度约 920，压到 880 正好不用横拖；
   再窄（1100 以下）才在表格内部滚动，整页始终不溢出 */
.fin-tbl { width: 100%; min-width: 880px; table-layout: fixed; font-size: 12.8px; }
table.tbl.fin-tbl th, table.tbl.fin-tbl td { padding: 9px 10px; }
.fin-tbl tbody tr { cursor: pointer; }
.fin-tbl .f-case { width: 24%; }
.fin-tbl .f-client { width: 10%; }
.fin-tbl .f-way { width: 7.5%; }
.fin-tbl .f-money { width: 11%; }
.fin-tbl .f-cnt { width: 5%; }
.fin-tbl .f-date { width: 9.5%; }
.fin-tbl .num { text-align: right; font-family: var(--font-num); white-space: nowrap; }
.fin-tbl td.f-client, .fin-tbl td.f-way { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 明细表的案名列允许折两行：这一列是主要阅读对象，硬截成一行看不全；
   弹窗里的同名类保持单行（那里列宽有限，折行会把表格撑高） */
.fin-tbl .ft-title {
  white-space: normal; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
/* 案件名 + 编号：财务明细表和「收款流水」弹窗共用，所以不做 .fin-tbl 限定 */
.ft-title { font-weight: 600; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ft-sub { display: flex; align-items: center; gap: 6px; margin-top: 3px; min-width: 0; }
.ft-sub .tag { height: 17px; padding: 0 6px; font-size: 10.4px; }
.ft-no { font-family: var(--font-num); font-size: 11.2px; color: var(--text-faint); }
/* 已收下面一条细进度条，扫一眼就知道收到几成 */
.fin-tbl .ft-bar { height: 3px; border-radius: 2px; background: var(--border); margin-top: 5px; overflow: hidden; }
.fin-tbl .ft-bar i { display: block; height: 100%; background: var(--success); border-radius: 2px; }
.fin-tbl .ft-unpaid.is-owing { color: var(--danger); font-weight: 700; }
.fin-tbl .ft-unpaid.is-over { color: var(--success); font-weight: 600; }
.fin-tbl tfoot td {
  background: var(--surface-2); font-weight: 700; border-top: 2px solid var(--border);
  font-family: var(--font-num);
}
.fin-tbl tfoot td:first-child { font-family: var(--font-body, inherit); }

/* 「收款流水」弹窗里的表：案件名长短差异很大，必须 fixed 布局，否则长案名会把
   整张表撑出弹窗（净得列被切掉、还多出一条横向滚动条）。给定宽后案名列走省略号。 */
.pay-tbl { width: 100%; table-layout: fixed; }
.pay-tbl th:nth-child(1) { width: 98px; }
.pay-tbl th:nth-child(3) { width: 106px; }
.pay-tbl th:nth-child(4) { width: 62px; }
.pay-tbl th:nth-child(5) { width: 62px; }
.pay-tbl th:nth-child(6) { width: 90px; }
.pay-tbl th:nth-child(7) { width: 98px; }
.pay-tbl td { white-space: nowrap; }
.pay-tbl td:nth-child(2) { max-width: 0; }

/* 按类型分布：横向条 + 欠款 */
.fin-type {
  display: flex; align-items: center; gap: 12px; padding: 8px 0;
  border-bottom: 1px dashed var(--border); font-size: 12.8px;
}
.fin-type:last-child { border-bottom: 0; }
.fin-type .ft-name { flex: 0 0 64px; color: var(--text); font-weight: 600; }
.fin-type .ft-bar2 { flex: 1; height: 8px; background: var(--body-bg); border-radius: 5px; overflow: hidden; min-width: 40px; }
.fin-type .ft-bar2 i { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.fin-type .ft-num { flex: 0 0 108px; text-align: right; font-family: var(--font-num); font-weight: 700; }
.fin-type .ft-owe { flex: 0 0 100px; text-align: right; font-size: 11.8px; color: var(--text-faint); font-family: var(--font-num); }
.fin-type .ft-owe.is-owing { color: var(--danger); font-weight: 600; }
.fin-type .ft-cnt { flex: 0 0 46px; text-align: right; font-size: 11.6px; color: var(--text-faint); }

@media (max-width: 1500px) {
  .fin-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .fin-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .fin-kpi .kpi .k-value { font-size: 17px; }
  .fin-bars { height: 104px; gap: 3px; }
  .fin-bars .fb-v { display: none; }
  .fin-type .ft-name { flex: 0 0 52px; }
  .fin-type .ft-num { flex: 0 0 84px; }
  .fin-type .ft-owe, .fin-type .ft-cnt { display: none; }
}

/* 右下角提醒 */
.remind-pop {
  display: none; position: fixed; right: 22px; bottom: 22px; width: 340px;
  max-width: calc(100vw - 34px); background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); z-index: 110; overflow: hidden; border: 1px solid var(--border);
}
.remind-pop.show { display: block; animation: pop .2s var(--ease); }
.remind-hd {
  padding: 13px 15px;
  background: linear-gradient(120deg, var(--primary), var(--primary-dark));
  color: #fff; display: flex; align-items: center; font-size: 14px;
}
.remind-hd b { flex: 1; letter-spacing: .3px; }
.remind-hd .icon-btn { color: #fff; }
.remind-hd .icon-btn:hover { background: rgba(255, 255, 255, .16); border-color: transparent; color: #fff; }
.remind-bd { max-height: 312px; overflow-y: auto; padding: 4px 0; }
.remind-item {
  padding: 10px 15px; border-bottom: 1px dashed var(--border); cursor: pointer;
  transition: background .13s var(--ease);
}
.remind-item:hover { background: var(--primary-tint); }
.remind-item:last-child { border-bottom: 0; }
.remind-item .t { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.remind-item .s { font-size: 11.5px; color: var(--text-muted); }
.remind-ft { padding: 9px 14px; border-top: 1px solid var(--border); text-align: right; background: var(--surface-2); }

/* ============================================================
   18. 响应式
   ============================================================ */
.only-mobile { display: none; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fee-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .money-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .theme-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .only-mobile { display: inline-flex; }
  .sidebar {
    transform: translateX(-100%); transition: transform .24s var(--ease);
    width: 252px; flex-basis: 252px;
    box-shadow: 12px 0 40px -16px rgba(4, 18, 36, .6);
  }
  .sidebar.open { transform: none; }
  .sidebar-mask.show { display: block; }
  .main { margin-left: 0; }

  /* 手机端列表行：说明文字（时间·法院）另起一行，否则会把标题挤成一个字 */
  .list-row { flex-wrap: wrap; row-gap: 3px; }
  .list-row .s { flex: 1 1 100%; }
  .topbar { padding: 0 12px; height: 56px; }
  .content { padding: 13px 12px 32px; }
  .page-hd { margin-bottom: 14px; }
  .page-hd h1 { font-size: 17.5px; }
  .page-hd .desc { font-size: 12px; }
  .page-hd .actions { width: 100%; }
  .card-hd { padding: 12px 13px; }
  .card-bd { padding: 13px; }

  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 13px 14px 12px; }
  .kpi .k-value { font-size: 23px; }
  .kpi .k-sub { font-size: 11px; }

  .dual-grid { grid-template-columns: 1fr; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .money-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 5 张金额卡排两列时会剩一张孤零零的半宽卡，让它占满最后一整行 */
  .money-cards > .money-card:last-child:nth-child(odd) { grid-column: span 2; }
  .case-grid { grid-template-columns: 1fr; }
  .search-box input { width: 100%; }

  .toolbar { gap: 6px; }
  .toolbar input, .toolbar select { flex: 1; min-width: 0; }

  /* 统计区间：横向滑动，避免按钮被挤成竖排折行 */
  .range-bar { padding: 9px 11px; gap: 8px; }
  .range-bar .seg {
    display: flex; width: 100%; overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .range-bar .seg::-webkit-scrollbar { display: none; }
  .range-bar .seg button { flex: 0 0 auto; white-space: nowrap; padding: 0 12px; }
  .range-bar #rangeLabel { width: 100%; }

  /* 卡片头里的分段控件同样改为横向滑动 */
  .card-hd .seg { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .card-hd .seg::-webkit-scrollbar { display: none; }
  .card-hd .seg button { flex: 0 0 auto; padding: 0 11px; }

  .detail-hd { padding: 15px 16px 14px; }
  .detail-hd h1 { font-size: 17px; }
  .detail-hd .meta { gap: 6px; }
  .tabs { padding: 5px; }
  .tabs button { padding: 8px 12px; font-size: 13px; }
  .tab-body { padding: 13px; }

  /* 弹窗改为底部拉起 */
  .modal { padding: 0; align-items: flex-end; }
  .modal-card {
    width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0;
    animation: sheetUp .22s var(--ease);
  }
  .modal-card.sm, .modal-card.lg { width: 100%; }
  @keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
  .modal-ft { padding-bottom: max(13px, env(safe-area-inset-bottom)); }

  /* 表格横向滚动，功能不阉割 */
  /* 窄屏下保留足够列宽，超出部分交给 .table-wrap 横向滚动；
     否则提示语一类的长文本列会被压成「竖排一个字」 */
  table.tbl { min-width: 720px; }

  .cal-cell { min-height: 64px; padding: 4px; }
  .cal-ev { font-size: 10.5px; padding: 1px 4px; border-radius: 4px; }
  .cal-cell .d { font-size: 11px; }
  .cal-dow span { font-size: 11px; padding: 8px 0; }

  .site-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
  .site-icon { width: 44px; height: 44px; border-radius: 13px; font-size: 13px; }
  .site-item .flex { opacity: 1; }

  .remind-pop { right: 12px; left: 12px; width: auto; bottom: 12px; }
  .theme-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toast-wrap { top: 12px; }
}

@media (max-width: 520px) {
  .login-card { padding: 28px 22px 22px; border-radius: 18px; }
  .login-logo { width: 54px; height: 54px; border-radius: 16px; }
  .login-card h1 { font-size: 17.5px; }

  .cal-cell { min-height: 56px; padding: 3px; }
  .cal-ev { white-space: nowrap; margin-bottom: 2px; }
  .money-cards { grid-template-columns: 1fr 1fr; }
  .kpi .k-value { font-size: 21px; }
  .kpi .k-label { font-size: 12px; }
  .detail-hd .dh-actions { width: 100%; }
  .detail-hd .dh-actions .btn { flex: 1; }
  .page-hd h1 { font-size: 16.5px; }
  .card-hd h2 { font-size: 14px; }
  .site-grid { grid-template-columns: repeat(3, 1fr); }
  /* 顶栏主题面板：手机上按钮离右边缘不远，右对齐会把面板顶出屏幕左侧，改成整宽下拉 */
  .theme-drop { position: fixed; left: 10px; right: 10px; top: 62px; width: auto; }
}

/* 尊重系统「减少动效」 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   19. 打印
   ============================================================ */
@media print {
  .sidebar, .topbar, .page-hd .actions, .tabs, .toolbar,
  .remind-pop, .toast-wrap, .btn, .sidebar-mask, .only-mobile { display: none !important; }
  body {
    background: #fff !important; background-image: none !important;
    color: #000; font-size: 12pt;
  }
  .main { margin-left: 0; }
  .content { padding: 0; max-width: none; }
  .card, .tab-body, .detail-hd, .case-card {
    box-shadow: none !important; border-color: #bbb !important; break-inside: avoid;
  }
  .detail-hd { background: #fff !important; }
  .detail-hd::after { display: none; }
  .detail-hd .meta > span { background: transparent; border-color: #ddd; }
  table.tbl { min-width: 0; font-size: 10.5pt; }
  table.tbl th, table.tbl td { padding: 6px 8px; border-color: #ccc; }
  table.tbl th { background: #f2f2f2 !important; }
  .tag { border-color: #ccc !important; }
  a { color: #000; text-decoration: none; }
  @page { size: A4; margin: 12mm; }
}

/* =============================================================
 * 案件进展报告（弹窗预览 + 打印导出）
 * 整体按「一页 A4 装得下」设计：段落间距、表格内边距都比正文小一档，
 * 工作记录改成左侧窄栏 + 右侧正文，比原来的卡片式省将近一半高度。
 * ============================================================= */
.report-sheet {
  color: #1a1a1a; font-size: 13px; line-height: 1.6;
  padding: 2px 4px;
}
.rp-head { text-align: center; padding: 2px 0 9px; }
/* 律所名称是抬头第一眼，比正文高一档；但必须小于主标题，层级才不塌 */
.rp-firm { font-size: 16px; font-weight: 700; letter-spacing: 1.2px; color: #333; line-height: 1.35; }
.rp-title { font-size: 14px; font-weight: 800; margin-top: 4px; letter-spacing: 2px; }
.rp-sub { font-size: 11.5px; color: #666; margin-top: 6px; }
.rp-rule { height: 1.5px; background: #1a1a1a; margin-bottom: 2px; }

.rp-sec { margin-top: 14px; }
.rp-sec-title {
  font-size: 13.5px; font-weight: 700; line-height: 1.3;
  padding-left: 8px; border-left: 3px solid #185FA5; margin-bottom: 7px;
}
.rp-muted { color: #999; font-size: 12px; padding: 2px; }

/* 基本信息：一行两组，7 项内容压成 4 行 */
.rp-tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; table-layout: fixed; }
.rp-tbl td { border: 1px solid #ddd; padding: 5px 9px; vertical-align: top; }
.rp-tbl .rp-k { width: 76px; background: #f5f7fa; color: #555; font-weight: 600; white-space: nowrap; }
.rp-tbl .rp-v { color: #1a1a1a; word-break: break-all; }

.rp-timeline { padding-left: 2px; }
.rp-tl-item { display: flex; gap: 9px; padding: 3px 0; position: relative; }
.rp-tl-item::before { content: ''; position: absolute; left: 4px; top: 14px; bottom: -3px; width: 1px; background: #e2e2e2; }
.rp-tl-item:last-child::before { display: none; }
.rp-tl-dot {
  flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: 4px;
  background: #fff; border: 2px solid #ccc; position: relative; z-index: 1;
}
.rp-tl-item.done .rp-tl-dot { background: #2f9e5f; border-color: #2f9e5f; }
.rp-tl-item.pending .rp-tl-dot { background: #185FA5; border-color: #185FA5; }
.rp-tl-body { flex: 1; min-width: 0; }
.rp-tl-line { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rp-tl-name { font-weight: 600; font-size: 12.5px; }
.rp-tl-date { font-size: 11px; color: #999; }
.rp-tl-desc { font-size: 12px; color: #555; margin-top: 1px; }

/* 工作记录：日期+方式在左，正文在右，一条一行分隔线 */
.rp-follows { border-top: 1px solid #e8e8e8; }
.rp-follow { display: flex; gap: 10px; padding: 6px 2px; border-bottom: 1px solid #e8e8e8; }
.rp-follow-meta { flex: none; width: 72px; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.rp-follow-date { font-size: 11px; color: #888; font-family: var(--font-num); }
.rp-follow-body { flex: 1; min-width: 0; }
.rp-follow-content { white-space: pre-wrap; font-size: 12.5px; }
.rp-follow-result { font-size: 11.5px; color: #555; margin-top: 3px; }

.rp-tag {
  display: inline-block; font-size: 10px; padding: 0 6px; line-height: 1.65;
  border-radius: 999px; border: 1px solid #ccc; color: #555;
}
.rp-tag.blue { background: #eaf2fb; border-color: #cfe2f8; color: #1f5fa8; }

.rp-list { margin: 0; padding-left: 18px; font-size: 12.5px; }
.rp-list li { margin-bottom: 3px; }

/* 落款：右上是承办律师 + 日期，最底下一行是律所名称 / 地址 / 电话 */
.rp-foot { margin-top: 20px; }
.rp-sign {
  display: flex; justify-content: flex-end; align-items: baseline; gap: 26px;
  font-size: 12.5px; padding-right: 4px;
}
.rp-sign-lawyer { font-weight: 600; }
.rp-sign-date { color: #666; font-family: var(--font-num); }
.rp-foot-contact {
  margin-top: 12px; padding-top: 7px; border-top: 1px solid #ddd;
  font-size: 11.5px; color: #555; letter-spacing: .3px;
}

/* 打印容器：默认隐藏，打印时唯一显示 */
.print-holder { display: none; }
@media print {
  /* margin:0 是刻意为之：浏览器只在页边距区域里画「页眉页脚」，
     边距归零后那个左下角的网址就没了，改由容器自己的 padding 控制留白。 */
  @page { size: A4; margin: 0; }
  body > *:not(.print-holder) { display: none !important; }
  .print-holder {
    display: block !important; position: static;
    color: #000; font-size: 12pt; margin: 0;
    padding: 13mm 13mm 11mm !important;
  }
  .print-holder .report-sheet { padding: 0; }
  .print-holder .rp-sec { break-inside: avoid; }
  .print-holder .rp-tbl td { border-color: #bbb; }
  .print-holder .rp-follow { break-inside: avoid; }
  .print-holder .rp-tl-item { break-inside: avoid; }
}

/* ============================================================
   AI 助手（v3.9.0）
   · 双栏：左选案件与材料，右对话；窄屏改单列
   · 所有颜色走主题变量，5 套皮肤自动适配
   ============================================================ */
.ai-wrap {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  gap: 14px;
  height: calc(100vh - 172px);
  min-height: 520px;
  align-items: stretch;
}

/* ---------- 左栏 ---------- */
.ai-side {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.ai-sec { display: flex; flex-direction: column; min-height: 0; padding: 13px 13px 10px; }
/* 案件区最多占左栏 46%，剩下的留给材料区；不用 max-height:38% 是因为它相对
   父级高度不固定时会退化成 none，案件多的时候把材料区整个挤到屏幕外。
   ⚠ 必须用 .ai-sec-case 而不是 :first-child —— 手机折叠条 .ai-side-fold 在桌面
   虽然 display:none，但仍是 .ai-side 的第一个子元素，:first-child 永远不命中。 */
.ai-sec-case { flex: 0 1 auto; max-height: 46%; }
.ai-sec-mat { border-top: 1px solid var(--border); flex: 1 1 auto; min-height: 132px; }
.ai-sec-hd {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 700; color: var(--text-muted);
  letter-spacing: .3px; margin-bottom: 9px;
}
.ai-count { font-weight: 400; color: var(--text-faint); font-size: 11.5px; }
.ai-mat-case {
  font-style: normal; font-weight: 400; color: var(--text-faint);
  font-size: 11.5px; margin-left: 2px;
  display: inline-block; max-width: 150px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom;
}
.ai-mat-ops { display: flex; gap: 8px; }
.ai-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--primary); font-size: 11.5px; font-family: inherit;
}
.ai-link:hover { text-decoration: underline; }

.ai-search {
  width: 100%; height: 32px; padding: 0 10px; margin-bottom: 9px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); font-size: 12.5px; font-family: inherit;
}
.ai-search:focus { outline: none; border-color: var(--primary); background: var(--card-bg); }

.ai-cases { overflow-y: auto; flex: 1 1 auto; min-height: 54px; display: flex; flex-direction: column; gap: 4px; }
/* 还没选案件时，案件列表吃满整栏 —— 否则下面一大片空白，看着像加载失败 */
.ai-side.only-cases .ai-sec-case { flex: 1 1 auto; max-height: none; }

/* 折叠条：只在窄屏出现 */
.ai-side-fold { display: none; }
.ai-case {
  text-align: left; width: 100%; cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 7px 9px; font-family: inherit; color: var(--text);
  display: flex; flex-direction: column; gap: 2px;
}
.ai-case:hover { background: var(--primary-tint); }
.ai-case.on { background: var(--primary-soft); border-color: var(--primary); }
.ai-case-t { font-size: 12.8px; font-weight: 600; line-height: 1.35; }
.ai-case.on .ai-case-t { color: var(--primary-dark); }
.ai-case-m { font-size: 11px; color: var(--text-faint); }
.ai-demo {
  font-style: normal; font-size: 10px; padding: 0 4px; border-radius: 3px;
  background: var(--warning-soft); color: var(--warning);
}

.ai-mats { overflow-y: auto; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.ai-mat {
  display: flex; align-items: center; gap: 6px; padding: 5px 6px;
  border-radius: var(--radius-xs); cursor: pointer; font-size: 12px;
}
.ai-mat:hover { background: var(--surface-2); }
.ai-mat.on { background: var(--primary-soft); }
.ai-mat.bad { opacity: .55; cursor: not-allowed; }
.ai-mat input { margin: 0; flex: 0 0 auto; accent-color: var(--primary); }
.ai-mat-k {
  flex: 0 0 auto; width: 17px; height: 17px; border-radius: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
}
.k-text { background: var(--primary); }
.k-img { background: var(--accent); }
.k-bad { background: var(--text-faint); }
.ai-mat-n {
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; color: var(--text);
}
.ai-mat-s { flex: 0 0 auto; font-size: 10.5px; color: var(--text-faint); }
.ai-eye {
  flex: 0 0 auto; border: 0; background: none; cursor: pointer;
  color: var(--text-faint); font-size: 13px; line-height: 1; padding: 0 2px;
}
.ai-eye:hover { color: var(--primary); }

/* ---------- 右栏 ---------- */
.ai-main {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}

.ai-skills {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.ai-skill {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  height: 29px; padding: 0 11px; border-radius: 15px; font-family: inherit;
  border: 1px solid var(--border-strong); background: var(--card-bg);
  color: var(--text-muted); font-size: 12.5px;
}
.ai-skill:hover { border-color: var(--primary); color: var(--primary); }
.ai-skill.on {
  background: var(--primary); border-color: var(--primary); color: #fff;
  box-shadow: 0 2px 8px var(--glow);
}
.ai-skill-gap { flex: 1; }
.ai-badge {
  font-size: 11px; padding: 3px 8px; border-radius: 10px;
  background: var(--surface-2); color: var(--text-faint); border: 1px solid var(--border);
}
.ai-badge.on { background: var(--success-soft); color: var(--success); border-color: transparent; }

/* 技能管理（设置页卡片墙）与技能选择弹窗 */
.ai-sk-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
}
.ai-skcard {
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--card-bg); padding: 12px 13px;
  display: flex; flex-direction: column; gap: 6px;
}
.ai-skcard.off { opacity: .55; }
.ai-skcard-hd { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ai-skcard-hd b { font-size: 13.5px; font-weight: 600; color: var(--text); }
.ai-skcard-m { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; flex: 1; }
.ai-skcard-ops { display: flex; align-items: center; gap: 13px; flex-wrap: wrap; margin-top: 2px; }
.ai-sk-cat {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--text);
  margin: 16px 0 8px;
}
.ai-sk-cat:first-of-type { margin-top: 0; }
.ai-sk-cat span {
  font-size: 11px; font-weight: 400; color: var(--text-faint);
  background: var(--surface-2); border-radius: 9px; padding: 1px 7px;
}
.ai-sk-body {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, monospace);
  font-size: 12px; line-height: 1.75; white-space: pre-wrap; word-break: break-word;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px; max-height: 320px; overflow: auto; margin: 0; color: var(--text);
}
.ai-sk-prev { margin-top: 14px; border-top: 1px dashed var(--border); padding-top: 12px; }
.ai-sk-prev-hd { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.ai-sk-prev-row { display: flex; gap: 8px; font-size: 12.5px; color: var(--text-muted); margin-bottom: 5px; }
.ai-sk-prev-row b { flex: 0 0 auto; min-width: 42px; font-weight: 500; color: var(--text); }
.ai-sk-warn {
  font-size: 12.5px; line-height: 1.7; color: var(--warning);
  background: var(--warning-soft, #fdf3e0);
  border-radius: 8px; padding: 10px 12px; margin: 8px 0;
}
.ai-skill-more { border-style: dashed; }
.ai-sk-picklist { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(206px, 1fr)); }
.ai-sk-pick {
  display: flex; flex-direction: column; gap: 3px;
  text-align: left; cursor: pointer; font-family: inherit;
  border: 1px solid var(--border); background: var(--card-bg);
  border-radius: 9px; padding: 10px 12px;
}
.ai-sk-pick:hover { border-color: var(--primary); }
.ai-sk-pick.on { border-color: var(--primary); background: var(--primary-soft); }
.ai-sk-pick b { font-size: 13px; font-weight: 600; color: var(--text); }
.ai-sk-pick span { font-size: 12px; line-height: 1.5; color: var(--text-muted); }

/* 消息区 */
.ai-msgs { flex: 1; overflow-y: auto; padding: 16px 16px 8px; min-height: 0; }
.ai-empty { max-width: 560px; margin: 8vh auto 0; text-align: center; }
.ai-empty-t { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.ai-empty-d { font-size: 13px; color: var(--text-muted); line-height: 1.85; }
.ai-empty-d p { margin: 0 0 14px; }
.ai-empty-ex { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-top: 4px; }
.ai-empty-ex button {
  cursor: pointer; font-family: inherit; font-size: 12.5px;
  padding: 7px 12px; border-radius: 16px;
  border: 1px solid var(--border-strong); background: var(--card-bg); color: var(--text-muted);
}
.ai-empty-ex button:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-tint); }

.ai-msg { margin-bottom: 16px; display: flex; flex-direction: column; }
.ai-msg.u { align-items: flex-end; }
.ai-msg.a { align-items: flex-start; }
.ai-bubble {
  max-width: 88%; padding: 10px 13px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.78; word-break: break-word;
}
.ai-msg.u .ai-bubble {
  background: var(--primary); color: #fff; border-bottom-right-radius: 4px;
  max-width: 78%;
}
.ai-msg.a .ai-bubble {
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-bottom-left-radius: 4px;
  max-width: 96%; width: auto;
}
.ai-bubble.md p { margin: 0 0 9px; }
.ai-bubble.md p:last-child { margin-bottom: 0; }
.ai-h3 { font-size: 14.5px; font-weight: 700; margin: 12px 0 7px; color: var(--text); }
.ai-h4 { font-size: 13.5px; font-weight: 700; margin: 10px 0 6px; color: var(--text); }
.ai-h3:first-child, .ai-h4:first-child { margin-top: 0; }
.ai-li { padding-left: 4px; margin: 3px 0; }
.ai-law { color: var(--primary-dark); font-weight: 600; }
.ai-code {
  background: var(--body-bg); border: 1px solid var(--border); border-radius: var(--radius-xs);
  padding: 9px 11px; font-size: 12px; overflow-x: auto; margin: 8px 0;
  font-family: ui-monospace, Consolas, monospace; white-space: pre-wrap;
}
.ai-bubble.md code {
  background: var(--primary-tint); padding: 1px 4px; border-radius: 3px;
  font-family: ui-monospace, Consolas, monospace; font-size: 12.5px;
}
.ai-msg-op { margin-top: 4px; }

.ai-tools { display: flex; flex-direction: column; gap: 4px; margin-bottom: 7px; }
.ai-tool {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--text-muted);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; padding: 4px 10px; width: fit-content; max-width: 100%;
}
.ai-tool.ok { background: var(--success-soft); border-color: transparent; color: var(--success); }
.ai-tool.err { background: var(--warning-soft); border-color: transparent; color: var(--warning); }
.ai-tool-i { font-weight: 700; }
.ai-tool-d { color: var(--text-faint); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-tool.ok .ai-tool-d, .ai-tool.err .ai-tool-d { color: inherit; opacity: .8; }

.ai-typing { display: inline-flex; gap: 3px; align-items: center; height: 18px; }
.ai-typing i {
  width: 5px; height: 5px; border-radius: 50%; background: var(--text-faint);
  animation: aiDot 1.1s infinite ease-in-out;
}
.ai-typing i:nth-child(2) { animation-delay: .15s; }
.ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes aiDot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* 已引用材料条 */
.ai-refs {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 14px; border-top: 1px solid var(--border); background: var(--surface-2);
}
.ai-refs-l { font-size: 11.5px; color: var(--text-faint); }
.ai-ref {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; padding: 3px 5px 3px 9px; border-radius: 11px;
  background: var(--primary-soft); color: var(--primary-dark);
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-ref button {
  border: 0; background: none; cursor: pointer; color: var(--primary);
  font-size: 11px; padding: 0 2px; line-height: 1;
}
.ai-ref button:hover { color: var(--danger); }

/* 输入区 */
.ai-compose { border-top: 1px solid var(--border); padding: 11px 14px 12px; }
.ai-compose textarea {
  width: 100%; resize: none; font-family: inherit; font-size: 13.5px; line-height: 1.6;
  padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--card-bg); color: var(--text); min-height: 44px; max-height: 200px;
}
.ai-compose textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--glow); }
.ai-compose-bar { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.ai-hint { flex: 1; font-size: 11.5px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-warn { color: var(--warning); }
.ai-dim { color: var(--text-faint); font-size: 11.5px; }

/* 预览弹窗 */
.ai-pv-meta { font-size: 12px; color: var(--text-faint); margin-bottom: 8px; }
.ai-pv-note { font-size: 13px; color: var(--text-muted); line-height: 1.8; }
.ai-pv {
  max-height: 56vh; overflow: auto; white-space: pre-wrap; word-break: break-word;
  font-size: 12.5px; line-height: 1.75; margin: 0; padding: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: inherit; color: var(--text);
}

/* ---------- 设置页：已配置的模型卡片 ---------- */
.ai-models { display: flex; flex-direction: column; gap: 8px; }
.ai-mcard {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); padding: 10px 12px;
}
.ai-mcard-hd { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 13.5px; }
.ai-mcard-hd b { font-weight: 650; }
.ai-mtag {
  font-size: 10.5px; padding: 1px 7px; border-radius: 9px;
  background: var(--card-bg); border: 1px solid var(--border); color: var(--text-faint);
}
.ai-mtag.on { background: var(--primary-soft); border-color: transparent; color: var(--primary-dark); }
.ai-mtag.bad { background: var(--warning-soft); border-color: transparent; color: var(--warning); }
.ai-mcard-m { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; word-break: break-all; }
.ai-mcard-ops {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 7px; padding-top: 7px; border-top: 1px dashed var(--border);
}
.ai-link.danger { color: var(--danger); }
.ai-test-out { font-size: 12px; }

/* ---------- 输入区工具条（上传 / 模型选择） ---------- */
.ai-bar-l { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; }
.ai-bar-r { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.ai-icon-btn {
  width: 30px; height: 30px; flex: 0 0 auto; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--card-bg); color: var(--text-muted); cursor: pointer;
}
.ai-icon-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.ai-icon-btn:active { transform: translateY(1px); }
/* 强制查库开关：跟图标按钮同高，但带文字，所以用 padding 而不是固定宽度。
   勾上时整颗变主色（不止小方块勾），扫一眼就知道这次会查库 */
.ai-toggle {
  display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto;
  height: 30px; padding: 0 9px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--card-bg); color: var(--text-muted);
  font-family: inherit; font-size: 12px; line-height: 1; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.ai-toggle:hover { border-color: var(--primary); color: var(--primary); }
.ai-toggle-box {
  width: 13px; height: 13px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); border-radius: 3px;
  background: #fff; font-size: 10px; line-height: 1; color: #fff;
}
.ai-toggle.on {
  border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 500;
}
.ai-toggle.on .ai-toggle-box { background: var(--primary); border-color: var(--primary); }
.ai-toggle.off { opacity: .5; }
/* 模型下拉：右下角，随时切换。appearance:none 后用伪元素画小三角，
   否则各浏览器原生箭头大小不一，跟按钮排在一起很突兀 */
.ai-model-wrap { position: relative; display: inline-flex; align-items: center; }
.ai-model-wrap::after {
  content: ''; position: absolute; right: 9px; top: 50%; margin-top: -2px;
  border: 4px solid transparent; border-top-color: var(--text-faint);
  pointer-events: none;
}
.ai-model-sel {
  appearance: none; -webkit-appearance: none;
  max-width: 190px; padding: 5px 24px 5px 9px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--card-bg); color: var(--text);
  font-family: inherit; font-size: 12px; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis;
}
.ai-model-sel:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--glow); }
.ai-model-sel:disabled { color: var(--text-faint); cursor: not-allowed; }
.ai-model-wrap.bad .ai-model-sel { border-color: var(--warning); color: var(--warning); }

/* 材料区顶部一行：勾了几份 */
.ai-mats-hint { font-size: 11.5px; color: var(--text-faint); padding: 0 0 7px; line-height: 1.5; }
.ai-mats-hint b { color: var(--primary); font-weight: 700; }

/* 聊天附件条（输入框上方） */
.ai-attach {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 8px 14px; border-top: 1px solid var(--border); background: var(--surface-2);
}
.ai-ref-file { background: var(--card-bg); border: 1px solid var(--border); color: var(--text-muted); }
.ai-ref-i { font-style: normal; font-size: 9.5px; font-weight: 700; color: var(--text-faint); letter-spacing: .3px; }

/* 用户气泡下面挂的「带了哪些材料」 */
.ai-msg-atts { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; margin-top: 5px; }
.ai-msg-att {
  font-size: 11px; color: var(--text-faint);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 9px; padding: 2px 8px;
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-msg-op { display: flex; align-items: center; gap: 10px; }
.ai-msg-model { font-size: 10.5px; color: var(--text-faint); }

/* 历史对话列表 */
.ai-conv-list { display: flex; flex-direction: column; gap: 6px; max-height: 62vh; overflow: auto; }
.ai-conv-item {
  display: flex; align-items: stretch; gap: 4px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--card-bg); overflow: hidden;
}
.ai-conv-item.on { border-color: var(--primary); background: var(--primary-soft); }
.ai-conv-main {
  flex: 1 1 auto; min-width: 0; text-align: left; border: 0; background: none;
  padding: 9px 11px; cursor: pointer; display: flex; flex-direction: column; gap: 3px;
  font-family: inherit;
}
.ai-conv-t {
  font-size: 13px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ai-conv-m { font-size: 11px; color: var(--text-faint); }
.ai-conv-del {
  flex: 0 0 auto; border: 0; background: none; cursor: pointer;
  color: var(--text-faint); font-size: 12px; padding: 0 11px;
}
.ai-conv-del:hover { color: var(--danger); }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .ai-wrap { grid-template-columns: 250px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .ai-wrap {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }
  .ai-side { max-height: none; }
  .ai-side-fold {
    display: flex; align-items: center; justify-content: space-between;
    padding: 11px 13px; cursor: pointer;
    font-size: 13px; font-weight: 600; color: var(--text);
  }
  .ai-fold-i { color: var(--text-faint); font-size: 12px; }
  .ai-side.folded .ai-sec { display: none; }
  .ai-sec-case { max-height: 236px; }
  .ai-mats { max-height: 216px; }
  .ai-main { height: calc(100vh - 258px); min-height: 360px; }
  /* 窄屏：模型下拉收窄，否则「上传 + 提示 + 模型 + 发送」一行放不下会换行 */
  .ai-model-sel { max-width: 122px; font-size: 11.5px; padding-right: 20px; }
  .ai-compose-bar { gap: 6px; }
  .ai-icon-btn { width: 28px; height: 28px; }
  /* 窄屏工具条已经很挤：两个上传图标 + 强制查库 + 模型下拉 + 发送。
     开关压到 28px 高、字缩小，提示文字靠 ellipsis 让位，宁可截断也不能换行撑高输入区 */
  .ai-toggle { height: 28px; padding: 0 7px; font-size: 11.5px; gap: 4px; }
  .ai-toggle-box { width: 12px; height: 12px; font-size: 9px; }
  /* 窄屏直接不显示这行：横排挤到最后只剩「MS-2…」没信息量，
     案件名在顶部折叠条上已经有了，省下的宽度留给模型下拉 */
  .ai-hint { display: none; }
  .ai-msg.u .ai-bubble { max-width: 90%; }
  .ai-msg.a .ai-bubble { max-width: 100%; }
  .ai-skills { gap: 5px; padding: 9px 11px; overflow-x: auto; flex-wrap: nowrap; }
  .ai-skill { flex: 0 0 auto; height: 27px; font-size: 12px; padding: 0 9px; }
  .ai-skill-gap, .ai-badge { display: none; }
  .ai-msgs { padding: 12px 11px 6px; }
  .ai-compose { padding: 9px 11px 10px; }
}
