/* ============================================================
   讼策 · 自助诉讼管理系统
   设计语言：卷宗纸张 + 朱红印记 + 宋体标题 + 等宽数字
   ============================================================ */

:root {
  --paper: #f6f2e9;
  --paper-2: #fffdf7;
  --paper-3: #efe9dc;
  --ink: #1e1b16;
  --ink-2: #45403a;
  --ink-3: #7d766a;
  --ink-4: #a39c8e;
  --line: #e2dac9;
  --line-2: #d3c8b2;
  --seal: #a5302a;
  --seal-deep: #7d211d;
  --seal-soft: #f6e7e3;
  --jade: #2f6b52;
  --jade-soft: #e5efe8;
  --amber: #9a6b15;
  --amber-soft: #f7ecd6;
  --blue: #2a4d78;
  --blue-soft: #e6ecf4;
  --violet: #5a4479;
  --violet-soft: #ece7f3;
  --teal: #1f6a6a;
  --teal-soft: #e2eeec;
  --gray-soft: #ece7dd;

  --radius: 4px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(58, 46, 28, 0.06);
  --shadow: 0 2px 10px rgba(58, 46, 28, 0.08), 0 1px 2px rgba(58, 46, 28, 0.06);
  --shadow-lg: 0 18px 48px rgba(42, 33, 20, 0.18), 0 2px 8px rgba(42, 33, 20, 0.08);

  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --rail-w: 244px;
  --page-max: 1180px;
  --tone-blue-bg: var(--blue-soft); --tone-blue-fg: var(--blue);
  --tone-violet-bg: var(--violet-soft); --tone-violet-fg: var(--violet);
  --tone-amber-bg: var(--amber-soft); --tone-amber-fg: var(--amber);
  --tone-teal-bg: var(--teal-soft); --tone-teal-fg: var(--teal);
  --tone-green-bg: var(--jade-soft); --tone-green-fg: var(--jade);
  --tone-red-bg: var(--seal-soft); --tone-red-fg: var(--seal);
  --tone-seal-bg: var(--seal-soft); --tone-seal-fg: var(--seal);
  --tone-gray-bg: var(--gray-soft); --tone-gray-fg: var(--ink-3);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(255, 253, 247, 0.9), transparent 60%),
    repeating-linear-gradient(0deg, rgba(126, 106, 74, 0.028) 0 1px, transparent 1px 3px);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--serif); font-weight: 600; letter-spacing: 0.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: rgba(165, 48, 42, 0.16); }

.boot {
  position: fixed; inset: 0; display: grid; place-content: center; justify-items: center;
  gap: 14px; z-index: 50;
}
.boot__seal {
  width: 58px; height: 58px; display: grid; place-items: center;
  background: var(--seal); color: #fdf8ee; font-family: var(--serif);
  font-size: 30px; border-radius: 6px; box-shadow: var(--shadow);
  animation: sealIn 0.5s ease both;
}
.boot__text { color: var(--ink-3); font-size: 13px; letter-spacing: 0.18em; }
@keyframes sealIn { from { opacity: 0; transform: scale(0.86) rotate(-6deg); } to { opacity: 1; transform: none; } }

/* ---------------- 布局骨架 ---------------- */
.app { position: relative; z-index: 1; min-height: 100%; }
.shell { display: flex; min-height: 100vh; }

.rail {
  width: var(--rail-w); flex: 0 0 var(--rail-w);
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.92), rgba(246, 242, 233, 0.72));
  padding: 22px 16px 18px;
  display: flex; flex-direction: column; gap: 22px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 4px; }
