/*
 * Project-stage nine-point polish (2026-08-18).
 *
 * Final visual and interaction-quality layer for the six core project stages:
 * program execution, workpaper collection, findings, communication, report and
 * remediation. The layer deliberately keeps all existing data, workflow,
 * approval and responsibility contracts unchanged.
 */

:is(
  body[data-active-view="walkthrough"],
  body[data-active-view="workpaper"],
  body[data-active-view="findings"],
  body[data-active-view="mgmtinteraction"],
  body[data-active-view="report"],
  body[data-active-view="remediationtrack"]
) {
  --stage-canvas: #f3f5f8;
  --stage-surface: #ffffff;
  --stage-surface-muted: #f8f9fb;
  --stage-ink: #172033;
  --stage-copy: #536176;
  --stage-muted: #7b8799;
  --stage-line: #dde3eb;
  --stage-line-soft: #ebeff4;
  --stage-blue: #1769e8;
  --stage-blue-strong: #0d5dd4;
  --stage-blue-soft: #edf4ff;
  --stage-green: #168a54;
  --stage-orange: #c46a14;
  --stage-red: #d54444;
  --stage-radius: 16px;
  --stage-control-radius: 9px;
  --stage-shadow: 0 1px 2px rgba(16, 24, 40, .025), 0 12px 34px rgba(42, 55, 78, .055);
  color: var(--stage-ink);
  background: var(--stage-canvas);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

:is(
  body[data-active-view="walkthrough"],
  body[data-active-view="workpaper"],
  body[data-active-view="findings"],
  body[data-active-view="mgmtinteraction"],
  body[data-active-view="report"],
  body[data-active-view="remediationtrack"]
) .main-content {
  background: var(--stage-canvas);
}

:is(
  #view-walkthrough,
  #view-workpaper,
  #view-findings,
  #view-mgmtinteraction,
  #view-report,
  #view-remediationtrack
) :is(button, input, select, textarea, summary) {
  font-family: inherit;
}

:is(
  #view-walkthrough,
  #view-workpaper,
  #view-findings,
  #view-mgmtinteraction,
  #view-report,
  #view-remediationtrack
) :is(.btn, button):not(:disabled) {
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

:is(
  #view-walkthrough,
  #view-workpaper,
  #view-findings,
  #view-mgmtinteraction,
  #view-report,
  #view-remediationtrack
) :is(.btn, button):not(:disabled):active {
  transform: translateY(1px) scale(.992);
}

:is(
  #view-walkthrough,
  #view-workpaper,
  #view-findings,
  #view-mgmtinteraction,
  #view-report,
  #view-remediationtrack
) :focus-visible {
  outline: 2px solid rgba(23, 105, 232, .42) !important;
  outline-offset: 2px;
}

/* ---------- shared closeout navigation ---------- */

.closure-stage-switcher {
  min-height: 62px;
  grid-template-columns: 146px minmax(0, 1fr);
  margin-bottom: 12px;
  padding: 8px 9px 8px 13px;
  border-color: rgba(211, 218, 228, .9);
  border-radius: var(--stage-radius);
  background: rgba(255, 255, 255, .91);
  box-shadow: 0 8px 24px rgba(41, 53, 75, .045), inset 0 1px 0 rgba(255, 255, 255, .82);
  backdrop-filter: blur(18px) saturate(130%);
}

.closure-stage-switcher-title {
  padding-right: 9px;
}

.closure-stage-switcher-title > svg {
  width: 19px;
  height: 19px;
}

.closure-stage-switcher-tabs {
  gap: 4px;
  padding: 3px;
  border: 1px solid #eaedf2;
  background: #f3f4f7;
}

.closure-stage-tab {
  min-height: 42px;
  grid-template-columns: 18px 17px minmax(0, 1fr);
  padding: 5px 9px;
}

.closure-stage-tab.is-active {
  box-shadow: 0 2px 7px rgba(31, 45, 70, .09), 0 0 0 1px rgba(202, 211, 224, .55);
}

.closure-page-surface,
#view-mgmtinteraction .mi-container > .view-card,
#view-report .rp-editing-workbench {
  border-radius: var(--stage-radius) !important;
  box-shadow: var(--stage-shadow) !important;
}

/* ---------- program execution ---------- */

#view-walkthrough .uaw-shell {
  --uaw-context-width: 304px;
  background: var(--stage-surface);
}

