/*
 * 设计变量（U-11，按工作台重做原型第六版）：主色深蓝 #1F4E9A、侧栏 #1C2B3A、原文区底 #F6F5F1、风险三色；
 * 界面字号四档 12 / 13 / 15 / 17，合同原文 16 / 24；圆角三档 4（标签）/ 6（控件）/ 8（容器）。
 * 深色变量组在下面两处（跟随系统、设置页选深色），浅色由 html[data-theme="light"] 固定。
 */
:root {
  color-scheme: light;
  /* 主色与中性色 */
  --color-primary: #1F4E9A;
  --color-primary-hover: #2A5DAE;
  --color-primary-active: #183F7E;
  --color-primary-bg: #E8EFFA;
  --color-primary-border: #A9BFE3;
  --color-on-primary: #FFFFFF;
  --color-link: #1F4E9A;
  --color-text: #1F2937;
  --color-text-2: #4B5563;
  --color-text-3: #6B7280;
  --color-text-disabled: #9CA3AF;
  --color-border: #CBD2DB;          /* 输入框、按钮边框 */
  --color-line: #E5E7EB;            /* 面板、分隔线 */
  --color-split: #EEF0F3;           /* 表格行线、列表分隔 */
  --color-bg: #F2F4F7;              /* 页面底色 */
  --color-surface: #FFFFFF;         /* 面板、卡片、对话框 */
  --color-fill: #F5F6F8;            /* 表头、次级底色、展开的事项 */
  --color-fill-hover: #EEF0F3;
  --color-disabled-bg: #F5F6F8;
  --color-paper-bg: #F6F5F1;        /* 原文区底 */
  --color-paper: #FFFFFF;           /* 纸面 */
  --color-sidebar: #1C2B3A;
  --color-sidebar-ink: #C9D3DF;
  --color-sidebar-ink-strong: #FFFFFF;
  --color-sidebar-active: rgba(255, 255, 255, .1);
  --color-sidebar-line: rgba(255, 255, 255, .08);
  --color-tooltip: #262626;
  /* 语义色（只用于确有状态的地方） */
  --color-danger: #B42318;
  --color-danger-bg: #FEF3F2;
  --color-danger-border: #FECDCA;
  --color-warning: #B54708;
  --color-warning-bg: #FFFAEB;
  --color-warning-border: #FEDF89;
  --color-success: #067647;
  --color-success-bg: #ECFDF3;
  --color-success-border: #ABEFC6;
  /* 风险等级：高 / 中 / 低，只用于事项编号、原文标记 */
  --risk-high: #B42318;
  --risk-mid: #B54708;
  --risk-low: #475467;
  --risk-low-bg: #EEF0F3;
  --on-risk: #FFFFFF;
  /* 原文高亮：半透明黄 */
  --hl: rgba(250, 204, 21, .22);
  --hl-strong: rgba(250, 204, 21, .48);
  --hl-edge: #E7B100;
  /* 定稿对照（U-22）：修改未提示琥珀色、提示未修改灰色（提示已修改用主色） */
  --final-miss: #D97706;
  --final-keep: #9CA3AF;

  /* 字体：界面用系统中文字体，合同原文用宋体 */
  --font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-contract: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --font-mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  --font-size-sm: 12px;
  --font-size-md: 13px;
  --font-size: 15px;
  --font-size-lg: 17px;
  --font-size-xl: 20px;
  --line-height-sm: 20px;
  --line-height: 24px;

  /* 控件规范：按钮两档（32 / 36），输入与下拉统一 32 */
  --control-height: 32px;
  --control-height-lg: 36px;
  --control-height-sm: 28px;
  --control-padding-x: 10px;        /* 输入框、下拉框左右内边距 */
  --button-padding-x: 14px;
  --button-padding-x-compact: 10px; /* .small：只收窄左右内边距 */
  --button-padding-x-lg: 14px;
  --radius-sm: 4px;                 /* 标签 */
  --radius: 6px;                    /* 控件 */
  --radius-lg: 8px;                 /* 容器、对话框、通知 */
  --icon-size: 14px;                /* 按钮内图标 */
  --icon-gap: 6px;                  /* 图标与文字间距 */
  --nav-icon-size: 18px;
  --help-size: 14px;                /* “?”帮助图标 */
  --select-arrow-space: 30px;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --focus-ring: 0 0 0 3px var(--color-primary-bg);
  --shadow-popup: 0 8px 24px rgba(16, 24, 40, .12);

  /* 布局 */
  --sidebar-width: 200px;
  --header-height: 56px;
  --panel-width: 440px;

  font-family: var(--font-family);
  font-size: var(--font-size);
  line-height: var(--line-height);
  color: var(--color-text);
  background: var(--color-bg);
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
/* 深色：跟随系统（设置页没有选浅色时）与设置页选深色两处，变量相同。 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-primary: #6E9EE8; --color-primary-hover: #86AEEC; --color-primary-active: #5A8CDB; --color-primary-bg: #1A2A44; --color-primary-border: #2F4A75; --color-on-primary: #0B1118; --color-link: #8DB4F0;
    --color-text: #E5E7EB; --color-text-2: #C4CAD3; --color-text-3: #9AA4B2; --color-text-disabled: #6B7280;
    --color-border: #344256; --color-line: #263040; --color-split: #1F2834; --color-bg: #0F141A; --color-surface: #141A21; --color-fill: #1A222C; --color-fill-hover: #212B37; --color-disabled-bg: #1A222C;
    --color-paper-bg: #121820; --color-paper: #1A2129;
    --color-sidebar: #0B1118; --color-sidebar-ink: #9AA8B8; --color-sidebar-ink-strong: #F3F4F6; --color-sidebar-active: rgba(255, 255, 255, .08); --color-sidebar-line: rgba(255, 255, 255, .06); --color-tooltip: #2B3440;
    --color-danger: #F97066; --color-danger-bg: #2A1513; --color-danger-border: #5A2522;
    --color-warning: #F7B84B; --color-warning-bg: #2A2112; --color-warning-border: #5A4520;
    --color-success: #6CE9A6; --color-success-bg: #12291D; --color-success-border: #1F4A33;
    --risk-high: #F97066; --risk-mid: #F7B84B; --risk-low: #B0B8C4; --risk-low-bg: #1F2731; --on-risk: #0F141A;
    --hl: rgba(231, 177, 0, .16); --hl-strong: rgba(231, 177, 0, .34); --hl-edge: #E7B100; --final-miss: #F7B84B; --final-keep: #6B7280;
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%239AA4B2' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    --shadow-popup: 0 8px 24px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --color-primary: #6E9EE8; --color-primary-hover: #86AEEC; --color-primary-active: #5A8CDB; --color-primary-bg: #1A2A44; --color-primary-border: #2F4A75; --color-on-primary: #0B1118; --color-link: #8DB4F0;
  --color-text: #E5E7EB; --color-text-2: #C4CAD3; --color-text-3: #9AA4B2; --color-text-disabled: #6B7280;
  --color-border: #344256; --color-line: #263040; --color-split: #1F2834; --color-bg: #0F141A; --color-surface: #141A21; --color-fill: #1A222C; --color-fill-hover: #212B37; --color-disabled-bg: #1A222C;
  --color-paper-bg: #121820; --color-paper: #1A2129;
  --color-sidebar: #0B1118; --color-sidebar-ink: #9AA8B8; --color-sidebar-ink-strong: #F3F4F6; --color-sidebar-active: rgba(255, 255, 255, .08); --color-sidebar-line: rgba(255, 255, 255, .06); --color-tooltip: #2B3440;
  --color-danger: #F97066; --color-danger-bg: #2A1513; --color-danger-border: #5A2522;
  --color-warning: #F7B84B; --color-warning-bg: #2A2112; --color-warning-border: #5A4520;
  --color-success: #6CE9A6; --color-success-bg: #12291D; --color-success-border: #1F4A33;
  --risk-high: #F97066; --risk-mid: #F7B84B; --risk-low: #B0B8C4; --risk-low-bg: #1F2731; --on-risk: #0F141A;
  --hl: rgba(231, 177, 0, .16); --hl-strong: rgba(231, 177, 0, .34); --hl-edge: #E7B100; --final-miss: #F7B84B; --final-keep: #6B7280;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%239AA4B2' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --shadow-popup: 0 8px 24px rgba(0, 0, 0, .5);
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--color-bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button, a, summary { touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
:where(a):hover { color: var(--color-primary-hover); }
svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: var(--font-size-xl); line-height: 28px; font-weight: 600; margin-bottom: 0; }
h2 { font-size: var(--font-size-lg); line-height: 26px; font-weight: 600; margin-bottom: 16px; }
h3 { font-size: var(--font-size); line-height: var(--line-height); font-weight: 600; margin-bottom: 8px; }
h4 { font-size: var(--font-size); line-height: var(--line-height); font-weight: 500; margin-bottom: 4px; }
p { line-height: var(--line-height); margin-bottom: 12px; }
small { font-size: var(--font-size-sm); }
hr { border: 0; border-top: 1px solid var(--color-line); }
.muted { color: var(--color-text-3); }
.nowrap { white-space: nowrap; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.mono { font-family: var(--font-mono); font-size: var(--font-size-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.hidden { display: none !important; }
.tight, .no-margin { margin: 0; }
.full-span { grid-column: 1 / -1; }
.small-note { font-size: var(--font-size-sm); line-height: var(--line-height-sm); color: var(--color-text-3); margin-bottom: 0; }
.loading-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; color: var(--color-text-3); }
.loading-screen p { margin: 0; }
.spinner { display: inline-block; width: 14px; height: 14px; flex: none; border: 2px solid var(--color-border); border-top-color: var(--color-primary); border-radius: 50%; animation: spin .8s linear infinite; }
.spinner.light { border-color: rgba(255, 255, 255, .45); border-top-color: var(--color-on-primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 按钮 ----------
 * 基础规则用 :where() 保持零权重，页签、事项标题等自带布局的按钮可以直接覆盖。
 * 两档高度：32px（默认，表单、工具栏、面板内），36px（页头操作区）。 */
:where(button, .button-link) {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--icon-gap);
  height: var(--control-height); padding: 0 var(--button-padding-x);
  border: 1px solid var(--color-border); border-radius: var(--radius);
  background: var(--color-surface); color: var(--color-text);
  font-size: var(--font-size-md); line-height: var(--line-height); font-weight: 400;
  white-space: nowrap; vertical-align: middle; text-decoration: none; cursor: pointer;
  transition: color .15s, background-color .15s, border-color .15s;
}
:where(button, .button-link):where(:hover:not(:disabled)) { color: var(--color-primary-hover); border-color: var(--color-primary-hover); }
:where(button, .button-link):where(:active:not(:disabled)) { color: var(--color-primary-active); border-color: var(--color-primary-active); }
:where(button, .button-link) svg { width: var(--icon-size); height: var(--icon-size); }
:where(button, .button-link).primary { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
:where(button, .button-link).primary:where(:hover:not(:disabled)) { background: var(--color-primary-hover); border-color: var(--color-primary-hover); color: var(--color-on-primary); }
:where(button, .button-link).primary:where(:active:not(:disabled)) { background: var(--color-primary-active); border-color: var(--color-primary-active); color: var(--color-on-primary); }
:where(button, .button-link).small { padding: 0 var(--button-padding-x-compact); }
:where(button).icon-only { width: var(--control-height); padding: 0; }
:where(button).ghost { border-color: transparent; background: transparent; color: var(--color-text-2); }
:where(button).ghost:where(:hover:not(:disabled)) { border-color: transparent; background: var(--color-fill-hover); color: var(--color-text); }
:where(button).danger { color: var(--color-danger); }
:where(button).ghost.danger:where(:hover:not(:disabled)) { background: var(--color-danger-bg); color: var(--color-danger); }
:where(button).link { height: auto; padding: 0; border: 0; background: none; color: var(--color-link); }
:where(button).link:where(:hover:not(:disabled)) { background: none; color: var(--color-primary-hover); }
:where(button):disabled { cursor: not-allowed; background: var(--color-disabled-bg); border-color: var(--color-border); color: var(--color-text-disabled); }
:where(button).ghost:disabled, :where(button).link:disabled { background: transparent; border-color: transparent; }
/* 显示为不可用、点了提示原因的按钮（U-20）：外观与 :disabled 相同，悬停不变色 */
button[aria-disabled="true"], button[aria-disabled="true"]:hover, button[aria-disabled="true"]:active { cursor: not-allowed; background: var(--color-disabled-bg); border-color: var(--color-border); color: var(--color-text-disabled); }
/* 提交中：保持原按钮外观并降低不透明度，不显示成禁用灰 */
:where(button):disabled:has(> .spinner) { background: var(--color-surface); border-color: var(--color-border); color: var(--color-text); opacity: .65; }
:where(button).primary:disabled:has(> .spinner) { background: var(--color-primary); border-color: var(--color-primary); color: var(--color-on-primary); }
button:disabled:not(.primary) > .spinner.light { border-color: var(--color-border); border-top-color: var(--color-primary); }
:where(button, a, summary):focus-visible { outline: 2px solid var(--color-primary-border); outline-offset: 1px; }
/* 36px 档：页头操作区 */
.page-heading .actions :where(button, .button-link) { height: var(--control-height-lg); padding: 0 var(--button-padding-x-lg); }

/* ---------- 输入框与下拉框 ----------
 * 下拉框采用 Bootstrap 5 .form-select 的做法：appearance:none + 右侧统一 SVG 箭头。 */
:where(input:not([type=checkbox], [type=radio], [type=file], [type=range]), select, textarea) {
  width: 100%; min-width: 0;
  border: 1px solid var(--color-border); border-radius: var(--radius);
  background-color: var(--color-surface); color: var(--color-text);
  font-size: var(--font-size-md); line-height: var(--line-height);
  transition: border-color .15s, box-shadow .15s;
}
:where(input:not([type=checkbox], [type=radio], [type=file], [type=range]), select) { height: var(--control-height); padding: 4px var(--control-padding-x); }
:where(textarea) { display: block; padding: 5px var(--control-padding-x); resize: vertical; min-height: 76px; }
:where(select) {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  padding-right: var(--select-arrow-space);
  background-image: var(--select-arrow); background-repeat: no-repeat; background-position: right 9px center; background-size: 14px 14px;
  text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
}
select::-ms-expand { display: none; }
:where(input, select, textarea)::placeholder { color: var(--color-text-disabled); }
:where(input, select, textarea):where(:hover:not(:disabled)) { border-color: var(--color-primary-hover); }
:where(input:not([type=checkbox], [type=radio], [type=file]), select, textarea):focus { outline: 0; border-color: var(--color-primary); box-shadow: var(--focus-ring); }
:where(input, select, textarea):disabled { background-color: var(--color-disabled-bg); border-color: var(--color-border); color: var(--color-text-disabled); cursor: not-allowed; }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
input[type=checkbox], input[type=radio] { width: 14px; height: 14px; margin: 0; flex: none; accent-color: var(--color-primary); cursor: pointer; }
input[type=file] { max-width: 100%; font-size: var(--font-size); color: var(--color-text-2); }
input[type=file]::file-selector-button {
  height: var(--control-height); margin-right: 8px; padding: 0 var(--button-padding-x);
  border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); color: var(--color-text);
  font: inherit; cursor: pointer; transition: color .15s, border-color .15s;
}
input[type=file]::file-selector-button:hover { color: var(--color-primary-hover); border-color: var(--color-primary-hover); }
input[type=file]:focus-visible { outline: 2px solid var(--color-primary-border); outline-offset: 2px; }

