/* View Entrance & Accessibility Skip Link */
.view:not([hidden]) { animation: view-in 180ms ease-out backwards; }
@keyframes view-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.skip-link {
  position: fixed;
  inset: 12px auto auto 12px;
  z-index: 120;
  transform: translateY(calc(-100% - 16px));
  padding: 10px 14px;
  border-radius: 6px;
  background: var(--ink);
  color: #ffffff;
  font-size: var(--text-sm);
  font-weight: 600;
}
.skip-link:focus { transform: none; }
.view h1[tabindex="-1"]:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }

/* Home Hero: Full-Width Architectural Editorial Band + Interactive Code X-Ray Bench */
#view-home .hero {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
}

#view-home .hero-copy {
  padding: clamp(24px, 3.2vw, 38px) clamp(22px, 3.6vw, 44px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "title actions"
    "desc actions";
  align-items: center;
  gap: 8px 32px;
}

#view-home .hero h1 {
  grid-area: title;
  margin: 0;
  font-size: clamp(30px, 3.6vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--ink);
  font-weight: 700;
}

#view-home .hero-copy > p {
  grid-area: desc;
  font-size: clamp(14px, 1.4vw, 15px);
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
  max-width: 48ch;
}

#view-home .hero-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

#view-home .hero-actions .button {
  gap: 8px;
  min-height: 42px;
  padding: 9px 18px;
  white-space: nowrap;
  font-size: var(--text-body);
}

.hero-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(0, 0.92fr);
  border-top: 1px solid var(--line);
  background: #0b1620;
  color: #e6eef5;
}

.hero-xray {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-right: 1px solid #1e3142;
  background: #0d1924;
}

.xray-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 11px 16px;
  border-bottom: 1px solid #1d2f40;
  background: #0a141e;
}

.xray-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: #c5d6e6;
}

.xray-mode-switch {
  display: inline-flex;
  border: 1px solid #263d52;
  border-radius: 5px;
  background: #081018;
  padding: 2px;
}

