.revenue-forecast-panel {
  margin-top: 16px;
}

.revenue-forecast-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.revenue-forecast-status {
  white-space: nowrap;
}

.revenue-forecast-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.revenue-forecast-kpi {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.revenue-forecast-kpi-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.revenue-forecast-kpi-value {
  display: block;
  margin-top: 5px;
  font-size: 22px;
  letter-spacing: -.03em;
}

.revenue-forecast-kpi-note {
  display: block;
  margin-top: 5px;
  color: var(--muted-2);
  font-size: 10px;
}

.revenue-forecast-subpanel {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.revenue-forecast-subpanel h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.revenue-forecast-subpanel .board-panel-head p {
  margin: 3px 0 0;
}

.revenue-forecast-segment-table,
.revenue-forecast-history-table {
  min-width: 760px;
}

.revenue-forecast-segment-table td:first-child,
.revenue-forecast-history-table td:first-child {
  font-weight: 600;
}

.revenue-forecast-segment-table small,
.revenue-forecast-history-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 400;
}

.revenue-forecast-table-wrap {
  overflow-x: auto;
  margin-top: 16px;
}

.revenue-forecast-table {
  min-width: 720px;
}

.revenue-forecast-table .forecast-cell {
  min-width: 170px;
}

.revenue-forecast-bar {
  position: relative;
  height: 8px;
  min-width: 120px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.revenue-forecast-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--pink);
}