#view-walkthrough .uaw-formal {
  background: var(--stage-surface);
}

#view-walkthrough .at-execution-worksheet {
  padding: 17px 20px 36px;
}

#view-walkthrough .at-program-page-title {
  min-height: 46px;
  margin-bottom: 11px;
}

#view-walkthrough .at-program-page-title h1 {
  font-size: 25px;
  font-weight: 770;
  letter-spacing: -.032em;
}

#view-walkthrough .at-program-page-title span {
  font-size: 10px;
  letter-spacing: .04em;
}

#view-walkthrough .at-program-overview {
  gap: 22px;
  margin-bottom: 11px;
  padding: 15px 17px;
  border-color: var(--stage-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .022), 0 7px 20px rgba(42, 55, 78, .028);
}

#view-walkthrough .at-program-overview-main dl > div {
  grid-template-columns: 70px minmax(0, 1fr);
}

#view-walkthrough .at-program-metrics {
  margin-bottom: 11px;
  border-color: var(--stage-line);
  background: #fbfcfe;
}

#view-walkthrough .at-data-workspace {
  overflow: hidden;
  border: 1px solid var(--stage-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(42, 55, 78, .04);
}

#view-walkthrough .at-data-workspace > header,
#view-walkthrough .at-data-workspace .at-data-toolbar {
  border-bottom-color: var(--stage-line-soft);
}

#view-walkthrough .at-data-table thead,
#view-walkthrough .at-data-table table thead {
  position: sticky;
  z-index: 2;
  top: 0;
  background: #f7f9fc;
}

#view-walkthrough .uaw-context {
  gap: 12px;
  padding: 15px 13px 18px;
  border-left-color: var(--stage-line);
  background: #fafbfd;
}

#view-walkthrough .uaw-context-head {
  padding-bottom: 11px;
}

#view-walkthrough .uaw-default-context > section {
  overflow: hidden;
  border: 1px solid var(--stage-line-soft);
  border-radius: 11px;
  background: #fff;
}

#view-walkthrough [data-uaw-program-actions] {
  gap: 7px;
}

#view-walkthrough [data-uaw-program-actions] > button {
  min-height: 62px;
  border-color: #e4e9f0;
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .02);
}

#view-walkthrough [data-uaw-program-actions] > button:hover {
  border-color: #aac4ec;
  background: #f4f8ff;
  box-shadow: 0 5px 14px rgba(48, 93, 161, .07);
}

#view-walkthrough .uaw-bottom {
  border-top-color: var(--stage-line);
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 -9px 24px rgba(40, 53, 75, .04);
}

/* ---------- workpaper collection ---------- */

#view-workpaper > .app-page-hero {
  min-height: 40px !important;
  padding: 0 2px 8px !important;
}

#view-workpaper > .app-page-hero h2 {
  font-size: 22px;
  font-weight: 770;
  letter-spacing: -.03em;
}

#view-workpaper .project-flow-nav.pfn-compact {
  margin-bottom: 10px !important;
  border-color: var(--stage-line) !important;
  border-radius: 11px !important;
}

#view-workpaper .wpm-workpaper-desk {
  overflow: hidden;
  border-color: var(--stage-line);
  border-radius: var(--stage-radius);
  background: #fff;
  box-shadow: var(--stage-shadow);
}

#view-workpaper .wpm-desk-head {
  min-height: 78px;
  padding: 13px 16px;
  background: #fff;
}

#view-workpaper .wpm-desk-head > div:first-child {
  max-width: 720px;
}

#view-workpaper .wpm-desk-head h3 {
  margin-top: 4px;
  font-size: 19px;
  font-weight: 770;
  letter-spacing: -.024em;
}