.brand__seal {
  width: 38px; height: 38px; flex: 0 0 38px; border-radius: 5px;
  background: var(--seal); color: #fdf8ee; display: grid; place-items: center;
  font-family: var(--serif); font-size: 21px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.brand__name { font-family: var(--serif); font-size: 17px; letter-spacing: 0.06em; line-height: 1.2; }
.brand__sub { font-size: 10.5px; color: var(--ink-4); letter-spacing: 0.16em; margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__label {
  font-size: 10.5px; color: var(--ink-4); letter-spacing: 0.2em; padding: 0 10px 6px;
  text-transform: uppercase;
}
.nav__item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius);
  color: var(--ink-2); font-size: 13.5px; cursor: pointer; border: 1px solid transparent;
  transition: background 0.15s, color 0.15s;
}
.nav__item:hover { background: rgba(255, 253, 247, 0.9); color: var(--ink); }
.nav__item.is-active {
  background: var(--paper-2); color: var(--ink); border-color: var(--line);
  box-shadow: var(--shadow-sm); font-weight: 600;
}
.nav__item.is-active .nav__icon { color: var(--seal); }
.nav__icon { width: 18px; height: 18px; flex: 0 0 18px; color: var(--ink-3); display: grid; place-items: center; }
.nav__badge {
  margin-left: auto; font-size: 10.5px; background: var(--seal-soft); color: var(--seal);
  padding: 1px 6px; border-radius: 10px; font-variant-numeric: tabular-nums;
}

