/*
 * Core audit flow visual polish — 2026-08-23
 *
 * First batch: annual plan, project risk assessment, audit scheme and program
 * execution. This layer only changes presentation and responsive composition;
 * routes, records, permissions, decisions and handoffs remain unchanged.
 */

/* ---------- Shared project work bar ---------- */

html[data-visual-style] body:is(
  [data-active-view="home"],
  [data-active-view="taskarrange"],
  [data-active-view="walkthrough"]
) .project-toolbar {
  border-color: var(--visual-line) !important;
  background: color-mix(in srgb, var(--visual-surface) 96%, var(--visual-accent) 4%) !important;
  box-shadow: 0 1px 0 color-mix(in srgb, var(--visual-ink) 7%, transparent) !important;
  backdrop-filter: none !important;
}

html[data-visual-style] body:is(
  [data-active-view="home"],
  [data-active-view="taskarrange"],
  [data-active-view="walkthrough"]
) :is(.project-switch-trigger, .project-actions #project-new-btn, .user-info-bar, .global-work-mode-options) {
  border-color: var(--visual-line) !important;
  background: var(--visual-surface) !important;
  color: var(--visual-ink) !important;
}

html[data-visual-style] body:is(
  [data-active-view="home"],
  [data-active-view="taskarrange"],
  [data-active-view="walkthrough"]
) :is(.project-switch-trigger strong, .user-info-name) {
  color: var(--visual-ink) !important;
}

html[data-visual-style] body:is(
  [data-active-view="home"],
  [data-active-view="taskarrange"],
  [data-active-view="walkthrough"]
) :is(.project-switch-trigger small, .user-info-role) {
  color: var(--visual-copy) !important;
}

/* ---------- Annual audit plan ---------- */

html[data-visual-style] body[data-active-view="auditplan"] :is(
  .ap-year-toolbar,
  .ap-coverage-map,
  .ap-execution-ledger
) {
  border-color: var(--visual-line) !important;
  border-radius: var(--visual-radius-lg) !important;
  background: var(--visual-surface) !important;
  box-shadow: var(--visual-shadow) !important;
}

html[data-visual-style] body[data-active-view="auditplan"] .ap-container.ap-landing {
  gap: 16px;
}

html[data-visual-style] body[data-active-view="auditplan"] .ap-year-toolbar {
  padding: 15px 17px;
}

html[data-visual-style] body[data-active-view="auditplan"] .ap-year-context label,
html[data-visual-style] body[data-active-view="auditplan"] .ap-year-context select,
html[data-visual-style] body[data-active-view="auditplan"] .ap-year-context > span {
  color: var(--visual-ink);
}

html[data-visual-style] body[data-active-view="auditplan"] .ap-year-context select {
  border-color: var(--visual-line);
  border-radius: var(--visual-radius-sm);
  background: var(--visual-surface);
}

html[data-visual-style] body[data-active-view="auditplan"] .ap-year-context > span {
  background: var(--visual-surface-soft);
}

html[data-visual-style] body[data-active-view="auditplan"] .ap-landing-metrics {
  gap: 10px;
}

html[data-visual-style] body[data-active-view="auditplan"] .ap-landing-metric {
  min-height: 96px;
  padding: 15px 17px;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms cubic-bezier(.16, 1, .3, 1);
}