.xray-mode-btn {
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #9cb5cc;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 140ms cubic-bezier(0.22, 1, 0.36, 1), color 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
.xray-mode-btn:hover { color: #ffffff; }
.xray-mode-btn.is-active {
  background: #173a59;
  color: #ffffff;
  font-weight: 600;
}
#hero-xray[data-xray-mode="after"] .xray-mode-btn.is-active {
  background: #154e37;
  color: #e9fbf3;
}
.xray-mode-btn:focus-visible,
.xray-probe:focus-visible {
  outline: 2px solid #7bb0de;
  outline-offset: -2px;
}

.xray-code {
  display: grid;
  padding: 6px 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
}

.xray-line {
  display: grid;
  grid-template-columns: 28px auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 16px;
  border: 0;
  border-left: 2.5px solid transparent;
  background: transparent;
  text-align: left;
  color: #d6e4f0;
  font: inherit;
}

.xray-context {
  color: #7994ab;
}
.xray-context code {
  grid-column: 3 / -1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.xray-probe {
  cursor: pointer;
  transition: background-color 140ms cubic-bezier(0.22, 1, 0.36, 1), border-color 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
.xray-probe:hover {
  background: #132535;
}
.xray-probe.is-active {
  background: #142b40;
  border-left-color: #df8254;
}
#hero-xray[data-xray-mode="after"] .xray-probe.is-active {
  background: #102a25;
  border-left-color: #5fd1a5;
}

.xray-ln {
  color: #7c97ae;
  font-variant-numeric: tabular-nums;
  user-select: none;
}
.xray-file {
  color: #8cb2d4;
  font-size: 12px;
  white-space: nowrap;
}
.xray-probe code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #f3f8fc;
}

.xray-badge {
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.xray-badge-critical { background: #6b1426; color: #ffd9e0; }
.xray-badge-high { background: #6d2d11; color: #ffe1d1; }
.xray-badge-clear { background: #134a34; color: #d3f7e6; }

.xray-advice {
  margin-top: auto;
  padding: 11px 16px;
  border-top: 1px solid #1d2f40;
  background: #09121b;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  font-size: var(--text-sm);
  line-height: 1.55;
}
.xray-advice strong {
  color: #f4f8fc;
  font-weight: 600;
  white-space: nowrap;
}
.xray-advice span {
  color: #a9c0d4;
}

.hero-art {
  position: relative;
  min-width: 0;
  min-height: 268px;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 52% 48%, #14334e 0%, #0a141d 76%);
  overflow: hidden;
}

.scan-instrument {
  position: relative;
  width: min(92%, 370px);
  aspect-ratio: 640 / 460;
  isolation: isolate;
}
.scan-instrument img { position: relative; display: block; width: 100%; height: auto; z-index: 1; }
.scan-beam {
  position: absolute;
  inset: 13.5% 24%;
  border-radius: 50%;
  background: conic-gradient(from -25deg, transparent 0 81%, #7de2c618 92%, #7bb0de66 99.6%, transparent);
  animation: field-sweep 3.8s cubic-bezier(0.22, 1, 0.36, 1) 0.3s 1 both;
}
@keyframes field-sweep {
  from { transform: rotate(0turn); }
  to { transform: rotate(1turn); }
}

.signal-tag {
  position: absolute;
  z-index: 2;
  right: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid #3f6687;
  border-radius: 6px;
  background: #0c1822f0;
  color: #edf3f7;
  animation: signal-in 320ms 0.18s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}
@keyframes signal-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.signal-marker {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  background: #1a3d5a;
  color: #b7d7f2;
  font-size: 16px;
}
.signal-tag strong, .signal-tag small { display: block; white-space: nowrap; }
.signal-tag strong { font-size: var(--text-sm); font-weight: 600; }
.signal-tag small { font: 12px var(--font-mono); color: #b5cbe0; margin-top: 2px; }
.signal-level {
  font-size: 12px;
  font-weight: 600;
  color: #ffe1d1;
  background: #6d2d11;
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.signal-level[data-state="critical"] { background: #6b1426; color: #ffd9e0; }
.signal-level[data-state="clear"] { background: #134a34; color: #d3f7e6; }

/* Home Flow: Flush 1px-Divided Stage Selector + Workbench Showcase */
.workflow-overview { margin: 28px 0 22px; }

.workbench-frame {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  overflow: hidden;
}

.workflow-cards {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: var(--line);
  gap: 1px;
}

.workflow-cards li {
  min-width: 0;
  background: #f7f9f9;
  position: relative;
  transition: background-color 140ms cubic-bezier(0.22, 1, 0.36, 1);
}
.workflow-cards li.is-active {
  background: var(--paper);
  box-shadow: inset 0 -2px 0 var(--blue);
}
.workflow-step-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  padding: 12px 14px;
  background: transparent;
  text-align: left;
}
.workflow-step-trigger:focus-visible { outline-offset: -3px; }

.step-art {
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 84px;
  height: 46px;
  flex: none;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.step-art svg {
  display: block;
  width: 100%;
  height: 100%;
  transition: transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
@media (hover: hover) {
  .workflow-cards li:hover svg { transform: translateY(-1px); }
}

.step-caption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.step-caption > span {
  color: var(--muted);
  font: 600 12px var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.workflow-cards li.is-active .step-caption > span { color: var(--blue); }
.step-caption h3 { margin: 0; font-size: var(--text-body); font-weight: 600; color: var(--ink); }
.step-caption small { color: var(--muted); font-size: var(--text-sm); }

.workbench-showcase {
  background: var(--paper);
}
.showcase-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: #f7f9f9;
  border-bottom: 1px solid var(--line);
  font-size: var(--text-sm);
  color: var(--muted);
}
.showcase-path {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.showcase-pill {
  flex: none;
  font-family: var(--font-mono);
  color: var(--blue);
  font-size: var(--text-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.showcase-stage {
  background: var(--side);
  padding: 12px;
}
.showcase-frame {
  margin: 0;
  border-radius: 5px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--paper);
}
.showcase-frame:not([hidden]) { animation: showcase-in 180ms cubic-bezier(0.22, 1, 0.36, 1) backwards; }
@keyframes showcase-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}
.showcase-frame img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1170 / 732;
  object-fit: cover;
  object-position: top;
}
.showcase-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.showcase-footer p { margin: 0; font-size: var(--text-sm); color: var(--muted); line-height: 1.5; }
.showcase-link {
  flex: none;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--blue);
  white-space: nowrap;
}
.showcase-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Home Bottom Utility */
.home-utility {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}
.home-utility .recent-panel,
.scope-panel {
  padding: 20px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.scope-note { font-size: var(--text-sm); color: var(--muted); }
.scope-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--line);
  overflow: hidden;
}
.scope-list li {
  padding: 8px 12px;
  background: #f8fafa;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 500;
}
.scope-panel p { margin: 12px 0 0; color: var(--muted); font-size: var(--text-sm); line-height: 1.65; }
#home-recent .empty-state { border: 0; background: #f6f8f8; padding: 14px; text-align: left; }
#home-recent .empty-state strong { display: none; }
.history-finding-count, .coverage-status { white-space: nowrap; }
.coverage-status { color: #9a3d12; font-weight: 600; }

/* Scan View Refinements */
.baseline-banner {
  border-left: 3px solid var(--blue);
}
.upload-art { width: 108px; height: 78px; margin-bottom: 6px; transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1); }
.dropzone:hover .upload-art, .dropzone.dragging .upload-art { transform: translateY(-2px); }

.folder-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px; margin-top: 12px; }
.folder-picker[hidden] { display: none; }
.folder-picker .button { min-height: 40px; }
.folder-picker span { color: var(--muted); font-size: var(--text-sm); }
.folder-select-first { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; cursor: pointer; }
.folder-select-first input { width: 16px; height: 16px; margin: 0; accent-color: var(--blue); }

.folder-exclusions {
  margin: 0 0 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: var(--text-sm);
  background: #f8fafa;
}
.folder-exclusions summary { cursor: pointer; padding: 9px 0; color: var(--blue); font-weight: 600; }
.folder-exclusions ul { max-height: 200px; overflow: auto; margin: 0 0 8px; padding: 0; list-style: none; }
.folder-exclusions li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--line);
}
.folder-exclusions code { overflow-wrap: anywhere; }
.folder-exclusions p { margin: 0 0 8px; }

.selected-file-path { margin: 8px 0 12px; }
.selected-file-path label { margin-bottom: 6px; }
.file-tabs :is(.file-tab, .remove-file):focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
.scan-submit-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.sample-panel .step-art, .guide-grid .step-art {
  width: 100%;
  height: 76px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  background: #f7f9f9;
}
.sample-panel .step-art svg, .guide-grid .step-art svg {
  max-width: 190px;
  height: 70px;
}

/* Guide View Refinements */
.guide-grid summary { margin-top: 10px; font-size: var(--text-sm); color: var(--blue); font-weight: 600; cursor: pointer; }
.guide-rules { margin-top: 18px; }
.guide-rules > summary { color: var(--ink); font-weight: 600; cursor: pointer; }
.guide-rules > p { margin: 12px 0; color: var(--muted); }
.guide-rule-list:not([hidden]) { columns: 320px 2; column-gap: 28px; margin-top: 16px; }
.guide-rule-list section { break-inside: avoid; border-top: 1px solid var(--line); padding-top: 12px; margin-bottom: 16px; }
.guide-rule-list section:last-child { margin-bottom: 0; }
.guide-rule-list h3 { margin: 0 0 6px; color: var(--ink); font-size: var(--text-body); }
.guide-rule-list ul { margin: 0; padding-inline-start: 1.25em; color: var(--muted); font-size: var(--text-sm); line-height: 1.75; }
.guide-rule-list li { overflow-wrap: anywhere; }

/* Report & Dialog High-Contrast Semantic System (WCAG AA >= 4.5:1) */
:is(#view-report, #checkout-dialog, #copy-task-dialog) {
  --report-secondary: #465660;
  --report-action: #0f4c81;
  --report-focus: #2854ca;
  --report-warning: #9a3d12;
  --report-positive: #165e42;
}

#view-report :is(
  .report-metadata, .score-ring small, .report-summary p, .severity-counts, .category-row,
  .finding summary small, .finding-body p, .finding-body h4, .finding-rule, .report-boundary,
  .report-boundary strong, .unlock-panel p, .unlock-panel small, .pack-price span,
  .mobile-report-actions > span, .payment-recovery > span
) {
  color: var(--report-secondary);
}

#view-report .meta-badge {
  background: var(--blue-soft);
  color: var(--report-action);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}
#view-report .report-provenance { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; }
#view-report .report-provenance a { color: var(--report-action); text-decoration: underline; text-underline-offset: 2px; }
#view-report .severity-counts b { color: var(--ink); }
#view-report .score-ring b { color: var(--report-warning); }
#view-report .score-ring.clear b { color: var(--report-positive); }
#view-report .finding-chevron { color: var(--report-secondary); }
#view-report :is(.evidence-block, .prompt-block pre) { color: #0e1a22; }

#view-report .severity.critical { color: #9e1b32; }
#view-report .severity.high, #view-report .category-row b { color: var(--report-warning); }
#view-report .severity.medium { color: #74550c; }
#view-report .severity.low { color: #2f4f6f; }
#view-report .category-row b.pass { color: var(--report-positive); }

.example-recheck-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 12px 16px;
  margin-bottom: 18px;
  background: var(--paper);
  border: 1px solid #c3d9ea;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  color: var(--report-secondary);
}
.example-recheck-bar .button { min-height: 36px; padding: 7px 14px; color: var(--report-action); }

/* Reinspection Comparison Delta Matrix */
#view-report :is(.compare-panel, .compare-panel strong, .report-empty, .report-empty strong) {
  color: var(--report-positive);
}
#view-report .report-empty.coverage-pending { background: #fdf4e4; border-color: #e4c997; }
#view-report .report-empty.coverage-pending,
#view-report .report-empty.coverage-pending strong { color: var(--report-warning); }

#view-report .compare-panel .comparison-counts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  font-size: var(--text-sm);
}
#view-report .delta-metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  padding: 9px 11px;
  background: var(--paper);
  border: 1px solid #c3dfd0;
  border-radius: var(--radius-sm);
  color: var(--report-positive);
}
#view-report .delta-metric b {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.continue-reinspection { margin-top: 12px; }