#view-workpaper .wpm-desk-head p {
  max-width: 690px;
  color: var(--stage-copy);
  font-size: 11.5px;
}

#view-workpaper .wpm-desk-kpis span {
  min-width: 74px;
  padding-inline: 12px;
}

#view-workpaper .wpm-desk-kpis strong {
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

#view-workpaper .wpm-desk-layout {
  grid-template-columns: 294px minmax(0, 1fr);
  min-height: 600px;
}

#view-workpaper .wpm-desk-list {
  border-right-color: var(--stage-line);
  background: #f8f9fb;
}

#view-workpaper .wpm-paper-row {
  min-height: 38px;
  border-radius: 9px;
}

#view-workpaper .wpm-paper-row:hover {
  border-color: #bfd0e8;
  background: #fff;
}

#view-workpaper .wpm-paper-row.active {
  border-color: #7ba9ef;
  background: var(--stage-blue-soft);
  box-shadow: inset 3px 0 0 var(--stage-blue);
}

#view-workpaper .wpm-desk-detail {
  background: #fff;
}

#view-workpaper .wpm-desk-current {
  min-height: 84px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--stage-line-soft);
}

#view-workpaper .wpm-desk-current h3 {
  font-size: 20px;
  font-weight: 760;
  letter-spacing: -.022em;
}

#view-workpaper .wpm-desk-fields {
  background: #fafbfd;
}

#view-workpaper .wpm-desk-next {
  border-top: 1px solid var(--stage-line-soft);
  background: #fbfcfe;
}

/* ---------- findings ---------- */

#view-findings .closure-findings-surface .ff-page-overview {
  min-height: 100px !important;
  padding: 19px 21px 17px !important;
}

#view-findings .closure-findings-surface .ff-page-overview-copy h2 {
  font-size: 24px !important;
  font-weight: 770 !important;
  letter-spacing: -.032em;
}

#view-findings .ff-page-overview-copy p {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.55;
}

#view-findings .ff-page-overview-metrics {
  border-color: var(--stage-line-soft) !important;
  background: #f8f9fb !important;
}

#view-findings .closure-findings-surface .finding-closeout-desk .fcd-head {
  min-height: 60px;
  padding: 13px 17px !important;
}

#view-findings .finding-closeout-desk .fcd-empty {
  min-height: 142px !important;
  padding: 25px 26px !important;
}

#view-findings .ff-all-findings > summary:hover,
#view-mgmtinteraction .mi-support-records > summary:hover,
#view-report :is(.rp-report-management, .rp-delivery-support) > summary:hover {
  background: #f8fafc !important;
}

/* ---------- issue communication ---------- */

#view-mgmtinteraction .mi-communication-toolbar {
  min-height: 96px !important;
  grid-template-columns: minmax(250px, .82fr) minmax(500px, 1.45fr) !important;
  gap: 20px !important;
  padding: 15px 17px 14px 20px !important;
}

#view-mgmtinteraction .mi-communication-identity strong {
  font-size: 22px;
  font-weight: 770;
}

#view-mgmtinteraction .mi-communication-summary {
  background: #f8f9fb;
}

#view-mgmtinteraction .mi-communication-summary span {
  min-height: 40px;
  padding: 8px 10px;
}

#view-mgmtinteraction .mi-feedback-workbench {
  min-height: 510px !important;
}

#view-mgmtinteraction .mi-feedback-workbench.is-empty {
  min-height: 260px !important;
}

#view-mgmtinteraction .mi-feedback-workbench.is-empty .mi-feedback-detail-empty {
  min-height: 258px !important;
  padding: 32px 24px !important;
}

#view-mgmtinteraction .mi-feedback-detail-empty .closure-empty-icon {
  width: 48px;
  height: 48px;
}

#view-mgmtinteraction .mi-feedback-item {
  border-radius: 10px !important;
}

#view-mgmtinteraction .mi-feedback-item:hover {
  border-color: #bfd0e8 !important;
  background: #fff !important;
}

