/* ─── LEJEK KONWERSJI — „schodki z ubytkiem" (public/ui/funnel-steps.js) ───────────────────────
   Scoped .nh-fs. WYŁĄCZNIE tokeny z tokens.css (--nh-*, --space-*, --radius-*, --icon-*), zero literałów kolorów,
   zero !important. Kolory ról: pasek = --nh-accent · cel = --nh-ok-text · odpadli = --nh-miss-* ·
   w toku = --nh-chip-* (kreskowane) · największy ubytek = --nh-warn-*. Identyczność niesie też etykieta (nie sam kolor). */
.nh-fs { font-family: var(--nh-font-body); color: var(--nh-text); background: var(--nh-surface); border: 1px solid var(--nh-line);
  border-radius: var(--nh-r-card); padding: var(--space-5); }
.nh-fs .nh-icon { --icon-color: currentColor; }

.nh-fs-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.nh-fs-title { display: flex; align-items: center; gap: var(--space-2); font-family: var(--nh-font-head); font-weight: 600; font-size: 16px; }
.nh-fs-title .nh-icon { color: var(--nh-accent); }
.nh-fs-sub { font-weight: 400; font-size: 13px; color: var(--nh-text-2); }
.nh-fs-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.nh-fs-seg { display: inline-flex; border: 1px solid var(--nh-line); border-radius: var(--nh-r-btn); overflow: hidden; }
.nh-fs-seg button { font-family: var(--nh-font-btn); font-size: 12.5px; padding: var(--space-1) var(--space-3); border: 0; cursor: pointer;
  background: var(--btn-ghost-bg); color: var(--btn-ghost-fg); }
.nh-fs-seg button + button { border-left: 1px solid var(--nh-line); }
.nh-fs-seg button[aria-pressed="true"] { background: var(--btn-primary-bg); color: var(--btn-primary-fg); }
.nh-fs-nowrap { display: inline-flex; align-items: center; gap: var(--space-1); }
.nh-fs-cmp { display: inline-flex; align-items: center; gap: var(--space-1); font-size: 12.5px; color: var(--nh-text-2); cursor: pointer; }
.nh-fs-cmp--off { cursor: default; color: var(--nh-text-muted); }
.nh-fs-tip { color: var(--nh-text-muted); cursor: help; font-size: 12px; }
.nh-fs-mode-note { margin: var(--space-2) 0 var(--space-4); font-size: 12.5px; color: var(--nh-text-2); }
.nh-fs-k-lost { color: var(--nh-miss-text); }
.nh-fs-k-pend { color: var(--nh-chip-tx); }

/* ── SIATKA — jedna definicja kolumn dla KAŻDEGO wiersza (etap, ubytek, przyczyna, nagłówek) ──
   etap | pasek | osoby | % | (Δ, gdy porównanie) | w toku. Stałe wysokości wierszy → równy rytm. */
.nh-fs-body { --fs-cols: minmax(150px, 190px) minmax(0, 1fr) 64px 72px 64px;
  --fs-areas: "lbl bar n pct mt"; display: flex; flex-direction: column; }
.nh-fs-body--cmp { --fs-cols: minmax(150px, 190px) minmax(0, 1fr) 64px 72px 84px 64px; --fs-areas: "lbl bar n pct dl mt"; }
.nh-fs-row { display: grid; grid-template-columns: var(--fs-cols); grid-template-areas: var(--fs-areas); align-items: center;
  column-gap: var(--space-4); padding: 0 var(--space-2); border-radius: var(--radius-sm); }
.nh-fs-c { min-width: 0; white-space: nowrap; }
.nh-fs-c--lbl { grid-area: lbl; display: flex; align-items: center; gap: var(--space-1); }
.nh-fs-c--bar { grid-area: bar; }
.nh-fs-c--n { grid-area: n; text-align: right; font-family: var(--nh-font-mono); font-variant-numeric: tabular-nums; }
.nh-fs-c--pct { grid-area: pct; text-align: right; font-family: var(--nh-font-mono); font-variant-numeric: tabular-nums; font-size: 12px; color: var(--nh-text-2); }
.nh-fs-c--dl { grid-area: dl; text-align: right; }
.nh-fs-c--mt { grid-area: mt; text-align: right; }
.nh-fs-ell { overflow: hidden; text-overflow: ellipsis; }