html[data-visual-style] body[data-active-view="auditplan"] .ap-landing-metric::before {
  inset: 15px 15px auto auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

html[data-visual-style] body[data-active-view="auditplan"] .ap-landing-metric:hover {
  border-color: color-mix(in srgb, var(--visual-accent) 35%, var(--visual-line));
  box-shadow: var(--visual-shadow-hover) !important;
  transform: translateY(-1px);
}

html[data-visual-style] body[data-active-view="auditplan"] .ap-landing-metric span {
  color: var(--visual-copy);
  font-size: 12px;
}

html[data-visual-style] body[data-active-view="auditplan"] .ap-landing-metric strong {
  color: var(--visual-ink);
  font-size: clamp(25px, 2.2vw, 31px);
  font-variant-numeric: tabular-nums;
}

html[data-visual-style] body[data-active-view="auditplan"] .ap-landing-metric small {
  color: var(--visual-faint);
  font-size: 11.5px;
}

html[data-visual-style] body[data-active-view="auditplan"] :is(.ap-coverage-head, .ap-ledger-head) {
  border-color: var(--visual-line-soft) !important;
  background: color-mix(in srgb, var(--visual-surface) 94%, var(--visual-accent-soft) 6%);
}

html[data-visual-style] body[data-active-view="auditplan"] :is(.ap-coverage-head h3, .ap-ledger-head h3) {
  color: var(--visual-ink);
}

html[data-visual-style] body[data-active-view="auditplan"] :is(.ap-coverage-head p, .ap-ledger-head p) {
  max-width: 72ch;
  color: var(--visual-copy);
}

html[data-visual-style] body[data-active-view="auditplan"] :is(.ap-coverage-head > div:first-child > span, .ap-ledger-head span) {
  color: var(--visual-accent-deep);
}

html[data-visual-style] body[data-active-view="auditplan"] :is(.ap-coverage-legend, .ap-coverage-map > footer, .ap-ledger-table th) {
  border-color: var(--visual-line-soft);
  background: var(--visual-surface-soft);
  color: var(--visual-copy);
}

html[data-visual-style] body[data-active-view="auditplan"] :is(.ap-coverage-table td, .ap-coverage-table th, .ap-ledger-table td) {
  border-color: var(--visual-line-soft);
}

html[data-visual-style] body[data-active-view="auditplan"] .ap-ledger-filters button {
  border-color: var(--visual-line);
  border-radius: var(--visual-radius-sm);
  background: var(--visual-surface);
  color: var(--visual-copy);
}

html[data-visual-style] body[data-active-view="auditplan"] .ap-ledger-filters button.is-active {
  border-color: color-mix(in srgb, var(--visual-accent) 64%, var(--visual-line));
  background: var(--visual-accent-soft);
  color: var(--visual-accent-deep);
}

html[data-visual-style] body[data-active-view="auditplan"] .ap-ledger-filters button.is-active b {
  background: var(--visual-accent);
}

/* ---------- Project risk assessment ---------- */

html[data-visual-style] body[data-active-view="home"] {
  --pra-ink: var(--visual-ink);
  --pra-text: var(--visual-copy);
  --pra-muted: var(--visual-faint);
  --pra-line: var(--visual-line);
  --pra-line-soft: var(--visual-line-soft);
  --pra-surface: var(--visual-surface);
  --pra-surface-soft: var(--visual-surface-soft);
  --pra-blue: var(--visual-accent);
  --pra-blue-soft: var(--visual-accent-soft);
  --pra-shadow: var(--visual-shadow);
}

html[data-visual-style] body[data-active-view="home"] :is(
  .pra-assessment-path,
  .pra-assessment-core-column > .pra-object-risk-board,
  .pra-assessment-evidence-sidebar,
  .pra-assessment-support
) {
  border-color: var(--visual-line) !important;
  border-radius: var(--visual-radius-lg) !important;
  background: var(--visual-surface) !important;
  box-shadow: var(--visual-shadow) !important;
}

html[data-visual-style] body[data-active-view="home"] .pra-object-panel {
  border-color: var(--visual-line) !important;
  background: var(--visual-surface-soft) !important;
}

html[data-visual-style] body[data-active-view="home"] .pra-object-card {
  border-color: var(--visual-line) !important;
  border-radius: var(--visual-radius-sm) !important;
  background: var(--visual-surface) !important;
}

html[data-visual-style] body[data-active-view="home"] .pra-object-card:is(.is-active, .active) {
  border-color: color-mix(in srgb, var(--visual-accent) 52%, var(--visual-line)) !important;
  background: color-mix(in srgb, var(--visual-accent-soft) 54%, var(--visual-surface)) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--visual-accent) 18%, transparent) !important;
}

html[data-visual-style] body[data-active-view="home"] .pra-object-risk-main,
html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table {
  background: var(--visual-surface) !important;
}