/* 表单布局：标签在上、左对齐 */
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field-label { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; color: var(--color-text-2); font-size: var(--font-size); line-height: var(--line-height); }
.field-label label { font-weight: 400; }
.field-label .help { margin-left: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .field:last-child { margin-bottom: 16px; }
.form-actions { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.check-label { display: inline-flex; align-items: center; gap: 8px; font-size: var(--font-size); color: var(--color-text); cursor: pointer; }
.type-other { margin-top: 8px; }
.section-divider { border: 0; border-top: 1px solid var(--color-line); margin: 20px 0; }

/* ---------- “?”帮助提示 ----------
 * 图标固定 14px；弹层 fixed 定位，由 app.js 的 placeHelp() 计算上下方向并夹紧在面板和视口内。 */
.help { display: inline-flex; position: relative; vertical-align: -2px; margin-left: 4px; line-height: 1; font-size: var(--font-size-sm); font-weight: 400; letter-spacing: 0; }
.help > summary { list-style: none; display: flex; align-items: center; justify-content: center; width: var(--help-size); height: var(--help-size); border-radius: 50%; color: var(--color-text-3); cursor: pointer; }
.help > summary::-webkit-details-marker { display: none; }
.help > summary svg { width: var(--help-size); height: var(--help-size); stroke-width: 1.9; }
.help > summary:hover, .help[open] > summary { color: var(--color-primary); }
.help > div {
  position: fixed; z-index: 1000; left: var(--tip-x, 0px); top: var(--tip-y, 0px);
  width: max-content; max-width: min(280px, calc(100vw - 16px));
  padding: 6px 10px; border-radius: var(--radius);
  background: var(--color-tooltip); color: #FFFFFF; box-shadow: var(--shadow-popup);
  font: 400 var(--font-size-sm)/var(--line-height-sm) var(--font-family); letter-spacing: 0;
  text-align: left; text-transform: none; white-space: normal; overflow-wrap: anywhere; cursor: default;
}
.help > div::before { content: ""; position: absolute; left: var(--arrow-x, 12px); top: -4px; width: 8px; height: 8px; margin-left: -4px; background: var(--color-tooltip); transform: rotate(45deg); }
.help[data-placed="top"] > div::before { top: auto; bottom: -4px; }
.help:not([data-placed]) > div { visibility: hidden; }

/* ---------- 标签 / 提示条 / 空状态 ---------- */
.badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px;
  border: 1px solid var(--color-border); border-radius: var(--radius);
  background: var(--color-fill); color: var(--color-text-2);
  font-size: var(--font-size-sm); line-height: 18px; font-weight: 400; white-space: nowrap; vertical-align: middle;
}
.badge.outline { background: transparent; border-color: var(--color-line); color: var(--color-text-3); }
.badge.dark { background: var(--color-fill-hover); color: var(--color-text-2); }
.badge.blue { background: var(--color-primary-bg); border-color: var(--color-primary-border); color: var(--color-primary-active); }
.badge.amber { background: var(--color-warning-bg); border-color: var(--color-warning-border); color: var(--color-warning); }
.badge.red { background: var(--color-danger-bg); border-color: var(--color-danger-border); color: var(--color-danger); }
.badge.green { background: var(--color-success-bg); border-color: var(--color-success-border); color: var(--color-success); }
.pill-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.banner {
  display: flex; align-items: flex-start; gap: 8px; margin-bottom: 16px; padding: 8px 12px;
  border: 1px solid var(--color-warning-border); border-radius: var(--radius); background: var(--color-warning-bg);
  color: var(--color-text); font-size: var(--font-size); line-height: var(--line-height);
}
.banner > svg { width: 16px; height: 16px; margin-top: 3px; color: var(--color-warning); }
.banner.info { border-color: var(--color-primary-border); background: var(--color-primary-bg); }
.banner.info > svg { color: var(--color-primary); }
.banner.error { border-color: var(--color-danger-border); background: var(--color-danger-bg); }
.banner.error > svg { color: var(--color-danger); }
.banner.success { border-color: var(--color-success-border); background: var(--color-success-bg); }
.banner.success > svg { color: var(--color-success); }
.banner p { margin: 0; }
.banner strong { font-weight: 500; }
.banner-body { min-width: 0; }
.banner-body p + p { margin-top: 2px; }

.empty { padding: 48px 16px; text-align: center; color: var(--color-text-3); }
.empty > svg { width: 32px; height: 32px; color: var(--color-text-disabled); margin-bottom: 8px; stroke-width: 1.4; }
.empty h3 { margin-bottom: 4px; color: var(--color-text-2); font-weight: 400; }
.empty p { max-width: 420px; margin: 0 auto; font-size: var(--font-size-sm); line-height: var(--line-height-sm); }
.empty > button { margin-top: 16px; }
/* 合同列表的空状态（U-20）：只有一个“上传合同” */
.empty-start .empty { display: flex; flex-direction: column; align-items: center; padding: 96px 16px; }
.empty-start .empty > button { margin-top: 8px; }

/* ---------- 整体布局 ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); height: 100vh; overflow: hidden; }
.sidebar { display: flex; flex-direction: column; min-height: 0; background: var(--color-sidebar); border-right: 1px solid var(--color-sidebar-line); color: var(--color-sidebar-ink); }
.brand { display: flex; align-items: center; flex: none; height: var(--header-height); padding: 0 24px; border-bottom: 1px solid var(--color-sidebar-line); color: var(--color-sidebar-ink-strong); }
.brand:hover { color: var(--color-sidebar-ink-strong); }
.brand-name { font-size: var(--font-size-lg); font-weight: 600; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 4px; padding: 8px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px; border-radius: var(--radius); color: var(--color-sidebar-ink); font-size: var(--font-size); }
.nav a svg { width: var(--nav-icon-size); height: var(--nav-icon-size); }
.nav a:hover { background: var(--color-sidebar-active); color: var(--color-sidebar-ink-strong); }
.nav a.active { background: var(--color-sidebar-active); color: var(--color-sidebar-ink-strong); font-weight: 500; }
.sidebar-footer { margin-top: auto; padding: 8px; border-top: 1px solid var(--color-sidebar-line); }
.sidebar-footer:empty { display: none; }
.demo-entry { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 16px; border-radius: var(--radius); color: var(--color-sidebar-ink); font-size: var(--font-size-sm); }
.demo-entry svg { width: var(--icon-size); height: var(--icon-size); }
.demo-entry:hover, .demo-entry.active { background: var(--color-sidebar-active); color: var(--color-sidebar-ink-strong); }
/* 侧栏底部“反馈”（U-17）：与“演示与测试”同一写法，在账号区之上 */
.feedback-entry { display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: 100%; height: 32px; padding: 0 16px; border: 0; border-radius: var(--radius); background: none; color: var(--color-sidebar-ink); font-size: var(--font-size-sm); }
.feedback-entry svg { width: var(--icon-size); height: var(--icon-size); }
.feedback-entry:hover { background: var(--color-sidebar-active); color: var(--color-sidebar-ink-strong); }
.main { position: relative; min-width: 0; height: 100vh; overflow: auto; }
.page { padding: 20px 24px 32px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: var(--control-height-lg); margin-bottom: 16px; }
.page-heading p { margin: 4px 0 0; color: var(--color-text-3); }
/* 开始的动作紧跟标题放左，搜索、刷新放同一行右侧（U-21，D-68）；放不下时右侧换到下一行，仍靠右 */
.page-heading:has(> .heading-main) { flex-wrap: wrap; align-items: flex-start; row-gap: 8px; }
.heading-main { display: flex; flex: 1 1 0; align-items: center; flex-wrap: wrap; gap: 8px 12px; min-width: 0; }
.heading-main > h1 { min-width: 0; padding: 4px 0; overflow-wrap: anywhere; }
.heading-main > .actions { flex: none; }
.heading-main > p { flex: 0 0 100%; margin-top: -8px; }
.heading-main ~ .actions { margin-left: auto; }
.page-heading .search-box input { height: var(--control-height-lg); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.toolbar h3 { margin: 0; }
.search-box { position: relative; width: 280px; max-width: 100%; }
.search-box input { padding-left: 32px; }
.search-box > svg { position: absolute; left: 11px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%); color: var(--color-text-3); pointer-events: none; }
/* 列表工具栏（U-23，合同审查与规则库）：标题下一行，左边范围页签（页签后写数量），右边搜索框（规则库另有“筛选”），下边一条分隔线；
 * 选中的页签 2px 主色下划线、加粗，数量灰色、选中时主色。页签放不下时在本行横向滚动，不撑宽页面。 */
.list-toolbar { display: flex; align-items: flex-end; gap: 12px; margin: -4px 0 12px; border-bottom: 1px solid var(--color-line); }
.scope-tabs { display: flex; gap: 22px; min-width: 0; margin-bottom: -1px; overflow-x: auto; scrollbar-width: none; }
.scope-tabs::-webkit-scrollbar { display: none; }
.scope-tabs :where(button) { flex: none; gap: 0; height: auto; padding: 8px 0 10px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--color-text-2); font-size: var(--font-size); line-height: var(--line-height); }
.scope-tabs :where(button):where(:hover:not(:disabled)) { border-color: transparent; color: var(--color-text); }
.scope-tabs button[aria-selected="true"] { border-bottom-color: var(--color-primary); color: var(--color-text); font-weight: 600; }
.scope-tabs button:focus-visible { outline-offset: -2px; }
.tab-count { margin-left: 5px; color: var(--color-text-3); font-size: var(--font-size-md); font-weight: 400; }
.scope-tabs button[aria-selected="true"] .tab-count { color: var(--color-primary); font-weight: 500; }
.list-tools { display: flex; flex: none; align-items: center; gap: 8px; margin-left: auto; padding-bottom: 8px; }
.list-tools .search-box { width: 220px; }
.list-tools .warning-text { display: inline-flex; align-items: center; gap: 4px; color: var(--color-warning); font-size: var(--font-size-sm); white-space: nowrap; }
.list-tools .warning-text svg { width: var(--icon-size); height: var(--icon-size); }
/* “筛选”按钮与弹出面板（details.menu：点面板外或按 Esc 收起，见 core/events.mjs）：三组单选小标签，底部“清除” */
.filter-menu > summary { gap: 4px; height: var(--control-height); padding: 0 10px; font-size: var(--font-size-md); }
.filter-menu > summary svg { width: var(--icon-size); height: var(--icon-size); }
.filter-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--color-primary); color: var(--color-on-primary); font-size: var(--font-size-sm); line-height: 18px; font-weight: 500; }
.menu-pop.filter-pop { display: block; width: 320px; max-width: calc(100vw - 32px); }
.filter-group-label { padding: 6px 10px 2px; color: var(--color-text-3); font-size: var(--font-size-sm); line-height: var(--line-height-sm); }
.filter-options { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 8px 8px; }
.filter-pop .filter-options :where(button) { width: auto; height: auto; padding: 3px 10px; border: 1px solid var(--color-line); border-radius: 13px; color: var(--color-text); }
.filter-pop .filter-options :where(button):where(:hover:not(:disabled)) { background: var(--color-fill-hover); color: var(--color-text); }
.filter-pop .filter-options button[aria-pressed="true"] { background: var(--color-primary-bg); border-color: var(--color-primary-border); color: var(--color-primary); font-weight: 600; }
.filter-foot { display: flex; justify-content: flex-end; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--color-split); }
.filter-foot .link, .filter-tags .link { width: auto; height: 28px; padding: 0 6px; font-size: var(--font-size-md); }
/* 已选条件：工具栏下方一排可移除的小标签，没有选时整行不占位 */
.filter-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; }
.filter-tags:empty { display: none; }
.filter-tags .filter-tag { gap: 4px; height: 26px; padding: 0 4px 0 10px; border: 0; border-radius: 13px; background: var(--color-primary-bg); color: var(--color-primary); }
.filter-tags .filter-tag:hover { color: var(--color-primary); }
.filter-tag svg { box-sizing: content-box; width: 10px; height: 10px; padding: 4px; border-radius: 50%; stroke-width: 2.4; }
.filter-tag:hover svg { background: var(--color-primary-border); }
.card { background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-lg); }
.card-pad { padding: 20px 24px; }
.card h2 { display: flex; align-items: center; }
.sources-card { margin-top: 16px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: var(--font-size); line-height: var(--line-height); }
.data-table th { padding: 12px 16px; background: var(--color-fill); color: var(--color-text); font-weight: 500; border-bottom: 1px solid var(--color-split); white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--color-split); vertical-align: middle; }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table tbody tr:hover > td { background: var(--color-fill); }
.data-table .col-action { width: 1%; white-space: nowrap; }
.data-table tr.row-link { cursor: pointer; }
.row-title { display: inline; color: var(--color-text); font-weight: 500; }
.row-title:hover { color: var(--color-primary); }
.row-sub { margin-top: 2px; font-size: var(--font-size-sm); line-height: var(--line-height-sm); color: var(--color-text-3); }
.row-sub .badge { margin-right: 4px; }
.file-cell { min-width: 240px; }
.table-link { color: var(--color-primary); }
.table-link:hover { color: var(--color-primary-hover); }
.table-footer { padding: 10px 16px; border-top: 1px solid var(--color-split); font-size: var(--font-size-sm); line-height: var(--line-height-sm); color: var(--color-text-3); text-align: right; }