/* Category Coverage & Checked Files */
.category-status { display: flex; align-items: center; gap: 4px; justify-self: end; }
#view-report .category-select {
  justify-self: start;
  min-height: 30px;
  border: 0;
  border-radius: 5px;
  padding: 0 5px;
  background: transparent;
  color: var(--report-action);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
#view-report .category-select:is(:hover, [aria-pressed=true]) { background: var(--blue-soft); color: var(--blue-hover); }
#view-report .category-select:focus-visible,
#view-report .category-pending:focus-visible { outline: 2px solid var(--report-focus); outline-offset: 2px; }
#view-report .category-pending { min-height: 30px; font-size: var(--text-sm); color: var(--report-warning); white-space: nowrap; }

.category-meter {
  grid-column: 1 / -1;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: #e6ebeb;
  appearance: none;
}
.category-meter::-webkit-meter-bar { height: 4px; border: 0; border-radius: 2px; background: #e6ebeb; }
.category-meter::-webkit-meter-optimum-value { border-radius: 2px; background: #4a7da8; }
.category-meter::-moz-meter-bar { border-radius: 2px; background: #4a7da8; }
.category-row:has([aria-pressed=true]) .category-meter::-webkit-meter-optimum-value { background: var(--report-focus); }
.category-row:has([aria-pressed=true]) .category-meter::-moz-meter-bar { background: var(--report-focus); }

.report-checked-files { margin-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: var(--text-sm); }
.report-checked-files summary { padding: 10px 0; color: var(--report-action); cursor: pointer; font-weight: 600; }
.report-checked-files ul { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow: auto; }
.report-checked-files li { padding: 5px 0; overflow-wrap: anywhere; }
.report-checked-files li:has(.checked-file-locate) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}
.report-checked-files .checked-file-locate { min-height: 32px; padding: 0 5px; color: var(--report-action); white-space: nowrap; }
.report-checked-files .checked-file-findings {
  display: block;
  min-height: 32px;
  max-width: 100%;
  padding: 0;
  text-align: start;
  color: var(--report-action);
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.report-checked-files .checked-file-findings[aria-pressed=true] { font-weight: 700; }
#view-report .report-checked-files :is(li, button):focus-visible { outline: 2px solid var(--report-focus); outline-offset: -2px; }

.report-file-counts { margin-top: 10px; color: #1f4f3c; font-size: var(--text-sm); }
.report-file-counts summary { padding: 6px 0; color: var(--report-action); cursor: pointer; font-weight: 600; }
.report-file-counts ul { list-style: none; margin: 4px 0 8px; padding: 0; max-height: 220px; overflow: auto; }
.report-file-counts li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 5px 0; }
.report-file-counts code { overflow-wrap: anywhere; }
#comparison-changes > ul { max-height: min(300px, 52vh); }
#comparison-changes .comparison-file { display: block; padding: 6px 0; border-bottom: 1px solid #cce3d6; }
#comparison-changes .comparison-file:last-child { border: 0; }
#comparison-changes .comparison-file > ul { max-height: none; margin: 2px 0 0; overflow: visible; }
#comparison-changes .comparison-file li {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) minmax(0, max-content);
  padding: 3px 0;
  font-size: 0.94em;
}
#comparison-changes .comparison-file li > span:last-child { max-width: 12em; text-align: right; }

.coverage-position-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.coverage-position-actions .text-button { min-height: 32px; }

.yaml-coverage-gaps { color: #704811; background: #fdf4e4; border-color: #e4c997; }
.yaml-coverage-gaps summary { cursor: pointer; font-weight: 650; }
.yaml-coverage-gaps ul { list-style: none; margin: 8px 0 0; padding: 0; }
.yaml-coverage-gaps li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 4px 0; }
.yaml-coverage-gaps code { overflow-wrap: anywhere; }
.coverage-rule-names { grid-column: 1 / -1; line-height: 1.65; overflow-wrap: anywhere; }
.yaml-coverage-gaps p { margin: 6px 0 0; }
.yaml-gap-location { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.yaml-gap-location .finding-locate { margin-left: 0; }
#view-report .yaml-coverage-gaps li:focus-visible { outline: 2px solid var(--report-focus); outline-offset: -2px; }

/* Report Filters & Search */
#view-report :is(.filter, .report-actions .secondary, .report-export-panel .secondary, .finding-locate, .copy-prompt) {
  color: var(--report-action);
  font-size: var(--text-sm);
}
#view-report .filter.active { color: var(--blue-hover); font-weight: 600; }
#view-report .unlock-panel .pack-label,
#view-report .pack-price { color: var(--report-action); }
#view-report .payment-recovery-idle { justify-content: flex-end; border: 0; padding: 0; background: transparent; }

.finding-search { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
#finding-category {
  width: auto;
  flex: none;
  min-height: 42px;
  margin: 0;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--report-action);
  font-size: var(--text-sm);
}
#finding-category:focus-visible { outline: 2px solid var(--report-focus); outline-offset: 1px; }
#finding-search { flex: 1; min-width: 0; min-height: 42px; }
#finding-search::-webkit-search-cancel-button { display: none; }
#clear-finding-search { min-height: 42px; padding: 0 8px; white-space: nowrap; }
.finding-path-filter {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--blue-soft);
  color: var(--report-secondary);
  font-size: var(--text-sm);
}
.finding-path-filter[hidden] { display: none; }
.finding-path-filter code { overflow-wrap: anywhere; }
#clear-finding-path { min-height: 44px; padding: 0 4px; white-space: nowrap; color: var(--report-action); }
#finding-search-status { margin: 0 0 10px; font-size: var(--text-sm); color: var(--report-secondary); }
.finding-results-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.finding-results-meta:has(#copy-matching-tasks:not([hidden])) { margin-bottom: 8px; }
.finding-results-meta:has(#copy-matching-tasks:not([hidden])) #finding-search-status { margin: 0; }
#copy-matching-tasks { min-height: 44px; flex: none; padding: 0 4px; color: var(--report-action); }

/* Folder Selection & Copy & History Transfer Dialogs */
#folder-selection { max-width: 620px; max-height: calc(100dvh - 32px); padding: 24px; }
#folder-selection h2 { margin: 0 0 14px; }
#folder-selection #folder-selection-context { margin: 0 0 12px; color: var(--muted); line-height: 1.6; }
#folder-selection-search { width: 100%; margin-bottom: 10px; }
.folder-selection-files { max-height: min(38dvh, 340px); overflow: auto; border-block: 1px solid var(--line); }
.folder-selection-files label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 6px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: var(--text-sm);
}
.folder-selection-files label:last-child { border-bottom: 0; }
.folder-selection-files label:has(input:checked) { background: var(--blue-soft); }
.folder-selection-files label:has(input:disabled) { color: #5f6f79; cursor: default; }
.folder-selection-files span { overflow-wrap: anywhere; }
.folder-selection-files small { max-width: 110px; color: var(--muted); font-size: 12px; text-align: right; }
.folder-selection-files input { accent-color: var(--blue); margin: 4px; }
.folder-selection-pagination, .folder-selection-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.folder-selection-pagination { margin: 8px 0; color: var(--muted); font-size: 12px; }
.folder-selection-pagination .text-button { min-height: 36px; }
.folder-selection-status { margin: 10px 0; color: var(--muted); font-size: var(--text-sm); }
.folder-selection-status.over-limit { color: var(--red); }
.folder-selection-actions { justify-content: flex-end; }
#folder-selection button:disabled { cursor: default; }

#checkout-dialog :is(.checkout-details > p, .checkout-footer, .checkout-price span, .checkout-benefits) {
  color: var(--report-secondary);
}
.checkout-details > p { font-size: var(--text-sm); margin: 0; }
#checkout-dialog :is(.checkout-benefits, .checkout-price span, #checkout-notice) { font-size: var(--text-sm); }
#checkout-dialog .checkout-benefits li:before { color: var(--report-positive); }
#checkout-dialog #checkout-notice { color: #1c3d59; line-height: 1.65; }
#checkout-dialog #checkout-notice.demo-notice { color: #704811; }
#checkout-dialog .dialog-close { color: var(--report-secondary); }

#copy-task-dialog { max-width: 660px; max-height: calc(100dvh - 32px); padding: clamp(16px, 4vw, 28px); }
#copy-task-dialog h2 { margin: 0 0 10px; }
#copy-task-help { color: var(--report-secondary); font-size: var(--text-sm); line-height: 1.6; margin: 0 0 14px; }
#copy-task-text {
  display: block;
  width: 100%;
  height: clamp(140px, 45dvh, 360px);
  min-height: 0;
  resize: vertical;
  overflow-wrap: anywhere;
  background: #f5f7f7;
  color: var(--ink);
}
.copy-task-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.copy-task-actions .button { min-height: 44px; }
.history-actions { display: flex; flex-wrap: wrap; gap: 9px; }
#history-transfer-dialog p { color: var(--report-secondary); line-height: 1.65; font-size: var(--text-sm); }

