.financial-forecast-product {
  background: linear-gradient(180deg, #1c1323 0%, #24152a 100%);
  color: #f2ede6;
}

.financial-forecast-product main {
  padding: 2.5rem 0 4rem;
}

.ff-shell {
  padding: 2rem 0 1.5rem;
}

#forecast-app {
  background: #2a1a2f;
  border: 1px solid rgba(216, 185, 138, 0.22);
  border-radius: 20px;
  padding: 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  /* Contain content to the host grid column. Without this, a wide descendant
     (e.g. a 36-month table) can force #forecast-app to grow past the .container
     and overflow the page horizontally. */
  max-width: 100%;
  overflow-x: hidden;
}

.ff-layout {
  display: grid;
  /* `minmax(0, 1fr)` (instead of bare `1fr`, which is `minmax(auto, 1fr)`) lets
     the main column shrink below the intrinsic size of its widest descendant,
     so wide tables/charts trigger their own internal scrollbars instead of
     stretching the whole layout. */
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 1rem;
}

.ff-sidebar {
  position: sticky;
  top: 0.6rem;
  height: calc(100vh - 2rem);
  overflow-y: auto;
  padding-right: 0.3rem;
}

.ff-main {
  overflow: visible;
  /* Belt-and-braces with `minmax(0, 1fr)` above: explicitly allow the main
     column to shrink so descendants honour `overflow-x: auto` rather than
     pushing the whole grid wider. */
  min-width: 0;
}

.ff-step-view {
  min-width: 0;
}

.ff-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.2rem;
  text-align: center;
}

.ff-top h1 {
  color: #f7f2eb;
  font-family: "Playfair Display", Georgia, serif;
  margin-bottom: 0.4rem;
}

.ff-top p {
  color: #cfc6bb;
  max-width: 68ch;
}

.ff-top__meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
}

.ff-company-card {
  background: #3b2438;
  border: 1px solid #5e4561;
  border-radius: 12px;
  padding: 0.75rem;
  margin-bottom: 0.9rem;
}

.ff-company-card__label {
  color: #a89f95;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
}

.ff-company-card__name {
  color: #f7f2eb;
  font-weight: 600;
}

.ff-progress-wrap {
  margin-bottom: 1rem;
}

.ff-progress-meta {
  color: #cfc6bb;
  font-size: 0.82rem;
}

.ff-progress-line {
  width: 100%;
  height: 8px;
  background: #3b2438;
  border-radius: 999px;
  margin: 0.5rem 0 0.85rem;
}

.ff-progress-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a88458, #d8b98a);
}