#view-mgmtinteraction .mi-feedback-item.active {
  border-color: #7ba9ef !important;
  background: var(--stage-blue-soft) !important;
  box-shadow: inset 3px 0 0 var(--stage-blue) !important;
}

/* ---------- audit report ---------- */

#view-report .rpew-head {
  min-height: 88px !important;
  padding: 16px 18px !important;
}

#view-report .rpew-head strong {
  font-size: 22px !important;
  font-weight: 770 !important;
}

#view-report .rpew-head p {
  margin-top: 4px;
  font-size: 12px !important;
}

#view-report .rpew-layout {
  grid-template-columns: 242px minmax(0, 1fr);
  min-height: 570px;
}

#view-report .rpew-nav {
  padding: 15px 13px;
  background: #f8f9fb !important;
}

#view-report .rpew-editor {
  padding: 22px 24px 28px !important;
  background: #f0f2f6 !important;
}

#view-report :is(.rp-narrative-editor, .rp-finding-editor) {
  border-radius: 14px !important;
  box-shadow: 0 8px 24px rgba(42, 55, 78, .05) !important;
}

#view-report .rpew-nav-row:hover {
  border-color: #bfd0e8 !important;
  background: #fff !important;
}

#view-report .rpew-nav-row.summary.active,
#view-report .rpew-issue-wrap.active .rpew-nav-row {
  border-color: #7ba9ef !important;
  background: var(--stage-blue-soft) !important;
}

/* ---------- remediation tracking ---------- */

#view-remediationtrack .closure-remediation-surface .ff-remediation-head {
  min-height: 96px;
  padding: 18px 21px;
}

#view-remediationtrack .closure-remediation-surface .ff-remediation-head h2 {
  font-size: 24px !important;
  font-weight: 770 !important;
  letter-spacing: -.032em;
}

#view-remediationtrack .ff-remediation-head p {
  font-size: 12px !important;
  line-height: 1.55;
}

#view-remediationtrack .closure-remediation-surface .ff-remediation-kpis article {
  min-height: 80px;
  padding: 12px 14px;
}

#view-remediationtrack .ff-remediation-kpis strong {
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

#view-remediationtrack .closure-remediation-surface .ff-remediation-empty {
  min-height: 244px !important;
  padding: 32px 24px !important;
}

#view-remediationtrack .ff-remediation-row:hover {
  border-color: #bfd0e8;
  background: #fff;
}

#view-remediationtrack .ff-remediation-row.active {
  border-color: #7ba9ef;
  background: var(--stage-blue-soft);
}

@media (min-width: 1500px) {
  #view-walkthrough .uaw-shell { --uaw-context-width: 322px; }
  #view-workpaper .wpm-desk-layout { grid-template-columns: 312px minmax(0, 1fr); }
  #view-report .rpew-layout { grid-template-columns: 258px minmax(0, 1fr); }
}

@media (max-width: 1120px) {
  #view-walkthrough .uaw-shell { --uaw-context-width: 286px; }
  #view-workpaper .wpm-desk-head { align-items: flex-start; flex-direction: column; }
  #view-workpaper .wpm-desk-kpis { width: 100%; margin-left: 0; }
  #view-mgmtinteraction .mi-communication-toolbar { grid-template-columns: 1fr !important; }
}

@media (max-width: 820px) {
  .closure-stage-switcher { grid-template-columns: 1fr; }
  .closure-stage-switcher-title { display: none; }
  #view-workpaper .wpm-desk-layout,
  #view-report .rpew-layout { grid-template-columns: 1fr; }
  #view-workpaper .wpm-desk-list { border-right: 0; border-bottom: 1px solid var(--stage-line); }
  #view-report .rpew-nav { border-right: 0 !important; border-bottom: 1px solid var(--stage-line); }
}

@media (prefers-reduced-motion: reduce) {
  :is(
    #view-walkthrough,
    #view-workpaper,
    #view-findings,
    #view-mgmtinteraction,
    #view-report,
    #view-remediationtrack
  ) * {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