/* Nagłówek kolumn + legenda */
.nh-fs-colh { height: 28px; font-family: var(--nh-font-head); font-size: 10.5px; letter-spacing: var(--nh-ls-section); text-transform: uppercase;
  color: var(--nh-text-2); border-bottom: 1px solid var(--nh-line); border-radius: 0; margin-bottom: var(--space-1); }
.nh-fs-colh .nh-fs-c--n, .nh-fs-colh .nh-fs-c--pct { font-family: var(--nh-font-head); font-size: 10.5px; }
.nh-fs-colh .nh-fs-c--bar { display: flex; gap: var(--space-4); text-transform: none; letter-spacing: 0; font-family: var(--nh-font-body); font-size: 11.5px; }
.nh-fs-leg { display: inline-flex; align-items: center; gap: var(--space-1); }
.nh-fs-leg-i { width: 14px; height: 8px; border-radius: 2px; display: inline-block; }
.nh-fs-leg-i--bar { background: var(--nh-accent); }
.nh-fs-leg-i--lost { background: var(--nh-miss-text); }
.nh-fs-leg-i--pend, .nh-fs-seg-pend { background: repeating-linear-gradient(135deg, var(--nh-chip-br) 0 3px, var(--nh-chip-bg) 3px 6px); }

/* Wiersz etapu */
.nh-fs-stage { height: 40px; cursor: pointer; }
.nh-fs-stage:hover, .nh-fs-stage:focus-visible, .nh-fs-rs:hover, .nh-fs-rs:focus-visible { background: var(--nh-row-select); outline: none; }
.nh-fs-stage .nh-fs-c--lbl { font-family: var(--nh-font-head); font-weight: 500; font-size: 13.5px; }
.nh-fs-stage .nh-fs-c--n { font-weight: 600; font-size: 15px; }
.nh-fs-track { height: 20px; background: var(--nh-field); border-radius: var(--radius-sm); overflow: hidden; }
.nh-fs-fill { height: 100%; background: var(--nh-accent); border-radius: var(--radius-sm); }
.nh-fs-stage--raw .nh-fs-fill { background: var(--nh-chip-br); }
.nh-fs-stage--raw .nh-fs-c--lbl { color: var(--nh-text-2); font-weight: 400; }
.nh-fs-stage--goal .nh-fs-fill { background: var(--nh-ok-text); }
.nh-fs-stage--goal .nh-fs-c--lbl, .nh-fs-stage--goal .nh-fs-c--n { color: var(--nh-ok-text); }
.nh-fs-delta { font-family: var(--nh-font-mono); font-size: 11.5px; font-variant-numeric: tabular-nums; padding: 1px var(--space-2); border-radius: var(--nh-r-pill);
  background: var(--nh-field); color: var(--nh-text-2); }
.nh-fs-delta--up { background: var(--nh-ok-bg); color: var(--nh-ok-text); }
.nh-fs-delta--down { background: var(--nh-miss-bg); color: var(--nh-miss-text); }
.nh-fs-mat { display: inline-flex; align-items: center; gap: var(--space-1); font-family: var(--nh-font-mono); font-size: 12px; color: var(--nh-warn-text); cursor: help; }