.rail__user {
  margin-top: auto; border-top: 1px solid var(--line); padding-top: 14px;
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--paper-3); color: var(--ink-2); font-family: var(--serif); font-size: 14px;
  border: 1px solid var(--line-2);
}
.rail__meta { min-width: 0; }
.rail__meta strong { display: block; font-size: 13px; font-weight: 600; }
.rail__meta span { font-size: 11px; color: var(--ink-4); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page { width: 100%; max-width: var(--page-max); margin: 0 auto; padding: 30px 34px 72px; }
.page--wide { max-width: 1360px; }

.topbar { display: none; }

/* ---------------- 通用块 ---------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-size: 25px; line-height: 1.25; letter-spacing: 0.02em; }
.page-sub { color: var(--ink-3); font-size: 12.5px; margin-top: 6px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.eyebrow { font-size: 10.5px; letter-spacing: 0.22em; color: var(--ink-4); text-transform: uppercase; }

.card {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
}
.card__title { font-size: 15px; letter-spacing: 0.02em; display: flex; align-items: center; gap: 8px; }
.card__title small { font-family: var(--sans); font-size: 11.5px; color: var(--ink-4); font-weight: 400; letter-spacing: 0; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid--side { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.stack { display: grid; gap: 16px; align-content: start; }
.stack--sm { display: grid; gap: 10px; align-content: start; }
.row { display: flex; align-items: center; gap: 10px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--ink-3); }
.faint { color: var(--ink-4); }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.mono { font-family: var(--mono); font-size: 12px; }
.hr { height: 1px; background: var(--line); border: 0; margin: 14px 0; }
.tr { text-align: right; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 13px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: var(--paper-2); color: var(--ink-2);
  font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.06s;
}
.btn:hover { border-color: var(--ink-4); color: var(--ink); background: #fffefb; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--seal); border-color: var(--seal); color: #fdf8ee; font-weight: 600; }
.btn--primary:hover { background: var(--seal-deep); border-color: var(--seal-deep); color: #fff; }
.btn--ink { background: var(--ink); border-color: var(--ink); color: #fdf8ee; }
.btn--ink:hover { background: #000; border-color: #000; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-3); }
.btn--ghost:hover { background: rgba(0, 0, 0, 0.04); border-color: transparent; color: var(--ink); }
.btn--danger { color: var(--seal); border-color: #e3c6c2; background: var(--seal-soft); }
.btn--danger:hover { background: #f2d9d5; border-color: var(--seal); }
.btn--sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn--xs { height: 24px; padding: 0 8px; font-size: 11.5px; border-radius: 3px; }
.btn--block { width: 100%; }
.btn--icon { width: 34px; padding: 0; }
.btn__icon { width: 15px; height: 15px; display: grid; place-items: center; }

/* ---------------- 标签 / 徽记 ---------------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: 3px; font-size: 11.5px; background: var(--gray-soft); color: var(--ink-3);
  border: 1px solid transparent; white-space: nowrap;
}
.chip--outline { background: transparent; border-color: var(--line-2); color: var(--ink-3); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 2px 7px;
  border-radius: 2px; background: var(--paper-3); color: var(--ink-3); border: 1px solid var(--line);
}
.tone-blue { background: var(--tone-blue-bg); color: var(--tone-blue-fg); }
.tone-violet { background: var(--tone-violet-bg); color: var(--tone-violet-fg); }
.tone-amber { background: var(--tone-amber-bg); color: var(--tone-amber-fg); }
.tone-teal { background: var(--tone-teal-bg); color: var(--tone-teal-fg); }
.tone-green { background: var(--tone-green-bg); color: var(--tone-green-fg); }
.tone-red { background: var(--tone-red-bg); color: var(--tone-red-fg); }
.tone-seal { background: var(--tone-seal-bg); color: var(--tone-seal-fg); }
.tone-gray { background: var(--tone-gray-bg); color: var(--tone-gray-fg); }
.chip.tone-blue, .chip.tone-violet, .chip.tone-amber, .chip.tone-teal,
.chip.tone-green, .chip.tone-red, .chip.tone-seal, .chip.tone-gray { border-color: transparent; }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 6px; }
.seal-badge {
  font-family: var(--serif); color: var(--seal); border: 1.5px solid var(--seal);
  border-radius: 3px; padding: 0 5px; font-size: 11px; letter-spacing: 0.1em;
  transform: rotate(-2deg); display: inline-block; opacity: 0.85;
}

/* ---------------- KPI / 指标 ---------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper-2); overflow: hidden; }
.kpi { padding: 16px 18px; border-right: 1px solid var(--line); position: relative; }
.kpi:last-child { border-right: 0; }
.kpi__label { font-size: 11.5px; color: var(--ink-3); letter-spacing: 0.04em; }
.kpi__value { font-family: var(--serif); font-size: 30px; line-height: 1.15; margin-top: 6px; letter-spacing: 0.01em; }
.kpi__value small { font-family: var(--sans); font-size: 12px; color: var(--ink-4); margin-left: 4px; }
.kpi__foot { font-size: 11.5px; color: var(--ink-4); margin-top: 4px; }
.kpi--alert .kpi__value { color: var(--seal); }

.ring { position: relative; display: inline-grid; place-items: center; }
.ring__track { stroke: var(--paper-3); }
.ring__value { stroke: var(--seal); transition: stroke-dashoffset 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
.ring--teal .ring__value { stroke: var(--teal); }
.ring--green .ring__value { stroke: var(--jade); }
.ring--amber .ring__value { stroke: var(--amber); }
.ring--red .ring__value { stroke: var(--seal); }
.ring__text { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring__num { font-family: var(--serif); font-variant-numeric: tabular-nums; line-height: 1; }
.ring__cap { font-size: 10px; color: var(--ink-4); letter-spacing: 0.1em; margin-top: 3px; }

.bar { height: 5px; border-radius: 3px; background: var(--paper-3); overflow: hidden; }
.bar__fill { height: 100%; border-radius: 3px; background: var(--seal); transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1); }
.bar--teal .bar__fill { background: var(--teal); }
.bar--green .bar__fill { background: var(--jade); }
.bar--amber .bar__fill { background: var(--amber); }
.bar--red .bar__fill { background: var(--seal); }
.bar--thin { height: 3px; }

/* ---------------- 列表 / 行 ---------------- */
.list { display: flex; flex-direction: column; }
.list__item {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 18px;
  border-bottom: 1px solid var(--line); transition: background 0.14s;
}
.list__item:last-child { border-bottom: 0; }
.list__item--link { cursor: pointer; }
.list__item--link:hover { background: #fffdf6; }
.list__title { font-size: 13.5px; font-weight: 500; line-height: 1.5; }
.list__meta { font-size: 11.5px; color: var(--ink-4); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }

.countdown { display: inline-flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.countdown b { font-family: var(--serif); font-size: 19px; color: var(--seal); line-height: 1; }
.countdown span { font-size: 11px; color: var(--ink-4); }

/* ---------------- 案件卡片 ---------------- */
.case-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.case-card {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 16px 18px 14px; cursor: pointer; position: relative; overflow: hidden;
  transition: box-shadow 0.18s, border-color 0.18s, transform 0.18s;
  display: flex; flex-direction: column; gap: 12px;
}
.case-card:hover { box-shadow: var(--shadow); border-color: var(--line-2); transform: translateY(-1px); }
.case-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--line-2);
}
.case-card[data-risk="high"]::before { background: var(--seal); }
.case-card[data-risk="medium"]::before { background: var(--amber); }
.case-card[data-risk="low"]::before { background: var(--jade); }
.case-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.case-card__title { font-family: var(--serif); font-size: 16px; line-height: 1.4; letter-spacing: 0.01em; }
.case-card__no { font-size: 11px; color: var(--ink-4); margin-top: 4px; font-variant-numeric: tabular-nums; }
.case-card__body { display: flex; gap: 14px; align-items: center; }
.case-card__facts { flex: 1; min-width: 0; display: grid; gap: 6px; font-size: 12px; color: var(--ink-3); }
.case-card__fact { display: flex; gap: 6px; align-items: center; min-width: 0; }
.case-card__fact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-card__foot { display: flex; align-items: center; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 11.5px; color: var(--ink-4); }

/* ---------------- 标签页 ---------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  padding: 10px 13px 11px; font-size: 13px; color: var(--ink-3); cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--seal); font-weight: 600; }
.tab__count { font-size: 10.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; background: var(--paper-2); }
.seg__item { padding: 6px 12px; font-size: 12.5px; color: var(--ink-3); cursor: pointer; border-right: 1px solid var(--line); }
.seg__item:last-child { border-right: 0; }
.seg__item.is-active { background: var(--ink); color: #fdf8ee; }

/* ---------------- 表单 ---------------- */
.field { display: grid; gap: 6px; }
.field__label { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.field__label i { color: var(--seal); font-style: normal; }
.field__hint { font-size: 11px; color: var(--ink-4); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line-2); background: #fffefb; border-radius: var(--radius);
  padding: 8px 11px; font: inherit; font-size: 13px; color: var(--ink); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--ink-4); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--seal); box-shadow: 0 0 0 3px rgba(165, 48, 42, 0.09);
}
.textarea { min-height: 84px; resize: vertical; line-height: 1.7; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .col-2 { grid-column: span 2; }
.form-section { font-family: var(--serif); font-size: 13px; color: var(--ink-2); padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 2px; display: flex; align-items: center; gap: 8px; }
.form-section span { font-family: var(--sans); font-size: 11px; color: var(--ink-4); }

.search { position: relative; display: flex; align-items: center; }
.search .input { padding-left: 32px; }
.search__icon { position: absolute; left: 10px; color: var(--ink-4); display: grid; place-items: center; pointer-events: none; }

/* ---------------- 空态 ---------------- */
.empty { padding: 46px 24px; text-align: center; color: var(--ink-4); }
.empty__mark {
  width: 46px; height: 46px; margin: 0 auto 12px; border: 1px dashed var(--line-2); border-radius: 50%;
  display: grid; place-items: center; color: var(--ink-4); font-family: var(--serif); font-size: 18px;
}
.empty__title { font-family: var(--serif); font-size: 15px; color: var(--ink-2); margin-bottom: 4px; }
.empty__text { font-size: 12px; max-width: 320px; margin: 0 auto; line-height: 1.7; }
.empty__actions { margin-top: 14px; display: flex; justify-content: center; gap: 8px; }

/* ---------------- 弹层 ---------------- */
.overlay {
  position: fixed; inset: 0; background: rgba(32, 25, 15, 0.36); backdrop-filter: blur(2px);
  z-index: 60; display: grid; place-items: center; padding: 24px; animation: fade 0.16s ease both;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 560px; max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: var(--paper-2); border-radius: 10px; box-shadow: var(--shadow-lg); overflow: hidden;
  animation: pop 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.modal--wide { max-width: 860px; }
.modal--full { max-width: 960px; height: calc(100vh - 48px); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal__head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.modal__title { font-family: var(--serif); font-size: 16px; }
.modal__sub { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; }
.modal__body { padding: 20px; overflow: auto; flex: 1; }
.modal__foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: rgba(246, 242, 233, 0.5); }
.modal__close { margin-left: auto; }

.toasts { position: fixed; z-index: 80; left: 50%; bottom: 26px; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast {
  background: var(--ink); color: #fdf8ee; padding: 9px 15px; border-radius: 5px; font-size: 12.5px;
  box-shadow: var(--shadow-lg); animation: toastIn 0.22s ease both; max-width: 84vw;
}
.toast--error { background: var(--seal-deep); }
.toast--ok { background: #244f3d; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------------- 矩阵 ---------------- */
.matrix-wrap { overflow: auto; max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--paper-2); }
.matrix { border-collapse: separate; border-spacing: 0; font-size: 12px; min-width: 100%; }
.matrix th, .matrix td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); }
.matrix thead th {
  position: sticky; top: 0; z-index: 3; background: var(--paper-3); font-weight: 600;
  padding: 8px; vertical-align: bottom; text-align: left; min-width: 150px; max-width: 190px;
  font-size: 11.5px; line-height: 1.45;
}
.matrix thead th:first-child { left: 0; z-index: 4; min-width: 210px; max-width: 260px; }
.matrix tbody th {
  position: sticky; left: 0; z-index: 2; background: var(--paper-2); text-align: left;
  padding: 9px 10px; font-weight: 400; min-width: 210px; max-width: 260px;
}
.matrix tbody tr:last-child th, .matrix tbody tr:last-child td { border-bottom: 0; }
.matrix th:last-child, .matrix td:last-child { border-right: 0; }
.matrix__issue { display: grid; gap: 3px; }
.matrix__issue .tag { justify-self: start; }
.matrix__issue .tag { font-size: 9.5px; padding: 0 4px; }
.matrix__mat { display: grid; gap: 2px; }
.matrix__mat strong { font-size: 12px; font-weight: 500; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.matrix__mat small { color: var(--ink-4); font-size: 10.5px; }
.matrix td.cell { padding: 0; text-align: center; cursor: pointer; }
.matrix td.cell button {
  width: 100%; height: 100%; min-height: 42px; border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center; font-size: 11px; color: var(--ink-4); transition: background 0.12s;
}
.matrix td.cell button:hover { background: rgba(165, 48, 42, 0.06); }
.matrix td.cell[data-s="core"] { background: rgba(47, 107, 82, 0.14); }
.matrix td.cell[data-s="support"] { background: rgba(42, 77, 120, 0.12); }
.matrix td.cell[data-s="rebut"] { background: rgba(154, 107, 21, 0.14); }
.matrix td.cell[data-s] button::after { content: ""; width: 10px; height: 10px; border-radius: 50%; }
.matrix td.cell[data-s="core"] button::after { background: var(--jade); }
.matrix td.cell[data-s="support"] button::after { background: var(--blue); }
.matrix td.cell[data-s="rebut"] button::after { background: var(--amber); }
.matrix td.cell[data-weak="1"] { background-image: linear-gradient(135deg, rgba(165, 48, 42, 0.1) 25%, transparent 25%, transparent 50%, rgba(165, 48, 42, 0.1) 50%, rgba(165, 48, 42, 0.1) 75%, transparent 75%); background-size: 8px 8px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--ink-3); }
.legend__item { display: flex; align-items: center; gap: 6px; }
.legend__swatch { width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.06); }

