:root {
  color-scheme: light;
  --primary: #0867cf;
  --primary-hover: #0755aa;
  --primary-soft: #eaf3ff;
  --ink: #172b46;
  --muted: #5b6b80;
  --line: #dce4ee;
  --bg: #f3f6fa;
  --surface: #fff;
  --green: var(--primary);
  --soft: var(--primary-soft);
  --red: #b42335;
  --radius: 12px;
  --header-height: 56px;
  --motion-fast: 160ms;
  --family-telecom: #0d7075;
  --family-mobile: var(--primary);
  --family-unicom: #7054a3;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 88px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, summary { touch-action: manipulation; }
button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-weight: 500; cursor: pointer; transition: color var(--motion-fast), background-color var(--motion-fast), border-color var(--motion-fast), box-shadow var(--motion-fast); }
button:hover { color: var(--primary); border-color: #a7c5e9; background: var(--primary-soft); }
button:active { background: #dcecff; }
button:disabled { color: #788496; background: #f3f5f8; border-color: var(--line); cursor: not-allowed; }
input, select, textarea { max-width: 100%; min-width: 0; min-height: 40px; border: 1px solid #b8c6d7; border-radius: 8px; padding: 9px 12px; background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--muted); }
input[type=search]::-webkit-search-cancel-button { cursor: pointer; }
select { cursor: pointer; }
label { color: var(--ink); }
:where(button,a,input,select,textarea,summary,[tabindex]):focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; }
:where(button,a,input,select,textarea,summary) { scroll-margin: 16px; }
[hidden] { display: none !important; }
.icon { display: inline-block; width: 20px; height: 20px; flex: none; vertical-align: middle; }
.visually-hidden { 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: 10px; left: 16px; z-index: 100; padding: 12px 20px; color: white; background: var(--primary); border-radius: 8px; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 8px #172b4603; }
.eyebrow { margin: 0 0 8px; color: var(--primary); font-size: 12px; font-weight: 600; letter-spacing: 1px; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h2 { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.45; letter-spacing: -.3px; }
h3 { font-size: 16px; line-height: 1.6; }
.audit-header { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; min-height: var(--header-height); gap: 8px 16px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.audit-brand { display: flex; align-items: center; min-width: 0; color: var(--ink); border-radius: 4px; }
.audit-brand h1 { margin: 0; font-size: 18px; line-height: 1.5; font-weight: 650; letter-spacing: .2px; }
.workspace-badge { display: flex; margin-left: 16px; align-items: center; gap: 8px; flex: none; color: var(--muted); font-size: 12px; }
.workspace-badge > span { width: 6px; height: 6px; background: var(--primary); border-radius: 50%; }
.audit-nav { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.audit-nav a { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 18px; color: var(--ink); border: 1px solid #c5d3e4; border-radius: 8px; background: var(--surface); font-size: 15px; font-weight: 600; white-space: nowrap; transition: background-color var(--motion-fast), color var(--motion-fast), border-color var(--motion-fast); }
.audit-nav a:hover { color: var(--primary); border-color: var(--primary); background: var(--primary-soft); }
.audit-nav a[aria-current=page] { color: #fff; border-color: var(--primary); background: var(--primary); box-shadow: 0 2px 6px #0867cf40; }
.analysis-main { max-width: none; width: 100%; min-width: 0; padding: 20px 24px 18px; }
.analysis-main:focus { outline: none; }
body:not([data-view=home]) .analysis-main { height: calc(100dvh - var(--header-height)); display: flex; flex-direction: column; }
#matrixView { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
.workspace-heading { display: flex; align-items: center; gap: 12px; flex: none; min-width: 0; }
.workspace-heading > div:first-child { min-width: 0; }
.workspace-heading h2 { margin: 0; font-size: 17px; line-height: 1.4; white-space: nowrap; }
.workspace-heading p:last-child { margin: 0; font-size: 13px; color: var(--muted); }
.library-metrics { display: flex; flex: none; align-items: center; gap: 10px; }
.library-metrics > div { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.library-metrics > div + div { border-left: 1px solid var(--line); padding-left: 10px; }
.library-metrics strong { font-size: 15px; font-weight: 650; line-height: 1.3; font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.library-metrics span { font-size: 12px; color: var(--muted); }
.audit-matrix-panel { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; overflow: hidden; }
/* The page title, the library totals, the search box, the active filters and the hint share
   one row, so the table itself starts as high as possible (user request, 2026-09-22).
   Flex wrap drops them onto a second line when the window is too narrow. */
.analysis-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 4px 10px; flex: none; }
.audit-tools { min-width: 0; flex: 1 1 240px; max-width: 400px; }
.audit-search { display: flex; align-items: center; gap: 8px; }
.search-label { flex: none; font-size: 13px; font-weight: 500; }
.search-input { display: flex; align-items: center; position: relative; flex: 1; min-width: 0; }
.search-input > .icon { position: absolute; left: 12px; width: 18px; height: 18px; pointer-events: none; color: var(--muted); }
#auditSearch { width: 100%; height: 30px; min-height: 30px; padding: 4px 10px 4px 34px; background: #fafbfd; }
.matrix-help { flex: none; margin: 0 0 0 auto; color: var(--muted); font-size: 12px; text-align: right; line-height: 1.4; }
.matrix-help span { color: var(--primary); }
.matrix-help span::before { content: ' · '; color: var(--muted); }
.analysis-scope { display: flex; min-width: 0; flex: 1 1 auto; align-items: center; gap: 8px; padding: 0; color: var(--muted); font-size: 12px; }
.analysis-scope:has(#analysisScope:empty) { display: none; }
#analysisScope { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#clearAnalysisFilters { flex: none; min-height: 28px; padding: 3px 8px; color: var(--primary); border-color: #c7dcf5; }
#auditContent { flex: 1; min-height: 0; min-width: 0; }
.audit-matrix-scroll { height: 100%; min-height: 160px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #b9c9db #f5f7fa; position: relative; border-top: 1px solid var(--line); scroll-padding-top: 100px; }
.audit-matrix-scroll:focus-visible { outline-offset: -3px; }
.audit-matrix { width: 100%; min-width: 0; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13px; }
.audit-matrix th, .audit-matrix td { border: 0; border-bottom: 1px solid var(--line); padding: 12px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.audit-matrix th { font-weight: 600; }
.audit-matrix small { font-size: 12px; font-weight: 400; color: var(--muted); }
.audit-matrix thead th { position: sticky; top: 0; z-index: 5; background: #f7f9fc; vertical-align: middle; height: 84px; border-top: 0; box-shadow: 0 1px var(--line); }
.audit-matrix thead .matrix-level2 { z-index: 6; }
.audit-matrix tbody .matrix-level2 { background: #fcfdff; border-right: 1px solid #edf1f6; }
.audit-matrix tbody .matrix-level3 { background: var(--surface); }
.audit-matrix tbody tr:hover > td { background: #f9fbfe; }
.audit-matrix .matrix-topic-column { width: 152px; }
.audit-matrix .matrix-level2 { width: 152px; }
/* Wide enough for the member-company dropdown under each family heading. */
.audit-matrix .matrix-operator-column { width: 150px; }
.matrix-topic-label { display: block; margin-bottom: 3px; font-size: 12px; color: var(--muted); }
#auditTopic { width: 100%; min-height: 28px; padding: 3px 8px; font-size: 13px; background: var(--surface); }
.matrix-topic-button { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 5px; min-height: 44px; width: 100%; padding: 4px 6px; border: 1px solid transparent; text-align: left; color: var(--ink); font-size: 13px; background: transparent; }
.matrix-topic-button:hover, .matrix-topic-button[aria-pressed=true] { color: var(--primary); background: var(--primary-soft); border-color: #c7dcf5; }
.scoring-nature { display: inline-block; padding: 1px 6px; border-radius: 4px; font-size: 12px; font-weight: 500; line-height: 1.6; white-space: nowrap; }
.scoring-nature.objective { color: #0759ab; background: #eaf3ff; }
.scoring-nature.subjective { color: #7054a3; background: #f2eefa; }
.combination-sort-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.combination-sort-heading > span { font-size: 13px; font-weight: 600; }
.audit-matrix thead .matrix-level3 > small { display: inline; margin-left: 10px; font-size: 12px; }
.audit-matrix .matrix-sort { display: inline-flex; align-items: center; justify-content: center; flex-wrap: wrap; min-height: 28px; gap: 2px 4px; padding: 2px 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; font-weight: 600; font-size: 13px; line-height: 1.6; color: inherit; }
.audit-matrix .matrix-sort:hover { background: #e8eef7; }
.audit-matrix .matrix-sort.active { color: var(--primary); background: #eaf3ff; border-color: #c7dcf5; }
.audit-matrix .matrix-family { text-align: center; padding: 4px 5px; }
.matrix-family .matrix-sort { width: 100%; }
.matrix-subject-select { display: block; width: 100%; min-height: 26px; margin-top: 3px; padding: 3px 6px; border: 1px solid #c7d3e3; border-radius: 5px; background: var(--surface, #fff); color: var(--ink); font-size: 12px; font-weight: 500; line-height: 1.4; text-overflow: ellipsis; cursor: pointer; }
.matrix-subject-select:hover { border-color: currentColor; }
.matrix-family[data-subject]:not([data-subject='']) .matrix-subject-select { color: inherit; font-weight: 650; border-color: currentColor; background: #fff; }
.matrix-family.family-0 { color: var(--family-telecom); }
.matrix-family.family-1 { color: var(--family-mobile); }
.matrix-family.family-2 { color: var(--family-unicom); }
.audit-matrix .matrix-count { text-align: center; vertical-align: top; padding: 16px 8px; color: var(--muted); font-variant-numeric: tabular-nums; }
.matrix-count button { min-width: 58px; min-height: 40px; padding: 6px 10px; gap: 4px; border: 1px solid #c8dff8; border-radius: 8px; background: rgba(8,103,207,var(--strength,.08)); color: var(--primary); font-size: 16px; font-weight: 650; }
.matrix-count button:hover { background: #dcecff; border-color: var(--primary); }
.matrix-count button small { color: #356491; font-size: 12px; }
.audit-matrix .matrix-count.zero, .audit-matrix .matrix-count.unreviewed { padding-top: 24px; }
.combination-card { margin: 0; min-width: 0; font-size: 13px; }
.combination-title { display: grid; grid-template-columns: 12px max-content minmax(0,1fr) auto; align-items: center; gap: 4px 8px; min-height: 48px; padding: 1px 0; cursor: pointer; list-style: none; border-radius: 4px; }
.combination-title::-webkit-details-marker { display: none; }
.combination-title::before { content: ''; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); color: var(--muted); grid-column: 1; grid-row: 1 / 3; }
.combination-card[open] > .combination-title::before { transform: rotate(45deg); }
.combination-label { grid-row: 1; grid-column: 2; color: var(--ink); font-size: 13px; font-weight: 650; white-space: nowrap; }
.combination-latest-date { grid-row: 1; grid-column: 3; color: var(--muted); font-size: 12px; font-weight: 400; white-space: nowrap; font-variant-numeric: tabular-nums; }
.combination-count-total { grid-column: 4; grid-row: 1; color: var(--muted); font-size: 12px; white-space: nowrap; }
.combination-title > .combination-description { grid-column: 2 / 5; grid-row: 2; display: block; min-width: 0; color: #4e6077; font-size: 13px; font-weight: 400; line-height: 1.6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combination-card[open] > .combination-title { padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.combination-details { padding: 0 0 8px 20px; font-size: 13px; line-height: 1.8; overflow-wrap: anywhere; }
.combination-details > h3 { font-size: 16px; margin: 8px 0; }
.combination-prerequisite { margin: 10px 0; padding: 10px 12px; border-left: 3px solid #bdd7f6; background: #f5f8fc; border-radius: 0 6px 6px 0; color: #435770; }
.combination-prerequisite b { display: block; color: var(--ink); font-size: 12px; margin-bottom: 4px; }
.combination-items-heading { color: var(--ink); font-weight: 600; margin: 16px 0 8px; }
.combination-items-heading small { margin-left: 8px; color: var(--muted); font-weight: 400; }
.combination-parts { counter-reset: part; padding: 0; margin: 8px 0; border: 1px solid var(--line); border-radius: 8px; list-style: none; background: var(--surface); }
.combination-parts li { counter-increment: part; display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-bottom: 1px solid #e8edf4; }
.combination-parts li:last-child { border-bottom: 0; }
.combination-parts li::before { content: counter(part,decimal-leading-zero); color: var(--primary); font-size: 12px; font-variant-numeric: tabular-nums; line-height: 1.9; }
.combination-parts li > span { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.combination-parts li > strong { max-width: 120px; color: var(--primary); text-align: right; font-size: 12px; }
.combination-quote { display: block; margin-top: 6px; white-space: pre-wrap; color: var(--muted); font-size: 12px; }
.combination-note, .combination-constraints, .combination-issues { color: var(--muted); font-size: 12px; line-height: 1.8; }
.combination-formula { margin: 10px 0; padding: 12px 14px; color: #1256a1; border: 1px solid #c7dcf5; border-radius: 8px; background: #f0f6ff; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.combination-tier-rules, .original-scoring-rules { margin-top: 14px; font-size: 13px; }
summary { cursor: pointer; color: var(--primary); }
.single-context-list { max-height: min(60dvh,520px); overflow: auto; overscroll-behavior: contain; padding: 3px 6px 6px 3px; border-radius: 6px; }
.single-context-list:focus-visible { outline-offset: -3px; }
.single-context-list > .single-context:first-child { margin-top: 0; }
.single-context { margin-top: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.single-context > a { display: inline-flex; min-height: 32px; align-items: center; font-weight: 600; }
.single-context p { margin: 4px 0 10px; }
.single-context ol { padding-left: 20px; }
.combination-pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; flex: none; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.combination-pagination > div { display: flex; align-items: center; gap: 10px; }
.combination-pagination label { display: flex; align-items: center; gap: 6px; color: var(--muted); white-space: nowrap; }
.combination-pagination select { width: auto; min-width: 62px; min-height: 36px; padding: 5px 8px; font-size: 13px; }
.combination-pagination button { min-height: 36px; font-size: 12px; padding: 6px 10px; white-space: nowrap; }
#combinationPage { min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.workspace-footnote { margin: 0; color: var(--muted); font-size: 12px; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-empty { padding: 64px 24px; text-align: center; color: var(--muted); font-size: 14px; }
.audit-empty p { margin: 12px 0; }
.audit-load-error { padding: 12px 20px; color: var(--red); background: #fff3f4; font-size: 13px; }
.audit-load-error p { margin: 0 0 8px; }
#auditContent:has(.audit-load-error) { display: flex; flex-direction: column; }
#auditContent:has(.audit-load-error) .audit-matrix-scroll { flex: 1; min-height: 0; height: auto; }
.loading-mark { display: inline-block; width: 24px; height: 24px; border: 2px solid #d5e5f8; border-top-color: var(--primary); border-radius: 50%; animation: loading .9s linear infinite; }
@keyframes loading { to { transform: rotate(360deg); } }
#auditEvidence { width: min(960px, calc(100vw - 48px)); max-height: min(900px, calc(100dvh - 64px)); padding: 0; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--surface); box-shadow: 0 24px 80px #172b4633; overflow: hidden; }
#auditEvidence[open] { display: flex; flex-direction: column; }
#auditEvidence::backdrop { background: #0b1e38a1; backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px 28px 20px; border-bottom: 1px solid var(--line); flex: none; background: var(--surface); }
.dialog-head > div { min-width: 0; }
.dialog-head h2 { font-size: 21px; line-height: 1.5; }
.dialog-head .eyebrow { margin-bottom: 6px; }
#auditEvidenceSubtitle { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
#auditEvidenceClose { width: 40px; height: 40px; padding: 8px; flex: none; }
#auditEvidenceBody { padding: 22px 28px 28px; overflow: auto; overflow-wrap: anywhere; overscroll-behavior: contain; scroll-padding: 16px; font-size: 14px; }
.combination-projects { margin-bottom: 20px; }
.combination-projects h3 { margin: 0 0 12px; font-size: 14px; }
.combination-project-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; max-height: 240px; overflow: auto; padding: 3px; scrollbar-width: thin; }
.combination-project-list button { display: block; width: 100%; min-width: 0; padding: 12px 14px; text-align: left; white-space: normal; line-height: 1.7; overflow-wrap: anywhere; }
.combination-project-list button[aria-pressed=true] { color: var(--ink); background: var(--primary-soft); border-color: var(--primary); box-shadow: inset 3px 0 var(--primary); }
.combination-project-list b { display: block; font-size: 13px; font-weight: 600; }
.combination-project-list span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
#auditEvidenceBody > label { display: block; margin: 0 0 20px; font-size: 13px; font-weight: 500; }
#combinationSourceSelect { display: block; width: 100%; margin-top: 8px; }
.combination-evidence-meta { padding: 14px 16px; background: #f5f8fc; border-radius: 8px; font-size: 13px; line-height: 1.9; color: var(--muted); }
.scoring-part-context { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px 0; font-size: 13px; }
.scoring-part-context button { min-height: 36px; font-size: 12px; }
.combination-full-source { white-space: pre-wrap; overflow-wrap: anywhere; padding: 20px; font: inherit; font-size: 14px; line-height: 1.95; color: #364c66; background: #fafbfd; border: 1px solid var(--line); border-radius: 8px; }
.link-button { border: 0; background: transparent; color: var(--primary); padding: 4px 0; font-size: 13px; text-align: left; }
/* Compact analysis workspace: retain readable type while dedicating height to records. */
body:not([data-view=home]) .analysis-main { padding: 6px 12px; }
@media (min-width: 768px) {
  .audit-matrix th, .audit-matrix td { padding: 3px 8px; }
  .audit-matrix thead th { height: 56px; padding: 4px 8px; }
  .audit-matrix .matrix-family { padding: 3px 2px; }
  .audit-matrix .matrix-sort { min-height: 28px; padding: 0 2px; gap: 0 4px; line-height: 1.4; }
  .matrix-topic-label { margin-bottom: 2px; line-height: 1.4; }
  #auditTopic { min-height: 28px; padding: 3px 6px; font-size: 12px; }
  .audit-matrix thead .matrix-level3 > small { display: none; }
  /* Fixed badge column keeps every type name on the same left edge; long names wrap under themselves. */
  .matrix-topic-button { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; justify-items: start; min-height: 28px; padding: 2px 4px; gap: 0 5px; font-size: 12px; line-height: 1.4; }
  .matrix-topic-button > .scoring-nature { justify-self: stretch; text-align: center; }
  .matrix-topic-button > span:only-child { grid-column: 2; }
  .scoring-nature { padding: 0 4px; }
  .audit-matrix .matrix-count, .audit-matrix .matrix-count.zero, .audit-matrix .matrix-count.unreviewed { vertical-align: middle; padding: 3px 6px; }
  .audit-matrix .matrix-combination-row:has(.combination-card[open]) > .matrix-count { vertical-align: top; padding-top: 6px; }
  .matrix-count button { min-width: 46px; min-height: 28px; padding: 2px 7px; font-size: 14px; border-radius: 5px; }
  .combination-title { display: flex; gap: 8px; min-height: 28px; padding: 0; }
  .combination-title::before { order: -1; flex: none; }
  .combination-label { order: 0; flex: none; }
  .combination-latest-date { order: 1; flex: none; }
  .combination-title > .combination-description { order: 2; flex: 1; }
  .combination-count-total { order: 3; flex: none; margin-left: auto; }
  .combination-card[open] > .combination-title { padding-bottom: 6px; margin-bottom: 8px; }
  .combination-pagination { padding: 4px 10px; }
  .combination-pagination select { min-height: 28px; padding: 2px 6px; }
  .combination-pagination button { min-height: 28px; padding: 3px 8px; }
}
@media (min-width: 1900px) { .audit-matrix .matrix-operator-column { width: 160px; } }
@media (max-width: 1199px) and (min-width: 768px) {
  .audit-tools { max-width: none; }
  .matrix-help, .search-label { display: none; }
  .audit-matrix .matrix-operator-column { width: 106px; }
  .audit-matrix .matrix-topic-column, .audit-matrix .matrix-level2 { width: 140px; }
  .combination-title { display: grid; min-height: 40px; gap: 0 6px; }
  .combination-count-total { margin-left: 0; }
}
@media (max-width: 1023px) {
  .audit-header { position: relative; padding: 8px 16px; }
  .workspace-badge { display: none; }
  .audit-nav a { justify-content: center; padding: 9px 14px; }
  .analysis-main { width: 100%; padding: 20px 20px 16px; }
  body:not([data-view=home]) .analysis-main { height: auto; display: block; }
  .audit-matrix-scroll { height: auto; max-height: 65dvh; min-height: 240px; }
  .audit-matrix .matrix-operator-column { width: 106px; }
  .library-metrics { gap: 20px; }
  .library-metrics > div + div { padding-left: 20px; }
  .search-label { display: none; }
}
@media (max-width: 767px) {
  html { scroll-padding-top: 80px; }
  body { font-size: 16px; }
  button, input, select, textarea { min-height: 44px; }
  input, select, textarea { font-size: 16px; }
  .audit-header { padding: 16px; min-height: 76px; }
  .audit-brand h1 { max-width: 20em; font-size: 15px; line-height: 1.6; letter-spacing: 0; text-wrap: balance; }
  .audit-nav { width: 100%; margin-left: 0; gap: 4px; }
  .audit-nav a { flex: 1; justify-content: center; gap: 7px; min-height: 46px; padding: 10px 7px; font-size: 14px; }
  .audit-nav .icon { width: 18px; height: 18px; }
  .analysis-main { padding: 24px 16px; }
  .workspace-heading { flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
  h2 { font-size: 24px; }
  .workspace-heading p:last-child { font-size: 14px; }
  .library-metrics { width: 100%; gap: 8px; }
  .library-metrics > div { flex: 1; min-width: 0; }
  .library-metrics > div + div { padding-left: 8px; }
  .library-metrics strong { font-size: 17px; }
  .analysis-toolbar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; }
  .workspace-heading { flex-wrap: wrap; }
  /* Stacked: the row-direction grow factors must not stretch these blocks vertically. */
  .audit-tools, .analysis-scope, .workspace-heading { flex: none; }
  .audit-tools { width: 100%; max-width: none; }
  #auditSearch { height: 46px; font-size: 16px; }
  .matrix-help { display: none; }
  .matrix-help span { display: inline; margin-left: 8px; }
  .analysis-scope { padding: 0; align-items: center; gap: 8px; }
  #clearAnalysisFilters { min-height: 44px; }
  .audit-matrix-scroll { height: auto; max-height: none; min-height: 0; overflow: visible; border-top: 1px solid var(--line); }
  .audit-matrix { display: block; width: 100%; table-layout: auto; }
  .audit-matrix colgroup { display: none; }
  .audit-matrix thead { display: block; background: #f7f9fc; padding: 12px; border-bottom: 1px solid var(--line); }
  .audit-matrix thead tr { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px 4px; }
  .audit-matrix thead th { position: static; display: block; width: auto; height: auto; padding: 0; border: 0; box-shadow: none; background: transparent; min-width: 0; }
  .audit-matrix thead .matrix-level2 { grid-column: 1 / 3; }
  .audit-matrix thead .matrix-level3 { grid-column: 3; display: flex; justify-content: flex-end; align-items: flex-end; }
  .matrix-topic-label { font-size: 12px; margin-bottom: 5px; }
  #auditTopic { width: 100%; min-height: 44px; font-size: 16px; }
  .combination-sort-heading > span, .audit-matrix thead .matrix-level3 > small { display: none; }
  .audit-matrix .matrix-sort { min-height: 44px; }
  .matrix-family .matrix-sort { flex-direction: row; padding: 6px 4px; font-size: 13px; gap: 3px; }
  .audit-matrix tbody { display: block; }
  .audit-matrix tbody tr { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); padding: 16px; margin: 0; border-bottom: 1px solid var(--line); background: var(--surface); gap: 12px 8px; }
  .audit-matrix tbody:last-child tr:last-child { border-bottom: 0; }
  .audit-matrix tbody tr > th, .audit-matrix tbody tr > td { display: block; width: auto; min-width: 0; padding: 0; border: 0; position: static; background: transparent; }
  .audit-matrix tbody tr:hover > td { background: transparent; }
  .audit-matrix tbody .matrix-level2 { grid-column: 1 / -1; }
  .matrix-topic-button { display: inline-flex; width: auto; flex-direction: row; align-items: center; gap: 8px; padding: 4px 8px; margin: -4px -8px; min-height: 44px; }
  .audit-matrix tbody .matrix-level3 { grid-column: 1 / -1; }
  .combination-title { min-height: 48px; column-gap: 6px; row-gap: 8px; }
  .combination-label { font-size: 13px; }
  .combination-latest-date, .combination-count-total { font-size: 12px; }
  .combination-title > .combination-description { font-size: 14px; line-height: 1.65; }
  .audit-matrix tbody .matrix-count { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 10px 8px; border-radius: 8px; background: #f4f7fb; font-size: 16px; min-height: 82px; }
  .matrix-count::before { content: attr(data-operator); display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
  .matrix-count button { width: 100%; min-width: 0; min-height: 44px; font-size: 16px; padding: 5px 6px; }
  .audit-matrix .matrix-count.zero, .audit-matrix .matrix-count.unreviewed { padding: 10px 8px; line-height: 2.2; }
  .matrix-count.zero::before, .matrix-count.unreviewed::before { line-height: 1.6; }
  .combination-details { padding-left: 0; font-size: 14px; }
  .combination-prerequisite { font-size: 14px; }
  .combination-parts li { padding: 12px 10px; font-size: 14px; }
  .audit-matrix tbody tr:has(.audit-empty) { display: block; }
  .combination-pagination { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px 12px; }
  .combination-pagination > div { justify-content: space-between; gap: 6px; }
  .combination-pagination label { font-size: 12px; gap: 4px; }
  .combination-pagination select { min-width: 54px; min-height: 44px; padding: 5px 4px; font-size: 16px; }
  .combination-pagination button { min-height: 44px; padding: 7px 8px; font-size: 12px; }
  #combinationPage { min-width: 32px; font-size: 12px; }
  .workspace-footnote { font-size: 12px; line-height: 1.8; }
  #auditEvidence { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); border-radius: 12px; }
  .dialog-head { padding: 18px 16px 16px; gap: 12px; }
  .dialog-head h2 { font-size: 18px; }
  #auditEvidenceClose { min-width: 44px; height: 44px; }
  #auditEvidenceBody { padding: 16px; }
  .combination-project-list { grid-template-columns: 1fr; max-height: 220px; }
  .combination-project-list button { padding: 12px; }
  #combinationSourceSelect { min-height: 44px; font-size: 16px; }
  .combination-full-source { font-size: 14px; padding: 14px; }
  .scoring-part-context button { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* Compact column headers are for mouse use; touch keeps 44px targets. */
@media (pointer: coarse) {
  .audit-matrix .matrix-sort { min-height: 44px; }
  #auditTopic, .matrix-subject-select { min-height: 44px; }
}
