select, input { font: inherit; color: var(--ink); }
select, .save-section input {
  max-width: 100%; min-height: 44px; border: 1px solid var(--line-strong);
  border-radius: 6px; background: var(--surface); padding: 8px 12px;
}
select:where(:not([multiple]):not([size]), :not([multiple])[size="1"]) {
  --select-padding-right: 40px;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2342534b' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  padding-right: var(--select-padding-right);
}
@media (forced-colors: active) {
  select:where(:not([multiple]):not([size]), :not([multiple])[size="1"]) {
    -webkit-appearance: auto;
    appearance: auto;
    background-image: none;
  }
}
select:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
button:disabled { cursor: not-allowed; opacity: .55; }
[hidden] { display: none !important; }
.task-selector { max-width: 400px; min-width: 220px; }
.task-selector select { width: 100%; }
.source-panel { border-block: 1px solid var(--line); padding: 20px 0; margin-bottom: 24px; }
.source-heading, .source-actions, .project-controls, .save-section {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.source-heading { justify-content: space-between; margin-bottom: 14px; }
.source-heading h2 { font-size: 16px; margin: 0; }
.run-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.run-option {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px;
  border: 1px solid var(--line); background: var(--surface); border-radius: 6px; cursor: pointer;
  overflow-wrap: anywhere;
}
.run-option:has(input:checked) { border-color: var(--green); background: var(--green-soft); }
.run-option input { margin-top: 5px; accent-color: var(--green); width: 18px; height: 18px; flex-shrink: 0; }
.run-option span { min-width: 0; }
.run-option strong, .run-option small { display: block; }
.run-option small { color: var(--ink-soft); margin-top: 4px; line-height: 1.6; font-size: 12px; }
.generate-row { margin-top: 16px; }
.generate-row > span, .request-status, .save-section > span { color: var(--ink-soft); font-size: 13px; }
.request-status { margin: 12px 0 0; min-height: 24px; overflow-wrap: anywhere; }
.request-status.is-error { color: var(--red-dark); }
.request-status.is-busy::before {
  content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px;
  border: 2px solid var(--line-strong); border-top-color: var(--green);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.projects-section { margin-top: 16px; }
.projects-section summary { cursor: pointer; width: fit-content; padding: 8px 0; font-weight: 600; }
.project-controls { margin-top: 10px; }
.project-controls select { flex: 1; min-width: 0; }
.button-primary { color: #fff; background: var(--green); border: 1px solid var(--green); }
.button-primary:hover { color: #fff; background: var(--green-dark); }
.flow-app { min-width: 160px; max-width: 210px; }
.app-identity strong, .matrix-app-copy strong { overflow-wrap: anywhere; white-space: normal; }
.flow-step { min-width: 190px; max-width: 240px; height: auto; min-height: 76px; }
.flow-step-copy strong { white-space: normal; overflow-wrap: anywhere; -webkit-line-clamp: 3; }
.comparison-layout { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
.matrix-wrap { max-height: 850px; overflow: auto; }
.matrix-grid { display: block; min-width: calc(180px + var(--app-count) * 195px); overflow: visible; }
.matrix-row { display: grid; gap: 1px; grid-template-columns: 180px repeat(var(--app-count), minmax(195px, 1fr)); border-bottom: 1px solid var(--line); }
.matrix-row:last-child { border-bottom: 0; }
.matrix-row:first-child { position: sticky; top: 0; z-index: 3; }
.matrix-header { background: var(--surface-soft); }
.matrix-grid .matrix-header { display: flex; align-items: center; }
.matrix-stage { position: sticky; left: 0; z-index: 1; background: var(--surface-soft); }
.heat-main { overflow-wrap: anywhere; white-space: normal; font-size: 12px; }
.matrix-app-copy strong, .matrix-app-copy span, .matrix-stage strong, .matrix-stage span, .heat-status { font-size: 12px; }
.heat-cell { min-height: 145px; }
.heat-score { font-size: 28px; font-variant-numeric: tabular-nums; }
.heat-cell.severity-missing { background: #edf0f2; color: #46515b; }
.heat-cell.severity-missing .heat-score { font-size: 16px; }
.heat-cell.severity-minimal, .selected-score.score-minimal { background: #f0f6f2; color: var(--ink); }
.tone-minimal { background: #e4efe8; }
.burden-stars { display: inline-flex; gap: 3px; align-items: center; vertical-align: middle; color: currentColor; }
.burden-stars > span { display: flex; }
.burden-stars svg { display: block; width: 16px; height: 16px; fill: transparent; stroke: currentColor; stroke-width: 1.5; }
.burden-stars .is-filled svg { fill: currentColor; }
.heat-cell .burden-stars, .selected-score .burden-stars { color: var(--ink-soft); }
.selected-score { flex-wrap: wrap; align-items: center; }
.severity-critical .burden-stars, .score-critical .burden-stars { color: var(--red-dark); }
.burden-unrated { font-size: 13px; color: var(--ink-soft); }
.metric-line.metric-stars { grid-template-columns: 32px minmax(0,1fr) auto; gap: 8px; }
.metric-stars .burden-stars { justify-self: start; }
.raw-score-details { font-size: 12px; color: var(--ink-soft); }
.raw-score-details summary { cursor: pointer; min-height: 36px; padding: 8px 0; }
.raw-score-details dl { margin: 4px 0 12px; }
.raw-score-details dl > div { display: flex; justify-content: space-between; gap: 12px; margin: 6px 0; }
.raw-score-details dd { margin: 0; font-variant-numeric: tabular-nums; }
.inspector { position: sticky; top: 85px; max-height: calc(100vh - 100px); overflow: auto; }
.detail-tabs { display: grid; grid-template-columns: 1fr 1fr; position: sticky; top: 0; z-index: 4; background: var(--surface); border-bottom: 1px solid var(--line); }
.detail-tabs button { min-height: 46px; padding: 9px 7px; border: 0; border-bottom: 2px solid transparent; background: transparent; font: inherit; font-size: 13px; color: var(--ink-soft); cursor: pointer; }
.detail-tabs button[aria-selected=true] { border-bottom-color: var(--green); color: var(--green-dark); font-weight: 600; background: var(--green-soft); }
.detail-tabs button:hover { background: var(--surface-soft); }
#issueCount { margin-left: 5px; font-size: 12px; font-variant-numeric: tabular-nums; }
.issue-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 0; font-size: 12px; }
.issue-toolbar select { min-width: 0; min-height: 40px; font-size: 12px; }
.issue-context { padding: 0 12px; font-size: 12px; color: var(--ink-soft); line-height: 1.7; overflow-wrap: anywhere; }
.issue-card { padding: 16px 14px; border-top: 1px solid var(--line); overflow-wrap: anywhere; font-size: 13px; line-height: 1.65; background: var(--surface); scroll-margin-top: 54px; }
.issue-card h3 { font-size: 14px; font-weight: 650; line-height: 1.5; margin: 10px 0 4px; text-wrap: pretty; }
.issue-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-soft); }
.issue-kind { flex-shrink: 0; border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px; font-size: 12px; line-height: 1.5; background: var(--surface-soft); }
.issue-card .issue-review-control { flex: 0 1 132px; min-width: 0; min-height: 32px; padding: 4px 30px 4px 8px; background-position: right 7px center; font-size: 12px; border-color: transparent; color: var(--ink-soft); }
.issue-card .issue-review-control:hover { border-color: var(--line-strong); background-color: var(--surface-soft); }
.issue-card[data-review-status="确认问题"] .issue-review-control,
.issue-card[data-review-status="值得优化"] .issue-review-control { color: var(--green-dark); background-color: var(--green-soft); }
.issue-location { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 36px; padding: 4px 0; border: 0; background: transparent; color: var(--ink-soft); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.issue-location span { min-width: 0; }
.issue-location svg, .issue-evidence-link svg { flex-shrink: 0; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.issue-location:hover { color: var(--green-dark); text-decoration: underline; text-underline-offset: 3px; }
.issue-location:active { background: var(--surface-soft); }
.issue-summary { margin: 8px 0 6px; color: var(--ink); }
.issue-candidate-note { margin: 0 0 12px; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.issue-card ul { padding-left: 18px; margin: 8px 0 12px; }
.issue-card li + li { margin-top: 7px; }
.issue-evidence { margin: 0 0 4px; }
.issue-evidence-link, .issue-evidence-unavailable { display: grid; grid-template-columns: minmax(0,1fr) auto 14px; align-items: center; gap: 8px; width: 100%; min-height: 36px; padding: 7px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; font-size: 12px; text-align: left; }
.issue-evidence-link { cursor: pointer; }
.issue-evidence-link > span, .issue-evidence-unavailable > span { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.issue-evidence-link small, .issue-evidence-unavailable small { font-size: 12px; color: var(--ink-soft); }
.issue-evidence-link svg { color: var(--green-dark); }
.issue-evidence-link:hover { background: var(--surface-soft); color: var(--green-dark); }
.issue-evidence-link:active { background: var(--green-soft); }
.issue-evidence-unavailable { color: var(--ink-soft); }
.issue-checks > summary, .issue-other-evidence > summary { min-height: 36px; padding: 8px 0; cursor: pointer; color: var(--green-dark); font-size: 12px; }
.issue-other-evidence > summary { color: var(--ink-soft); }
.issue-analysis-section { margin-top: 10px; }
.issue-analysis-section > strong { display: block; font-size: 12px; font-weight: 600; }
.issue-analysis-section:last-child ul { margin-bottom: 4px; }
.detail-tabs button:focus-visible, .issue-checks summary:focus-visible,
.issue-other-evidence summary:focus-visible, .issue-location:focus-visible,
.issue-evidence-link:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.issue-location-status { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.inspector { scroll-padding-top: 54px; }
.matrix-row.is-issue-target { outline: 2px solid var(--green-dark); outline-offset: -2px; }
.matrix-row.is-issue-target .matrix-stage { outline: 2px solid var(--green-dark); outline-offset: -2px; }
@media (max-width: 700px) {
  .issue-card .issue-review-control { min-height: 44px; }
  .issue-location, .issue-evidence-link, .issue-evidence-unavailable,
  .issue-checks > summary, .issue-other-evidence > summary { min-height: 44px; }
}
.evidence-image { display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.evidence-image img { display: block; width: 100%; height: 290px; object-fit: contain; background: var(--surface-soft); border-radius: 4px; }
.evidence-empty { padding: 28px 16px; background: var(--surface-soft); color: var(--ink-soft); text-align: center; }
.reason-block p { white-space: pre-wrap; overflow-wrap: anywhere; }
.score-meta { font-size: 12px; color: var(--ink-soft); overflow-wrap: anywhere; margin: 10px 0; }
.metric-line { grid-template-columns: 32px 1fr 64px; }
.metric-line strong { text-align: right; font-variant-numeric: tabular-nums; }
.profile-row { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); }
.profile-app { display: flex; max-width: none; width: 100%; overflow-wrap: anywhere; }
.profile-pair { display: grid; grid-template-columns: 32px minmax(40px, 1fr) 70px; gap: 10px; align-items: center; margin-top: 8px; font-size: 12px; }
.profile-pair strong { text-align: right; font-variant-numeric: tabular-nums; }
.profile-track { height: 10px; background: var(--surface-soft); }
.profile-track i { display: block; height: 100%; background: var(--green); }
.profile-pair.execution .profile-track i { background: var(--blue); }
.key-execution { background: var(--blue); }
.findings-list { margin-top: 22px; border-top: 1px solid var(--line); }
.finding { padding: 16px 0; border-bottom: 1px solid var(--line); }
.finding h3 { margin: 0 0 6px; font-size: 14px; }
.finding p { margin: 4px 0; color: var(--ink-soft); overflow-wrap: anywhere; }
.finding button { margin-top: 8px; }
.flow-section { min-width: 0; }
.filter-summary { color: var(--green-dark); font-size: 12px; font-weight: 600; white-space: nowrap; }
.flow-section .flow-canvas {
  display: grid;
  grid-template-columns: 152px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.flow-section .flow-labels {
  position: relative;
  z-index: 2;
  border-right: 1px solid var(--line);
  background: #f8faf8;
}
.flow-section .flow-app {
  display: flex;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: none;
  height: 68px;
  padding: 0 9px;
  border-bottom: 1px solid var(--line);
}
.flow-section .flow-app:last-child { border-bottom: 0; }
.flow-section .app-identity strong {
  display: block;
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-section .app-identity small, #matrix .matrix-app-copy small {
  display: block;
  max-width: 180px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#matrix .matrix-app-copy small { max-width: 150px; }
.flow-section .flow-pan {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: #a8b6ad #f1f4f1;
  scrollbar-width: thin;
}
.flow-section .flow-pan:focus-visible { outline: 2px solid var(--green); outline-offset: -3px; }
.flow-section .flow-board {
  display: block;
  width: max-content;
  min-width: 100%;
  gap: 0;
}
.flow-section .flow-lane {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 68px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
}
.flow-section .flow-lane:last-child { border-bottom: 0; }
.flow-section .flow-lane:hover { background: #f8faf8; }
.flow-section .flow-sequence {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--flow-columns), var(--flow-step-width));
  width: max-content;
  height: 100%;
  gap: 0;
  align-items: center;
  background: linear-gradient(to bottom, transparent calc(50% - 1px), #c8d4ca calc(50% - 1px), #c8d4ca 50%, transparent 50%);
}
.flow-section .flow-sequence.flow-drop-target::after {
  content: "";
  position: absolute;
  left: calc(var(--drop-index) * var(--flow-step-width));
  top: 5px;
  height: 56px;
  border-left: 2px solid var(--green);
  pointer-events: none;
}
.flow-section .flow-slot {
  display: flex;
  box-sizing: border-box;
  align-items: center;
  min-width: 0;
  width: calc(var(--flow-step-width) - 3px);
  height: 40px;
  padding: 0 2px;
  border: 1px solid #cbd9cf;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 1px 3px rgb(29 54 39 / 9%);
}
.flow-section .flow-step {
  display: flex;
  flex: 1 1 auto;
  box-sizing: border-box;
  min-width: 0;
  max-width: none;
  min-height: 36px;
  height: 36px;
  gap: 3px;
  padding: 2px;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: grab;
  touch-action: none;
}
.flow-section .flow-step:hover { transform: none; }
.flow-section .flow-step:active, .flow-section .flow-step.is-dragging { cursor: grabbing; opacity: .55; }
.flow-section .flow-step.is-selected { background: #e7f2e9; box-shadow: none; }
.flow-section .flow-step:focus-visible, .flow-section .flow-disclosure:focus-visible,
.flow-zoom button:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.flow-section .flow-step strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flow-section .step-number {
  width: 19px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 3px;
  font-size: 11px;
}
.flow-section .flow-board.is-condensed .flow-slot { padding: 0; }
.flow-section .flow-board.is-condensed .flow-step { gap: 0; padding: 0; justify-content: center; }
.flow-section .flow-board.is-condensed .flow-step strong { display: none; }
.flow-section .flow-board.is-condensed .step-number { width: 12px; height: 19px; background: none; font-size: 10px; }
.flow-section .flow-board.is-condensed .flow-disclosure { width: 13px; }
.flow-section .flow-board.is-condensed .flow-disclosure svg { width: 11px; }
.flow-section .flow-disclosure {
  display: grid;
  width: 20px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #4d6554;
  cursor: pointer;
}
.flow-section .flow-disclosure svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
.flow-section .flow-disclosure[aria-expanded=true] svg { transform: rotate(180deg); }
.flow-zoom { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 5px; }
.flow-zoom button { min-width: 30px; min-height: 30px; padding: 3px; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.flow-zoom button:hover { background: #e9f2eb; }
.flow-zoom span { min-width: 42px; color: var(--ink-soft); font-size: 11px; text-align: center; }
.flow-edit-status { min-height: 20px; margin-top: 6px; color: var(--green-dark); font-size: 12px; }
.flow-preview {
  position: fixed;
  z-index: 50;
  box-sizing: border-box;
  width: min(420px, calc(100vw - 16px));
  max-height: min(620px, calc(100dvh - 16px));
  flex-direction: column;
  overflow: auto;
  padding: 9px;
  border: 1px solid #b8cbbd;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 12px 26px rgb(25 45 30 / 18%);
}
.flow-preview:not([hidden]) { display: flex; }
.flow-preview-head { display: flex; flex: 0 0 auto; max-height: 25dvh; overflow: auto; align-items: start; justify-content: space-between; gap: 8px; font-size: 12px; }
.flow-preview-head strong { overflow-wrap: anywhere; }
.flow-preview-head button { border: 0; background: transparent; cursor: pointer; font-size: 20px; line-height: 1; }
.flow-preview-image { display: block; flex: 1 1 auto; min-height: 0; width: 100%; height: min(540px, calc(100dvh - 160px)); margin-top: 8px; padding: 0; border: 0; background: #f5f7f5; cursor: zoom-in; }
.flow-preview-image img { display: block; width: 100%; height: 100%; object-fit: contain; }
.flow-preview p { color: var(--ink-soft); font-size: 12px; }
@media (max-width: 700px) {
  .flow-section .flow-canvas { grid-template-columns: 110px minmax(0,1fr); }
  .flow-section .flow-app { padding: 0 5px; gap: 5px; }
  .flow-section .flow-app .app-mark { width: 23px; height: 23px; }
  .flow-section .app-identity { display: grid; gap: 0; }
  .flow-section .app-identity strong { max-width: 75px; }
}
.save-section { border-top: 1px solid var(--line); padding: 22px 0; margin-top: 20px; }
.save-section input { width: 300px; min-width: 0; }
.save-section > span { flex-basis: 100%; }
#imageDialog { max-width: 96vw; max-height: 96vh; border: 0; border-radius: 8px; padding: 16px; background: var(--surface); }
#imageDialog::backdrop { background: rgb(20 30 25 / 65%); }
#imageDialog form { display: flex; justify-content: flex-end; margin-bottom: 10px; }
#imageDialog #fullImageContainer img { display: block; max-height: 80vh; max-width: 85vw; object-fit: contain; }
@media (max-width: 1100px) {
  .comparison-layout { grid-template-columns: minmax(0, 1fr); }
  .inspector { position: static; max-height: none; }
}
@media (max-width: 700px) {
  .task-selector { max-width: none; width: 100%; }
  .source-heading { align-items: flex-start; }
  .source-actions { gap: 8px; }
  .run-list { grid-template-columns: 1fr; }
  .matrix-grid { min-width: calc(150px + var(--app-count) * 175px); }
  .matrix-row { display: grid; grid-template-columns: 150px repeat(var(--app-count), minmax(175px, 1fr)); }
  .matrix-row:first-child { display: grid; }
  .matrix-cell { display: flex; }
  .matrix-cell::before { display: none; }
  .matrix-stage { min-height: auto; flex-direction: column; align-items: flex-start; }
  .heat-cell { min-height: 155px; padding: 14px; flex-direction: column; align-items: flex-start; }
  .heat-cell .heat-main { padding-right: 0; }
  .heat-cell .heat-score { position: static; font-size: 26px; margin-top: auto; }
  .heat-cell .heat-status { margin-top: 4px; }
  .save-section input { width: 100%; }
  .top-actions { flex-wrap: wrap; }
  .page-heading { gap: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .request-status.is-busy::before { animation: none; }
}

/* Keep filters in their own rows, regardless of the number or length of App names. */
#resultArea .controls { display: grid; grid-template-columns: max-content minmax(0,1fr) auto auto; align-items: center; gap: 12px 20px; }
#resultArea .controls .metric-field { grid-column: 1; grid-row: 1; width: auto; min-width: max-content; }
#resultArea .controls .app-field { grid-column: 1 / -1; grid-row: 2; width: 100%; min-width: 0; }
#resultArea .controls .check-control { grid-column: 2; grid-row: 1; justify-self: end; margin: 0; white-space: nowrap; }
#resultArea .controls .filter-summary { grid-column: 3; grid-row: 1; font-size: 12px; }
#resultArea .controls .filter-summary:empty { display: none; }
#resultArea .controls .reset-button { grid-column: 4; grid-row: 1; margin: 0; }
#resultArea .app-toggles { gap: 6px; min-width: 0; }
#resultArea .app-filter { min-height: 32px; max-width: 100%; padding: 3px 8px; gap: 6px; }
#resultArea .app-filter input { flex: 0 0 14px; }
#resultArea .app-filter .app-mark { width: 22px; height: 22px; font-size: 11px; border-radius: 5px; }
#resultArea .app-filter-name { min-width: 0; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.matrix-view-controls { display: flex; gap: 12px; align-items: center; justify-content: flex-end; flex-wrap: wrap; margin: 0 0 10px; }
.matrix-view-controls .segmented-control { width: auto; display: inline-flex; }
.matrix-view-controls .button { min-height: 36px; padding: 6px 12px; font-size: 12px; }
#matrix .comparison-layout { --stage-width: 112px; --cell-width: 128px; --cell-height: 88px; grid-template-columns: minmax(0,1fr) clamp(260px, 21vw, 290px); gap: 12px; }
#matrix .comparison-layout[data-density=comfortable] { --stage-width: 150px; --cell-width: 176px; --cell-height: 128px; }
#matrix .comparison-layout.is-panel-collapsed { grid-template-columns: minmax(0,1fr); }
#matrix .matrix-wrap { max-height: min(76vh, 850px); overflow: auto; }
#matrix .matrix-grid { min-width: calc(var(--stage-width) + var(--app-count) * (var(--cell-width) + 1px)); }
#matrix .matrix-row { display: grid; grid-template-columns: var(--stage-width) repeat(var(--app-count), minmax(var(--cell-width),1fr)); }
#matrix .matrix-header { min-height: 54px; padding: 8px; }
#matrix .matrix-row:first-child > .matrix-header:first-child { position: sticky; left: 0; z-index: 4; }
#matrix .matrix-app-header { gap: 6px; min-width: 0; }
#matrix .matrix-app-header .app-mark { width: 22px; height: 22px; font-size: 11px; }
#matrix .matrix-app-copy strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
#matrix .matrix-stage { min-height: 0; padding: 8px; }
#matrix .matrix-stage strong { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
#matrix .heat-cell { display: grid; min-height: var(--cell-height); padding: 8px; grid-template-columns: minmax(0,1fr); gap: 4px; align-content: center; }
#matrix .heat-cell .heat-main { grid-column: 1; grid-row: 1; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; white-space: normal; padding: 0; line-height: 1.45; }
#matrix .heat-cell .heat-score { position: static; grid-column: 1; grid-row: 2; margin: 0; font-size: 21px; }
#matrix .heat-cell .heat-status { grid-column: 1; grid-row: 3; margin: 0; font-size: 11px; white-space: normal; }
#matrix .heat-cell.severity-missing .heat-score { font-size: 14px; }
#matrix .empty-cell { min-height: var(--cell-height); padding: 8px; }
@media (max-width: 1100px) {
  #matrix .comparison-layout { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 700px) {
  #resultArea .controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
  #resultArea .controls .metric-field, #resultArea .controls .app-field { flex-basis: 100%; min-width: 0; }
  #resultArea .controls .metric-field { order: 0; }
  #resultArea .controls .app-field { order: 1; }
  #resultArea .controls .check-control, #resultArea .controls .filter-summary, #resultArea .controls .reset-button { order: 2; }
  #resultArea .controls .reset-button { margin-left: auto; }
  #matrix .comparison-layout { --stage-width: 94px; --cell-width: 120px; }
  #matrix .heat-cell::before, #matrix .empty-cell::before { display: none; }
}

/* Result workspace: shared controls and responsive evidence viewer. */
.result-view-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin-top: 20px; }
.result-view-tabs button { min-height: 44px; padding: 10px 2px; border: 0; border-bottom: 3px solid transparent; background: transparent; font: inherit; color: var(--ink-soft); cursor: pointer; }
.result-view-tabs button[aria-selected=true] { border-bottom-color: var(--green); color: var(--green-dark); font-weight: 700; }
#resultArea .controls { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px 0; min-height: 0; }
#resultArea .controls .metric-field { min-width: 0; flex: 0 0 auto; }
#resultArea .metric-field legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#resultArea .controls .check-control { margin: 0; white-space: normal; }
#resultArea .controls .filter-summary { order: 5; margin-left: auto; }
#resultArea .controls > #toggleInspector { margin-left: auto; min-height: 40px; padding: 7px 12px; font-size: 13px; }
.record-filter-disclosure, .result-view-settings { position: relative; }
.record-filter-disclosure > summary, .result-view-settings > summary { min-height: 40px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); padding: 9px 12px; cursor: pointer; font-size: 13px; }
.matrix-record-filter { margin: 14px 0 8px; max-width: 720px; }
.matrix-record-filter[open] { border: 1px solid var(--line); border-radius: 6px; padding: 10px; background: #fafbfa; }
.matrix-record-filter[open] > summary { width: fit-content; }
.matrix-record-filter .record-filter-content { position: static; width: auto; max-width: none; padding: 12px 0 0; border: 0; box-shadow: none; }
#recordFilterCount { font-variant-numeric: tabular-nums; margin-left: 5px; color: var(--green-dark); }
.record-filter-content, .view-settings-content { position: absolute; top: calc(100% + 8px); left: 0; z-index: 12; width: 320px; max-width: calc(100vw - 40px); padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 8px 24px #18332324; }
.record-filter-content label[for=recordFilterSearch] { display: block; font-size: 13px; margin-bottom: 6px; }
#recordFilterSearch { width: 100%; min-height: 40px; border: 1px solid var(--line-strong); border-radius: 5px; padding: 8px 10px; }
.record-filter-hint, #recordFilterEmpty { color: var(--ink-soft); font-size: 12px; margin: 8px 0; }
#resultArea #appToggles { display: grid; gap: 6px; max-height: 300px; overflow: auto; }
#resultArea .matrix-record-filter #appToggles { display: flex; flex-wrap: wrap; max-height: 260px; }
#resultArea .app-filter { min-height: 40px; width: 100%; }
#resultArea .app-filter-name { max-width: none; white-space: normal; overflow-wrap: anywhere; }
.view-settings-content { width: 235px; display: flex; flex-direction: column; align-items: stretch; gap: 12px; }
.view-settings-content .segmented-control { width: 100%; }
.view-settings-content label { display: flex; align-items: center; gap: 8px; font-size: 13px; }
#resultArea .view-settings-content .reset-button { margin: 0; width: 100%; }
#resultArea .overview-line { grid-template-columns: minmax(180px, .8fr) minmax(0, 1.5fr); gap: 16px; padding: 14px 16px; }
.workbench #resultArea .overview-context { display: none; }
.workbench #resultArea .overview-line { display: block; padding: 0; }
#resultArea .overview-stats { gap: 8px 20px; }
.overview-scope { flex-basis: 100%; color: var(--ink-soft); font-size: 11px; text-align: right; }
#resultArea .legend-row { gap: 8px 16px; margin: 0 0 20px; padding: 12px 0; border-bottom: 1px solid var(--line); }
#resultArea .legend-explainer { flex-basis: 100%; font-size: 12px; }
#resultArea .workspace-section { margin-top: 0; }
#resultArea .section-heading { margin-bottom: 12px; }
#matrix .comparison-layout { grid-template-columns: minmax(0,1fr) clamp(280px, 23vw, 340px); }
#matrix .comparison-layout.is-panel-collapsed { grid-template-columns: minmax(0,1fr); }
#matrix .matrix-cell.is-design-pinned { position: sticky; left: calc(var(--stage-width) + 1px); z-index: 2; box-shadow: 2px 0 0 var(--line-strong); }
#matrix .matrix-header.is-design-pinned { z-index: 4; }
#matrix .matrix-stage { z-index: 3; }
.matrix-scroll-hint { font-size: 12px; color: var(--ink-soft); text-align: right; margin: 0 0 8px; }
.matrix-score-help { margin-top: 12px; font-size: 12px; color: var(--ink-soft); line-height: 1.7; }
.matrix-score-help summary { cursor: pointer; padding: 6px 0; width: fit-content; }
#flow .flow-comparison-layout { display: grid; grid-template-columns: minmax(0,1fr) clamp(280px, 23vw, 340px); align-items: start; gap: 12px; }
#flow .flow-comparison-layout.is-panel-collapsed { grid-template-columns: minmax(0,1fr); }
#flow .flow-path-content { min-width: 0; }
#flow .inspector-content { display: block; }
#flow .inspector-content > * + * { margin-top: 12px; }
.issue-return { margin: 12px; font-size: 13px; }
#clearIssueFilters { margin: 0 12px 16px; font-size: 13px; }
#inspectorDialog { width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--surface); overflow: hidden; }
#inspectorDialog::backdrop { background: #172c2666; }
.inspector-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
#inspectorDialog .inspector { display: block; position: static; max-height: calc(100dvh - 112px); overflow: auto; border: 0; border-radius: 0; }
#inspectorDialog .inspector-content { display: block; }
#inspectorDialog .inspector-content > * + * { margin-top: 12px; }
.workbench .inferred-chain small { display: block; color: var(--ink-soft); font-size: 11px; line-height: 1.55; margin-top: 8px; }
@media (max-width: 1100px) {
  #matrix .comparison-layout { grid-template-columns: minmax(0,1fr); }
  #flow .flow-comparison-layout { grid-template-columns: minmax(0,1fr); }
  #resultArea .overview-line { grid-template-columns: 1fr; }
  #resultArea .overview-stats { justify-content: flex-start; }
  .overview-scope { text-align: left; }
}
@media (max-width: 700px) {
  .matrix-record-filter { max-width: none; }
  #resultArea .controls { gap: 10px; }
  #resultArea .controls .metric-field { flex-basis: 100%; order: 0; }
  #resultArea .result-view-settings { order: 2; }
  #resultArea .controls > #toggleInspector { order: 3; margin-left: 0; flex: 1; }
  #resultArea .controls .check-control { order: 4; flex-basis: 100%; }
  #resultArea .controls .filter-summary { margin-left: 0; }
  #resultArea .controls .segmented-control { width: 100%; }
  #resultArea .controls .segment { flex: 1; padding: 9px 10px; }
  .record-filter-content { width: min(320px, calc(100vw - 48px)); }
  .view-settings-content { left: auto; right: -60px; }
  #resultArea .section-heading { display: block; }
  #resultArea .matrix-reading { margin-top: 8px; font-size: 12px; }
  #resultArea .overview-stat { white-space: normal; }
  #inspectorDialog { margin: auto auto 0; width: 100%; max-width: 100%; max-height: 88dvh; border-radius: 14px 14px 0 0; }
  #inspectorDialog .inspector { max-height: calc(88dvh - 66px); }
}

#resultArea .view-settings-content > * { flex: 0 0 auto; min-width: 0; }
#resultArea .view-settings-content label { white-space: nowrap; }
@media (max-width: 700px) {
  #resultArea .matrix-reading { max-width: none; text-align: left; }
  #resultArea .section-heading p { margin-left: 0; }
  #pinDesignControl { display: none; }
}