/* ---------- 审查工作台 ---------- */
.non-contract-notice, .parse-update-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex: none; padding: 8px 20px; background: var(--color-surface); border-bottom: 1px solid var(--color-line); }
.workbench { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
/* 页头一行（U-11）：返回、标题、状态徽标、项目、导出、运行审查 */
.work-header { display: flex; align-items: center; gap: 12px; flex: none; height: var(--header-height); padding: 0 20px 0 12px; background: var(--color-surface); border-bottom: 1px solid var(--color-line); }
.work-back { display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: var(--radius); color: var(--color-text-3); }
.work-back:hover { background: var(--color-fill); color: var(--color-text); }
.work-back svg { width: 16px; height: 16px; }
.work-header .title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--font-size-lg); line-height: 24px; font-weight: 600; }
.work-header .badge { flex: none; height: 22px; padding: 0 8px; border-color: transparent; border-radius: var(--radius-sm); font-size: var(--font-size-sm); font-weight: 500; }
.work-header .badge:not(.green):not(.red):not(.stale):not(.outline):not(.final-badge) { border-color: var(--color-line); background: var(--color-fill); color: var(--color-text-3); }
.work-header .badge.outline { border-color: var(--color-line); background: transparent; color: var(--color-text-3); font-weight: 400; }
.work-header button.badge { cursor: pointer; }
.work-header button.badge:hover { border-color: var(--color-border); color: var(--color-text); }
/* 部分完成的原因（U-20）：徽标后一个灰色短语，与徽标一起点到“审查要点” */
.status-note { margin-left: 6px; color: var(--color-text-3); font-size: var(--font-size-sm); font-weight: 400; white-space: nowrap; }
.work-header .status-link { display: inline-flex; flex: none; align-items: center; gap: 0; height: auto; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.work-header .status-link .status-note { margin-left: 8px; }
.work-header .status-link:hover .status-note { color: var(--color-text); text-decoration: underline; text-underline-offset: 3px; }
.work-header .status-link:hover .badge { border-color: var(--color-border); color: var(--color-text); }
.badge.stale { border-color: transparent; background: var(--risk-low-bg); color: var(--risk-low); }
.work-header .actions { flex: none; flex-wrap: nowrap; margin-left: auto; gap: 8px; }
.work-header .actions :where(button, .button-link, summary) { height: var(--control-height-lg); padding: 0 var(--button-padding-x-lg); font-size: var(--font-size-md); }
.work-header .actions svg { width: 14px; height: 14px; }
.export-button svg + svg { width: 12px; height: 12px; margin-left: -2px; }
/* 下拉菜单（导出）：details.menu，点外面或 Esc 收起（core/events.mjs） */
.menu { position: relative; }
.menu > summary { display: inline-flex; align-items: center; gap: var(--icon-gap); border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); color: var(--color-text); white-space: nowrap; list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover, .menu[open] > summary { background: var(--color-fill); }
.menu-pop { position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; display: grid; gap: 2px; min-width: 168px; padding: 6px; border: 1px solid var(--color-line); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-popup); }
.menu-pop :where(button) { justify-content: flex-start; width: 100%; height: 34px; padding: 0 10px; border: 0; background: none; font-size: var(--font-size-md); }
.menu-pop :where(button):where(:hover:not(:disabled)) { background: var(--color-fill); color: var(--color-text); }
.menu-pop :where(button):disabled { background: none; }
.menu-pop .exports-note { display: block; max-width: 220px; padding: 0 10px 6px; font-size: var(--font-size-sm); line-height: 18px; color: var(--color-text-3); white-space: normal; }
/* 页头历次审查（U-15）：审查过两次及以上时状态徽标兼做下拉按钮，颜色同徽标；下拉靠左展开，各行按列对齐，当前一行打勾 */
.work-header .run-menu { flex: none; }
.work-header .run-menu > summary.badge { gap: 2px; padding-right: 4px; }
.work-header .run-menu > summary.badge svg { width: 12px; height: 12px; }
.work-header .run-menu > summary.green { background: var(--color-success-bg); }
.work-header .run-menu > summary.red { background: var(--color-danger-bg); }
.work-header .run-menu > summary.stale { background: var(--risk-low-bg); }
.work-header .run-menu > summary:hover, .work-header .run-menu[open] > summary { box-shadow: inset 0 0 0 1px var(--color-border); }
.run-menu > .menu-pop { left: 0; right: auto; grid-template-columns: 14px repeat(4, auto); column-gap: 12px; max-width: calc(100vw - 24px); }
.run-menu .menu-pop .run-option { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; column-gap: 12px; align-items: center; color: var(--color-text-2); white-space: nowrap; }
.run-menu .run-option[aria-current="true"] { color: var(--color-text); font-weight: 500; }
.run-check svg { width: 14px; height: 14px; color: var(--color-primary); }
.run-time, .run-counts { color: var(--color-text-3); font-variant-numeric: tabular-nums; font-weight: 400; }
.run-flag { color: var(--color-text-3); font-weight: 400; }
.run-flag.stale { color: var(--risk-low); }
.run-flag.red { color: var(--color-danger); }
.stale-note a { color: var(--color-link); }
.stale-note a:hover { color: var(--color-primary-hover); }
/* 工作台页：侧栏收成 56px 图标栏 */
@media (min-width: 761px) {
  .shell:has(> .main > .workbench) { grid-template-columns: 56px minmax(0, 1fr); }
  .shell:has(> .main > .workbench) .brand { display: none; }
  .shell:has(> .main > .workbench) .nav { align-items: center; padding: 12px 0; }
  /* 图标下一行小字（U-20：“反馈”等侧栏项不只有图标，与其他侧栏项一致） */
  .shell:has(> .main > .workbench) .nav a, .shell:has(> .main > .workbench) .demo-entry, .shell:has(> .main > .workbench) .feedback-entry { flex-direction: column; justify-content: center; gap: 3px; width: 48px; height: 48px; padding: 0; }
  .shell:has(> .main > .workbench) .nav-text { display: block; font-size: 11px; line-height: 14px; white-space: nowrap; }
  .shell:has(> .main > .workbench) .account-info, .shell:has(> .main > .workbench) .account > summary > svg { display: none; }
  .shell:has(> .main > .workbench) .sidebar-footer { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 0; }
  .shell:has(> .main > .workbench) .account > summary { justify-content: center; width: 40px; height: 40px; margin: 0 auto; padding: 0; }
  .shell:has(> .main > .workbench) .account-pop { right: auto; bottom: 0; left: calc(100% + 8px); min-width: 168px; }
}
.work-grid { display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-width); flex: 1; min-height: 0; }
.document-region { overflow: auto; padding: 28px 32px 64px; background: var(--color-paper-bg); scroll-behavior: smooth; }
/* 纸面（U-11）：最宽 860，宋体 16 / 1.9，左侧 84 留给边栏标记 */
.document-paper { position: relative; max-width: 860px; min-height: 1000px; margin: 0 auto; padding: 56px 56px 72px 84px; background: var(--color-paper); border: 1px solid var(--color-line); border-radius: var(--radius-lg); font-family: var(--font-contract); font-size: 16px; line-height: 1.9; color: var(--color-text); }
.document-paper .segment { position: relative; margin: 0 0 .55em; line-height: 1.9; white-space: pre-wrap; overflow-wrap: anywhere; scroll-margin-top: 24px; }
.document-paper .seg-title { text-align: center; font-size: 24px; font-weight: 700; margin: 0 0 1.2em; }
.document-paper .seg-field, .document-paper .seg-sig { margin-bottom: .2em; }
.document-paper .seg-preamble { margin: .8em 0; }
.document-paper .seg-clause { font-weight: 700; margin: 1.2em 0 .4em; }
.document-paper .seg-attTitle { font-weight: 700; margin: 1.6em 0 .6em; }
.document-paper .seg-sigNote { margin-top: 28px; color: var(--color-text-3); }
.document-table-wrap { max-width: 100%; margin: .4em 0 1em; }
.document-table { width: 100%; border-collapse: collapse; font-family: inherit; font-size: 16px; line-height: 1.7; }
.document-table td, .document-table th { position: relative; padding: 4px 8px; border: 1px solid var(--color-border); text-align: left; vertical-align: top; white-space: nowrap; }
.document-table td.wrap, .document-table th.wrap { width: 100%; white-space: normal; overflow-wrap: anywhere; }
.document-table th { font-weight: 600; }
.document-cell-paragraph { margin: 0; white-space: pre-wrap; }
.document-table :is(td, th):not(.wrap) .document-cell-paragraph { white-space: nowrap; }
.document-cell-paragraph + .document-cell-paragraph { margin-top: 4px; }
/* 高亮：展开的事项的全部证据片段（半透明黄，左侧一道边），点中的一处加深；项目页签的定位同样用 .selected */
.document-paper .segment.hl, .document-paper .segment.selected { background: var(--hl); box-shadow: -8px 0 0 var(--hl), 8px 0 0 var(--hl); }
.document-paper .segment.hl::before, .document-paper .segment.selected::before { content: ""; position: absolute; left: -8px; top: 0; bottom: 0; width: 3px; background: var(--hl-edge); }
.document-paper .segment.focus, .document-table tr.focus > * { --hl: var(--hl-strong); }
.document-table tr.hl > *, .document-table tr.selected > * { background: var(--hl); }
.document-table tr.hl > :first-child, .document-table tr.selected > :first-child { box-shadow: inset 3px 0 0 var(--hl-edge); }
/* 边栏标记：18px 风险色描边圈 + 编号；展开的事项实心，已处理灰；同一片段多条纵向叠放 */
.mark { --c: var(--risk-low); position: absolute; left: -58px; top: 6px; z-index: 1; display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 1.5px solid var(--c); border-radius: 50%; background: transparent; color: var(--c); font: 600 12px/1 var(--font-family); letter-spacing: -.04em; white-space: nowrap; }
.document-table .mark { left: -59px; top: 9px; }
.mark.sev-high { --c: var(--risk-high); }
.mark.sev-mid { --c: var(--risk-mid); }
.mark.sev-low { --c: var(--risk-low); }
.mark.done { border-color: var(--color-border); color: var(--color-text-disabled); }
.mark.active { background: var(--c); border-color: var(--c); color: var(--on-risk); }
.mark.done.active { background: var(--color-text-disabled); border-color: var(--color-text-disabled); color: var(--on-risk); }
.mark:where(:hover:not(:disabled)) { border-color: var(--c); color: var(--c); transform: scale(1.15); }
.mark.active:hover { color: var(--on-risk); }
.mark.mark-i1 { top: 28px; } .mark.mark-i2 { top: 50px; } .mark.mark-i3 { top: 72px; } .mark.mark-i4 { top: 94px; } .mark.mark-i5 { top: 116px; }
.document-table .mark.mark-i1 { top: 31px; } .document-table .mark.mark-i2 { top: 53px; } .document-table .mark.mark-i3 { top: 75px; } .document-table .mark.mark-i4 { top: 97px; } .document-table .mark.mark-i5 { top: 119px; }