html[data-visual-style] body[data-active-view="home"] .pra-risk-table-head {
  border-color: var(--visual-line-soft) !important;
  background: color-mix(in srgb, var(--visual-surface) 94%, var(--visual-accent-soft) 6%);
}

html[data-visual-style] body[data-active-view="home"] .pra-risk-table-head span,
html[data-visual-style] body[data-active-view="home"] .pra-risk-title-button strong {
  color: var(--visual-ink) !important;
}

html[data-visual-style] body[data-active-view="home"] :is(
  .pra-risk-table-head h3,
  .pra-risk-table-head p,
  .pra-risk-main-fact,
  .pra-risk-title-button small
) {
  color: var(--visual-copy) !important;
}

html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table th {
  border-color: var(--visual-line-soft);
  background: var(--visual-surface-soft);
  color: var(--visual-copy);
  font-size: 11px;
}

html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table td {
  border-color: var(--visual-line-soft);
  background: var(--visual-surface);
}

html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table tbody tr:hover td {
  background: color-mix(in srgb, var(--visual-accent-soft) 28%, var(--visual-surface));
}

html[data-visual-style] body[data-active-view="home"] .pra-inline-decision {
  border-color: var(--visual-line);
  background: var(--visual-surface);
  color: var(--visual-ink);
}

html[data-visual-style] body[data-active-view="home"] .pra-stage-scheme {
  border-color: var(--visual-line) !important;
  background: color-mix(in srgb, var(--visual-surface) 97%, var(--visual-accent-soft) 3%) !important;
  box-shadow: 0 -10px 28px color-mix(in srgb, var(--visual-ink) 9%, transparent) !important;
}

/* ---------- Audit scheme ---------- */

html[data-visual-style] body[data-active-view="taskarrange"] {
  --scheme-ink: var(--visual-ink);
  --scheme-text: var(--visual-copy);
  --scheme-muted: var(--visual-faint);
  --scheme-line: var(--visual-line);
  --scheme-line-soft: var(--visual-line-soft);
  --scheme-surface: var(--visual-surface);
  --scheme-surface-soft: var(--visual-surface-soft);
  --scheme-blue: var(--visual-accent);
  --scheme-blue-soft: var(--visual-accent-soft);
  --scheme-shadow: var(--visual-shadow);
}

html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange > .app-page-hero h2,
html[data-visual-style] body[data-active-view="taskarrange"] :is(
  .wf-scheme-project-title h3,
  .wf-program-ledger-head h3,
  .wf-program-row strong
) {
  color: var(--visual-ink) !important;
}

html[data-visual-style] body[data-active-view="taskarrange"] :is(
  .wf-scheme-project-meta,
  .wf-scheme-project-meta span,
  .wf-program-ledger-head p,
  .wf-program-row small
) {
  color: var(--visual-copy) !important;
}

html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange :is(
  .wf-scheme-brief,
  .wf-program-filterbar,
  .wf-program-table,
  .wf-program-row
) {
  border-color: var(--visual-line) !important;
  background: var(--visual-surface) !important;
}

html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-edit-panel[data-program-edit-panel] {
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: rgba(15, 27, 45, .46) !important;
}

html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-scheme-brief {
  border-radius: var(--visual-radius-lg) !important;
  box-shadow: var(--visual-shadow) !important;
}

html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange :is(
  .wf-scheme-brief-head,
  .wf-scheme-overview,
  .wf-scheme-summary-details,
  .wf-program-row.is-head
) {
  border-color: var(--visual-line-soft) !important;
  background: var(--visual-surface-soft) !important;
}

html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-scheme-document-icon {
  border-color: var(--visual-line);
  border-radius: var(--visual-radius-sm);
  background: var(--visual-accent-soft);
  color: var(--visual-accent-deep);
}

html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange :is(
  .wf-program-filterbar input,
  .wf-program-filterbar select,
  .wf-scheme-brief-actions .btn,
  .wf-program-actions .btn
) {
  border-color: var(--visual-line) !important;
  border-radius: var(--visual-radius-sm) !important;
  background: var(--visual-surface) !important;
  color: var(--visual-copy) !important;
}