.ff-sidebar-steps {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.ff-sidebar-step {
  border: 1px solid #4a314a;
  background: #2f1f35;
  color: #ede3d6;
  border-radius: 12px;
  padding: 0.55rem 0.65rem;
  font-size: 0.84rem;
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 0.45rem;
  align-items: center;
  text-align: left;
}

.ff-sidebar-step__number {
  color: #a89f95;
  font-weight: 700;
  font-size: 0.8rem;
}

.ff-sidebar-step__badge {
  background: rgba(120, 201, 157, 0.2);
  border: 1px solid rgba(120, 201, 157, 0.5);
  color: #d8f8e5;
  font-size: 0.68rem;
  border-radius: 999px;
  padding: 0.16rem 0.45rem;
}

.ff-sidebar-step.is-active {
  border-color: #d8b98a;
  box-shadow: 0 0 0 2px rgba(216, 185, 138, 0.2);
}

.ff-sidebar-step.is-inactive {
  opacity: 0.7;
}

.ff-nav-controls {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.ff-step-header,
.ff-subsection-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Top-of-dashboard action bar (Print Summary / Save JSON Data). Centred,
   prominent, and clearly separated from the KPI grid below. */
.ff-subsection-head--actions {
  justify-content: center;
  margin: 0.25rem 0 1.6rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px dashed rgba(216, 185, 138, 0.18);
}

.ff-subsection-head--actions .ff-actions-inline {
  gap: 0.85rem;
  justify-content: center;
}

.ff-subsection-head--actions .btn,
.btn[data-action="import-json-file"] {
  min-width: 200px;
  padding: 0.7rem 1.6rem;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-width: 1.5px;
  border-radius: 10px;
}

/* Override the global muted outline (border-color: --color-border) with a
   strong accent gold so the call-to-action reads at a glance. */
.ff-subsection-head--actions .btn--outline,
.btn--outline[data-action="import-json-file"] {
  color: #f5e3b6;
  background: rgba(198, 168, 90, 0.12);
  border-color: var(--color-accent);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), inset 0 0 0 1px rgba(198, 168, 90, 0.18);
}

.ff-subsection-head--actions .btn--outline:hover,
.ff-subsection-head--actions .btn--outline:focus-visible,
.btn--outline[data-action="import-json-file"]:hover,
.btn--outline[data-action="import-json-file"]:focus-visible {
  background: var(--color-accent);
  color: #1a0b20;
  border-color: var(--color-accent);
  box-shadow: 0 4px 14px rgba(198, 168, 90, 0.35);
  outline: none;
}

.ff-step-header {
  margin-bottom: 0.75rem;
}

/* Intro copy that sits directly under the step header (above the first
   .ff-panel). Keeps the step opening clean and consistent with how other
   steps introduce themselves. */
.ff-step-intro {
  margin: 0 0 1rem;
  padding: 0 0.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ff-step-intro p {
  margin: 0;
  line-height: 1.5;
}

/* Inline code snippets inside helper / intro text (e.g. ".json"). */
#forecast-app code {
  background: rgba(198, 168, 90, 0.14);
  color: #f5e3b6;
  border: 1px solid rgba(198, 168, 90, 0.35);
  border-radius: 4px;
  padding: 0.05rem 0.4rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.ff-top-actions {
  justify-content: center;
  margin-bottom: 0.7rem;
}

.ff-bottom-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
  margin-top: 0.85rem;
}

.ff-panel {
  background: #321f37;
  border: 1px solid #4f3450;
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
  /* Allow the panel to shrink inside its grid cell so wide descendants use
     their own `.ff-table-wrap` (overflow-x: auto) scrollers instead of
     stretching the panel. */
  min-width: 0;
}

.ff-panel h2,
.ff-panel h3 {
  color: #f7f2eb;
  margin-bottom: 0.6rem;
}

.ff-panel--critical {
  border-color: #d76f78;
}

.ff-helper {
  color: #cfc6bb;
  font-size: 0.92rem;
}

/* Phase 4.3.2: inline empty-state / validation hints.
   Used in result panels to distinguish "calculated zero" from
   "not yet populated by the user". Deliberately muted and non-blocking. */
.ff-empty-note {
  color: #e2d6c2;
  background: rgba(216, 185, 138, 0.08);
  border-left: 3px solid rgba(216, 185, 138, 0.55);
  padding: 0.5rem 0.75rem;
  margin: 0.2rem 0 0.6rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.88rem;
  line-height: 1.4;
}

.ff-empty-note strong {
  color: #f2ede6;
}

.ff-inline-note {
  color: #e2d6c2;
  background: rgba(134, 168, 255, 0.08);
  border-left: 3px solid rgba(134, 168, 255, 0.45);
  padding: 0.45rem 0.7rem;
  margin: 0.2rem 0 0.6rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.88rem;
  line-height: 1.4;
}

/* Phase 4.3.2: the Results Dashboard can show a lightweight
   "data completeness" banner at the top summarising any obviously
   missing decision-sensitive inputs. */
.ff-data-completeness {
  border: 1px solid rgba(216, 185, 138, 0.35);
  background: rgba(216, 185, 138, 0.06);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
}

.ff-data-completeness h3 {
  margin: 0 0 0.35rem;
  font-size: 1.02rem;
  font-weight: 600;
  color: #f2ede6;
}

.ff-data-completeness ul {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
  color: #e2d6c2;
  font-size: 0.9rem;
}

.ff-data-completeness li {
  margin: 0.15rem 0;
}

.ff-data-completeness--ok {
  border-color: rgba(142, 214, 166, 0.45);
  background: rgba(142, 214, 166, 0.06);
}

.ff-grid {
  display: grid;
  gap: 0.8rem;
}

.ff-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ff-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ff-field,
.ff-checkbox {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
}

.ff-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
}