/* Wiersz ubytku — stopień na osi paska */
.nh-fs-drop { height: 30px; font-size: 12px; }
.nh-fs-step { position: relative; display: flex; align-items: center; height: 12px; }
.nh-fs-steppad { height: 100%; flex: none; }
.nh-fs-steppad--l { display: flex; justify-content: flex-end; align-items: center; padding-right: var(--space-2); box-sizing: border-box; }
.nh-fs-seg-lost, .nh-fs-seg-pend { height: 100%; flex: none; cursor: pointer; }
.nh-fs-seg-lost { background: var(--nh-miss-text); border-radius: 2px 0 0 2px; }
.nh-fs-seg-pend { border-radius: 0 2px 2px 0; }
.nh-fs-seg-lost:only-of-type { border-radius: 2px; }
.nh-fs-steptxt { font-size: 11.5px; color: var(--nh-text-2); padding-left: var(--space-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nh-fs-steppad--l .nh-fs-steptxt { padding-left: 0; }
.nh-fs-k-lost { color: var(--nh-miss-text); }
.nh-fs-k-pend { color: var(--nh-chip-tx); }
.nh-fs-dropn { color: var(--nh-miss-text); font-weight: 600; font-size: 12px; cursor: pointer; }
.nh-fs-drop--hyg .nh-fs-dropn { color: var(--nh-text-2); }
.nh-fs-drop--hyg .nh-fs-seg-lost { background: var(--nh-chip-br); }
.nh-fs-drop--big { background: var(--nh-warn-bg); box-shadow: inset 3px 0 0 var(--nh-warn-br); }
.nh-fs-big { display: inline-flex; color: var(--nh-warn-text); cursor: help; }
.nh-fs-tog { display: inline-flex; align-items: center; gap: var(--space-1); min-width: 0; font-family: var(--nh-font-btn); font-size: 12px;
  border: 0; background: transparent; color: var(--nh-text-2); cursor: pointer; padding: 0 var(--space-1) 0 var(--space-3); }
.nh-fs-tog:hover { color: var(--nh-text); }

/* Rozwinięte przyczyny — te same kolumny (liczby równają się z etapami) */
.nh-fs-rs { height: 26px; font-size: 12.5px; cursor: pointer; }
.nh-fs-rs .nh-fs-c--bar { padding-left: var(--space-5); display: flex; align-items: center; gap: var(--space-2); }
.nh-fs-rs--h .nh-fs-c--bar { padding-left: var(--space-3); font-weight: 600; }
.nh-fs-rs--h.nh-fs-rs--lost { color: var(--nh-miss-text); }
.nh-fs-rs--h.nh-fs-rs--pending { color: var(--nh-chip-tx); }
.nh-fs-rs--h .nh-fs-c--n { font-weight: 600; }
.nh-fs-ours { font-weight: 400; color: var(--nh-warn-text); }
.nh-fs-dot { width: 8px; height: 8px; border-radius: var(--nh-r-pill); background: currentColor; display: inline-block; flex: none; }
.nh-fs-rs--pending .nh-fs-dot { background: repeating-linear-gradient(135deg, var(--nh-chip-tx) 0 2px, var(--nh-chip-bg) 2px 4px); }

.nh-fs-foot { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--nh-line-soft); font-size: 12px; color: var(--nh-text-2);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); }
.nh-fs-foot--ok .nh-icon { color: var(--nh-ok-text); }
.nh-fs-foot--bad { color: var(--nh-miss-text); }

/* Tabela osób (szuflada drilla) */
.nh-fs-people { width: 100%; border-collapse: collapse; font-size: 13px; }
.nh-fs-people th { text-align: left; font-family: var(--nh-font-head); font-weight: 500; font-size: 11px; letter-spacing: var(--nh-ls-section);
  text-transform: uppercase; color: var(--nh-text-2); padding: var(--space-2); border-bottom: 1px solid var(--nh-line); }
.nh-fs-people td { padding: var(--space-2); border-bottom: 1px solid var(--nh-line-soft); }
.nh-fs-people tr[data-person] { cursor: pointer; }
.nh-fs-people tr[data-person]:hover, .nh-fs-people tr[data-person]:focus-visible { background: var(--nh-row-select); outline: none; }
.nh-fs-mono { font-family: var(--nh-font-mono); white-space: nowrap; }
.nh-fs-go { color: var(--nh-text-muted); text-align: right; }
.nh-fs-opis { font-size: 12px; color: var(--nh-text-2); min-width: 180px; }
.nh-fs-empty { padding: var(--space-4); color: var(--nh-text-muted); }

@media (max-width: 720px) {
  .nh-fs { padding: var(--space-4); }
  .nh-fs-body, .nh-fs-body--cmp { --fs-cols: minmax(0, 1fr) 52px 60px; --fs-areas: "lbl n pct" "bar bar bar" "dl . mt"; }
  .nh-fs-colh .nh-fs-c--dl, .nh-fs-colh .nh-fs-c--mt { display: none; }
  .nh-fs-c--dl:empty, .nh-fs-c--mt:empty { display: none; }
  .nh-fs-row { row-gap: var(--space-1); column-gap: var(--space-2); }
  .nh-fs-stage { height: auto; padding-top: var(--space-2); padding-bottom: var(--space-2); }
  .nh-fs-drop { height: auto; padding-top: var(--space-1); padding-bottom: var(--space-1); }
  .nh-fs-c--dl { text-align: left; }
  .nh-fs-colh .nh-fs-c--bar { display: none; }
  .nh-fs-rs .nh-fs-c--bar { grid-area: lbl; }
  .nh-fs-rs .nh-fs-c--lbl { display: none; }
  .nh-fs-rs { height: auto; min-height: 26px; }
}