/* Report & Dialog Focus Rings (Matches #2854ca / rgb(40, 84, 202)) */
:is(#view-report, #checkout-dialog, #copy-task-dialog) :is(button, a, summary, textarea):focus-visible {
  outline: 2px solid var(--report-focus);
  outline-offset: 2px;
}
#view-report .compare-panel strong[tabindex]:focus-visible {
  outline: 2px solid var(--report-focus);
  outline-offset: 2px;
}
#retry-comparison[aria-disabled="true"] { cursor: wait; }
#view-report .finding summary:focus-visible { outline-offset: -3px; }

/* Forced Colors Mode */
@media (forced-colors: active) {
  #view-report .filter[aria-pressed="true"] {
    border-color: Highlight;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
  }
}

/* Responsive Adjustments */
@media (max-width: 1000px) {
  #view-home .hero-copy {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "title" "desc" "actions";
    gap: 12px;
  }
  #view-home .hero-actions { justify-content: flex-start; margin-top: 4px; }
  .hero-stage { grid-template-columns: minmax(0, 1fr); }
  .hero-xray { border-right: 0; border-bottom: 1px solid #1e3142; }
  .hero-art { min-height: 220px; }
  .workflow-step-trigger { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .step-art { width: 100%; height: 52px; }
  #view-report .compare-panel .comparison-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  #view-home .hero-copy { padding: 22px 18px; }
  #view-home .hero h1 { font-size: clamp(28px, 8.5vw, 38px); }
  #view-home .hero-copy > p { font-size: var(--text-body); }
  #view-home .hero-actions .button { min-height: 42px; padding: 9px 14px; font-size: var(--text-sm); }
  .xray-head { padding: 10px 12px; }
  .xray-line { grid-template-columns: 24px minmax(0, 1fr) auto; gap: 6px; padding: 7px 12px; }
  .xray-file { display: none; }
  .xray-advice { padding: 10px 12px; }
  .hero-art { min-height: 204px; }
  .scan-instrument { width: min(86%, 320px); }
  .signal-tag { right: 12px; bottom: 12px; padding: 7px 9px; gap: 7px; }
  .signal-marker { width: 22px; height: 22px; font-size: 14px; }
  .workflow-overview { margin: 22px 0 16px; }
  .workflow-step-trigger { padding: 10px 8px; gap: 6px; }
  .step-art { height: 42px; }
  .step-caption h3 { font-size: var(--text-sm); }
  .step-caption > span, .step-caption small { font-size: 12px; }
  .showcase-stage { padding: 6px; }
  .showcase-footer { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .home-utility { grid-template-columns: 1fr; gap: 12px; }

  #view-report :is(.filter, .finding-locate, .checked-file-locate, .checked-file-findings, .mobile-report-actions .button) {
    min-height: 44px;
  }
  #view-report .payment-recovery { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .scope-list { grid-template-columns: 1fr; }
  .finding-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  #finding-category { grid-column: 1 / -1; justify-self: start; }
  #view-report .category-select, #view-report .category-pending { min-height: 42px; }
  .coverage-position-actions .text-button { min-height: 42px; }
  .scan-submit-actions #run-scan { flex: 1; }
  #folder-selection { padding: 16px; }
  .folder-selection-files label { min-height: 44px; }
  #view-report .compare-panel .comparison-counts { grid-template-columns: 1fr 1fr; gap: 6px; }
  #view-report .delta-metric { padding: 7px 8px; font-size: 12px; }
  .example-recheck-bar { padding: 10px 12px; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .view:not([hidden]), .scan-beam, .signal-tag, .showcase-frame:not([hidden]) {
    animation: none;
  }
  .step-art svg, .upload-art, .button, .sidebar nav a, .finding-chevron {
    transition: none;
  }
  .workflow-cards li:hover svg,
  .dropzone:hover .upload-art,
  .dropzone.dragging .upload-art {
    transform: none;
  }
}

/* Short Viewport Dialog Fit (e.g. height: 320px) */
@media (max-height: 440px) {
  :is(#checkout-dialog, #folder-selection, #copy-task-dialog)[open] {
    display: flex;
    flex-direction: column;
    max-height: calc(100dvh - 24px);
    padding: 16px;
  }
  :is(#checkout-dialog, #folder-selection, #copy-task-dialog) > * { flex: none; }
  #checkout-dialog .checkout-heading { padding-inline-end: 44px; }
  #checkout-dialog h2 { font-size: 20px; margin: 0 0 6px; }
  #checkout-dialog .dialog-close { top: 8px; right: 8px; }
  #checkout-dialog .checkout-details { flex: 0 1 auto; min-height: 0; overflow: auto; }
  .checkout-details > p { margin: 0; font-size: 12px; }
  #checkout-dialog :is(.checkout-benefits, .checkout-price span, #checkout-notice) { font-size: 12px; }
  #checkout-dialog .checkout-price { margin: 4px 0; }
  #checkout-dialog .checkout-price strong { font-size: 28px; }
  #checkout-dialog .checkout-benefits { line-height: 1.65; margin: 4px 0 6px; }
  #checkout-dialog #checkout-notice { max-height: 26dvh; overflow: auto; margin: 8px 0; padding: 8px 10px; }
  #checkout-dialog #checkout-actions { grid-template-columns: repeat(auto-fit, minmax(min(100%, 172px), 1fr)); }
  #checkout-dialog .checkout-footer { font-size: 11px !important; margin-top: 7px !important; }

  #folder-selection .folder-selection-files { flex: 0 1 auto; min-height: 46px; }
  #folder-selection h2 { margin-bottom: 8px; }
  #folder-selection #folder-selection-context { margin-bottom: 6px; }
  #folder-selection-search { margin-bottom: 6px; }
  .folder-selection-pagination { margin: 3px 0; }
  .folder-selection-status { margin: 6px 0; }

  #copy-task-dialog #copy-task-text { flex: 0 1 auto; min-height: 60px; resize: none; }
  .copy-task-actions { margin-top: 8px; }
}

@media (max-height: 440px) and (min-width: 460px) {
  #checkout-dialog .checkout-details {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    grid-template-areas: "intro benefits" "price benefits";
    align-content: start;
    align-items: center;
    column-gap: 12px;
  }
  .checkout-details > p { grid-area: intro; }
  .checkout-details .checkout-price { grid-area: price; }
  .checkout-details .checkout-benefits { grid-area: benefits; }
}