.ff-field input,
.ff-field select {
  border: 1px solid #5a3b58;
  border-radius: 8px;
  background: #28172e;
  color: #f2ede6;
  padding: 0.55rem 0.65rem;
}

.ff-tip {
  color: #a89f95;
  font-size: 0.72rem;
  margin-left: 0.2rem;
  cursor: help;
}

.ff-subpanel {
  border: 1px solid #523854;
  background: #291a2f;
  border-radius: 10px;
  padding: 0.75rem;
  margin-top: 0.8rem;
}

.ff-seasonality-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.ff-pcf-table-wrap {
  overflow-x: auto;
  margin-top: 0.65rem;
  border: 1px solid #523854;
  border-radius: 10px;
  background: #201127;
}

.ff-pcf-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
  color: #f2ede6;
  min-width: 980px;
}

.ff-pcf-table th,
.ff-pcf-table td {
  padding: 0.35rem 0.45rem;
  text-align: right;
  border-bottom: 1px solid #3a2340;
  white-space: nowrap;
}

.ff-pcf-table th {
  background: #291a2f;
  font-weight: 600;
  color: #d9c8a8;
  position: sticky;
  top: 0;
}

.ff-pcf-table th.ff-pcf-col-label,
.ff-pcf-table td.ff-pcf-col-label {
  text-align: left;
  min-width: 220px;
  color: #f7efe0;
  font-weight: 500;
  position: sticky;
  left: 0;
  background: #291a2f;
  z-index: 1;
}

.ff-pcf-table td.ff-pcf-col-total {
  font-variant-numeric: tabular-nums;
  color: #d9c8a8;
  font-weight: 600;
}

.ff-pcf-table td.ff-pcf-col-action {
  text-align: center;
}

.ff-pcf-table input[type="number"] {
  width: 68px;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  border: 1px solid #5a3b58;
  background: #1a0b20;
  color: #f2ede6;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ff-pcf-table input[type="text"] {
  width: 200px;
  padding: 0.3rem 0.4rem;
  border-radius: 6px;
  border: 1px solid #5a3b58;
  background: #1a0b20;
  color: #f2ede6;
}

.ff-pcf-table tfoot td {
  background: #1a0b20;
  color: #d9c8a8;
  font-weight: 600;
}

.ff-pcf-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.7rem;
  margin-top: 0.8rem;
}

.ff-pcf-summary-card {
  padding: 0.65rem 0.8rem;
  background: #201127;
  border: 1px solid #523854;
  border-radius: 10px;
}

.ff-pcf-summary-card .ff-pcf-summary-label {
  font-size: 0.72rem;
  color: #bfa98e;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ff-pcf-summary-card .ff-pcf-summary-value {
  font-size: 1.05rem;
  font-weight: 600;
  color: #f7efe0;
  margin-top: 0.15rem;
  font-variant-numeric: tabular-nums;
}

.ff-pcf-summary-card--warn .ff-pcf-summary-value {
  color: #ff9e7b;
}

.ff-pcf-summary-card .ff-pcf-summary-meta {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: #bfa98e;
  margin-top: 0.1rem;
  letter-spacing: 0.03em;
}

.ff-pcf-group {
  margin-top: 0.9rem;
}

.ff-pcf-group:first-child {
  margin-top: 0.2rem;
}

.ff-pcf-group-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #d9c8a8;
  margin: 0 0 0.3rem 0;
}

.ff-pcf-trend-caption {
  margin-top: 0.35rem;
  font-size: 0.8rem;
}

.ff-pcf-summary-value-small {
  font-size: 0.92rem;
  font-weight: 500;
  color: #f7efe0;
}

.ff-pcf-stress {
  margin-top: 1rem;
  padding: 0.85rem 0.95rem;
  border: 1px dashed rgba(216, 185, 138, 0.35);
  border-radius: 12px;
  background: rgba(32, 17, 39, 0.6);
}