html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange :is(
  .wf-scheme-brief-actions .btn-primary,
  .wf-program-actions .btn-primary
) {
  border-color: var(--visual-accent) !important;
  background: var(--visual-accent) !important;
  color: #fff !important;
  box-shadow: 0 5px 14px color-mix(in srgb, var(--visual-accent) 21%, transparent) !important;
}

html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-row.is-program-summary:hover {
  background: color-mix(in srgb, var(--visual-accent-soft) 28%, var(--visual-surface)) !important;
}

html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-edit-toggle {
  color: var(--visual-accent-deep) !important;
}

/* ---------- Program execution ---------- */

html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough :is(
  .at-primary-taskbar,
  .at-evidence-workbench,
  .at-evidence-workbench-head,
  .at-evidence-work-area,
  .at-evidence-preview,
  .at-evidence-preview-head,
  .uaw-context,
  .uaw-bottom
) {
  border-color: var(--visual-line) !important;
  background: var(--visual-surface) !important;
  color: var(--visual-ink);
}

html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .at-primary-taskbar {
  background: color-mix(in srgb, var(--visual-surface) 96%, var(--visual-accent-soft) 4%) !important;
  backdrop-filter: none;
}

html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough :is(
  .at-primary-taskbar-heading > h1,
  .at-evidence-workbench-head h3,
  .at-evidence-preview-head strong,
  .uaw-context-head strong
) {
  color: var(--visual-ink) !important;
}

html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough :is(
  .at-primary-taskbar-title > span,
  .at-work-view-tabs button,
  .at-evidence-preview-empty,
  .at-evidence-preview-empty p,
  .uaw-context-head span
) {
  color: var(--visual-copy) !important;
}

html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .at-work-view-tabs button.is-active {
  border-bottom-color: var(--visual-accent) !important;
  color: var(--visual-accent-deep) !important;
}

html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .at-work-view-tabs button > em {
  background: var(--visual-surface-soft);
  color: var(--visual-faint);
}

html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .at-work-view-tabs button.is-active > em {
  background: var(--visual-accent-soft);
  color: var(--visual-accent-deep);
}

html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .at-evidence-workbench {
  border-radius: var(--visual-radius-lg) !important;
  box-shadow: var(--visual-shadow) !important;
}

html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .at-evidence-work-area:has(.at-evidence-preview-empty) {
  min-height: 280px;
}

html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .at-evidence-preview-empty {
  display: grid;
  min-height: 240px;
  place-content: center;
  padding: 28px;
  text-align: center;
}

html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .at-evidence-preview-empty strong {
  color: var(--visual-ink);
  font-size: 15px;
}

html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .at-evidence-preview-empty p {
  max-width: 56ch;
  margin: 8px auto 0;
  line-height: 1.65;
}

html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .uaw-context {
  border-radius: var(--visual-radius-lg) !important;
  box-shadow: var(--visual-shadow) !important;
}

/* ---------- Style-specific authorship ---------- */



html[data-visual-style="weave"] body:is(
  [data-active-view="auditplan"],
  [data-active-view="home"],
  [data-active-view="taskarrange"],
  [data-active-view="walkthrough"]
) :is(.ap-year-toolbar, .ap-coverage-map, .ap-execution-ledger, .pra-object-risk-board, .wf-scheme-brief, .at-evidence-workbench) {
  background-image: radial-gradient(circle at 97% 0%, transparent 0 42px, rgba(52, 118, 109, .07) 43px 44px, transparent 45px) !important;
}

/* ---------- Responsive composition ---------- */