.revenue-forecast-range {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.revenue-forecast-promo {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.revenue-forecast-basis {
  min-width: 230px;
  max-width: 320px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  white-space: normal;
}

.revenue-forecast-basis strong {
  display: block;
  color: var(--text);
  font-size: 11px;
}

.revenue-forecast-steps {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  color: var(--muted);
}

.revenue-forecast-step {
  padding-left: 12px;
  position: relative;
}

.revenue-forecast-step::before {
  content: '';
  position: absolute;
  left: 0;
  top: .58em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--pink);
}

.revenue-forecast-method {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, .7fr);
  gap: 14px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--pink-soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.revenue-forecast-method strong {
  color: var(--text);
}

.revenue-forecast-warning {
  color: var(--yellow);
}

@media (max-width: 900px) {
  .revenue-forecast-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .revenue-forecast-method {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .revenue-forecast-kpis {
    grid-template-columns: 1fr;
  }

  .revenue-forecast-subpanel {
    margin-top: 12px;
    padding-top: 12px;
  }

  .revenue-forecast-table-wrap {
    overflow-x: visible;
  }

  .revenue-forecast-segment-table,
  .revenue-forecast-history-table,
  .revenue-forecast-table {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
  }

  .revenue-forecast-segment-table thead,
  .revenue-forecast-history-table thead,
  .revenue-forecast-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .revenue-forecast-segment-table tbody,
  .revenue-forecast-history-table tbody,
  .revenue-forecast-table tbody,
  .revenue-forecast-segment-table tr,
  .revenue-forecast-history-table tr,
  .revenue-forecast-table tr,
  .revenue-forecast-segment-table td,
  .revenue-forecast-history-table td,
  .revenue-forecast-table td {
    display: block;
  }

  .revenue-forecast-segment-table tr,
  .revenue-forecast-history-table tr,
  .revenue-forecast-table tr {
    margin-top: 8px;
    padding: 9px 0;
    border-top: 1px solid var(--line);
  }

  .revenue-forecast-segment-table tr:first-child,
  .revenue-forecast-history-table tr:first-child,
  .revenue-forecast-table tr:first-child {
    margin-top: 0;
  }

  .revenue-forecast-segment-table td,
  .revenue-forecast-history-table td,
  .revenue-forecast-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 5px 0;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .revenue-forecast-segment-table td:first-child,
  .revenue-forecast-history-table td:first-child,
  .revenue-forecast-table td:first-child {
    display: block;
    padding-bottom: 7px;
    text-align: left;
  }

  .revenue-forecast-segment-table td:not(:first-child)::before,
  .revenue-forecast-history-table td:not(:first-child)::before,
  .revenue-forecast-table td:not(:first-child)::before {
    flex: 0 0 auto;
    color: var(--muted-2);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 500;
    text-align: left;
  }

  .revenue-forecast-table .forecast-cell {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(92px, auto) minmax(0, 1fr);
    align-items: start;
  }

  .revenue-forecast-table .forecast-cell::before {
    grid-column: 1;
    flex: none;
    color: var(--muted-2);
    content: attr(data-label);
    font-size: 10px;
    font-weight: 500;
    text-align: left;
  }

  .revenue-forecast-table .forecast-cell > strong,
  .revenue-forecast-table .forecast-cell > .revenue-forecast-range,
  .revenue-forecast-table .forecast-cell > .revenue-forecast-bar {
    grid-column: 2;
    margin-left: auto;
    max-width: 100%;
  }

  .revenue-forecast-table .forecast-cell > .revenue-forecast-bar {
    width: 100%;
    min-width: 0;
  }

  .revenue-forecast-table .forecast-cell > .revenue-forecast-range {
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: right;
  }

  .revenue-forecast-table .revenue-forecast-basis,
  .revenue-forecast-table .revenue-forecast-promo {
    max-width: none;
    min-width: 0;
    text-align: right;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .revenue-forecast-table .revenue-forecast-basis,
  .revenue-forecast-table .revenue-forecast-promo {
    display: flex;
  }

  .revenue-forecast-table .revenue-forecast-basis > span,
  .revenue-forecast-table .revenue-forecast-promo > span {
    min-width: 0;
    flex: 1 1 auto;
    overflow-wrap: anywhere;
    white-space: normal;
  }
}

/* ---------------------------------------------------------------------------
   Lighter pass, matching Wynik firmy and Sprzedaż: white tiles with thin
   rules, ink numbers, one calm bar colour, wrapped explanations.
   --------------------------------------------------------------------------- */
.revenue-forecast-panel { font-variant-numeric: tabular-nums; }
.revenue-forecast-head { padding-bottom: 12px; border-bottom: 1px solid #e8e9e0; }
.revenue-forecast-head h3 { margin: 4px 0; font-size: 22px; font-weight: 600; }
.revenue-forecast-head p { margin: 0; color: #65665f; font-size: 11px; }

.revenue-forecast-kpi { padding: 14px 16px; border: 1px solid #e8e9e0; border-radius: 10px; background: #fff; }
.revenue-forecast-kpi-label { color: #65665f; font-size: 10px; font-weight: 500; letter-spacing: .02em; }
.revenue-forecast-kpi-value { font-size: 24px; font-weight: 600; line-height: 1.15; }
.revenue-forecast-kpi-note { padding-top: 5px; border-top: 1px dashed #e8e9e0; color: #65665f; font-size: 10.5px; }

.revenue-forecast-subpanel { border-top-color: #e8e9e0; }
.revenue-forecast-subpanel h4 { font-size: 13px; font-weight: 600; }

.revenue-forecast-panel .board-table th,
.revenue-forecast-panel .board-table td { vertical-align: top; }
.revenue-forecast-segment-table td:not(:first-child),
.revenue-forecast-segment-table thead th:not(:first-child),
.revenue-forecast-history-table td:not(:first-child):not(:last-child),
.revenue-forecast-history-table thead th:not(:first-child):not(:last-child) { text-align: right; }
.revenue-forecast-history-table td:last-child,
.revenue-forecast-history-table thead th:last-child { text-align: left; color: #65665f; }

/* Explanations and promotion names are sentences: let them wrap in their own columns. */
.board-table.revenue-forecast-table td { white-space: normal; }
.revenue-forecast-table thead th { text-align: left !important; }
.board-table.revenue-forecast-table td:first-child { white-space: nowrap; }
.board-table.revenue-forecast-table td:first-child small { display: block; }
.board-table.revenue-forecast-table .forecast-cell { min-width: 170px; white-space: nowrap; }
.revenue-forecast-basis { min-width: 220px; max-width: 340px; font-size: 10.5px; line-height: 1.45; }
.revenue-forecast-promo { min-width: 200px; max-width: 320px; font-size: 10.5px; line-height: 1.45; }

.revenue-forecast-bar { height: 4px; background: #e8e9e0; }
.revenue-forecast-bar span { background: #3fb2ab; }
.revenue-forecast-step::before { background: #0a0a0a; }
.revenue-forecast-method { border: 1px solid #e8e9e0; border-left: 3px solid #fdc61e; border-radius: 8px; background: #fffbea; color: #65665f; font-size: 10.5px; line-height: 1.5; }
.revenue-forecast-warning { color: #5e4d00; }

/* The chef assistant covers the tables here as well. */
body[data-module="revenue-forecast"] #asystent-produkcji { display: none !important; }