/* 右侧面板（440，≤1280 为 400）：页签与筛选行吸顶，滚动容器是 .review-panel */
.review-panel { position: relative; min-width: 0; overflow: auto; background: var(--color-surface); border-left: 1px solid var(--color-line); }
.panel-top { position: sticky; top: 0; z-index: 5; background: var(--color-surface); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 44px; padding: 12px 20px 0; }
.panel-header h2 { margin: 0; font-size: var(--font-size-lg); line-height: 24px; }
.panel-tabs { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 4px 20px 0; border-bottom: 1px solid var(--color-line); }
.panel-tabs button { height: 40px; margin-bottom: -1px; padding: 0 2px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--color-text-3); font-size: var(--font-size); }
.panel-tabs button:where(:hover:not(:disabled)) { border-color: transparent; color: var(--color-text); }
.panel-tabs button.active, .panel-tabs button.active:hover { border-bottom-color: var(--color-primary); color: var(--color-text); font-weight: 600; }
.panel-body { padding: 14px 20px 40px; }
.panel-body > .toolbar { margin-bottom: 12px; }
/* 分段按钮（单选）：审查阶段、签署方式、外观 */
.segmented { display: flex; }
.theme-choice { max-width: 360px; }
.segmented label { position: relative; flex: 1; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: flex; align-items: center; justify-content: center; height: var(--control-height); margin-left: -1px; padding: 0 8px; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text); font-size: var(--font-size-md); white-space: nowrap; cursor: pointer; }
.segmented label:first-child span { margin-left: 0; border-radius: var(--radius) 0 0 var(--radius); }
.segmented label:last-child span { border-radius: 0 var(--radius) var(--radius) 0; }
.segmented label:hover input:not(:checked) + span { background: var(--color-fill); }
.segmented input:checked + span { position: relative; z-index: 1; background: var(--color-primary-bg); border-color: var(--color-primary); color: var(--color-primary); font-weight: 600; }
.segmented input:focus-visible + span { box-shadow: var(--focus-ring); }
.checkbox-field { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-field + .small-note { margin: 4px 0 0 22px; }
/* 基础信息（U-11）：两列，每项一个标签一个控件；材料一张列表 */
.basic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding-top: 4px; }
.basic-grid .field { margin: 0; }
.basic-grid .field.full, .basic-grid .basic-actions { grid-column: 1 / -1; }
/* “更多”（U-20）：合同来源、规则集、材料等收起在这里 */
.basic-grid .basic-more { grid-column: 1 / -1; padding-top: 0; }
.basic-more[hidden] { display: none; }
.basic-more-toggle { display: inline-flex; align-items: center; gap: 4px; height: auto; padding: 0; border: 0; background: none; color: var(--color-text-3); font-size: var(--font-size-md); }
.basic-more-toggle:where(:hover:not(:disabled)) { background: none; color: var(--color-text); }
.basic-more-toggle svg { width: 14px; height: 14px; transition: transform .15s; }
.basic-more-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.basic-grid .field-label { gap: 8px; margin-bottom: 6px; font-size: var(--font-size-md); color: var(--color-text-3); }
.basic-grid :is(select, input:not([type=radio], [type=checkbox], [type=file])) { height: var(--control-height-lg); font-size: var(--font-size-md); }
.basic-grid .segmented span { height: var(--control-height-lg); }
/* “我方”一行：下拉之后跟“付款方 | 收款方”（TF3，不新增一项） */
.party-pay { display: flex; gap: 8px; }
.party-pay select { flex: 1; min-width: 0; }
.party-pay .segmented { flex: none; }
.party-pay .segmented span { min-width: 64px; }
/* 只读的基础信息（没有合同写权限，U-16）：标签下一行写取值 */
.basic-grid .field-value { min-height: 20px; color: var(--color-text); font-size: var(--font-size-md); line-height: 20px; overflow-wrap: anywhere; }
.field-note { font-size: var(--font-size-sm); color: var(--color-text-disabled); }
/* 开关（基础信息“本合同不调用模型”）：名称在左，开关在右 */
.switch-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--control-height-lg); font-size: var(--font-size-md); color: var(--color-text-2); cursor: pointer; }
input[type=checkbox].switch { appearance: none; -webkit-appearance: none; position: relative; width: 32px; height: 18px; margin: 0; border-radius: 9px; background: var(--color-border); transition: background-color .15s; }
input[type=checkbox].switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(16, 24, 40, .25); transition: transform .15s; }
input[type=checkbox].switch:checked { background: var(--color-primary); }
input[type=checkbox].switch:checked::after { transform: translateX(14px); }
input[type=checkbox].switch:focus-visible { outline: 2px solid var(--color-primary-border); outline-offset: 1px; }
.field-required { font-size: var(--font-size-sm); color: var(--color-danger); }
.material-list { overflow: hidden; border: 1px solid var(--color-line); border-radius: var(--radius-lg); }
.material-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 36px; padding: 0 10px; border-bottom: 1px solid var(--color-line); font-size: var(--font-size-md); }
.material-row:last-child { border-bottom: 0; }
.material-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.material-name b { margin-right: 8px; font-weight: 500; }
.material-name small { margin-left: 8px; color: var(--color-text-3); font-size: var(--font-size-md); }
.material-right { display: flex; flex: none; align-items: center; gap: 8px; }
.material-state { flex: none; color: var(--color-text-3); }
.material-state.ok { color: var(--color-success); }
.material-state.missing { color: var(--color-warning); }
.material-row :where(button).link { font-size: var(--font-size-md); }
.material-add :where(button).link svg { width: 12px; height: 12px; }
.basic-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; }
.attachment-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; padding: 8px 12px; border: 1px solid var(--color-line); border-radius: var(--radius); }
.attachment-row .name { overflow-wrap: anywhere; }
.parse-notes { margin: 6px 0 0; font-size: var(--font-size-sm); line-height: var(--line-height-sm); color: var(--color-text-2); }
.parse-notes > summary { display: inline-flex; align-items: center; gap: 4px; color: var(--color-text-3); cursor: pointer; list-style: none; }
.parse-notes > summary::-webkit-details-marker { display: none; }
.parse-notes > summary::after { content: ""; width: 5px; height: 5px; margin: -3px 2px 0; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.parse-notes[open] > summary::after { margin-top: 3px; transform: rotate(-135deg); }
.parse-notes > summary:hover { color: var(--color-primary); }
.parse-notes ul { margin: 4px 0 0; padding-left: 18px; }
.parse-notes li + li { margin-top: 2px; }

/* 审查结果（U-11）：筛选行吸顶；事项去卡片边框改分隔线，展开的浅灰底；详情四块带 12px 小标题 */
.finding-toolbar { display: flex; align-items: center; gap: 6px; padding: 12px 20px; border-bottom: 1px solid var(--color-line); }
.finding-toolbar select { flex: 1 1 0; min-width: 0; height: 32px; padding: 0 22px 0 8px; color: var(--color-text-3); font-size: var(--font-size-md); background-position: right 7px center; background-size: 12px 12px; }
.seg-ctl { display: inline-flex; flex: none; height: 32px; overflow: hidden; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); }
.seg-ctl :where(button) { height: 100%; gap: 5px; padding: 0 8px; border: 0; border-right: 1px solid var(--color-border); border-radius: 0; background: none; color: var(--color-text); font-size: var(--font-size-md); }
.seg-ctl :where(button):last-child { border-right: 0; }
.seg-ctl :where(button):where(:hover:not(:disabled)) { background: var(--color-fill); color: var(--color-text); }
.seg-ctl button.on, .seg-ctl button.on:hover { background: var(--color-primary-bg); color: var(--color-primary); font-weight: 600; }
.seg-ctl button b { font-weight: 600; }
.panel-body.flush { padding-top: 0; }
.stale-note { margin: 12px 0; font-size: var(--font-size-md); line-height: var(--line-height-sm); color: var(--color-text-3); }
.list-empty { margin: 0; padding: 56px 0; text-align: center; color: var(--color-text-3); }
.finding { margin: 0 -20px; border-bottom: 1px solid var(--color-line); scroll-margin-top: 104px; }
.finding.open { background: var(--color-fill); }
.finding.done { opacity: .6; }
.finding.done.open { opacity: 1; }
.finding-head { position: relative; display: block; width: 100%; height: auto; padding: 14px 20px 14px 52px; border: 0; border-radius: 0; background: none; color: var(--color-text); text-align: left; white-space: normal; line-height: var(--line-height); font-size: var(--font-size); }
.finding:not(.open) .finding-head:where(:hover:not(:disabled)) { background: var(--color-fill); color: var(--color-text); }
.finding-head:where(:hover:not(:disabled)) { color: var(--color-text); }
.finding-num { --c: var(--risk-low); position: absolute; left: 20px; top: 15px; display: grid; place-items: center; width: 20px; height: 20px; border: 1.5px solid var(--c); border-radius: 50%; background: var(--c); color: var(--on-risk); font: 600 12px/1 var(--font-family); letter-spacing: -.04em; }
.finding-num.sev-high { --c: var(--risk-high); }
.finding-num.sev-mid { --c: var(--risk-mid); }
.finding-num.sev-low { --c: var(--risk-low); }
.finding-num.manual { background: transparent; color: var(--c); }
.finding-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 4px; font-size: var(--font-size-md); line-height: 20px; color: var(--color-text-3); }
.finding-location { color: var(--color-text); font-weight: 500; }
.finding-severity { font-size: var(--font-size-sm); }
.finding-meta .tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--radius-sm); background: var(--color-fill); color: var(--color-text-3); font-size: var(--font-size-sm); }
.finding.open .finding-meta .tag { background: var(--color-surface); }
.finding-title { display: block; font-size: var(--font-size); line-height: 1.55; }
.finding-body { padding: 0 20px 16px 52px; }
.finding-own { margin: 0 0 10px; font-size: var(--font-size-sm); line-height: var(--line-height-sm); color: var(--color-text-3); }
.evidence-row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; margin: 0 0 12px; font-size: var(--font-size-md); color: var(--color-text-3); }
.evidence-row :where(button) { height: auto; padding: 0; border: 0; background: none; color: var(--color-text); font-size: var(--font-size-md); text-decoration: underline; text-decoration-color: var(--color-border); text-underline-offset: 3px; }
.evidence-row :where(button):where(:hover:not(:disabled)) { color: var(--color-text); text-decoration-color: currentColor; }
.evidence-row button.on { font-weight: 600; text-decoration-color: var(--hl-edge); }
.sep { color: var(--color-text-disabled); }
.finding-sec { margin: 0 0 14px; }
.finding-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 22px; margin: 0 0 4px; font-size: var(--font-size-sm); color: var(--color-text-3); }
.finding-sec-head :where(button) { font-size: var(--font-size-sm); }
.finding-sec .quote { margin: 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--color-border); background: none; color: var(--color-text-3); font-family: var(--font-contract); font-size: 15px; line-height: 1.75; white-space: normal; }
.finding-sec .quote p, .revise-view p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.finding-sec .quote > * + *, .revise-view > * + * { margin-top: 6px; }
.revise { padding: 10px 12px; border: 1px solid var(--color-line); border-radius: var(--radius-lg); background: var(--color-surface); font-family: var(--font-contract); font-size: 15px; line-height: 1.75; }
.revise del { color: var(--color-danger); text-decoration: line-through; }
.revise ins { color: var(--color-success); text-decoration: underline; text-decoration-color: var(--color-success); text-underline-offset: 3px; }
.revise del + ins { margin-left: 3px; }
.revise .gap { padding: 0 1px; color: var(--color-text-disabled); }
.revise textarea { display: none; min-height: 96px; font: 15px/1.75 var(--font-contract); }
.revise.editing { padding: 0; border: 0; background: none; }
.revise.editing .revise-view { display: none; }
.revise.editing textarea { display: block; }
.advice { margin: 0; font-size: var(--font-size); line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.advice-note { margin: 6px 0 0; font-size: var(--font-size-md); line-height: 1.6; color: var(--color-text-3); white-space: pre-wrap; overflow-wrap: anywhere; }
.advice-note:first-child { margin-top: 0; }
.basis { margin: 0; font-size: var(--font-size-md); line-height: 1.6; color: var(--color-text-3); overflow-wrap: anywhere; }
.basis .rule { color: var(--color-text-disabled); }
.mini-wrap { overflow-x: auto; }
.mini-table { width: 100%; border-collapse: collapse; font: 13px/1.5 var(--font-contract); }
.mini-table th, .mini-table td { padding: 3px 6px; border: 1px solid var(--color-line); text-align: left; vertical-align: top; white-space: nowrap; }
.mini-table th { color: var(--color-text-disabled); font-weight: 400; }
.mini-table td.wrap { width: 100%; white-space: normal; }
/* :has() 单独写一条：不认 :has() 的老浏览器只丢这一条，不连带上一条（HF1）。 */
.mini-table td:has(.chg) { width: 100%; white-space: normal; }
textarea.opinion { min-height: 72px; font-size: var(--font-size); line-height: 1.6; }
.finding-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.finding-actions :where(button).small { height: var(--control-height-sm); padding: 0 10px; font-size: var(--font-size-md); }
.finding-actions :where(button).link { height: var(--control-height-sm); padding: 0 6px; border-radius: var(--radius); }
.finding-actions :where(button).link:where(:hover:not(:disabled)) { background: var(--color-primary-bg); }
.finding-actions > .link:first-child { margin-left: -6px; }
.finding-actions .push { margin-left: auto; }
.finding-actions button.on { border-color: var(--color-primary); background: var(--color-primary-bg); color: var(--color-primary); }
.reasons { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; scroll-margin-bottom: 12px; }
.reasons :where(button).small { height: var(--control-height-sm); padding: 0 10px; font-size: var(--font-size-md); }
.coverage { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; padding: 14px 0; font-size: var(--font-size-md); color: var(--color-text-3); }
.coverage :where(button) { height: auto; padding: 0; border: 0; background: none; color: inherit; font-size: var(--font-size-md); }
.coverage :where(button):where(:hover:not(:disabled)) { color: var(--color-text); }
.coverage-more { font-size: 16px; }
.finding-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.locate-narrow { display: none; }
.quote { margin: 0; padding: 8px 12px; background: var(--color-fill); border-left: 2px solid var(--color-border); line-height: var(--line-height); white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-text { line-height: var(--line-height); white-space: pre-wrap; overflow-wrap: anywhere; }

/* 审查要点（U-11）：按执行状态分组，组头 15px/600 + 条数、无底色；行里只写规则名 */
.record-groups { margin: 0 0 12px; }
.record-group { border-bottom: 1px solid var(--color-line); scroll-margin-top: 56px; }
.record-group-head { display: flex; align-items: center; justify-content: flex-start; gap: 8px; width: 100%; height: auto; padding: 12px 0; border: 0; border-radius: 0; background: none; color: var(--color-text); font-size: var(--font-size); text-align: left; }
.record-group-head:where(:hover:not(:disabled)) { color: var(--color-text); }
.record-group-head svg { width: 14px; height: 14px; color: var(--color-text-disabled); transition: transform .15s; }
.record-group.open .record-group-head svg { transform: rotate(90deg); }
.record-group-head b { font-weight: 600; }
.record-group-count { color: var(--color-text-3); }
.record-group-note { color: var(--color-text-3); font-size: var(--font-size-md); }
.record-group-body { display: none; padding: 0 0 10px 22px; }
.record-group.open .record-group-body { display: block; }
.record { padding: 5px 0; font-size: var(--font-size); line-height: 1.5; }
.record small { display: block; margin-top: 1px; color: var(--color-text-3); font-size: var(--font-size-md); }
/* 定稿（U-22，按 docs/设计/原型/定稿上传交互_20261019.html）：页头“上传定稿”与竖分隔线、标题旁“已定稿”；
   页签顶部两行文件信息，三组带色点（提示已修改主色、修改未提示琥珀、提示未修改灰）；一行一处改动（改前删除线、改后浅绿底），点一行在原文中高亮；
   原文侧改动片段一道 4px 竖条、纯新增一个“+”，可点 */
.work-divider { flex: none; width: 1px; height: 20px; margin: 0 2px; background: var(--color-line); }
.work-header .badge.final-badge { border-color: var(--color-primary-border); background: var(--color-primary-bg); color: var(--color-primary); }
.final-badge.pop { animation: final-pop .5s ease-out; }
@keyframes final-pop { 0% { transform: scale(.85); opacity: 0; } 60% { transform: scale(1.06); } }
.final-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 2px 0 12px; border-bottom: 1px solid var(--color-split); }
.final-file { min-width: 0; }
.final-name { color: var(--color-text); font-weight: 600; line-height: var(--line-height); overflow-wrap: anywhere; }
.final-meta { margin-top: 2px; font-size: var(--font-size-sm); line-height: 18px; color: var(--color-text-3); font-variant-numeric: tabular-nums; }
.final-flag { color: var(--color-warning); }
.final-actions { display: flex; flex: none; gap: 12px; padding-top: 2px; }
.final-actions :where(button).link { font-size: var(--font-size-md); }
.final-head ~ .banner { margin: 12px 0 0; }
.final-loading { display: flex; align-items: center; gap: 8px; padding: 24px 0; color: var(--color-text-3); font-size: var(--font-size-md); }
.final-group { border-bottom-color: var(--color-split); }
.final-group-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--final-keep); }
.final-group-dot.done { background: var(--color-primary); }
.final-group-dot.miss { background: var(--final-miss); }
.final-group.empty .record-group-head { color: var(--color-text-3); }
.final-group.empty .record-group-head svg { visibility: hidden; }
.final-group .record-group-body { padding: 0 0 10px 12px; }
.final-row { position: relative; }
.final-row + .final-row { margin-top: 2px; }
.final-row-main { display: block; width: 100%; height: auto; padding: 10px 12px; border: 0; border-radius: var(--radius); background: none; color: var(--color-text); text-align: left; white-space: normal; font-size: var(--font-size); line-height: var(--line-height); }
button.final-row-main:where(:hover:not(:disabled)) { background: var(--color-fill); color: var(--color-text); }
.final-row.on .final-row-main { background: var(--color-fill); box-shadow: inset 3px 0 0 var(--final-miss); }
.final-loc { display: block; min-height: 26px; color: var(--color-text-2); font-size: var(--font-size-md); line-height: 26px; }
.final-row.has-action .final-loc { padding-right: 104px; }
.final-loc .tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--radius-sm); background: var(--color-fill); color: var(--color-text-3); font-size: var(--font-size-sm); }
.final-diff, .final-text { display: block; font-family: var(--font-contract); font-size: 15px; line-height: 26px; white-space: pre-wrap; overflow-wrap: anywhere; }
/* 提示未修改：原文只作上下文，最多三行（点一行在原文中看全文） */
.final-text { display: -webkit-box; overflow: hidden; color: var(--color-text-3); -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.final-diff del { color: var(--color-danger); text-decoration-thickness: 1px; }
.final-diff ins { padding: 0 1px; border-radius: 2px; background: var(--color-success-bg); color: var(--color-success); text-decoration: none; }
.final-diff del + ins { margin-left: 2px; }
.final-finding { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; font-size: var(--font-size-md); line-height: 20px; color: var(--color-text-2); }
.final-dot { --c: var(--risk-low); flex: none; width: 6px; height: 6px; border: 1px solid var(--c); border-radius: 50%; background: var(--c); transform: translateY(-1px); }
.final-dot.sev-high { --c: var(--risk-high); }
.final-dot.sev-mid { --c: var(--risk-mid); }
.final-dot.manual { background: transparent; }
.final-problem { min-width: 0; }
.final-state { flex: none; margin-left: auto; padding-left: 8px; color: var(--color-text-3); white-space: nowrap; }
.final-related { display: block; margin-top: 4px; font-size: var(--font-size-md); line-height: 20px; color: var(--color-text-3); }
.final-row :where(button).final-miss { position: absolute; top: 10px; right: 12px; height: 26px; padding: 0 10px; font-size: var(--font-size-md); }
.final-reported { position: absolute; top: 10px; right: 12px; display: inline-flex; align-items: center; gap: 4px; height: 26px; font-size: var(--font-size-sm); color: var(--color-success); white-space: nowrap; }
.final-reported svg { width: 12px; height: 12px; stroke-width: 2.4; }
.final-group :where(button).final-more { margin: 4px 0 0 12px; font-size: var(--font-size-md); }
/* 上传对话框：提交后进度条与“正在与第 N 次审查对照” */
.final-progress { margin-top: 14px; }
.final-progress-bar { height: 4px; overflow: hidden; border-radius: 2px; background: var(--color-fill-hover); }
.final-progress-bar i { display: block; width: 0; height: 100%; background: var(--color-primary); animation: final-progress 2.4s cubic-bezier(.2, .7, .3, 1) forwards; }
@keyframes final-progress { to { width: 90%; } }
.final-progress-label { margin-top: 6px; font-size: var(--font-size-md); color: var(--color-text-3); }
/* 原文侧：竖条在事项编号圆右侧（编号圆在 -58px 起），“+”在锚点片段与下一段之间 */
.final-bar { position: absolute; left: -26px; top: 4px; bottom: 4px; z-index: 1; width: 12px; height: auto; padding: 0; border: 0; border-radius: 0; background: none; cursor: pointer; }
.final-bar::before { content: ""; position: absolute; left: 4px; top: 0; bottom: 0; width: 4px; border-radius: 2px; background: var(--color-primary); }
.final-bar.miss::before { background: var(--final-miss); }
.final-bar:where(:hover:not(:disabled))::before { left: 3px; width: 6px; }
.final-plus { position: absolute; left: -30px; top: calc(100% - 5px); z-index: 2; display: grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 50%; background: var(--final-miss); color: var(--on-risk); font: 600 13px/1 var(--font-family); cursor: pointer; }
.final-plus::before { content: "+"; }
.final-plus.lead { top: -14px; }
.final-plus:where(:hover:not(:disabled)) { border: 0; background: var(--final-miss); color: var(--on-risk); transform: scale(1.12); }
.document-table .final-bar { left: -28px; }
.document-table .final-plus { left: -32px; }
.document-paper.final-fresh .final-bar::before { animation: final-grow .6s ease-out both; }
@keyframes final-grow { from { transform: scaleY(0); } }
/* 窄屏：纸面左侧留白变小、事项编号圆右移，竖条与“+”跟着右移，不压编号圆 */
@media (max-width: 1000px) {
  .final-bar { left: -22px; }
  .final-plus { left: -24px; }
}
@media (max-width: 760px) {
  .final-bar { left: -17px; }
  .final-plus { left: -17px; width: 16px; height: 16px; font-size: 12px; }
  .work-divider { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .final-badge.pop, .final-progress-bar i, .document-paper.final-fresh .final-bar::before { animation: none; }
  .final-progress-bar i { width: 60%; }
}
.progress-card { margin-bottom: 16px; padding: 16px; border: 1px solid var(--color-line); border-radius: var(--radius); }
.progress-title { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.run-description { margin-top: 4px; font-size: var(--font-size-sm); line-height: var(--line-height-sm); color: var(--color-text-3); }
.progress-card progress { display: block; width: 100%; height: 6px; margin-top: 12px; accent-color: var(--color-primary); }
.mobile-tabs { display: none; }

/* ---------- 规则库 ---------- */
.back-link { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 12px; color: var(--color-text-2); }
.back-link svg { width: var(--icon-size); height: var(--icon-size); }
.back-link:hover { color: var(--color-primary); }
.rule-detail-heading { align-items: flex-start; }
.rule-detail-heading h1 { max-width: 820px; }
.rule-detail-heading > .actions { margin-top: -4px; }
.rule-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.meta-text { font-size: var(--font-size-sm); line-height: var(--line-height-sm); color: var(--color-text-3); }
.rule-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.rule-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; }
.rule-summary dl { margin: 0; }
.rule-summary dt { margin-bottom: 4px; color: var(--color-text-3); }
.rule-summary dd { margin: 0; line-height: var(--line-height); white-space: pre-wrap; overflow-wrap: anywhere; }
.rule-summary .wide { grid-column: 1 / -1; }
.basis-status { display: block; margin-top: 4px; font-size: var(--font-size-sm); color: var(--color-warning); }
.test-result { padding: 10px 0; border-bottom: 1px solid var(--color-split); }
.test-result:last-child { border-bottom: 0; padding-bottom: 0; }
.test-result .pill-row { margin-bottom: 4px; }
.test-result .pill-row > span:not(.badge) { font-size: var(--font-size-sm); color: var(--color-text-3); }
.test-result .small-note { margin-top: 2px; }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline li { padding: 10px 0; border-bottom: 1px solid var(--color-split); }
.timeline li:first-child { padding-top: 0; }
.timeline li:last-child { border-bottom: 0; padding-bottom: 0; }
.timeline time { display: block; margin-bottom: 2px; font-size: var(--font-size-sm); line-height: var(--line-height-sm); color: var(--color-text-3); }
.source-box { margin-bottom: 8px; padding: 12px; border: 1px solid var(--color-line); border-radius: var(--radius); }

/* ---------- 生成规则 / 审查记录 / 模型设置 ---------- */
.two-column { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.upload-zone { padding: 24px 16px; text-align: center; background: var(--color-fill); border: 1px dashed var(--color-border); border-radius: var(--radius); }
.upload-zone > svg { width: 28px; height: 28px; margin-bottom: 8px; color: var(--color-text-3); stroke-width: 1.5; }
.upload-zone h3 { margin-bottom: 4px; font-weight: 500; }
.upload-zone p { margin: 0 0 16px; font-size: var(--font-size-sm); line-height: var(--line-height-sm); color: var(--color-text-3); }
.upload-row { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.material-list { display: grid; gap: 8px; margin-top: 16px; }
.material-list:empty { display: none; }
.material-option { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--color-line); border-radius: var(--radius); cursor: pointer; }
.material-option:hover { border-color: var(--color-primary-hover); }
.material-option:has(input:checked) { border-color: var(--color-primary); background: var(--color-primary-bg); }
.material-option small { display: block; color: var(--color-text-3); }
.generation-card { padding: 12px; border: 1px solid var(--color-line); border-radius: var(--radius); }
.generation-card + .generation-card { margin-top: 8px; }
.generation-card h3 { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.generation-card .finding-top { margin-bottom: 2px; }
.generation-card p { margin: 8px 0 0; }
.generation-card .actions { margin-top: 8px; }
.info-list { margin: 8px 0; padding-left: 20px; color: var(--color-text-2); }
.setting-panel { max-width: 720px; }
.setting-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.setting-header h2 { margin: 0; }
.field + .settings-key { margin-top: -12px; }
.settings-key { margin-top: 4px; font-size: var(--font-size-sm); line-height: var(--line-height-sm); color: var(--color-text-3); }
.detail-text + .small-note { margin-top: 8px; }

/* ---------- 演示与测试 ---------- */
.demo-toc { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: -4px 0 16px; }
.demo-toc a { color: var(--color-primary); }
.demo-toc a:hover { color: var(--color-primary-hover); }
.demo-doc { max-width: 1080px; }
.demo-section { padding: 20px 24px; }
.demo-section + .demo-section { border-top: 1px solid var(--color-line); }
.demo-section h2 { margin-bottom: 12px; }
.demo-section h3 { margin: 16px 0 8px; font-weight: 500; }
.demo-section p { color: var(--color-text-2); }
.demo-section ol, .demo-section ul { margin: 0 0 12px; padding-left: 20px; }
.demo-section li + li { margin-top: 4px; }
.demo-section > :last-child { margin-bottom: 0; }
.demo-table { margin-bottom: 12px; overflow: auto; border: 1px solid var(--color-line); border-radius: var(--radius); }
.demo-table .data-table th[scope=row] { width: 180px; background: var(--color-fill); font-weight: 400; color: var(--color-text-2); border-bottom: 1px solid var(--color-split); }
.demo-table .data-table tbody tr:hover > td { background: none; }
.demo-actions { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }

/* ---------- 对话框与通知 ---------- */
dialog { width: 560px; max-width: calc(100vw - 32px); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: var(--radius-lg); background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-popup); }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px 12px 24px; border-bottom: 1px solid var(--color-split); }
.dialog-head h2 { margin: 0; font-size: var(--font-size-lg); line-height: 24px; }
.dialog-head button.icon-only { color: var(--color-text-3); }
.dialog-head button.icon-only:hover { color: var(--color-text); }
.dialog-body { padding: 20px 24px 24px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.dialog-error { margin-bottom: 16px; padding: 8px 12px; border: 1px solid var(--color-danger-border); border-radius: var(--radius); background: var(--color-danger-bg); color: var(--color-text); }
.dialog-intro { margin-bottom: 16px; color: var(--color-text-2); }
/* 版本更新提示（REL1） */
.release-notes h3 { margin-top: 0; }
.release-notes ol { margin: 0 0 16px; padding-left: 20px; }
.release-notes li + li { margin-top: 6px; }
.release-note { margin: 0; color: var(--color-text-2); }
.dialog-body .upload-zone input[type=file] { max-width: 360px; }
#notices { position: fixed; top: 16px; left: 50%; z-index: 1100; display: flex; flex-direction: column; align-items: center; gap: 8px; width: max-content; max-width: calc(100vw - 32px); transform: translateX(-50%); pointer-events: none; }
.notice { display: flex; align-items: flex-start; gap: 8px; max-width: 640px; padding: 9px 12px; background: var(--color-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-popup); color: var(--color-text); pointer-events: auto; }
.notice::before { content: ""; flex: none; width: 16px; height: 16px; margin-top: 3px; background: no-repeat center / 16px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%2352c41a'/%3E%3Cpath d='m4.6 8.2 2.3 2.2 4.5-4.6' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.notice.error::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%23ff4d4f'/%3E%3Cpath d='m5.5 5.5 5 5m0-5-5 5' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E"); }
.notice.info::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%235B7FB8'/%3E%3Cpath d='M8 7.2v4' fill='none' stroke='%23fff' stroke-width='1.6' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='4.9' r='.95' fill='%23fff'/%3E%3C/svg%3E"); }
.notice button { width: 22px; height: 22px; padding: 0; border: 0; background: none; color: var(--color-text-3); font-size: 16px; line-height: 22px; }
.notice button:hover { background: none; color: var(--color-text); }

/* ---------- 响应式 ---------- */
@media (min-width: 1650px) {
  :root { --panel-width: 480px; }
  .panel-body { padding-left: 24px; padding-right: 24px; }
  .panel-header, .panel-tabs { padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 1280px) {
  :root { --panel-width: 400px; }
  .document-paper { padding-left: 68px; }
  .mark { left: -50px; }
  .document-table .mark { left: -51px; }
}
@media (max-width: 1200px) {
  :root { --sidebar-width: 176px; --panel-width: 400px; }
  .brand { padding: 0 20px; }
  .nav a { padding: 0 12px; }
  .page { padding: 20px; }
  .document-region { padding: 16px 16px 40px; }
  .document-paper { padding: 40px 32px 56px 64px; }
  .mark { left: -48px; }
  .document-table .mark { left: -49px; }
  .rule-detail-grid, .two-column { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 1000px) {
  :root { --sidebar-width: 56px; --panel-width: 360px; }
  .brand { justify-content: center; padding: 0; }
  .brand-name { font-size: var(--font-size); }
  .brand-name, .nav-text { display: none; }
  .nav a, .demo-entry, .feedback-entry { justify-content: center; padding: 0; }
  .nav a svg { width: 18px; height: 18px; }
}
/* 56px 图标栏（1000px 以下的各页）：图标下一行小字，与工作台页的侧栏相同（U-20）；760px 以下侧栏变成顶栏，只有图标 */
@media (min-width: 761px) and (max-width: 1000px) {
  .nav { align-items: center; padding: 8px 0; }
  .sidebar-footer { padding: 8px 0; }
  .nav a, .demo-entry, .feedback-entry { flex-direction: column; gap: 3px; width: 48px; height: 48px; margin: 0 auto; }
  .nav-text { display: block; font-size: 11px; line-height: 14px; white-space: nowrap; }
}
@media (max-width: 1000px) {
  .page { padding: 20px 16px; }
  .two-column, .rule-detail-grid { grid-template-columns: 1fr; }
  .document-paper { padding: 32px 20px 48px 56px; }
  .mark { left: -42px; }
  .document-table .mark { left: -43px; }
  .document-region { padding: 12px; }
  .panel-body { padding-left: 16px; padding-right: 16px; }
  .panel-header, .panel-tabs { padding-left: 16px; padding-right: 16px; }
  .finding-toolbar { padding-left: 16px; padding-right: 16px; }
  .finding { margin: 0 -16px; }
  .page-heading { gap: 8px; }
  .scope-tabs { gap: 16px; }
}
@media (max-width: 760px) {
  :root { --panel-width: 100%; }
  .shell { grid-template-columns: 1fr; grid-template-rows: 48px minmax(0, 1fr); }
  .sidebar { flex-direction: row; align-items: center; border-right: 0; border-bottom: 1px solid var(--color-line); }
  .brand { display: none; }
  .nav { flex-direction: row; gap: 2px; padding: 0 8px; }
  .nav a { width: 40px; height: 40px; }
  .sidebar-footer { margin: 0 0 0 auto; padding: 0 8px; border-top: 0; }
  .demo-entry, .feedback-entry { width: 40px; height: 40px; }
  .main { height: calc(100vh - 48px); }
  .page { padding: 16px; }
  .page-heading { align-items: flex-start; }
  .toolbar { flex-wrap: wrap; gap: 8px; }
  .toolbar .search-box { width: 100%; }
  .heading-main ~ .actions:has(> .search-box) { flex: 1 1 100%; flex-wrap: nowrap; }
  .page-heading .search-box { flex: 1 1 auto; width: auto; min-width: 0; }
  .data-table td, .data-table th { padding: 10px 12px; }
  .workbench { height: calc(100vh - 48px); }
  .work-header { height: auto; min-height: var(--header-height); padding: 8px 12px 8px 4px; gap: 8px; }
  .work-header .actions { gap: 4px; flex-wrap: nowrap; }
  .work-header .actions :where(button) { padding: 0 10px; }
  .work-header .actions button svg { display: none; }
  .work-header .title { font-size: var(--font-size); }
  .work-header .badge.outline { display: none; }
  .work-header .status-link .status-note { display: none; }
  .locate-narrow { display: inline-flex; }
  .mobile-tabs { display: flex; flex: none; height: 44px; background: var(--color-surface); border-bottom: 1px solid var(--color-line); }
  .mobile-tabs button { width: 50%; height: 44px; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--color-text-2); }
  .mobile-tabs button.active { border-bottom-color: var(--color-primary); color: var(--color-primary); font-weight: 500; }
  .work-grid { display: block; position: relative; overflow: auto; }
  .work-grid .document-region, .work-grid .review-panel { display: none; }
  .work-grid.show-document .document-region { display: block; }
  .work-grid.show-review .review-panel { display: block; }
  .document-region { height: calc(100vh - 150px); padding: 12px 12px 48px; }
  .review-panel { min-height: calc(100vh - 150px); overflow: visible; border: 0; }
  .document-paper { padding: 32px 16px 48px 48px; font-size: 15px; }
  .document-paper .seg-title { font-size: 22px; }
  .mark { left: -36px; }
  .document-table .mark { left: -37px; }
  .form-grid, .rule-summary { grid-template-columns: 1fr; }
  .rule-summary .wide, .full-span { grid-column: auto; }
  .card-pad, .demo-section { padding: 16px; }
  .rule-detail-heading { display: block; }
  .rule-detail-heading .actions { margin-top: 12px; }
  .dialog-body { padding: 16px; }
  .dialog-head { padding: 12px 12px 12px 16px; }
  .file-cell { min-width: 200px; }
  .setting-panel { max-width: 100%; }
  /* 列表工具栏：搜索框一行占满，页签在它下面贴着分隔线 */
  .list-toolbar { flex-wrap: wrap; }
  .list-tools { order: -1; flex: 1 1 100%; }
  .list-tools .search-box { flex: 1 1 auto; width: auto; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
  .spinner { animation: none; }
}

/* ---------- 反馈（U-17） ---------- */
/* 工作台原文里选中文字后的“标为漏报”：挂在 body 上，放在正文右侧留白、与选区第一行同高（--miss-x、--miss-y 由 views/feedback.mjs 写） */
.miss-mark { position: fixed; left: var(--miss-x, 0px); top: var(--miss-y, 0px); z-index: 30; height: 28px; padding: 0 10px; border-color: var(--color-primary); background: var(--color-surface); color: var(--color-primary); font-size: var(--font-size-sm); box-shadow: var(--shadow-popup); }
.miss-mark[hidden] { display: none; }
.feedback-form .segmented span { min-width: 64px; }
.feedback-quote { max-height: 160px; overflow: auto; font-family: var(--font-contract); }
.feedback-form textarea { width: 100%; resize: vertical; }
.feedback-shot { display: flex; align-items: center; gap: 12px; min-width: 0; }
.feedback-shot img { flex: none; width: 64px; height: 48px; object-fit: cover; border: 1px solid var(--color-line); border-radius: var(--radius); }
.feedback-shot-name { min-width: 0; overflow: hidden; color: var(--color-text-2); font-size: var(--font-size-md); text-overflow: ellipsis; white-space: nowrap; }
.feedback-form :where(button).link svg { width: 12px; height: 12px; }
/* 管理页页签“常规 | 反馈”与反馈列表、详情 */
.admin-tabs { display: flex; gap: 20px; margin: -4px 0 16px; border-bottom: 1px solid var(--color-line); }
.admin-tabs a { height: 40px; margin-bottom: -1px; padding: 0 2px; border-bottom: 2px solid transparent; color: var(--color-text-3); font-size: var(--font-size); line-height: 40px; }
.admin-tabs a:hover { color: var(--color-text); }
.admin-tabs a.active { border-bottom-color: var(--color-primary); color: var(--color-text); font-weight: 600; }
.feedback-excerpt { min-width: 240px; overflow-wrap: anywhere; }
.feedback-full { margin: 0 0 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-section .feedback-quote, dialog .feedback-quote { margin-bottom: 16px; }
.feedback-meta { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0 0 16px; font-size: var(--font-size-md); }
.feedback-meta dt { color: var(--color-text-3); }
.feedback-meta dd { margin: 0; overflow-wrap: anywhere; }
.feedback-shot-full { display: block; margin-bottom: 16px; }
.feedback-shot-full img { display: block; max-width: 100%; max-height: 360px; border: 1px solid var(--color-line); border-radius: var(--radius); }
.feedback-table a, .feedback-meta a { color: var(--color-link); }
.feedback-table a:hover, .feedback-meta a:hover { color: var(--color-primary-hover); }