/* ---------------- 时间线 ---------------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 6px; bottom: 6px; width: 1px; background: var(--line-2); }
.timeline__item { position: relative; padding: 0 0 20px; }
.timeline__item:last-child { padding-bottom: 0; }
.timeline__dot {
  position: absolute; left: -26px; top: 3px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--paper-2); border: 1px solid var(--line-2); display: grid; place-items: center;
  font-size: 9px; color: var(--ink-4); font-variant-numeric: tabular-nums;
}
.timeline__item.is-current .timeline__dot { border-color: var(--seal); color: var(--seal); box-shadow: 0 0 0 3px rgba(165, 48, 42, 0.1); }
.timeline__item.is-done .timeline__dot { background: var(--jade); border-color: var(--jade); color: #fff; }

/* ---------------- 文书阅读 ---------------- */
.doc-reader { background: var(--paper-2); padding: 34px 40px; font-family: var(--serif); font-size: 14.5px; line-height: 2; color: var(--ink); }
.doc-reader h1 { font-size: 21px; text-align: center; letter-spacing: 0.16em; margin: 0 0 22px; font-weight: 600; }
.doc-reader h2 { font-size: 15px; margin: 22px 0 6px; letter-spacing: 0.04em; }
.doc-reader h3 { font-size: 14px; margin: 16px 0 4px; color: var(--ink-2); }
.doc-reader p { margin: 0 0 10px; text-align: justify; }
.doc-reader strong { font-weight: 600; }
.doc-reader blockquote { margin: 0 0 10px; padding: 8px 14px; border-left: 2px solid var(--line-2); background: var(--paper-3); font-size: 13px; color: var(--ink-2); }
.doc-reader ol, .doc-reader ul { margin: 0 0 10px; padding-left: 1.6em; list-style: revert; }
.doc-reader li { margin-bottom: 3px; }
.doc-reader hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.doc-reader .doc-table__wrap { margin: 10px 0 14px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.doc-reader .doc-table { width: 100%; min-width: 420px; border-collapse: collapse; font-family: var(--sans); font-size: 12.5px; line-height: 1.7; }
.doc-reader .doc-table th, .doc-reader .doc-table td { border: 1px solid var(--line-2); padding: 7px 10px; text-align: left; vertical-align: top; }
.doc-reader .doc-table th { background: var(--paper-3); font-weight: 600; white-space: nowrap; color: var(--ink); }
.doc-reader .doc-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--paper-3) 55%, transparent); }
.doc-reader .doc-note { font-family: var(--sans); font-size: 11.5px; color: var(--ink-4); border-top: 1px dashed var(--line-2); padding-top: 10px; margin-top: 18px; line-height: 1.8; }

