/* OneStay 管理工作台。统一尺寸以内容可读和多设备比较为准。 */
:root {
  color-scheme: light;
  --canvas: #f5f6f8;
  --surface: #ffffff;
  --surface-subtle: #fafbfc;
  --text: #20242c;
  --muted: #667085;
  --line: #e5e7eb;
  --line-strong: #d0d5dd;
  --active: #edf0f4;
  --accent: #2554b8;
  --good: #16845a;
  --warning: #9b6800;
  --danger: #ba3541;
  --neutral: #7c8594;
  --topbar-height: 56px;
  --sidebar-width: 200px;
  --radius: 6px;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-code: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--canvas); scroll-padding-top: 80px; scrollbar-gutter:stable; }
/* The console has no page-level horizontal navigation. Keep trackpad boundary
   feedback inside a genuine local scroller; preserve vertical scrolling/zoom. */
html, body { overscroll-behavior-x:none; }
.main, .sidebar-nav, .scope-list, .table-wrap, .delivery-table-wrap, .tabs, .dialog { overscroll-behavior-x:none; }
body { margin: 0; color: var(--text); font: 13px/1.6 var(--font-ui); -webkit-font-smoothing: antialiased; }
body, input, select, textarea, button { font-family: var(--font-ui); }
button, input, select, textarea { font-size: 13px; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { max-width: 100%; }
button { color: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { line-height: 1.35; font-weight: 600; }
p { text-wrap: pretty; }
ul, ol { margin-top: 0; }
button, a, summary, input, select, textarea, [tabindex] { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); }
[hidden] { display: none !important; }
button:disabled, input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
button[aria-disabled="true"], a[aria-disabled="true"] { color: var(--muted); cursor: not-allowed; }
::selection { background: #dce7ff; }
.muted, .secondary, .hint { color: var(--muted); }
.small, .help-text, .hint { font-size: 12px; line-height: 1.55; }
.code, code, .mono { font-family: var(--font-code); font-size: .94em; overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.visually-hidden, .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; }
.skip-link { position: fixed; top: -60px; left: 16px; z-index: 100; background: var(--surface); padding: 10px 16px; border: 1px solid var(--accent); }
.skip-link:focus { top: 8px; }

/* 固定导航保持 200px；正文占据余下空间，纵向不锁定屏幕高度。 */
.app { min-height: 100vh; }
.topbar { position: fixed; inset: 0 0 auto; z-index: 30; height: var(--topbar-height); display: flex; align-items: center; gap: 18px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: baseline; gap: 9px; min-width: 152px; color: #1e232b; font-size: 19px; font-weight: 650; letter-spacing: -.55px; }
.brand:hover { text-decoration: none; }
.brand small, .brand-sub { color: var(--muted); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.topbar-title, .topbar-context { padding-left: 20px; border-left: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 16px; margin-left: auto; min-width: 0; }
.topbar-actions > span { font-size: 12px; color: var(--muted); }
.menu-toggle, .menu-button { display: none; }
.topbar .menu-toggle { display: none; }
.sidebar { position: fixed; top: var(--topbar-height); bottom: 0; left: 0; z-index: 25; width: var(--sidebar-width); display: flex; flex-direction: column; background: var(--surface); border-right: 1px solid var(--line); }
.sidebar-header { padding: 20px 18px 8px; }
.sidebar-header p { color: var(--muted); font-size: 12px; }
.sidebar-nav, .sidebar > nav { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 16px 10px; scrollbar-width: thin; scrollbar-color: #d6dae1 transparent; }
.nav-group, .sidebar details { margin: 0 0 14px; }
.nav-group > summary, .sidebar details > summary { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 4px 10px; list-style: none; color: var(--muted); font-size: 11px; font-weight: 500; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
.nav-group > summary::after, .sidebar details > summary::after { content: "›"; margin-left: auto; color: #8f98a5; font-size: 16px; transform: rotate(0); }
.nav-group[open] > summary::after, .sidebar details[open] > summary::after { transform: rotate(90deg); }
.nav-link { display: flex; align-items: center; gap: 9px; min-height: 36px; padding: 7px 10px; margin: 2px 0; border-radius: 4px; color: #46505e; font-size: 13px; line-height: 1.45; }
.nav-link:hover { color: var(--text); background: #f6f7f9; text-decoration: none; }
.nav-link.active, .nav-link[aria-current="page"] { color: #202b3c; background: var(--active); font-weight: 600; }
.nav-count { margin-left: auto; padding-left: 4px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.sidebar-footer, .sidebar-health { flex: none; padding: 14px 18px 16px; background: var(--surface); border-top: 1px solid var(--line); }
.sidebar-footer strong, .sidebar-health strong { display: block; font-size: 12px; font-weight: 500; }
.sidebar-footer small, .sidebar-health small { display: block; padding-top: 2px; color: var(--muted); font-size: 11px; }
.sidebar-footer .status, .sidebar-health .status { font-size: 12px; }
.sidebar-backdrop { display: none; }
.main { min-width: 0; margin-left: var(--sidebar-width); padding: calc(var(--topbar-height) + 24px) 24px 40px; }
.main > .content, .page-content { max-width: 1720px; margin: 0 auto; min-width: 0; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page-heading h1 { font-size: 25px; letter-spacing: -.6px; }
.page-heading p { max-width: 880px; margin-top: 7px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.page-heading .button { flex: none; }
.page-heading .breadcrumb, .breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin: 0 0 10px; color: var(--muted); font-size: 12px; }
.breadcrumb a { color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* 范围层：先选客户和控制端，再进入当前页面的对象目录。 */
.scope-bar { display: flex; align-items: end; flex-wrap: wrap; gap: 14px 18px; margin-bottom: 22px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.scope-bar > label, .scope-bar .field { min-width: 180px; margin: 0; }
.scope-bar > label { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.scope-bar > label > select { flex: 1; width: 180px; min-width: 0; }
.scope-bar select { min-width: 180px; }
.scope-bar .scope-note, .scope-bar > .muted { flex: 1; min-width: 170px; padding-bottom: 8px; font-size: 12px; }
.scope-bar .button { margin-left: auto; }
.scope-label { color: var(--muted); font-size: 12px; }
.workbench { display: grid; grid-template-columns: 220px minmax(0, 1fr); align-items: start; gap: 20px; min-width: 0; }
.scope-rail { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.scope-rail > h2, .scope-rail > h3, .scope-rail > header, .scope-rail-head { padding: 16px 14px 12px; font-size: 13px; }
.scope-rail > p { padding: 0 14px 12px; color: var(--muted); font-size: 12px; }
.scope-rail > details > summary { padding: 14px; font-size: 13px; font-weight: 600; list-style: none; cursor: pointer; border-bottom: 1px solid var(--line); }
.scope-rail > details > summary::after { content: "−"; float: right; color: var(--muted); font-weight: 400; }
.scope-rail > details:not([open]) > summary::after { content: "+"; }
.scope-rail > details:not([open]) > summary { border-bottom: 0; }
.scope-search { padding: 0 12px 12px; }
.scope-search input { width: 100%; }
.scope-list { padding: 6px; max-height: min(560px, calc(100vh - 270px)); overflow-y: auto; scrollbar-width: thin; }
.scope-item { display: block; width: 100%; margin: 2px 0; padding: 11px 10px; color: var(--text); text-align: left; line-height: 1.45; border: 0; border-radius: 4px; background: transparent; }
.scope-item:hover { text-decoration: none; background: #f5f6f8; }
.scope-item.active, .scope-item[aria-current="true"], .scope-item[aria-selected="true"] { background: var(--active); }
.scope-item strong { display: block; font-size: 13px; font-weight: 500; }
.scope-item small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.scope-item .scope-item-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scope-item .count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.scope-item .status { margin-top: 4px; font-size: 11px; }
.scope-rail-foot { padding: 12px 14px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); }
.workarea { min-width: 0; }
.workarea > :last-child { margin-bottom: 0; }
.workspace { min-width: 0; }

/* 公共区块与指标：只靠间距和细分隔线建立层次。 */
.section { min-width: 0; margin-bottom: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 18px 20px 14px; }
.section-head h2 { font-size: 15px; letter-spacing: -.15px; }
.section-head h3 { font-size: 14px; }
.section-head p { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.section-head > .status, .section-head > a { flex: none; margin-top: 1px; }
.section-body { padding: 0 20px 20px; }
.section-body > :last-child { margin-bottom: 0; }
.section-footer { padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.section .section { border-radius: 4px; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.metric { min-width: 0; padding: 18px 20px; border-right: 1px solid var(--line); }
.metric:last-child { border-right: 0; }
.metric > span, .metric > label, .metric .metric-label { display: block; color: var(--muted); font-size: 12px; }
.metric > strong, .metric .metric-value { display: block; margin-top: 7px; font-size: 27px; line-height: 1.25; font-weight: 600; letter-spacing: -.7px; font-variant-numeric: tabular-nums; }
.metric > small, .metric > p { display: block; margin-top: 6px; font-size: 11px; color: var(--muted); }
.metric a { color: inherit; }
.metric .good { color: var(--good); }
.metric .warning { color: var(--warning); }
.metric .danger { color: var(--danger); }
.split { display: grid; grid-template-columns: minmax(0, 2.55fr) minmax(250px, 1fr); gap: 20px; align-items: start; min-width: 0; }
.split.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.split > * { min-width: 0; }
.facts { margin: 0; }
.facts dl, dl.facts { display: grid; grid-template-columns: minmax(120px, .8fr) minmax(0, 1.6fr); margin: 0; }
.facts dt, .facts dd { margin: 0; padding: 10px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.facts dt { color: var(--muted); }
.facts dd { padding-left: 16px; }
.facts dt:last-of-type, .facts dd:last-of-type { border-bottom: 0; }
.fact { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.fact:last-child { border-bottom: 0; }
.fact > span:first-child, .fact > dt { color: var(--muted); flex: none; }
.fact > strong, .fact > dd, .fact > span:last-child { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }
.inline-list { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 12px; }
.inline-list > li { display: inline-flex; align-items: center; gap: 6px; }

/* 文本状态不使用胶囊背景，点形与文字共同传达结论。 */
.status { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; color: var(--neutral); font-size: 12px; line-height: 1.5; font-weight: 500; overflow-wrap: anywhere; }
.status.good { color: var(--good); }
.status.warning { color: var(--warning); }
.status.danger { color: var(--danger); }
.status.neutral { color: var(--neutral); }
.dot { display: inline-block; width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: currentColor; vertical-align: middle; }
.dot.good, .chain-dot.good { color: var(--good); background: var(--good); }
.dot.warning, .chain-dot.warning { color: var(--warning); background: var(--surface); border: 1.5px solid var(--warning); }
.dot.danger, .chain-dot.danger { color: var(--danger); background: var(--danger); border-radius: 1px; }
.dot.neutral, .chain-dot.neutral { color: var(--neutral); background: var(--surface); border: 1px solid var(--neutral); }
.status.warning > .dot { background: transparent; border: 1.5px solid currentColor; }
.status.danger > .dot { border-radius: 1px; }
.status.neutral > .dot { background: transparent; border: 1px solid currentColor; }

/* 表格保留 13px 主值。狭窄视口变为带字段标签的记录，不机械丢列。 */
.table-wrap { width: 100%; min-width: 0; overflow-x: auto; scrollbar-width: thin; }
.data-table { width: 100%; border-collapse: collapse; border-spacing: 0; text-align: left; font-size: 13px; table-layout: auto; }
.data-table thead { background: var(--surface-subtle); }
.data-table th { padding: 11px 16px; color: var(--muted); font-size: 11px; line-height: 1.45; font-weight: 500; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); vertical-align: bottom; }
.data-table td { height: 54px; padding: 12px 16px; line-height: 1.5; border-bottom: 1px solid var(--line); vertical-align: middle; overflow-wrap: anywhere; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fafbfc; }
.data-table tbody tr.selected, .data-table tbody tr[aria-selected="true"] { background: #f0f4fb; }
.data-table th:first-child, .data-table td:first-child { padding-left: 20px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 20px; }
.data-table td:first-child { min-width: 120px; max-width: 240px; }
.data-table th.numeric, .data-table td.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .cell-main, .cell-main { display: block; font-size: 13px; color: var(--text); font-weight: 500; }
.data-table .cell-sub, .cell-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.data-table td > small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.data-table .status { white-space: normal; min-width: 68px; }
.data-table .row-actions { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.data-table .button { min-height: 30px; padding: 4px 10px; font-size: 12px; white-space: nowrap; }
.data-table td[data-label="证据时间"], .data-table td[data-label="时间"] { min-width: 70px; white-space: nowrap; }
.table-row-link { text-decoration: none; font-weight: 500; }
.data-table .selection-cell { width: 36px; min-width: 36px; padding-right: 0; }
.data-table input[type="checkbox"] { width: 15px; height: 15px; margin: 0; }
.table-footnote { padding: 10px 20px; color: var(--muted); font-size: 11px; border-top: 1px solid var(--line); }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 0 20px 14px; }
.toolbar > input[type="search"], .toolbar > .search-field { flex: 1 1 210px; max-width: 400px; }
.toolbar > select { min-width: 130px; }
.toolbar .toolbar-spacer { flex: 1; }
.toolbar .result-count { margin-left: auto; color: var(--muted); font-size: 12px; }
.search-field { position: relative; }
.search-field input { width: 100%; }
.pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pagination-controls { display: flex; align-items: center; gap: 8px; }
.pagination .button { min-height: 32px; padding: 4px 10px; font-size: 12px; }
.pagination select { min-height: 32px; padding: 3px 26px 3px 8px; font-size: 12px; }
.empty { padding: 38px 24px; text-align: center; color: var(--muted); }
.empty h3, .empty strong { display: block; margin-bottom: 7px; color: var(--text); font-size: 14px; font-weight: 500; }
.empty p { max-width: 500px; margin: 0 auto; font-size: 13px; }
.empty .button { margin-top: 16px; }
.data-table td.empty { height: auto; padding: 38px 24px; }

/* 回执：同一阶段纵向对齐，摘要能直接定位首个缺口。 */
.chain-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 16px 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.chain-summary strong { display: block; margin-bottom: 4px; font-size: 14px; font-weight: 600; }
.chain-summary p { color: var(--muted); font-size: 12px; }
.chain-summary .status { flex: none; margin-top: 3px; }
.chain-dot { position: relative; z-index: 1; display: inline-block; width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: var(--neutral); }
.chain-dots { display: flex; align-items: center; gap: 9px; }
.chain-dots .chain-dot + .chain-dot::before { position: absolute; content: ""; right: 12px; top: 4px; width: 6px; height: 1px; background: var(--line-strong); }
.chain-dots .chain-dot.warning::before, .chain-dots .chain-dot.neutral::before { top: 3px; }
.stage-list { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 0; padding: 22px 20px 20px; margin: 0; list-style: none; }
.stage { position: relative; min-width: 0; padding: 0 14px 0 0; }
.stage::before { content: ""; position: absolute; left: 15px; right: 5px; top: 5px; height: 1px; background: var(--line-strong); }
.stage:last-child::before { content: none; }
.stage > .chain-dot { display: block; margin-bottom: 12px; }
.stage > strong, .stage .stage-name { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 500; }
.stage p, .stage > small, .stage .stage-detail { display: block; color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.stage .status { display: block; margin-top: 5px; font-size: 11px; }
.chain-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 20px; padding: 0 20px 16px; color: var(--muted); font-size: 11px; }
.chain-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.stage-list.vertical { display: block; padding: 18px 20px 6px; }
.stage-list.vertical .stage { min-height: 66px; padding: 0 0 20px 26px; }
.stage-list.vertical .stage > .chain-dot { position: absolute; left: 0; top: 5px; margin: 0; }
.stage-list.vertical .stage::before { left: 4px; top: 20px; bottom: 3px; right: auto; width: 1px; height: auto; }
.stage-list.vertical .stage:last-child { min-height: 0; }
.stage-list.vertical .stage > strong { font-size: 13px; }

/* 表单用选择和依赖说明表达能力边界，摘要在宽屏上保持可见。 */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 7px 13px; color: #344054; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 5px; font-size: 13px; line-height: 1.45; font-weight: 500; text-align: center; text-decoration: none; transition: background-color 100ms ease, border-color 100ms ease; }
.button:hover { background: #f7f8fa; border-color: #aeb6c1; text-decoration: none; }
.button.primary { color: #fff; background: #2b3648; border-color: #2b3648; }
.button.primary:hover { background: #1e293a; border-color: #1e293a; }
.button.danger { color: var(--danger); border-color: #e4b9be; background: var(--surface); }
.button.danger:hover { background: #fdf5f5; border-color: #c77983; }
.button.text, .button.link { color: var(--accent); border-color: transparent; background: transparent; padding-left: 5px; padding-right: 5px; }
.button.text:hover, .button.link:hover { background: #f1f4f9; }
.button.icon { width: 36px; padding: 0; }
.button.small { min-height: 30px; padding: 4px 10px; font-size: 12px; }
.button-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea { min-height: 36px; padding: 7px 10px; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 4px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #8992a0; }
input[type="checkbox"], input[type="radio"] { accent-color: #2e579f; vertical-align: middle; }
input[readonly] { background: #f6f7f9 !important; color: var(--muted) !important; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
textarea { display: block; width: 100%; min-height: 96px; resize: vertical; }
select { cursor: pointer; }
.field { display: grid; gap: 6px; margin-bottom: 18px; min-width: 0; }
.field > label, label.field > span:first-child { font-size: 13px; font-weight: 500; }
.field > input, .field > select, .field > textarea { width: 100%; }
.field .hint, .field > small { color: var(--muted); font-size: 12px; line-height: 1.55; }
.field .error { color: var(--danger); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
.form-grid > .full, .form-grid > .full-width { grid-column: 1 / -1; }
.form-grid .field { margin-bottom: 20px; }
.field-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px; }
.field-row > label { display: inline-flex; align-items: center; gap: 6px; }
.notice { margin: 0 0 18px; padding: 13px 16px; background: #f5f7fa; border: 1px solid var(--line); border-radius: 4px; color: #4f5b6d; font-size: 12px; line-height: 1.65; }
.notice strong { color: var(--text); font-weight: 600; }
.notice p + p { margin-top: 5px; }
.notice.warning { color: #80600d; background: #fdfbf4; border-color: #eae2c5; }
.notice.danger { color: #98323c; background: #fdf7f7; border-color: #ecd6d9; }
.notice.good { color: #216f52; background: #f5faf7; border-color: #d4e7db; }
.tabs { display: flex; align-items: stretch; gap: 24px; margin: 0 0 20px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin; }
.tabs > a, .tabs > button { position: relative; flex: none; min-height: 42px; padding: 7px 0 11px; color: var(--muted); background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; font-size: 13px; line-height: 1.5; }
.tabs > a:hover, .tabs > button:hover { color: var(--text); text-decoration: none; }
.tabs > .active, .tabs > [aria-selected="true"], .tabs > [aria-current="page"] { color: var(--text); border-bottom-color: #344054; font-weight: 600; }
.capability-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.capability-table th, .capability-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.capability-table th { color: var(--muted); font-size: 11px; font-weight: 500; }
.capability-table td:first-child { width: 32px; }
.capability-table tr:last-child td { border-bottom: 0; }
.capability-table small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.module-option { position: relative; display: grid; grid-template-columns: 17px minmax(0, 1fr); align-items: start; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); cursor: pointer; }
.module-option:hover { border-color: #b5c1d1; }
.module-option:has(input:checked) { border-color: #a7b8d5; background: #f8faff; }
.module-option:has(input:disabled) { cursor: default; }
.module-option input { width: 15px; height: 15px; margin: 3px 0 0; }
.module-option strong { display: block; font-size: 13px; font-weight: 500; }
.module-option small, .module-option p { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.module-option code { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.module-option .dependency { margin-top: 7px; color: #52678d; font-size: 11px; }
.wizard { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 24px; min-width: 0; }
.wizard-main, .wizard-content { min-width: 0; }
.wizard-summary { position: sticky; top: 80px; min-width: 0; }
.wizard-summary .facts { padding: 0 18px 14px; }
.wizard-summary .fact { gap: 16px; font-size: 12px; }
.wizard-summary .fact > span:first-child { max-width: 108px; }
.wizard-summary .section-head { padding-left: 18px; padding-right: 18px; }
.stepper { display: flex; align-items: stretch; margin: 0 0 24px; padding: 0; list-style: none; border-bottom: 1px solid var(--line); }
.stepper > li, .stepper > button { display: flex; align-items: center; gap: 9px; flex: 1; min-height: 48px; padding: 10px 12px; color: var(--muted); border: 0; border-bottom: 2px solid transparent; background: transparent; font-size: 13px; text-align: left; }
.stepper > .active, .stepper > [aria-current="step"] { color: var(--text); border-bottom-color: #344054; font-weight: 600; }
.stepper .step-number { display: inline-flex; justify-content: center; align-items: center; width: 22px; height: 22px; flex: none; background: #edf0f4; border-radius: 4px; font-size: 12px; }
.stepper .active .step-number { color: #fff; background: #344054; }
.wizard-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.wizard-actions .button.primary { min-width: 140px; }
.wizard-actions > .muted { flex: 1; font-size: 12px; }
.wizard-summary .wizard-actions { display: grid; grid-template-columns: 1fr; }
.wizard-summary .wizard-actions .button { width: 100%; }
.base-capabilities { border-top: 1px solid var(--line); }
.base-capabilities > summary { padding: 12px 0; cursor: pointer; color: var(--muted); font-size: 12px; }
.base-capabilities .inline-list { padding-bottom: 14px; }

/* 详情抽屉与确认窗保留上下文；原生 dialog 负责遮罩和焦点范围。 */
.dialog { width: min(560px, calc(100vw - 40px)); max-height: calc(100dvh - 64px); padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; box-shadow: 0 20px 64px rgb(16 24 40 / 16%); overflow: auto; }
.dialog::backdrop, .detail-drawer::backdrop { background: rgb(20 28 42 / 28%); }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding: 22px 24px 16px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin-top: 3px; font-size: 19px; letter-spacing: -.3px; }
.dialog-head p { margin-top: 6px; color: var(--muted); font-size: 12px; }
.dialog-head .button { flex: none; }
.dialog-body { padding: 22px 24px; }
.dialog-body > :last-child { margin-bottom: 0; }
.dialog-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); background: var(--surface-subtle); }
.detail-drawer { position: fixed; inset: 0 0 0 auto; width: 560px; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; padding: 0; color: var(--text); background: var(--surface); border: 0; border-left: 1px solid var(--line-strong); border-radius: 0; box-shadow: -12px 0 48px rgb(16 24 40 / 12%); overflow: auto; }
.detail-drawer .dialog-head { position: sticky; top: 0; z-index: 3; padding: 21px 24px 18px; background: var(--surface); }
.detail-drawer .dialog-head h2 { font-size: 20px; }
.detail-drawer .dialog-body { padding: 20px 24px 28px; }
.detail-drawer .dialog-actions { position: sticky; bottom: 0; z-index: 3; background: var(--surface); }
.detail-drawer .section { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; margin-bottom: 22px; padding-bottom: 10px; }
.detail-drawer .section-head { padding: 0 0 14px; }
.detail-drawer .section-body { padding: 0 0 12px; }
.detail-drawer .section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.timeline { margin: 0; padding: 0; list-style: none; }
.timeline > li, .timeline-item { position: relative; padding: 0 0 22px 24px; }
.timeline > li::before, .timeline-item::before { content: ""; position: absolute; left: 3px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.timeline > li:last-child::before, .timeline-item:last-child::before { content: none; }
.timeline > li::after, .timeline-item::after { content: ""; position: absolute; left: 0; top: 7px; width: 7px; height: 7px; border: 1px solid var(--neutral); border-radius: 50%; background: var(--surface); }
.timeline > li.good::after, .timeline-item.good::after { border-color: var(--good); background: var(--good); }
.timeline > li.warning::after, .timeline-item.warning::after { border-color: var(--warning); }
.timeline > li.danger::after, .timeline-item.danger::after { border-color: var(--danger); background: var(--danger); border-radius: 1px; }
.timeline strong { display: block; font-size: 13px; font-weight: 500; }
.timeline time { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; }
.timeline p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 60; width: max-content; max-width: min(460px, calc(100vw - 32px)); padding: 12px 16px; color: #fff; background: #2b3648; border-radius: 5px; box-shadow: 0 6px 24px rgb(16 24 40 / 12%); font-size: 13px; }

/* 当前模板结构的明确映射。 */
.brand { align-items: center; }
.brand > strong { font-size: 19px; font-weight: 650; }
.brand > span { color: var(--muted); font-size: 12px; font-weight: 400; letter-spacing: 0; }
.topbar-meta { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.topbar-meta > span { color: var(--muted); font-size: 11px; }
button.sidebar-footer { text-align: left; border: 0; border-top: 1px solid var(--line); }
button.sidebar-footer:hover { background: var(--surface-subtle); }
.page-heading .eyebrow { margin: 0 0 5px; font-size: 11px; line-height: 1.5; }
.scope-bar > small { padding-bottom: 9px; color: var(--muted); font-size: 11px; }
.rail-search { width: calc(100% - 24px); margin: 12px; }
.scope-rail details + details { border-top: 1px solid var(--line); }
.scope-rail > details > .scope-item { width: calc(100% - 12px); margin-left: 6px; margin-right: 6px; }
.scope-rail summary > span { padding-left: 4px; color: var(--muted); font-size: 11px; font-weight: 400; }
.section > .toolbar:first-child { padding-top: 16px; }
.toolbar label:not(.search-field) { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.toolbar label select { max-width: 100%; }
.pagination > label { display: inline-flex; align-items: center; gap: 6px; }
dl.facts { display: block; padding: 0 20px 16px; }
.facts > .fact { display: grid; grid-template-columns: minmax(120px, 180px) minmax(0, 1fr); gap: 24px; padding: 10px 0; }
.facts > .fact > dt, .facts > .fact > dd { padding: 0; margin: 0; border: 0; font-size: 13px; }
.facts > .fact > dt { max-width: none; white-space: normal; }
.facts > .fact > dd { min-width: 0; text-align: left; }
.diagnostic-context > .facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 24px; padding-bottom: 20px; }
.diagnostic-context .fact { display: block; padding: 0; border: 0; }
.diagnostic-context .fact > dt { max-width: none; margin-bottom: 4px; font-size: 11px; }
.diagnostic-context .fact > dd { text-align: left; font-size: 12px; }
.backbar { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.backbar > span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
button.chain-summary { display: grid; grid-template-columns: minmax(110px, 1fr) minmax(260px, 2.2fr) minmax(90px, .9fr); align-items: center; width: 100%; gap: 16px; margin: 0; text-align: left; color: var(--text); background: var(--surface); border: 0; border-top: 1px solid var(--line); }
button.chain-summary:hover { background: var(--surface-subtle); }
button.chain-summary > div > small { display: block; color: var(--muted); font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
button.chain-summary > span { justify-self: end; }
button.chain-summary > div > strong { font-size: 13px; }
.chain-summary .chain-dots { width: 100%; justify-content: space-between; gap: 0; }
.chain-summary .chain-dot { display: flex; flex-direction: column; align-items: center; flex: 1; width: auto; height: auto; border: 0; border-radius: 0; background: transparent; }
.chain-summary .chain-dot .dot { position: relative; z-index: 1; width: 7px; height: 7px; flex-basis: 7px; }
.chain-summary .chain-dot.warning .dot { background: var(--surface); border: 1.5px solid currentColor; }
.chain-summary .chain-dot.neutral .dot { background: var(--surface); border: 1px solid currentColor; }
.chain-summary .chain-dot.danger .dot { border-radius: 1px; }
.chain-summary .chain-dot > small { display: block; margin-top: 8px; color: var(--muted); font-size: 10px; line-height: 1.3; white-space: nowrap; }
.chain-summary .chain-dot + .chain-dot::before { right: calc(50% + 7px); top: 3px; width: calc(100% - 14px); }
.overview-release { padding: 12px 20px; border-top: 1px solid var(--line); }
.overview-release > small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; }
.overview-release > strong { display: block; font-family: var(--font-code); font-size: 14px; font-weight: 500; }
.overview-release > p { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.65; }
.overview-release > .button { margin-top: 9px; font-size: 12px; min-height: 30px; padding-top: 4px; padding-bottom: 4px; }
.attention-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.attention-item { min-width: 0; padding: 18px 20px; border: 0; border-right: 1px solid var(--line); background: transparent; text-align: left; }
.attention-item:last-child { border-right: 0; }
.attention-item:hover { background: var(--surface-subtle); }
.attention-item > strong { display: block; font-size: 24px; line-height: 1.35; font-weight: 600; }
.attention-item > strong > span { display: block; margin-top: 9px; font-size: 13px; font-weight: 500; }
.attention-item > small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.stage-list:has(.stage > span) { display: block; padding: 0; }
.stage-list .stage:has(> span) { display: grid; grid-template-columns: 10px minmax(150px, 1.1fr) 90px minmax(140px, 1fr); align-items: center; gap: 14px; min-height: 65px; padding: 13px 20px; border-top: 1px solid var(--line); }
.stage-list .stage:has(> span)::before { display: none; }
.stage-list .stage > span > strong { display: block; font-size: 13px; font-weight: 500; }
.stage-list .stage > span > code { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.stage-list .stage > span:nth-of-type(2) { font-size: 12px; }
.stage-list .stage > .dot { width: 7px; height: 7px; flex-basis: 7px; }
.stage-list .stage.good > .dot { background: var(--good); }
.stage-list .stage.warning > .dot { background: transparent; border: 1.5px solid var(--warning); }
.stage-list .stage.danger > .dot { background: var(--danger); border-radius: 1px; }
.stage-list .stage.neutral > .dot { background: transparent; border: 1px solid var(--neutral); }
.stage-list .stage.good > span:nth-of-type(2) { color: var(--good); }
.stage-list .stage.warning > span:nth-of-type(2) { color: var(--warning); }
.stage-list .stage.danger > span:nth-of-type(2) { color: var(--danger); }
.stage-list .stage.neutral > span:nth-of-type(2) { color: var(--muted); }
#dialogBody { padding: 6px 24px 22px; }
#dialog > form > .section-head { padding: 20px 24px 18px; }
#dialog > form > .section-head h2 { font-size: 19px; }
#dialogBody > .facts { padding-left: 0; padding-right: 0; }
#dialogBody > :last-child { margin-bottom: 0; }
.wizard#licenseForm { display: block; max-width: 1120px; margin: 0 auto; }
.main:has(#licenseForm) > #scopeBar { display: none; }
.wizard#licenseForm > .section > .form-grid { padding: 0 20px 2px; }
.wizard#licenseForm > .section > .module-grid { padding: 0 20px 20px; }
.wizard#licenseForm > .section > .notice { margin: 0 20px 20px; }
.stepper > span { flex: 1; min-height: 48px; padding: 10px 12px; color: var(--muted); border-bottom: 2px solid transparent; font-size: 13px; }
.stepper > span[aria-current="step"] { color: var(--text); border-bottom-color: #344054; font-weight: 600; }
.wizard#licenseForm > .wizard-actions { position: sticky; bottom: 0; z-index: 10; border: 1px solid var(--line); border-radius: 4px; }
.wizard-actions > span { flex: 1; text-align: center; color: var(--muted); font-size: 12px; }
.profile-matrix { margin-top: 16px; border-top: 1px solid var(--line); }
.profile-matrix > div { display: grid; grid-template-columns: 65px 76px minmax(0, 1fr); align-items: start; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.profile-matrix > div > span { color: var(--muted); font-family: var(--font-code); font-size: 12px; }
.profile-matrix > div > small { color: var(--muted); font-size: 12px; line-height: 1.6; }
#dialogBody > p { margin-bottom: 16px; color: var(--muted); font-size: 13px; }
#dialogBody > .module-grid { margin: 18px 0; }
#buildError:empty { display: none; }
#buildError { color: var(--danger); }
.auth-view .sidebar, .auth-view #scopeBar, .auth-view .page-heading, .auth-view .topbar-meta { display: none; }
.auth-view .topbar .menu-toggle { display: none; }
.auth-view .main { margin: 0; min-height: 100vh; padding: 112px 20px 48px; }
.auth-panel { width: 420px; max-width: 100%; margin: 0 auto; }
.auth-panel .section-head { padding: 24px 28px 20px; }
.auth-panel .section-head h2 { font-size: 21px; }
.auth-panel form { padding: 0 28px 24px; }
.auth-panel form > .button { width: 100%; }
.auth-panel .toolbar { justify-content: space-between; margin-top: 16px; padding: 0; font-size: 12px; }

@media (min-width: 1680px) {
  .main { padding-left: 32px; padding-right: 32px; }
  .workbench { grid-template-columns: 240px minmax(0, 1fr); gap: 24px; }
  .wizard { grid-template-columns: minmax(0, 1fr) 330px; }
}

@media (min-width: 1101px) and (max-width: 1360px) {
  .scope-bar { gap: 12px; }
  .scope-bar > label { min-width: 0; }
  .scope-bar > label > select { width: 155px; }
  .scope-bar .scope-note { min-width: 0; }
}

@media (max-width: 1200px) {
  .main { padding-left: 20px; padding-right: 20px; }
  .workbench { grid-template-columns: 200px minmax(0, 1fr); gap: 16px; }
  .split { grid-template-columns: minmax(0, 2fr) minmax(230px, 1fr); gap: 16px; }
  .metric { padding: 16px; }
  .data-table th, .data-table td { padding-left: 12px; padding-right: 12px; }
  .data-table th:first-child, .data-table td:first-child { padding-left: 16px; }
  .data-table th:last-child, .data-table td:last-child { padding-right: 16px; }
  .wizard { grid-template-columns: minmax(0, 1fr) 280px; gap: 18px; }
  .module-grid { grid-template-columns: 1fr; }
  .stage-list { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 24px; }
  .stage:nth-child(4n)::before { content: none; }
}

@media (max-width: 1024px) {
  .split { grid-template-columns: 1fr; }
  .split.equal { grid-template-columns: 1fr; }
  .workbench .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .workbench .metric:nth-child(2n) { border-right: 0; }
  .workbench .metric:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .wizard { grid-template-columns: 1fr; }
  .wizard-summary { position: static; }
  .wizard-summary .wizard-actions { display: flex; }
  .wizard-summary .wizard-actions .button { width: auto; }
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scope-bar > label, .scope-bar .field { min-width: 160px; }
  .scope-bar select { min-width: 160px; }
  button.chain-summary { grid-template-columns: minmax(120px, 1fr) minmax(260px, 2.2fr) minmax(90px, .9fr); }
  .attention-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attention-item:nth-child(2) { border-right: 0; }
  .attention-item:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 1100px) {
  .workbench { grid-template-columns: 1fr; gap: 18px; }
  .scope-rail .scope-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: 212px; padding: 6px; }
  .scope-rail > details:not([open]) > summary { padding: 12px 14px; }
  .scope-bar { gap: 10px 12px; }
  .scope-bar > label { flex: 1 1 200px; min-width: 0; }
  .scope-bar .scope-note { flex: 1 1 240px; padding-bottom: 7px; }
  .scope-bar > label > select { width: 130px; min-width: 0; }
  .scope-rail-foot { display: none; }
}

@media (max-width: 900px) {
  .topbar { padding: 0 18px; gap: 12px; }
  .brand { min-width: 0; font-size: 18px; }
  .brand small { display: none; }
  .topbar-context, .topbar-title { display: none; }
  .menu-toggle, .menu-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); }
  .topbar .menu-toggle { display: inline-flex; }
  .sidebar { width: 240px; transform: translateX(-100%); visibility: hidden; transition: transform 140ms ease, visibility 140ms ease; }
  body.nav-open .sidebar, .sidebar.open, .sidebar[data-open="true"] { transform: translateX(0); visibility: visible; }
  body.nav-open .sidebar-backdrop { display: block; position: fixed; inset: var(--topbar-height) 0 0; z-index: 24; background: rgb(20 28 42 / 28%); }
  #navBackdrop:not([hidden]) { display: block; position: fixed; inset: var(--topbar-height) 0 0; z-index: 24; background: rgb(20 28 42 / 28%); }
  .main { margin-left: 0; padding: 78px 20px 32px; }
  .page-heading { margin-bottom: 18px; }
  .workbench { grid-template-columns: 1fr; gap: 18px; }
  .scope-rail { width: 100%; }
  .scope-rail .scope-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: 212px; padding: 6px; }
  .scope-rail > h2, .scope-rail > h3, .scope-rail-head { padding: 12px 14px 6px; }
  .scope-rail-foot { display: none; }
  .scope-item { min-height: 70px; }
  .scope-bar { margin-bottom: 18px; }
  .scope-bar .scope-note { flex-basis: 100%; padding-bottom: 0; }
  .scope-bar .button { margin-left: 0; }
  .workbench .metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .workbench .metric:nth-child(2n) { border-right: 1px solid var(--line); }
  .workbench .metric:nth-child(-n + 2) { border-bottom: 0; }
  .workbench .metric:last-child { border-right: 0; }
  .wizard-actions { position: sticky; bottom: 0; z-index: 10; }
}

@media (max-width: 700px) {
  body { font-size: 13px; }
  .topbar { height: 56px; padding: 0 14px; }
  .topbar-actions { gap: 10px; }
  .topbar-actions > span { display: none; }
  .topbar-actions .button { min-height: 36px; padding: 6px 9px; font-size: 12px; }
  .topbar-meta { gap: 8px; }
  .topbar-meta > span { display: none; }
  .topbar-meta .button { min-height: 36px; padding: 6px 9px; font-size: 12px; }
  .brand > span { display: none; }
  .brand > svg { width: 25px; height: 25px; }
  .brand > strong { font-size: 17px; }
  .main { padding: 76px 14px 28px; }
  .page-heading { flex-wrap: wrap; gap: 14px; }
  .page-heading h1 { font-size: 23px; letter-spacing: -.4px; }
  .page-heading p { font-size: 13px; line-height: 1.65; }
  .page-actions { flex-wrap: wrap; }
  .scope-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 12px; }
  .scope-bar > label, .scope-bar .field, .scope-bar select { width: 100%; min-width: 0; }
  .scope-bar > label { display: grid; grid-template-columns: 48px minmax(0, 1fr); align-items: center; grid-column: 1 / -1; gap: 8px; }
  .scope-bar > label > select { width: 100%; min-width: 0; min-height: 36px; }
  .scope-bar .scope-note, .scope-bar > .muted { display: none; }
  .scope-bar > .button { grid-column: 2; grid-row: 4; justify-self: end; min-height: 34px; margin: 0; padding-top: 4px; padding-bottom: 4px; }
  .scope-bar > small { grid-column: 1; grid-row: 4; padding-bottom: 0; align-self: center; }
  .scope-rail .scope-list { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 196px; }
  .scope-item { min-height: 68px; padding: 10px 8px; }
  .metrics, .workbench .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 18px; }
  .metric { padding: 15px 16px; }
  .metric:nth-child(2n), .workbench .metric:nth-child(2n) { border-right: 0; }
  .metric:nth-child(-n + 2), .workbench .metric:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .metric > strong, .metric .metric-value { font-size: 25px; }
  .section { margin-bottom: 18px; }
  .section-head { padding: 16px 16px 13px; gap: 12px; }
  .section-head h2 { font-size: 15px; }
  .section-head > a { max-width: 100px; text-align: right; font-size: 12px; }
  .section-body { padding: 0 16px 18px; }
  .section-footer { padding: 12px 16px; }
  .toolbar { padding: 0 16px 13px; gap: 10px; }
  .toolbar > input[type="search"], .toolbar > .search-field { max-width: none; flex-basis: 100%; }
  .toolbar > select { min-width: 0; flex: 1 1 110px; }
  .toolbar .result-count { flex-basis: auto; margin-left: auto; font-size: 11px; }
  .toolbar label:not(.search-field) > select { padding-left: 8px; padding-right: 8px; font-size: 12px; }
  .table-wrap { overflow: visible; }
  .data-table, .data-table tbody { display: block; width: 100%; }
  .data-table thead { display: none; }
  .data-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; row-gap: 12px; padding: 16px; border-top: 1px solid var(--line); }
  .data-table th, .data-table td { display: block; width: auto; min-width: 0; max-width: none; height: auto; padding: 0 !important; border: 0; font-size: 13px; }
  .data-table td:first-child { grid-column: 1 / -1; min-width: 0; max-width: none; }
  .data-table td:first-child { order: -2; }
  .data-table td[data-label="状态"], .data-table td[data-label="当前状态"], .data-table td[data-label="运行状态"], .data-table td[data-label="结果"] { order: -1; grid-column: 1 / -1; }
  .data-table td::before { content: attr(data-label); display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.4; }
  .data-table td:not([data-label])::before, .data-table td[data-label=""]::before { display: none; }
  .data-table td.numeric { text-align: left; }
  .data-table td:last-child { grid-column: 1 / -1; order: 2; }
  .data-table td[data-label="操作"]::before { display: none; }
  .data-table td:last-child .button { min-height: 40px; }
  .data-table .selection-cell { width: auto; grid-column: auto; }
  .data-table td.selection-cell + td { grid-column: 1 / -1; }
  .data-table .selection-cell::before { display: none; }
  .data-table td.empty { grid-column: 1 / -1; padding: 18px 8px !important; }
  .data-table td.empty::before { display: none; }
  .data-table tr:has(td[colspan]) { grid-template-columns: 1fr; }
  .data-table td[colspan] { grid-column: 1 / -1; }
  .pagination { padding: 13px 16px; }
  .pagination-controls { width: 100%; flex-wrap: wrap; }
  .pagination .button, .pagination select { min-height: 40px; }
  .pagination-controls > .button:first-of-type { margin-left: auto; }
  .table-footnote { padding: 10px 16px; }
  .button { min-height: 40px; }
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { min-height: 40px; }
  .chain-summary { flex-direction: column; gap: 10px; padding: 14px 16px; }
  .chain-summary .status { margin: 0; }
  .stage-list { display: block; padding: 18px 16px 6px; }
  .stage { min-height: 68px; padding: 0 0 22px 28px; }
  .stage > .chain-dot { position: absolute; left: 1px; top: 5px; margin: 0; }
  .stage::before, .stage:nth-child(4n)::before { content: ""; left: 5px; top: 20px; bottom: 3px; right: auto; width: 1px; height: auto; }
  .stage:last-child::before { content: none; }
  .stage:last-child { min-height: 0; padding-bottom: 14px; }
  .stage > strong, .stage .stage-name { font-size: 13px; }
  .stage p, .stage > small, .stage .stage-detail { font-size: 12px; }
  .stage .status { display: inline-flex; margin-top: 4px; font-size: 12px; }
  .chain-legend { padding-left: 16px; padding-right: 16px; gap: 8px 14px; }
  .chain-dots { gap: 8px; }
  .chain-dots .chain-dot + .chain-dot::before { right: 11px; width: 5px; }
  button.chain-summary { grid-template-columns: minmax(0, 1fr) auto; gap: 16px; }
  button.chain-summary > .chain-dots { grid-row: 2; grid-column: 1 / -1; padding-bottom: 3px; }
  button.chain-summary > span { grid-column: 2; grid-row: 1; }
  .chain-summary .chain-dot + .chain-dot::before { right: calc(50% + 7px); top: 3px; width: calc(100% - 14px); }
  .attention-item { padding: 16px; }
  .attention-item > strong { font-size: 23px; }
  .attention-item > strong > span { font-size: 12px; }
  .attention-item > small { font-size: 11px; }
  .diagnostic-context > .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; padding-left: 16px; padding-right: 16px; }
  .stage-list .stage:has(> span) { grid-template-columns: 10px minmax(0, 1fr) auto; align-items: start; gap: 6px 12px; padding: 13px 16px; }
  .stage-list .stage > .dot { margin-top: 6px; }
  .stage-list .stage:has(> span) > small { grid-column: 2 / -1; font-size: 11px; }
  .stage-list .stage > span:nth-of-type(2) { margin-top: 1px; white-space: nowrap; }
  .tabs { gap: 22px; margin-bottom: 18px; }
  .tabs > a, .tabs > button { min-height: 44px; }
  .form-grid, .module-grid { grid-template-columns: 1fr; }
  .form-grid { gap: 0; }
  .module-option { padding: 14px; }
  .stepper { margin-bottom: 18px; }
  .stepper > li, .stepper > button { gap: 6px; padding: 9px 6px; font-size: 12px; }
  .stepper .step-number { width: 20px; height: 20px; }
  .stepper > span { padding: 10px 5px; font-size: 12px; }
  .wizard { gap: 18px; }
  .wizard-actions { padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .wizard-actions .button.primary { flex: 1; }
  .wizard-summary .wizard-actions .button.primary { width: auto; }
  .facts dl, dl.facts { grid-template-columns: minmax(96px, .85fr) minmax(0, 1.5fr); }
  .facts dd { padding-left: 12px; }
  .fact { gap: 14px; }
  .facts > .fact { grid-template-columns: minmax(96px, .8fr) minmax(0, 1.6fr); gap: 14px; }
  .notice { padding: 12px 14px; }
  .dialog { width: calc(100vw - 24px); max-height: calc(100dvh - 32px); }
  .dialog-head, .detail-drawer .dialog-head { padding: 18px 18px 14px; }
  .dialog-body, .detail-drawer .dialog-body { padding: 18px; }
  .dialog-actions, .detail-drawer .dialog-actions { padding: 12px 18px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .dialog-head .button.icon, .detail-drawer .button.icon { width: 40px; min-height: 40px; }
  .detail-drawer { width: min(560px, 100vw); }
  .toast { right: 16px; bottom: 16px; }
  #dialogBody { padding: 4px 18px 18px; }
  #dialog > form > .section-head { padding: 18px; }
  .backbar { align-items: flex-start; flex-direction: column; gap: 8px; margin-bottom: 16px; }
  .wizard#licenseForm > .section > .form-grid { padding-left: 16px; padding-right: 16px; }
  .wizard#licenseForm > .section > .module-grid { padding-left: 16px; padding-right: 16px; }
  .wizard#licenseForm > .section > .notice { margin-left: 16px; margin-right: 16px; }
  .profile-matrix > div { grid-template-columns: 55px 65px minmax(0, 1fr); gap: 8px; }
  .auth-view .main { padding: 86px 14px 30px; }
  .auth-panel .section-head { padding: 22px 22px 18px; }
  .auth-panel form { padding-left: 22px; padding-right: 22px; }
}

@media (max-width: 390px) {
  .scope-bar > label, .scope-bar .field { display: grid; grid-template-columns: 46px minmax(0, 1fr); align-items: center; gap: 8px; }
  .scope-rail .scope-list { grid-template-columns: 1fr; max-height: 172px; }
  .scope-item { min-height: 54px; }
  .scope-item strong { font-size: 13px; }
  .scope-item small { margin-top: 2px; }
  .topbar-actions { gap: 6px; }
  .metric { padding: 14px; }
  .stepper > li, .stepper > button { align-items: flex-start; flex-direction: column; gap: 5px; }
  .data-table tr { column-gap: 12px; }
  .data-table .row-actions { gap: 7px; }
  .dialog-actions .button { flex: 1; }
}

/* 桌面目录在表格内浏览记录，分页保持在工作区底部可达。 */
@media (min-width: 701px) {
  [data-list] > .table-wrap {
    max-height: var(--table-height, clamp(220px, calc(100dvh - 510px), 620px));
    overflow: auto;
    overscroll-behavior: none contain;
    scrollbar-gutter: stable;
  }
  [data-list] > .table-wrap .data-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface-subtle);
    box-shadow: 0 1px 0 var(--line);
  }
  [data-list] > .pagination { min-height: 57px; }
}

@media (min-width: 1101px) {
  [data-list] > .table-wrap {
    max-height: var(--table-height, clamp(240px, calc(100dvh - 460px), 620px));
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  :root { --canvas: #fff; }
  .topbar, .sidebar, .scope-bar, .page-actions, .toolbar, .pagination, .wizard-actions, .toast { display: none !important; }
  .main { margin: 0; padding: 0; }
  .workbench, .split, .wizard { display: block; }
  .scope-rail { display: none; }
  .section { break-inside: avoid; }
  .data-table { display: table; }
  .data-table thead { display: table-header-group; }
  .data-table tbody { display: table-row-group; }
  .data-table tr { display: table-row; }
  .data-table th, .data-table td { display: table-cell; padding: 8px !important; }
  .data-table td::before { display: none; }
  [data-list] > .table-wrap { max-height: none; overflow: visible; }
  [data-list] > .table-wrap .data-table th { position: static; }
  a { color: inherit; }
}

.fact-list > summary { cursor: pointer; color: var(--ink); font-weight: 600; }
.fact-list ul { max-height: 240px; overflow: auto; padding-left: 18px; margin: 8px 0 0; }
.fact-list li { margin: 5px 0; overflow-wrap: anywhere; }
[data-filter-pending] .result-count::after { content: " · 检索中"; color: #667085; }
.preview-save-notice[hidden] { display: none !important; }
.preview-save-notice { position: fixed; z-index: 80; left: max(16px, calc(50vw - 300px)); right: max(16px, calc(50vw - 300px)); bottom: 16px; display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; padding: 16px; border: 1px solid #cba24b; background: #fffbf1; color: #613f0f; box-shadow: 0 8px 28px rgb(0 0 0 / 10%); }
.preview-save-notice strong { font-size: 14px; }
.preview-save-notice span { font-size: 13px; grid-column: 1; }
.preview-save-notice button { grid-column: 2; grid-row: 1 / 3; align-self: center; }
@media (min-width:701px) {
  #devicePicker { width:420px; min-width:0; max-width:100%; }
}
/* Wide workbenches use stable semantic columns, not repeated intrinsic sizing
   across every text cell. Compact layouts retain their existing adaptive table. */
@media (min-width:1280px) {
  [data-list] .data-table { table-layout:fixed; }
  [data-list] .data-table th:last-child { width:84px; }
  [data-list] td[data-label="时间"] { white-space:normal; }
  [data-list="agents"] th:nth-child(4) { width:80px; }
  [data-list="agents"] th:nth-child(5) { width:100px; }
  [data-list="agents"] th:nth-child(6) { width:136px; }
  [data-list="controllers"] th:nth-child(2) { width:152px; }
  [data-list="controllers"] th:nth-child(3) { width:136px; }
  [data-list="controllers"] th:nth-child(5) { width:64px; }
  [data-list="controllers"] th:nth-child(6) { width:112px; }
  [data-list="customers"] th:nth-child(2) { width:112px; }
  [data-list="customers"] th:nth-child(4), [data-list="customers"] th:nth-child(5), [data-list="customers"] th:nth-child(6) { width:64px; }
  [data-list="licenses"] th:nth-child(3), [data-list="licenses"] th:nth-child(4) { width:80px; }
  [data-list="licenses"] th:nth-child(5) { width:96px; }
  [data-list="licenses"] th:nth-child(6) { width:112px; }
  [data-list="licenses"] th:nth-child(7) { width:88px; }
  [data-list="audit"] th:nth-child(2) { width:148px; }
  [data-list="audit"] th:nth-child(5) { width:120px; }
  [data-list="audit"] th:nth-child(6) { width:112px; }
  [data-list="qvm"] th:nth-child(4) { width:112px; }
  [data-list="qvm"] th:nth-child(5) { width:104px; }
  [data-list="qvm"] th:nth-child(6) { width:136px; }
  [data-list="offsets"] th:nth-child(4) { width:88px; }
  [data-list="offsets"] th:nth-child(5) { width:124px; }
  [data-list="offsets"] th:nth-child(6) { width:160px; }
  [data-list="generations"] th:nth-child(2) { width:88px; }
  [data-list="generations"] th:nth-child(3), [data-list="generations"] th:nth-child(4) { width:112px; }
  [data-list="generations"] th:nth-child(6) { width:136px; }
}
@media (min-width:1280px) and (max-width:1360px) {
  [data-list] .data-table th, [data-list] .data-table td { padding-left:12px; padding-right:12px; }
}
@media (max-width:700px) {
  .device-search > label:not(.search-field) { display:grid; grid-template-columns:54px minmax(0,1fr); width:100%; min-width:0; }
  #devicePicker { min-width:0; width:100%; }
}