@media (max-width: 760px) {
  body:is(
    [data-active-view="home"],
    [data-active-view="taskarrange"],
    [data-active-view="walkthrough"]
  ) .project-toolbar {
    padding: 8px 10px !important;
  }

  body:is(
    [data-active-view="home"],
    [data-active-view="taskarrange"],
    [data-active-view="walkthrough"]
  ) .project-bar-inner {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: start !important;
    gap: 7px 8px !important;
  }

  body:is(
    [data-active-view="home"],
    [data-active-view="taskarrange"],
    [data-active-view="walkthrough"]
  ) .project-context {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  body:is(
    [data-active-view="home"],
    [data-active-view="taskarrange"],
    [data-active-view="walkthrough"]
  ) .project-context .project-label {
    display: none !important;
  }

  body:is(
    [data-active-view="home"],
    [data-active-view="taskarrange"],
    [data-active-view="walkthrough"]
  ) .project-actions {
    display: flex !important;
    grid-column: 2 !important;
    grid-row: 1 !important;
    align-self: stretch !important;
    flex-wrap: nowrap !important;
  }

  body:is(
    [data-active-view="home"],
    [data-active-view="taskarrange"],
    [data-active-view="walkthrough"]
  ) .project-actions #project-new-btn {
    min-height: 40px !important;
    padding-inline: 10px !important;
  }

  body:is(
    [data-active-view="home"],
    [data-active-view="taskarrange"],
    [data-active-view="walkthrough"]
  ) .user-info-bar {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    width: 100% !important;
    min-height: 40px !important;
    justify-self: stretch !important;
  }

  body:is(
    [data-active-view="home"],
    [data-active-view="taskarrange"],
    [data-active-view="walkthrough"]
  ) .user-info-content {
    display: none !important;
  }

  /* Annual plan: two-by-two metrics keep the real work in the first screen. */
  html[data-visual-style] body[data-active-view="auditplan"] .ap-landing-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px;
  }

  html[data-visual-style] body[data-active-view="auditplan"] .ap-landing-metric {
    min-height: 92px;
    padding: 13px 14px;
  }

  html[data-visual-style] body[data-active-view="auditplan"] .ap-landing-metric::before {
    top: 13px;
    right: 13px;
  }

  html[data-visual-style] body[data-active-view="auditplan"] .ap-landing-metric strong {
    margin-top: 7px;
    font-size: 25px;
  }

  html[data-visual-style] body[data-active-view="auditplan"] .ap-landing-metric small {
    display: -webkit-box;
    overflow: hidden;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  html[data-visual-style] body[data-active-view="auditplan"] .ap-year-toolbar {
    gap: 12px;
    padding: 13px;
  }

  html[data-visual-style] body[data-active-view="auditplan"] .ap-year-context,
  html[data-visual-style] body[data-active-view="auditplan"] .ap-landing-actions {
    width: 100%;
  }

  html[data-visual-style] body[data-active-view="auditplan"] .ap-year-context label {
    flex: 1 1 170px;
  }

  html[data-visual-style] body[data-active-view="auditplan"] .ap-year-context select {
    flex: 1 1 auto;
    min-width: 0;
  }

  html[data-visual-style] body[data-active-view="auditplan"] .ap-landing-actions > .btn {
    flex: 1 1 160px;
  }

  html[data-visual-style] body[data-active-view="auditplan"] .ap-landing-more {
    flex: 0 0 auto;
  }

  html[data-visual-style] body[data-active-view="auditplan"] :is(.ap-coverage-head, .ap-ledger-head) {
    padding: 14px;
  }

  /* Risk assessment: object chooser becomes a rail; decisions become cards. */
  html[data-visual-style] body[data-active-view="home"] .pra-object-panel {
    padding: 13px 11px !important;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-list {
    display: flex !important;
    grid-template-columns: none !important;
    gap: 8px !important;
    overflow-x: auto;
    padding: 1px 1px 7px;
    scroll-snap-type: x proximity;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-card {
    flex: 0 0 min(250px, 78vw);
    scroll-snap-align: start;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-card:only-child {
    flex-basis: 100%;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-entry-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-entry-actions .pra-add-object-button {
    grid-column: 1 / -1;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-risk-table-head {
    align-items: stretch !important;
    flex-direction: column !important;
    gap: 10px;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-risk-table-head-actions {
    justify-content: flex-start;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table table,
  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table tbody {
    display: block;
    width: 100%;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table thead {
    display: none !important;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
    background: var(--visual-surface-soft);
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table tbody tr {
    display: grid;
    grid-template-columns: minmax(0, .78fr) minmax(0, 1.22fr);
    gap: 10px 12px;
    padding: 13px;
    border: 1px solid var(--visual-line);
    border-radius: var(--visual-radius);
    background: var(--visual-surface);
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table tbody tr > td {
    display: block;
    min-width: 0;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table tbody tr > td:nth-child(1),
  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table tbody tr > td:nth-child(2),
  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table tbody tr > td:nth-child(5) {
    grid-column: 1 / -1;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table tbody tr > td:nth-child(2) {
    padding-top: 9px !important;
    border-top: 1px solid var(--visual-line-soft) !important;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table tbody tr > td:nth-child(3)::before,
  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table tbody tr > td:nth-child(4)::before {
    display: block;
    margin-bottom: 5px;
    color: var(--visual-faint);
    font-size: 10px;
    font-weight: 700;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table tbody tr > td:nth-child(3)::before {
    content: "风险评分";
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table tbody tr > td:nth-child(4)::before {
    content: "本项目决定";
  }

  /* The current register has eight columns; do not inherit the retired
     five-column card labels or desktop percentage widths on narrow screens. */
  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table .pra-risk-register-sheet table {
    min-width: 0 !important;
    width: 100%;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table .pra-risk-register-sheet tbody tr > td {
    width: auto !important;
    max-width: none;
    grid-column: auto;
    text-align: left !important;
    overflow-wrap: anywhere;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table .pra-risk-register-sheet tbody tr > td:is(:nth-child(3), :nth-child(4), :nth-child(7), :nth-child(8), [colspan]) {
    grid-column: 1 / -1;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table .pra-risk-register-sheet tbody tr > td:nth-child(2) {
    padding-top: 0 !important;
    border-top: 0 !important;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table .pra-risk-register-sheet tbody tr > td::before {
    display: block;
    margin-bottom: 5px;
    color: var(--visual-copy);
    font-size: 12px;
    font-weight: 500;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table .pra-risk-register-sheet tbody tr > td:nth-child(1)::before { content: "序号"; }
  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table .pra-risk-register-sheet tbody tr > td:nth-child(2)::before { content: "模块"; }
  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table .pra-risk-register-sheet tbody tr > td:nth-child(3)::before { content: "风险事项"; }
  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table .pra-risk-register-sheet tbody tr > td:nth-child(4)::before { content: "可能影响"; }
  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table .pra-risk-register-sheet tbody tr > td:nth-child(5)::before { content: "可能性（固有）"; }
  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table .pra-risk-register-sheet tbody tr > td:nth-child(6)::before { content: "重要性（固有）"; }
  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table .pra-risk-register-sheet tbody tr > td:nth-child(7)::before { content: "评估状态"; }
  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table .pra-risk-register-sheet tbody tr > td:nth-child(8)::before { content: "评估人"; }
  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table .pra-risk-register-sheet tbody tr > td[colspan]::before { content: none; }

  html[data-visual-style] body[data-active-view="home"] .pra-object-risk-table .pra-risk-register-sheet :is(.pra-risk-domain-summary, .pra-risk-title-summary, .pra-risk-impact-summary) strong {
    font-size: 14px;
    line-height: 1.55;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-inline-decision,
  html[data-visual-style] body[data-active-view="home"] .pra-risk-row-actions .btn {
    width: 100%;
  }

  html[data-visual-style] body[data-active-view="home"] .pra-stage-scheme-title small {
    display: none;
  }

  /* Audit scheme: override the late 940px desktop-table fallback. */
  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-filterbar {
    align-items: stretch;
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-filterbar label:not(.wf-program-search) {
    flex: 1 1 calc(50% - 4px);
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-filterbar select {
    width: 100%;
    min-width: 0;
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-scheme-detail-page .wf-program-table {
    overflow: visible !important;
    padding: 9px !important;
    border-radius: 0 0 var(--visual-radius) var(--visual-radius) !important;
    background: var(--visual-surface-soft) !important;
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-scheme-detail-page .wf-program-row.is-head {
    display: none !important;
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-scheme-detail-page .wf-program-row.is-program-summary {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    min-width: 0 !important;
    gap: 10px 12px !important;
    margin-bottom: 9px;
    padding: 13px !important;
    border: 1px solid var(--visual-line) !important;
    border-radius: var(--visual-radius) !important;
    background: var(--visual-surface) !important;
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-row.is-program-summary > span {
    min-width: 0;
    min-height: 0;
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-row.is-program-summary > span:nth-child(1) {
    grid-column: 2;
    grid-row: 1;
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-row.is-program-summary > span:nth-child(2) {
    grid-column: 1;
    grid-row: 1;
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-row.is-program-summary > span:nth-child(3),
  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-row.is-program-summary > span:nth-child(4) {
    grid-column: 1 / -1;
    padding-top: 9px;
    border-top: 1px solid var(--visual-line-soft);
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-row.is-program-summary > span:nth-child(5) {
    grid-column: 1;
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-row.is-program-summary > span:nth-child(6) {
    grid-column: 2;
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-row.is-program-summary > span:nth-child(n + 3):nth-child(-n + 5)::before {
    display: block;
    margin-bottom: 4px;
    color: var(--visual-faint);
    font-size: 10px;
    font-weight: 700;
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-row.is-program-summary > span:nth-child(3)::before {
    content: "风险来源";
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-row.is-program-summary > span:nth-child(4)::before {
    content: "准备怎么审";
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-row.is-program-summary > span:nth-child(5)::before {
    content: "负责人 / 时间";
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-row.is-program-summary strong,
  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-row.is-program-summary small {
    overflow: visible !important;
    white-space: normal !important;
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange :is(
    .wf-program-edit-panel,
    .wf-program-filter-empty
  ) {
    min-width: 0 !important;
  }

  html[data-visual-style] body[data-active-view="taskarrange"] #view-taskarrange .wf-program-edit-panel {
    margin: -9px 0 9px;
    border: 1px solid var(--visual-line) !important;
    border-top: 0 !important;
    border-radius: 0 0 var(--visual-radius) var(--visual-radius);
  }

  /* Program execution: the context tool becomes a complete, scrollable sheet. */
  html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .uaw-context {
    position: fixed !important;
    z-index: 120 !important;
    top: 58px !important;
    right: 8px !important;
    bottom: 12px !important;
    left: 8px !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
    padding: 12px !important;
    overflow: auto !important;
    overscroll-behavior: contain;
    border-radius: var(--visual-radius-lg) !important;
    box-shadow: 0 24px 70px color-mix(in srgb, var(--visual-ink) 26%, transparent) !important;
  }

  html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .uaw-shell.is-context-collapsed .uaw-context {
    visibility: hidden !important;
    opacity: 0 !important;
    transform: translateY(18px) scale(.985) !important;
    pointer-events: none !important;
  }

  html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .at-primary-taskbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 8px;
    padding: 11px 11px 0;
  }

  html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .at-primary-taskbar-actions {
    padding-top: 8px;
  }

  html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .at-work-view-tabs {
    gap: 16px;
    overflow-x: auto;
  }

  html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .at-evidence-work-area,
  html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .at-evidence-work-area:not(.is-sources-hidden) {
    grid-template-columns: 1fr !important;
    min-height: 0;
  }

  html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .at-evidence-sources:not(.is-hidden) {
    max-height: 220px;
    overflow: auto;
    border-right: 0;
    border-bottom: 1px solid var(--visual-line);
  }

  html[data-visual-style] body[data-active-view="walkthrough"] #view-walkthrough .at-evidence-preview-empty {
    min-height: 210px;
    padding: 22px 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html[data-visual-style] body:is(
    [data-active-view="auditplan"],
    [data-active-view="home"],
    [data-active-view="taskarrange"],
    [data-active-view="walkthrough"]
  ) *,
  html[data-visual-style] body:is(
    [data-active-view="auditplan"],
    [data-active-view="home"],
    [data-active-view="taskarrange"],
    [data-active-view="walkthrough"]
  ) *::before,
  html[data-visual-style] body:is(
    [data-active-view="auditplan"],
    [data-active-view="home"],
    [data-active-view="taskarrange"],
    [data-active-view="walkthrough"]
  ) *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