/* ---------------- 登录 ---------------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.login__brand {
  position: relative; overflow: hidden; padding: 54px 52px; display: flex; flex-direction: column;
  background: linear-gradient(155deg, #251f18 0%, #33291f 46%, #4a2e24 100%); color: #f3ece0;
}
.login__brand::after {
  content: "讼"; position: absolute; right: -40px; bottom: -90px; font-family: var(--serif);
  font-size: 380px; line-height: 1; color: rgba(255, 246, 232, 0.035);
}
.login__brand::before {
  content: ""; position: absolute; inset: 0; opacity: 0.35;
  background: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 46px);
}
.login__mark { display: flex; align-items: center; gap: 12px; position: relative; }
.login__seal {
  width: 44px; height: 44px; border-radius: 6px; background: #a5302a; color: #fdf8ee;
  display: grid; place-items: center; font-family: var(--serif); font-size: 24px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 10px 26px rgba(0, 0, 0, 0.3);
}
.login__name { font-family: var(--serif); font-size: 19px; letter-spacing: 0.14em; }
.login__name small { display: block; font-family: var(--sans); font-size: 10px; letter-spacing: 0.2em; color: rgba(243, 236, 224, 0.5); margin-top: 3px; }
.login__claim { margin-top: auto; position: relative; }
.login__claim h1 { font-size: 34px; line-height: 1.45; letter-spacing: 0.04em; font-weight: 600; }
.login__claim h1 em { font-style: normal; color: #e8b6a4; }
.login__claim p { margin-top: 16px; font-size: 13px; color: rgba(243, 236, 224, 0.62); line-height: 1.9; max-width: 380px; }
.login__points { margin-top: 30px; display: grid; gap: 11px; }
.login__point { display: flex; gap: 10px; font-size: 12.5px; color: rgba(243, 236, 224, 0.78); align-items: flex-start; }
.login__point i {
  font-style: normal; font-family: var(--serif); color: #e8b6a4; font-size: 11px;
  border: 1px solid rgba(232, 182, 164, 0.4); border-radius: 2px; padding: 0 5px; margin-top: 2px;
}
.login__foot { margin-top: 36px; font-size: 11px; color: rgba(243, 236, 224, 0.36); letter-spacing: 0.05em; }
.login__panel { display: flex; align-items: center; justify-content: center; padding: 40px 32px; }
.login__box { width: 100%; max-width: 358px; }
.login__tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.login__tab {
  position: relative; padding: 0 0 9px; border: 0; background: none; cursor: pointer;
  font-family: var(--sans); font-size: 13.5px; letter-spacing: 0.06em; color: var(--ink-4);
  transition: color 0.16s ease;
}
.login__tab:hover { color: var(--ink-2); }
.login__tab.is-active { color: var(--ink); }
.login__tab.is-active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--seal);
}
.code-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.code-row .btn { height: 38px; white-space: nowrap; min-width: 104px; }
.code-row .btn[disabled] { opacity: 1; background: var(--paper-3); border-color: var(--line-2); color: var(--ink-3); }
.code-tip { margin-top: 8px; font-size: 11.5px; }
.login__title { font-size: 23px; letter-spacing: 0.04em; }
.login__desc { font-size: 12.5px; color: var(--ink-3); margin: 8px 0 26px; }
.login__hint {
  margin-top: 18px; padding: 10px 12px; border: 1px dashed var(--line-2); border-radius: var(--radius);
  font-size: 11.5px; color: var(--ink-4); line-height: 1.8; background: rgba(255, 253, 247, 0.6);
}
.login__hint b { color: var(--ink-2); font-weight: 500; }

/* ---------------- 详情键值 ---------------- */
.kv { display: grid; grid-template-columns: 84px 1fr; gap: 8px 12px; font-size: 12.5px; }
.kv dt { color: var(--ink-4); }
.kv dd { margin: 0; color: var(--ink-2); line-height: 1.6; }

