/* Progress owns its card sizing; the page remains the only outer scroller. */
@layer ffProgressLayout {
  .ff-reference-progress { gap: 16px !important; align-content: start !important; }
  .ff-reference-progress .ff-progress-layout {
    grid-template-columns: minmax(0, 1fr) 310px !important;
    align-items: stretch !important;
    gap: 16px !important;
    min-width: 0 !important;
  }
  .ff-reference-progress .ff-progress-layout > .ff-card,
  .ff-reference-progress .ff-progress-side > .ff-card {
    min-width: 0 !important;
    margin: 0 !important;
    padding: 16px !important;
    border: 1px solid #b39c8440 !important;
    border-radius: 16px !important;
  }
  .ff-reference-progress .ff-section-title {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    padding: 0 0 14px !important;
    margin: 0 !important;
    min-height: 0 !important;
  }
  .ff-reference-progress .ff-section-title h2 { margin: 0 !important; }
  .ff-reference-progress .ff-progress-side {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto minmax(0, 1fr) !important;
    gap: 12px !important;
    min-height: 0 !important;
    align-self: stretch !important;
    align-content: start !important;
  }
  /* The five-row task window determines this row, not the activity history. */
  .ff-reference-progress .ff-progress-layout[data-task-window-count="5"] .ff-progress-side {
    contain: size !important;
    height: 100% !important;
  }
  .ff-reference-progress .ff-progress-side h3 {
    font: 600 13px/1.4 Arial, sans-serif !important;
    margin: 0 0 10px !important;
  }
  .ff-reference-progress .ff-progress-side > .ff-card:first-child {
    max-height: 130px !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }
  .ff-reference-progress .ff-progress-side p {
    font-size: 12px !important;
    line-height: 1.5 !important;
    overflow-wrap: anywhere;
  }
  .ff-reference-progress .ff-progress-side > .ff-card:first-child p {
    padding: 0 !important;
    border: 0 !important;
  }
  .ff-reference-progress .ff-stat-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }
  .ff-reference-progress .ff-stat-row button {
    min-width: 0 !important;
    min-height: 58px !important;
    padding: 8px 10px !important;
    margin: 0 !important;
    flex: initial !important;
  }
  .ff-reference-progress .ff-stat-row strong { font-size: 19px !important; }
  .ff-reference-progress .ff-stat-row span { margin-top: 4px !important; }
  .ff-reference-progress .ff-recent-activity {
    display: flex !important;
    flex-direction: column !important;
    align-self: stretch !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }
  .ff-reference-progress .ff-recent-activity h3 { flex: 0 0 auto !important; }
  .ff-reference-progress .ff-activity-scroll {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: 240px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding-inline-end: 8px !important;
    scrollbar-gutter: stable !important;
    overscroll-behavior-y: contain !important;
  }
  .ff-reference-progress :is(.ff-activity-scroll, .ff-progress-side > .ff-card:first-child) {
    scrollbar-width: thin;
    scrollbar-color: #b39c84 transparent;
  }
  .ff-reference-progress .ff-activity-scroll p {
    margin: 0 !important;
    padding: 10px 0 !important;
    border: 0 !important;
    border-bottom: 1px solid #b39c8440 !important;
  }
  .ff-reference-progress .ff-activity-scroll p:first-child { padding-top: 0 !important; }
  .ff-reference-progress :is(.ff-progress-operations, .ff-progress-eco-bar) {
    margin: 0 !important;
    min-width: 0 !important;
  }
  .ff-reference-progress .ff-progress-operations {
    border-radius: 16px !important;
    overflow: hidden !important;
  }
  .ff-reference-progress .ff-progress-operations > summary {
    padding: 16px 18px !important;
    font: 600 13px/1.5 Arial, sans-serif !important;
  }
  .ff-reference-progress .ff-progress-eco-bar { padding: 14px 18px !important; }
  .folio-guide-active .simple-readiness-evidence:not([hidden]) {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    align-content: start !important;
    gap: 14px !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
    padding: 20px !important;
    margin: 0 !important;
  }
  .folio-guide-active .simple-readiness-evidence > :is(h3, p) {
    grid-column: 1 / -1 !important;
    margin: 0 !important;
  }
  .folio-guide-active .simple-readiness-evidence > h3 {
    font: 600 17px/1.4 Arial, sans-serif !important;
  }
  .folio-guide-active .simple-readiness-evidence > p {
    font: 12px/1.6 Arial, sans-serif !important;
    max-width: 90ch;
  }
  .folio-guide-active .simple-readiness-evidence .ff-check-grid > .simple-card {
    display: flex !important;
    flex-direction: column !important;
    align-self: stretch !important;
    gap: 8px !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    padding: 18px !important;
    margin: 0 !important;
    background: #e9ded5 !important;
    color: #0a0b0b !important;
    border: 1px solid #b39c8440 !important;
    border-radius: 16px !important;
  }
  .folio-guide-active .simple-readiness-evidence .simple-card :is(h4, p, label) {
    margin: 0 !important;
    line-height: 1.5 !important;
  }
  .folio-guide-active .simple-readiness-evidence .simple-card h4 { font-size: 13px !important; }
  .folio-guide-active .simple-readiness-evidence .simple-card label { margin-top: 4px !important; }
  .folio-guide-active .simple-readiness-evidence .simple-card textarea {
    height: 88px !important;
    min-height: 88px !important;
    margin: 6px 0 0 !important;
  }
  .folio-guide-active .simple-readiness-evidence .simple-card > button {
    align-self: start !important;
    min-height: 40px !important;
    max-width: 100% !important;
    margin-top: auto !important;
    white-space: normal !important;
  }
  .folio-guide-active .ff-check-group { min-width: 0 !important; margin: 0 !important; }
  .folio-guide-active .ff-check-group > h4 { font: 500 12px/1.5 Arial, sans-serif !important; color: #dcc6b0 !important; margin: 4px 0 10px !important; }
  .folio-guide-active .ff-check-grid { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)) !important; align-items: stretch !important; gap: 14px !important; }
  @media (min-width: 1101px) {
    .ff-reference-progress .ff-progress-layout[data-task-window-count]:not([data-task-window-count="5"]) {
      grid-template-columns: minmax(0, 1fr) !important;
    }
    .ff-reference-progress .ff-progress-layout[data-task-window-count]:not([data-task-window-count="5"]) .ff-progress-side {
      grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
      grid-template-rows: auto !important;
    }
  }
  @media (max-width: 1100px) {
    .ff-reference-progress .ff-progress-layout { grid-template-columns: minmax(0, 1fr) !important; }
    .ff-reference-progress .ff-progress-layout[data-task-window-count] .ff-progress-side {
      contain: none !important;
      height: auto !important;
      grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
      grid-template-rows: auto !important;
    }
    .ff-reference-progress .ff-recent-activity { grid-column: 1 / -1 !important; }
  }
  @media (max-width: 600px) {
    .folio-guide-active .ff-check-grid { grid-template-columns: minmax(0, 1fr) !important; gap: 12px !important; }
    .ff-reference-progress { gap: 14px !important; }
    .ff-reference-progress .ff-progress-layout[data-task-window-count] .ff-progress-side { grid-template-columns: minmax(0, 1fr) !important; }
    .ff-reference-progress .ff-section-title { flex-wrap: wrap !important; }
    .ff-reference-progress .ff-progress-eco-bar button { min-height: 44px !important; }
    .folio-guide-active .simple-readiness-evidence:not([hidden]) {
      grid-template-columns: minmax(0, 1fr) !important;
      padding: 18px 16px !important;
      gap: 12px !important;
    }
    .folio-guide-active .simple-readiness-evidence .simple-card textarea { font-size: 16px !important; }
    .folio-guide-active .simple-readiness-evidence .simple-card > button { min-height: 44px !important; }
  }
}