.ff-pcf-stress-head {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-bottom: 0.55rem;
}

.ff-pcf-stress-helper {
  color: #cfc6bb;
  font-size: 0.82rem;
}

.ff-pcf-stress-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  align-items: flex-end;
}

.ff-pcf-stress-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.82rem;
  color: #ede3d6;
  min-width: 220px;
}

.ff-pcf-stress-field input[type="number"] {
  width: 90px;
  padding: 0.35rem 0.45rem;
  border-radius: 6px;
  border: 1px solid #5a3b58;
  background: #1a0b20;
  color: #f2ede6;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ff-pcf-stress-suffix {
  font-size: 0.72rem;
  color: #bfa98e;
  margin-top: 0.15rem;
}

.ff-pcf-stress .btn {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
}

.ff-pcf-stress-output {
  margin-top: 0.85rem;
}

.ff-pcf-stress-table th,
.ff-pcf-stress-table td {
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.ff-pcf-stress-delta {
  color: #f5c57b;
  font-weight: 600;
}

.ff-actions-inline {
  display: inline-flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.ff-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.ff-stat-card {
  border: 1px solid rgba(216, 185, 138, 0.25);
  border-radius: 10px;
  padding: 0.75rem;
  background: #24152b;
}

.ff-stat-card__label {
  color: #cfc6bb;
  font-size: 0.84rem;
}

.ff-stat-card__value {
  font-size: 1.2rem;
  font-weight: 600;
  color: #f7f2eb;
}

.ff-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.ff-chart,
.ff-chart-svg {
  width: 100%;
}

.ff-chart-empty {
  padding: 1rem 0;
  color: #a89f95;
}

.ff-chart-bars {
  width: 100%;
  height: auto;
}

.ff-table-wrap {
  overflow-x: auto;
}

.ff-table {
  width: 100%;
  border-collapse: collapse;
}

.ff-table th,
.ff-table td {
  border: 1px solid #533957;
  padding: 0.5rem;
  text-align: left;
  font-size: 0.85rem;
}

.ff-table--period th,
.ff-table--period td {
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  white-space: nowrap;
  text-align: right;
}

.ff-table--period thead th,
.ff-table--period tbody th {
  text-align: left;
  color: #f2ede6;
}

.ff-table--period tbody th {
  position: sticky;
  left: 0;
  background: #2a1a30;
  z-index: 1;
}

.ff-row-header th,
.ff-row-header td {
  background: rgba(198, 161, 110, 0.08);
  font-weight: 700;
}

.ff-row-subtotal th,
.ff-row-subtotal td {
  background: rgba(198, 161, 110, 0.05);
  font-style: italic;
}

.ff-row-total th,
.ff-row-total td {
  background: rgba(198, 161, 110, 0.15);
  font-weight: 700;
  border-top: 1px solid #c6a16e;
}

.ff-details {
  margin-top: 0.6rem;
}

.ff-details > summary {
  cursor: pointer;
  padding: 0.4rem 0.6rem;
  background: rgba(198, 161, 110, 0.08);
  border-radius: 6px;
  font-weight: 600;
}

.ff-inputs-recap {
  display: grid;
  gap: 0.6rem;
}

.ff-inputs-recap__group h4 {
  margin: 0 0 0.3rem;
  color: #d8b98a;
  font-size: 0.9rem;
}

.ff-inputs-recap__group dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 0.2rem 0.8rem;
  font-size: 0.82rem;
}

.ff-inputs-recap__group dt {
  color: #cfc6bb;
}

.ff-inputs-recap__group dd {
  margin: 0;
  color: #f7f2eb;
}

.ff-badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.78rem;
  border: 1px solid transparent;
}

.ff-badge--ok {
  border-color: #78c99d;
  color: #b9f1cc;
}

.ff-badge--warning {
  border-color: #d8b98a;
  color: #f0d8af;
}

.ff-badge--critical {
  border-color: #df6f78;
  color: #ffc5ca;
}