.note {
  font-size: 12px; color: var(--ink-2); background: var(--paper-3); border-left: 2px solid var(--line-2);
  padding: 10px 13px; border-radius: 0 var(--radius) var(--radius) 0; line-height: 1.75;
}
.note--warn { background: var(--amber-soft); border-left-color: var(--amber); }
.note--danger { background: var(--seal-soft); border-left-color: var(--seal); }
.note--ok { background: var(--jade-soft); border-left-color: var(--jade); }

.issue-cover { display: flex; align-items: center; gap: 10px; }
.issue-cover .bar { flex: 1; }

.evidence-list { display: grid; gap: 5px; margin-top: 8px; }
.evidence-list li { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-3); }
.evidence-list li b { font-weight: 500; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.checklist { display: grid; gap: 2px; }
.checkline { display: flex; align-items: flex-start; gap: 9px; padding: 5px 0; font-size: 12.5px; cursor: pointer; }
.checkline input { margin: 4px 0 0; accent-color: var(--seal); }
.checkline.is-done span { color: var(--ink-4); text-decoration: line-through; }

.table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.table th { text-align: left; font-weight: 500; color: var(--ink-4); font-size: 11.5px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: rgba(246, 242, 233, 0.6); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }


/* ---------------- 案件头部 ---------------- */
.case-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.case-head__main { min-width: 0; flex: 1 1 320px; }
.case-head__side { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.case-head__grade { font-family: var(--serif); font-size: 14px; white-space: nowrap; }
.case-head__gaps { font-size: 11px; color: var(--ink-4); white-space: nowrap; }
@media (max-width: 860px) {
  .case-head { gap: 12px; margin-bottom: 16px; }
  .case-head__main { flex: 1 1 100%; }
  .case-head__side { width: 100%; justify-content: space-between; gap: 10px; }
  .case-head__side .page-actions { width: auto; flex: 0 0 auto; }
  .case-head__side .page-actions .btn { flex: 0 0 auto; }
}


/* ---------------- AI 辅助面板 ---------------- */
.ai-slot { margin-top: 12px; }
.ai-panel {
  border: 1px solid var(--line);
  border-left: 3px solid var(--teal);
  background: var(--paper-2, #fbf8f2);
  border-radius: 3px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.ai-panel--error { border-left-color: var(--seal); color: var(--seal); font-size: 12px; }
.ai-panel__head {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--serif); font-size: 12.5px; letter-spacing: .04em;
  color: var(--teal); margin-bottom: 8px;
}
.ai-panel__body { font-size: 12.5px; line-height: 1.85; color: var(--ink-2); }
.ai-panel__body p { margin: 0 0 8px; }
.ai-panel__body h1, .ai-panel__body h2, .ai-panel__body h3 {
  font-family: var(--serif); font-size: 13px; margin: 12px 0 6px; color: var(--ink);
}
.ai-panel__body ol, .ai-panel__body ul { margin: 0 0 8px; padding-left: 20px; }
.ai-panel__body li { margin-bottom: 4px; }
.ai-panel__body strong { color: var(--ink); }
@media (max-width: 860px) {
  .ai-panel { padding: 10px 12px; }
  .ai-panel__body { font-size: 12.5px; }
}

/* ---------------- 移动端 ---------------- */
@media (max-width: 1080px) {
  .grid--side { grid-template-columns: minmax(0, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:nth-child(2) { border-right: 0; }
  .kpi:nth-child(1), .kpi:nth-child(2) { border-bottom: 1px solid var(--line); }
  .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .rail { display: none; }
  .shell { flex-direction: column; }
  .topbar {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px; position: sticky; top: 0; z-index: 30;
    background: rgba(246, 242, 233, 0.94); backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--line); min-height: 52px;
  }
  .topbar__title { font-family: var(--serif); font-size: 16px; letter-spacing: 0.03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar__back { border: 0; background: transparent; padding: 4px; display: grid; place-items: center; color: var(--ink-2); }
  .topbar .brand__seal { width: 30px; height: 30px; flex-basis: 30px; font-size: 17px; }
  .page { padding: 18px 14px 96px; }
  .page-head { margin-bottom: 16px; gap: 12px; }
  .page-title { font-size: 21px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
  .case-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .col-2 { grid-column: span 1; }
  .kpi { padding: 13px 14px; }
  .kpi__value { font-size: 25px; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: rgba(255, 253, 247, 0.96); backdrop-filter: blur(12px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar__item {
    flex: 1; display: grid; justify-items: center; gap: 3px; padding: 5px 0;
    font-size: 10.5px; color: var(--ink-4); cursor: pointer; border-radius: 4px;
  }
  .tabbar__item.is-active { color: var(--seal); }
  .tabbar__item.is-active .nav__icon { color: var(--seal); }
  .modal { max-width: 100%; max-height: calc(100vh - 24px); border-radius: 10px; }
  .overlay { padding: 12px; align-items: flex-end; }
  .modal--full { height: calc(100vh - 24px); }
  .doc-reader { padding: 22px 18px; font-size: 14px; }
  .doc-reader .doc-table { min-width: 320px; font-size: 11.5px; }
  .doc-reader .doc-table th, .doc-reader .doc-table td { padding: 6px 7px; }
  .matrix thead th:first-child, .matrix tbody th { min-width: 148px; max-width: 148px; }
  .matrix thead th { min-width: 118px; }
  .login { grid-template-columns: 1fr; }
  .login__brand { display: none; }
  .login__panel { padding: 0 22px; min-height: 100vh; align-items: center; }
  .login__box { max-width: 100%; }
  .toasts { bottom: 84px; }
}

@media (min-width: 861px) {
  .tabbar { display: none; }
}

@media (max-width: 420px) {
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .kpi { border-right: 0; border-bottom: 1px solid var(--line); }
  .kpi:last-child { border-bottom: 0; }
  .kv { grid-template-columns: 76px 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* 打印：隐藏导航，保留文书 */
@media print {
  .rail, .topbar, .tabbar, .page-actions, .tabs, .toasts, .overlay .modal__foot { display: none !important; }
  body { background: #fff; }
  .page { max-width: none; padding: 0; }
  .card { border: 0; box-shadow: none; }
}