.ff-badge--info {
  border-color: #7aa6ff;
  color: #bcd3ff;
}

.ff-review-summary {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.ff-review-list {
  margin: 0.75rem 0 1rem;
  padding-left: 1rem;
  list-style: disc;
}

#ff-print-layout {
  display: none;
}

@media print {
  @page {
    margin: 10mm 12mm;
    size: A4 landscape;
  }

  body > *:not(#ff-print-layout) {
    display: none !important;
  }

  #ff-print-layout {
    display: block !important;
    position: static !important;
    inset: auto;
    background: #fff;
    color: #111827;
    padding: 0;
    margin: 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
  }

  #ff-print-layout,
  #ff-print-layout *:not(svg):not(svg *) {
    background: #fff !important;
    color: #111827 !important;
    position: static !important;
    float: none !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    flex-grow: 0 !important;
    flex-shrink: 1 !important;
    transform: none !important;
    box-shadow: none !important;
    filter: none !important;
    opacity: 1 !important;
  }

  #ff-print-layout svg,
  #ff-print-layout svg * {
    /* Preserve SVG geometry: height / width attributes on <rect>, <line>, etc.
       must not be overridden by the universal reset above. */
    background: transparent !important;
    box-shadow: none !important;
    filter: none !important;
  }

  #ff-print-layout svg text,
  #ff-print-layout svg tspan {
    fill: #111827 !important;
  }

  #ff-print-layout .ff-print-root,
  #ff-print-layout .ff-print-root * {
    visibility: visible !important;
  }

  #ff-print-layout .ff-print-root {
    max-width: none;
    margin: 0 auto;
    padding: 0;
    background: #fff;
    color: #111827;
    font-family: Inter, Arial, sans-serif;
    font-size: 11px;
    line-height: 1.35;
  }

  #ff-print-layout .ff-print-section {
    margin: 0 0 16px;
    padding: 0;
    page-break-inside: avoid;
    break-inside: avoid;
    min-height: 0 !important;
  }

  #ff-print-layout .ff-print-section:last-child {
    margin-bottom: 0;
    page-break-after: auto;
    break-after: auto;
  }

  #ff-print-layout h1,
  #ff-print-layout h2 {
    font-family: "Playfair Display", Georgia, serif;
  }

  #ff-print-layout .subtitle,
  #ff-print-layout .timestamp {
    color: #374151 !important;
    margin: 2px 0;
  }

  #ff-print-layout .print-kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 10px 0 0;
  }

  #ff-print-layout .print-card {
    border: 1px solid #9ca3af;
    border-radius: 6px;
    padding: 8px;
    background: #fff !important;
  }

  #ff-print-layout .print-card p {
    margin: 3px 0 0;
    font-weight: 700;
  }

  #ff-print-layout .print-chart {
    margin: 0 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff !important;
    min-height: 0 !important;
  }

  #ff-print-layout .print-chart figcaption {
    margin: 8px 8px 0;
    font-weight: 700;
    color: #111827 !important;
  }

  #ff-print-layout .print-chart svg {
    display: block;
    width: 100%;
    height: auto;
  }

  #ff-print-layout .print-subsection {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  #ff-print-layout .print-chart-fallback {
    border: 1px dashed #9ca3af;
    border-radius: 6px;
    padding: 10px;
    margin: 0 0 12px;
    font-style: italic;
  }

  #ff-print-layout .print-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #9ca3af;
    background: #fff !important;
    margin: 0 0 10px;
  }

  #ff-print-layout .print-table th,
  #ff-print-layout .print-table td {
    border: 1px solid #9ca3af;
    padding: 6px;
    text-align: left;
    color: #111827 !important;
    background: #fff !important;
  }

  #ff-print-layout .print-table--period {
    font-size: 9.5px;
  }

  #ff-print-layout .print-table--period th,
  #ff-print-layout .print-table--period td {
    padding: 3px 4px;
    text-align: right;
    white-space: nowrap;
  }

  #ff-print-layout .print-table--period thead th {
    text-align: center;
    background: #f3f4f6 !important;
  }

  #ff-print-layout .print-table--period tbody th {
    text-align: left;
    font-weight: 600;
  }

  #ff-print-layout .print-row-header th,
  #ff-print-layout .print-row-header td {
    background: #f3f4f6 !important;
    font-weight: 700;
  }

  #ff-print-layout .print-row-subtotal th,
  #ff-print-layout .print-row-subtotal td {
    background: #f9fafb !important;
    font-style: italic;
  }

  #ff-print-layout .print-row-total th,
  #ff-print-layout .print-row-total td {
    background: #e5e7eb !important;
    font-weight: 700;
    border-top: 2px solid #111827;
  }

  #ff-print-layout .print-table--kv {
    font-size: 10.5px;
  }

  #ff-print-layout .print-table--kv th {
    width: 40%;
    background: #f9fafb !important;
  }

  #ff-print-layout .print-table .print-table__group th {
    background: #e5e7eb !important;
    color: #111827 !important;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 4px 6px;
  }

  #ff-print-layout .print-sub-heading {
    margin: 12px 0 4px;
    font-size: 11.5px;
    font-weight: 700;
    color: #111827 !important;
  }

  #ff-print-layout .print-helper {
    margin: 4px 0 6px;
    font-style: italic;
    color: #4b5563 !important;
    font-size: 10px;
  }

  #ff-print-layout .print-subsection h3 {
    margin: 12px 0 4px;
    font-size: 13px;
    border-bottom: 1px solid #9ca3af;
    padding-bottom: 3px;
    /* Never orphan a sub-heading at the bottom of a page ahead of its table. */
    page-break-after: avoid;
    break-after: avoid;
  }

  #ff-print-layout .print-sub-heading {
    /* Phase 4.3.2: print hardening - keep sub-headings with the following content. */
    page-break-after: avoid;
    break-after: avoid;
  }

  #ff-print-layout .print-helper {
    /* Helper captions should stay with the table/chart they describe. */
    page-break-after: avoid;
    break-after: avoid;
  }

  #ff-print-layout .print-table,
  #ff-print-layout .print-chart {
    /* Phase 4.3.2: prefer not to split an entire table or chart mid-page.
       Modern engines will still break a very tall table across pages,
       but small/medium tables and all charts will stay intact. */
    page-break-inside: avoid;
    break-inside: avoid;
  }

  #ff-print-layout .print-table thead {
    /* Repeat table headers on every page when a long table does have to split. */
    display: table-header-group;
  }

  #ff-print-layout .print-table tfoot {
    display: table-footer-group;
  }

  #ff-print-layout .print-table tr,
  #ff-print-layout .print-table tbody tr {
    /* Keep individual rows intact rather than splitting a row across pages. */
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* Phase 4.3.2-G: print-only compact treatment for very wide 36-month
     period tables. Tightens cell padding and drops font another half point
     without affecting screen view. */
  #ff-print-layout .print-table--period-monthly th,
  #ff-print-layout .print-table--period-monthly td {
    font-size: 9px;
    padding: 2px 3px;
  }

  /* Orphan / widow tuning to reduce single-line stranded paragraphs. */
  #ff-print-layout p,
  #ff-print-layout .print-helper {
    orphans: 3;
    widows: 3;
  }

  /* Scenario Testing is diagnostic, not client-facing. Print output comes
     from the dedicated #ff-print-layout tree, which already excludes any
     scenario-testing controls on the live dashboard. */
}

@media (max-width: 900px) {
  .ff-layout {
    grid-template-columns: 1fr;
  }

  .ff-sidebar {
    position: static;
    height: auto;
    overflow: visible;
  }

  .ff-grid--3,
  .ff-grid--2,
  .ff-chart-grid,
  .ff-kpi-grid {
    grid-template-columns: 1fr;
  }

  .ff-seasonality-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

#forecast-app ::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

#forecast-app ::-webkit-scrollbar-thumb {
  background: #6f526e;
  border-radius: 999px;
}

#forecast-app ::-webkit-scrollbar-track {
  background: #2a1a2f;
}
