/* Factlever demo V3.6 */
.demo-page {
  background: var(--paper);
}

.demo-hero {
  min-height: auto;
}

.demo-hero .v3-hero-node strong {
  font-size: 20px;
}

.demo-summary-section {
  overflow: visible;
}

.demo-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

.demo-kpis {
  display: grid;
  margin-top: 48px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.demo-kpi {
  min-width: 0;
  min-height: 168px;
  padding: 26px 24px;
  border-right: 1px solid var(--line);
  background: var(--white);
}

.demo-kpi:last-child {
  border-right: 0;
}

.demo-kpi__label,
.demo-kpi__value,
.demo-kpi__note {
  display: block;
}

.demo-kpi__label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.demo-kpi__value {
  margin: 14px 0 8px;
  color: var(--navy);
  font-size: clamp(30px, 3.2vw, 44px);
  line-height: 1.05;
}

.demo-kpi__note {
  color: var(--muted);
  font-size: 14px;
}

.demo-dashboard-panel {
  min-width: 0;
  padding: clamp(24px, 3.4vw, 38px);
  border: 1px solid var(--line);
  background: var(--white);
}

.demo-dashboard-panel--summary {
  margin-top: 18px;
  border-color: #334365;
  background: var(--navy);
  color: var(--white);
  box-shadow: var(--shadow-strong);
}

.demo-dashboard-panel__header {
  display: flex;
  margin-bottom: 26px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.demo-dashboard-panel__header h3 {
  max-width: 26ch;
  margin: 6px 0 0;
  font-size: clamp(25px, 2.6vw, 36px);
}

.demo-dashboard-panel__header p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.demo-panel-kicker {
  display: inline-block;
  color: var(--cobalt);
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  font-weight: 500;
}

.demo-dashboard-panel--summary .demo-panel-kicker {
  color: var(--sky);
}

.demo-diagnosis dl {
  display: grid;
  margin: 0;
  border-top: 1px solid var(--line-dark);
  grid-template-columns: repeat(2, 1fr);
}

.demo-diagnosis dl > div {
  display: grid;
  min-height: 150px;
  padding: 24px 28px 24px 0;
  border-bottom: 1px solid var(--line-dark);
  grid-template-columns: 120px 1fr;
  gap: 22px;
}

.demo-diagnosis dl > div:nth-child(odd) {
  border-right: 1px solid var(--line-dark);
}

.demo-diagnosis dl > div:nth-child(even) {
  padding-left: 28px;
}

.demo-diagnosis dt {
  color: var(--sky);
  font-size: 15px;
  font-weight: 700;
}

.demo-diagnosis dd {
  margin: 0;
  color: #d3dced;
  font-size: 17px;
}

.demo-disclaimer {
  margin: 24px 0 0;
  padding: 16px 18px;
  border-left: 3px solid var(--sky);
  background: rgba(139, 203, 255, 0.08);
  color: #c1cde1;
  font-size: 14px;
}

.demo-filters {
  display: grid;
  margin-top: clamp(46px, 6vw, 76px);
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--white);
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 14px;
  align-items: end;
}

.demo-control {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 9px;
}

.demo-control > span {
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 650;
}

.demo-control select {
  width: 100%;
  min-height: 50px;
  padding: 10px 38px 10px 12px;
  border: 1px solid #9facbf;
  border-radius: 2px;
  background: var(--white);
  color: var(--navy);
  font-size: 16px;
}

.demo-control select:focus-visible {
  border-color: var(--cobalt);
}

.demo-reset {
  min-height: 50px;
  white-space: nowrap;
}

.demo-view-switch {
  display: flex;
  margin-top: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.demo-view-switch > span {
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
}

.demo-view-switch > div {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.demo-view-switch button {
  min-height: 46px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  font-weight: 650;
}

.demo-view-switch button:hover {
  border-color: var(--line);
  color: var(--navy);
}

.demo-view-switch button[aria-pressed="true"] {
  border-color: var(--navy);
  background: var(--navy);
  color: var(--white);
}

.demo-dashboard-grid {
  display: grid;
  margin-top: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.demo-dashboard-panel--wide {
  grid-column: 1 / -1;
}

.demo-clear-drilldown {
  min-width: 120px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--white);
  color: var(--cobalt);
  cursor: pointer;
  font-size: 16px;
  font-weight: 650;
}

.demo-clear-drilldown:hover {
  border-color: var(--cobalt);
}

.demo-chart-list {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 9px;
  list-style: none;
}

.demo-chart-row {
  min-width: 0;
}

.demo-chart-button {
  display: grid;
  width: 100%;
  min-height: 66px;
  padding: 12px 14px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: var(--paper);
  color: var(--navy);
  cursor: pointer;
  font-size: 16px;
  gap: 9px;
  text-align: left;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.demo-chart-button:hover,
.demo-chart-button[aria-pressed="true"] {
  border-color: var(--cobalt);
  background: #eef2ff;
}

.demo-chart-button.is-static {
  cursor: default;
}

.demo-chart-row__heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.demo-chart-row__heading strong {
  white-space: nowrap;
}

.demo-chart-row progress {
  width: 100%;
  height: 9px;
  border: 0;
  border-radius: 0;
  background: var(--ice);
  color: var(--cobalt);
}

.demo-chart-row progress::-webkit-progress-bar {
  background: var(--ice);
}

.demo-chart-row progress::-webkit-progress-value {
  background: var(--cobalt);
}

.demo-chart-row progress::-moz-progress-bar {
  background: var(--cobalt);
}

.demo-chart-list--compact .demo-chart-button {
  min-height: 60px;
}

.demo-empty {
  color: var(--muted);
}

.demo-table-section {
  margin-top: 16px;
  padding: clamp(24px, 3.4vw, 38px);
  border: 1px solid var(--line);
  background: var(--white);
}

.demo-scroll-hint {
  display: none;
  margin: -6px 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.demo-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--white);
  scrollbar-color: var(--cobalt) var(--ice);
}

#demo-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  font-size: 15px;
}

#demo-table caption {
  padding: 14px;
  color: var(--muted);
  font-size: 14px;
  text-align: left;
}

#demo-table th,
#demo-table td {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

#demo-table th {
  padding: 0 8px;
  background: var(--paper);
}

#demo-table th button {
  width: 100%;
  min-width: 44px;
  min-height: 48px;
  padding: 8px 6px;
  border: 0;
  background: transparent;
  color: var(--navy);
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.demo-pagination {
  display: flex;
  margin-top: 18px;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.demo-pagination span {
  font-size: 15px;
}

.demo-pagination button {
  min-width: 104px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--white);
  color: var(--navy);
  cursor: pointer;
  font-size: 16px;
}

.demo-pagination button:hover:not(:disabled) {
  border-color: var(--cobalt);
}

.demo-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.demo-methodology {
  margin-top: 18px;
  border: 1px solid var(--line);
  background: var(--white);
}

.demo-methodology summary {
  position: relative;
  min-height: 56px;
  padding: 15px 56px 15px 18px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 650;
  list-style: none;
}

.demo-methodology summary::-webkit-details-marker {
  display: none;
}

.demo-methodology summary::after {
  position: absolute;
  top: 50%;
  right: 18px;
  color: var(--cobalt);
  content: "+";
  font-size: 24px;
  transform: translateY(-50%);
}

.demo-methodology[open] summary::after {
  content: "−";
}

.demo-methodology > div {
  padding: 0 18px 20px;
  color: var(--muted);
  font-size: 16px;
}

.demo-dashboard-cta {
  display: flex;
  margin-top: 48px;
  padding: clamp(30px, 5vw, 54px);
  background: var(--navy);
  color: var(--white);
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.demo-dashboard-cta h3 {
  max-width: 24ch;
}

.demo-dashboard-cta .v3-eyebrow {
  margin-bottom: 12px;
}

.demo-dashboard-cta__action {
  display: grid;
  min-width: min(100%, 340px);
  gap: 14px;
}

.demo-noscript {
  margin-top: 24px;
  padding: 28px;
  border: 1px solid var(--signal);
  background: var(--signal-soft);
}

@media (max-width: 1080px) {
  .demo-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .demo-reset {
    width: 100%;
  }

  .demo-diagnosis dl {
    grid-template-columns: 1fr;
  }

  .demo-diagnosis dl > div,
  .demo-diagnosis dl > div:nth-child(even) {
    min-height: 0;
    padding: 20px 0;
    border-right: 0;
  }
}

@media (max-width: 760px) {
  .demo-kpis,
  .demo-dashboard-grid,
  .demo-filters {
    grid-template-columns: 1fr;
  }

  .demo-kpi {
    min-height: 0;
    padding: 20px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .demo-kpi:last-child {
    border-bottom: 0;
  }

  .demo-dashboard-panel--wide {
    grid-column: auto;
  }

  .demo-view-switch {
    align-items: flex-start;
    flex-direction: column;
  }

  .demo-view-switch > div {
    width: 100%;
  }

  .demo-view-switch button {
    flex: 1 1 140px;
  }

  .demo-dashboard-panel__header {
    flex-direction: column;
  }

  .demo-clear-drilldown {
    width: 100%;
  }

  .demo-diagnosis dl > div,
  .demo-diagnosis dl > div:nth-child(even) {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .demo-scroll-hint {
    display: block;
  }

  .demo-table-wrap {
    position: relative;
    box-shadow: inset -18px 0 18px -18px rgba(8, 20, 49, 0.36);
  }

  #demo-table th:first-child,
  #demo-table td:first-child {
    position: sticky;
    z-index: 2;
    left: 0;
    background: var(--white);
    box-shadow: 1px 0 0 var(--line);
  }

  #demo-table th:first-child {
    z-index: 3;
    background: var(--paper);
  }

  .demo-pagination {
    justify-content: space-between;
  }

  .demo-pagination button {
    min-width: 96px;
  }

  .demo-dashboard-cta {
    align-items: stretch;
    flex-direction: column;
  }

  .demo-dashboard-cta .v3-button {
    width: 100%;
  }
}

@media (max-width: 1180px) {
  .demo-scroll-hint {
    display: block;
  }

  .demo-table-wrap {
    position: relative;
    box-shadow: inset -24px 0 22px -20px rgba(8, 20, 49, 0.52);
  }
}

@media (max-width: 520px) {
  .demo-view-switch > div {
    display: grid;
    width: 100%;
    grid-template-columns: 1fr;
  }

  .demo-view-switch button {
    width: 100%;
    min-height: 46px;
    flex: none;
  }
}

@media (max-width: 360px) {
  .demo-hero .v3-hero-map__nodes {
    grid-template-columns: 1fr;
  }

  .demo-hero .v3-hero-node {
    min-height: 82px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .demo-page *,
  .demo-page *::before,
  .demo-page *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}

/* Factlever V3.6 — funnel with explicit transitions */
#demo-funnel {
  display: grid;
  width: 100%;
  margin-inline: auto;
  gap: 0;
  justify-items: center;
}

.demo-funnel-stage {
  display: flex;
  width: 100%;
  min-width: 0;
  justify-content: center;
}

.demo-funnel-stage__button {
  display: grid;
  width: var(--demo-funnel-width, 100%);
  min-height: 70px;
  padding: 12px clamp(16px, 3vw, 28px);
  border: 1px solid var(--line);
  border-radius: 2px;
  background: linear-gradient(90deg, rgba(49, 92, 255, 0.07), rgba(49, 92, 255, 0.14));
  color: var(--navy);
  cursor: pointer;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 18px;
  align-items: center;
  text-align: left;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.demo-funnel-stage__button:hover,
.demo-funnel-stage__button:focus-visible,
.demo-funnel-stage__button[aria-pressed="true"] {
  border-color: var(--cobalt);
  background: #e7edff;
  transform: translateY(-2px);
}

.demo-funnel-stage__name {
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
}

.demo-funnel-stage__count {
  color: var(--cobalt);
  font-family: "IBM Plex Mono", monospace;
  font-size: 22px;
}

.demo-funnel-stage__share {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  grid-column: 1 / -1;
  line-height: 1.3;
}

.demo-funnel-transition {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: center;
}

.demo-funnel-transition::before,
.demo-funnel-transition::after {
  position: absolute;
  z-index: 0;
  left: 50%;
  content: "";
  transform: translateX(-50%);
}

.demo-funnel-transition::before {
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line);
}

.demo-funnel-transition::after {
  bottom: 4px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--cobalt);
  border-bottom: 2px solid var(--cobalt);
  transform: translateX(-50%) rotate(45deg);
}

.demo-funnel-transition__button {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: min(360px, 84%);
  min-height: 46px;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  cursor: pointer;
  gap: 1px;
  place-items: center;
  text-align: center;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.demo-funnel-transition__button strong {
  font-size: 14px;
  line-height: 1.3;
}

.demo-funnel-transition__button small {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  line-height: 1.3;
}

.demo-funnel-transition__button:hover,
.demo-funnel-transition__button:focus-visible,
.demo-funnel-transition__button[aria-pressed="true"] {
  border-color: var(--cobalt);
  box-shadow: 0 8px 24px rgba(49, 92, 255, 0.14);
  transform: scale(1.015);
}

.demo-funnel-transition.is-signal .demo-funnel-transition__button {
  border-color: var(--cobalt);
  background: var(--navy);
  color: var(--white);
  box-shadow: 0 10px 28px rgba(8, 20, 49, 0.22);
}

.demo-funnel-transition.is-signal .demo-funnel-transition__button small {
  color: var(--sky);
}

@media (max-width: 640px) {
  .demo-funnel-stage__button {
    min-height: 64px;
    padding-inline: 14px;
  }

  .demo-funnel-stage__name {
    font-size: 14px;
  }

  .demo-funnel-stage__count {
    font-size: 19px;
  }

  .demo-funnel-transition__button {
    min-width: min(300px, 94%);
  }
}

@media (max-width: 360px) {
  .demo-funnel-stage__button {
    width: max(var(--demo-funnel-width, 100%), 62%);
  }

  .demo-funnel-transition__button strong { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .demo-funnel-stage__button,
  .demo-funnel-transition__button {
    transition: none !important;
    transform: none !important;
  }
}

@media (forced-colors: active) {
  .demo-funnel-stage__button,
  .demo-funnel-transition__button {
    border: 1px solid ButtonText;
  }
}

@media (forced-colors: active) {
  .demo-kpi,
  .demo-dashboard-panel,
  .demo-filters,
  .demo-table-section,
  .demo-methodology {
    border: 1px solid CanvasText;
  }
}

/* Tabela sygnalizuje przewijanie na podstawie faktycznego overflow, nie breakpointu. */
.demo-scroll-hint {
  display: none;
}

.demo-scroll-hint.is-visible {
  display: block;
}

.demo-table-wrap {
  box-shadow: none;
  transition: box-shadow 160ms ease;
}

.demo-table-wrap.has-horizontal-overflow:not(.is-scroll-end) {
  box-shadow: inset -24px 0 22px -20px rgba(8, 20, 49, 0.52);
}

.demo-table-wrap.has-horizontal-overflow.is-scroll-end {
  box-shadow: inset 24px 0 22px -20px rgba(8, 20, 49, 0.32);
}

@media (max-width: 640px) {
  .demo-scroll-hint.is-visible,
  .demo-table-wrap {
    display: none;
  }
}

/* V3.2 — właścicielski dashboard premium */
.demo-page {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

.demo-summary-section .v3-container,
.demo-details-section .v3-container {
  min-width: 0;
  max-width: 1280px;
}

.demo-kpis {
  margin-top: 44px;
  border: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.demo-kpi {
  position: relative;
  min-height: 174px;
  padding: 26px 24px 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-top: 4px solid var(--cobalt);
  background: var(--white);
  box-shadow: 0 10px 28px rgba(8, 20, 49, 0.06);
}

.demo-kpi:first-child {
  border-top-color: var(--navy);
  background: var(--navy);
}

.demo-kpi:first-child .demo-kpi__label,
.demo-kpi:first-child .demo-kpi__note {
  color: #bfcbe0;
}

.demo-kpi:first-child .demo-kpi__value {
  color: var(--white);
}

.demo-kpi__label {
  min-height: 42px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.35;
}

.demo-kpi__value {
  min-width: 0;
  margin: 14px 0 9px;
  font-size: clamp(34px, 3.6vw, 50px);
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
}

.demo-kpi__note {
  font-size: 14px;
  line-height: 1.4;
}

.demo-dashboard-panel {
  border-radius: 8px;
}

.demo-dashboard-panel--summary {
  margin-top: 16px;
  padding: clamp(28px, 4vw, 48px);
  border: 0;
  border-radius: 10px;
  background:
    radial-gradient(circle at 92% 0%, rgba(49, 92, 255, 0.22), transparent 34%),
    var(--navy);
}

.demo-dashboard-panel__header h3 {
  max-width: 34ch;
}

.demo-diagnosis dl {
  position: relative;
  display: grid;
  border-top: 1px solid var(--line-dark);
  grid-template-columns: 1fr;
}

.demo-diagnosis dl::before {
  position: absolute;
  top: 28px;
  bottom: 28px;
  left: 12px;
  width: 1px;
  background: linear-gradient(var(--sky), var(--cobalt));
  content: "";
}

.demo-diagnosis dl > div,
.demo-diagnosis dl > div:nth-child(even),
.demo-diagnosis dl > div:nth-child(odd) {
  position: relative;
  display: grid;
  min-height: 0;
  padding: 24px 0 24px 48px;
  border-right: 0;
  border-bottom: 1px solid var(--line-dark);
  grid-template-columns: minmax(175px, 0.34fr) minmax(0, 1fr);
  gap: 24px;
}

.demo-diagnosis dl > div::before {
  position: absolute;
  top: 29px;
  left: 6px;
  width: 13px;
  height: 13px;
  border: 3px solid var(--navy);
  background: var(--sky);
  box-shadow: 0 0 0 1px var(--sky);
  content: "";
}

.demo-diagnosis__lead dd,
.demo-diagnosis__move dd {
  color: var(--white);
  font-size: clamp(18px, 1.9vw, 23px);
  font-weight: 700;
}

.demo-diagnosis dt {
  font-size: 16px;
}

.demo-diagnosis dd {
  color: #d7dfed;
  font-size: 17px;
}

.demo-diagnosis__move ol {
  display: grid;
  margin: 0;
  padding-left: 24px;
  gap: 12px;
}

.demo-diagnosis__move li {
  padding-left: 6px;
  color: var(--white);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.45;
}

.demo-diagnosis__move li::marker {
  color: var(--sky);
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
}

.demo-disclaimer {
  margin-top: 14px;
  border-left-color: var(--signal);
  background: rgba(232, 93, 117, 0.08);
}

.demo-filter-shell {
  margin-top: clamp(44px, 6vw, 72px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 12px 32px rgba(8, 20, 49, 0.06);
}

.demo-filter-shell > summary {
  display: flex;
  min-height: 64px;
  padding: 14px 22px;
  cursor: pointer;
  list-style: none;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.demo-filter-shell > summary::-webkit-details-marker {
  display: none;
}

.demo-filter-shell > summary span {
  color: var(--navy);
  font-size: 18px;
  font-weight: 750;
}

.demo-filter-shell > summary strong {
  color: var(--cobalt);
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
}

.demo-filters {
  display: grid;
  margin: 0;
  padding: 22px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px 14px;
  align-items: end;
}

.demo-filters legend {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  border: 0;
}

.demo-control > span {
  min-height: 42px;
  color: var(--ink-soft);
  font-size: 15px;
}

.demo-control select {
  min-height: 52px;
  padding: 11px 12px;
  border: 1px solid #9aa8bc;
  border-radius: 4px;
  background-color: var(--white);
  color: var(--navy);
  font-size: 16px;
  font-weight: 650;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.demo-control select:hover {
  border-color: var(--cobalt);
}

.demo-control select:focus-visible {
  border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(139, 203, 255, 0.38);
  outline: 0;
}

.demo-active-filters {
  display: flex;
  min-height: 44px;
  grid-column: 1 / -2;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.demo-filter-chip {
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid #c6d1e2;
  border-radius: 999px;
  background: var(--ice);
  color: var(--navy);
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
}

.demo-filter-chip:hover {
  border-color: var(--cobalt);
  background: #eef2ff;
}

.demo-filter-chip--empty {
  display: inline-flex;
  cursor: default;
  align-items: center;
}

.demo-reset {
  display: inline-flex;
  min-width: 144px;
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid #9caecc;
  border-radius: 4px;
  background: var(--white);
  color: var(--cobalt);
  cursor: pointer;
  font: inherit;
  font-size: 16px;
  font-weight: 750;
  align-items: center;
  justify-content: center;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.demo-reset:hover:not(:disabled) {
  border-color: var(--cobalt);
  background: #eef2ff;
  box-shadow: 0 6px 16px rgba(49, 92, 255, 0.1);
}

.demo-reset:disabled {
  cursor: default;
  opacity: 0.55;
}

.demo-view-switch {
  display: grid;
  margin: 22px 0 0;
  padding: 0;
  border: 0;
  gap: 10px;
}

.demo-view-switch legend {
  width: 100%;
  color: var(--navy);
  font-size: 17px;
  font-weight: 750;
}

.demo-view-switch > div {
  display: grid;
  width: 100%;
  overflow: hidden;
  border: 1px solid #aeb9ca;
  border-radius: 6px;
  background: var(--white);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
}

.demo-view-switch button {
  position: relative;
  min-width: 0;
  min-height: 52px;
  padding: 10px 12px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.2;
  transition: background-color 170ms ease, color 170ms ease, box-shadow 170ms ease;
}

.demo-view-switch button:last-child {
  border-right: 0;
}

.demo-view-switch button:hover {
  border-color: var(--line);
  background: var(--ice);
}

.demo-view-switch button[aria-pressed="true"] {
  border-color: transparent;
  background: var(--navy);
  color: var(--white);
  box-shadow: inset 0 -4px 0 var(--sky);
}

.demo-dashboard-grid {
  margin-top: 22px;
  gap: 18px;
}

.demo-dashboard-grid .demo-dashboard-panel {
  padding: clamp(24px, 3vw, 34px);
  box-shadow: 0 10px 28px rgba(8, 20, 49, 0.05);
}

.demo-chart-list {
  gap: 8px;
}

.demo-chart-button {
  position: relative;
  min-height: 72px;
  padding: 13px 16px 13px 18px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 5px;
  background: var(--paper);
  gap: 11px;
  transition: transform 150ms ease, border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.demo-chart-button:not(.is-static)::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: transparent;
  content: "";
}

.demo-chart-button:not(.is-static):hover {
  border-color: #aebee0;
  background: #eef2ff;
  box-shadow: 0 8px 18px rgba(8, 20, 49, 0.07);
  transform: translateX(2px);
}

.demo-chart-button[aria-pressed="true"] {
  border-color: var(--cobalt);
  background: #eef2ff;
  box-shadow: 0 8px 22px rgba(49, 92, 255, 0.12);
}

.demo-chart-button[aria-pressed="true"]::before {
  background: var(--cobalt);
}

.demo-chart-row__label {
  display: grid;
  gap: 2px;
}

.demo-chart-row__action {
  color: var(--cobalt);
  font-size: 14px;
  font-weight: 750;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.demo-chart-button:hover .demo-chart-row__action,
.demo-chart-button[aria-pressed="true"] .demo-chart-row__action {
  opacity: 1;
  transform: none;
}

.demo-chart-row progress {
  height: 7px;
  overflow: visible;
  border-radius: 999px;
  transition: value 280ms ease;
}

.demo-chart-row progress::-webkit-progress-bar {
  border-radius: 999px;
  background: #dce4f0;
}

.demo-chart-row progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--cobalt);
  transition: width 280ms ease;
}

.demo-chart-row progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--cobalt);
}

.demo-chart-row--funnel .demo-chart-button {
  min-height: 68px;
}

.demo-chart-row--step-1 .demo-chart-button {
  width: 96%;
  margin-left: 2%;
}

.demo-chart-row--step-2 .demo-chart-button {
  width: 92%;
  margin-left: 4%;
}

.demo-chart-row--step-3 .demo-chart-button {
  width: 88%;
  margin-left: 6%;
}

.demo-chart-row--step-4 .demo-chart-button {
  width: 84%;
  margin-left: 8%;
}

.demo-chart-row--step-5 .demo-chart-button {
  width: 80%;
  margin-left: 10%;
}

.demo-lollipop-track {
  position: relative;
  display: block;
  width: 100%;
  height: 13px;
}

.demo-chart-row--lollipop .demo-lollipop-track progress {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 5px;
  transform: translateY(-50%);
}

.demo-chart-row--lollipop progress::-webkit-progress-value {
  border-radius: 999px;
  box-shadow: none;
}

.demo-chart-row--lollipop progress::-moz-progress-bar {
  border-radius: 999px;
  box-shadow: none;
}

.demo-lollipop-point {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: clamp(6px, var(--demo-lollipop-position), calc(100% - 6px));
  width: 12px;
  height: 12px;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--cobalt);
  box-shadow: 0 0 0 1px var(--cobalt);
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.demo-chart-row--ranking .demo-chart-button {
  min-height: 64px;
}

.demo-empty {
  min-height: 64px;
  padding: 18px;
  border: 1px dashed var(--line);
  background: var(--paper);
}

.demo-table-section {
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(8, 20, 49, 0.05);
}

.demo-table-wrap {
  border-radius: 5px;
}

#demo-table {
  min-width: 1040px;
  table-layout: fixed;
  font-size: 15px;
}

#demo-table thead {
  position: sticky;
  z-index: 4;
  top: 0;
}

#demo-table th {
  background: var(--navy);
  white-space: normal;
}

#demo-table th button {
  position: relative;
  min-height: 64px;
  padding-right: 24px;
  color: var(--white);
  font-size: 16px;
  line-height: 1.2;
  text-decoration: none;
  white-space: normal;
}

#demo-table th > #context-column-label {
  display: flex;
  min-height: 64px;
  align-items: center;
}

#demo-table th:nth-child(1),
#demo-table td:nth-child(1) {
  width: 8%;
}

#demo-table th:nth-child(2),
#demo-table td:nth-child(2),
#demo-table th:nth-child(3),
#demo-table td:nth-child(3),
#demo-table th:nth-child(4),
#demo-table td:nth-child(4) {
  width: 10%;
}

#demo-table th:nth-child(5),
#demo-table td:nth-child(5) {
  width: 12%;
}

#demo-table th:nth-child(6),
#demo-table td:nth-child(6) {
  width: 15%;
}

#demo-table th:nth-child(7),
#demo-table td:nth-child(7) {
  width: 17%;
}

#demo-table th:nth-child(8),
#demo-table td:nth-child(8) {
  width: 18%;
  white-space: normal;
}

#demo-table td:nth-child(8) .demo-badge {
  max-width: 100%;
  overflow-wrap: anywhere;
}

#demo-table th button::after {
  position: absolute;
  top: 50%;
  right: 6px;
  color: #93a3bd;
  content: "↕";
  font-size: 14px;
  transform: translateY(-50%);
}

#demo-table th[aria-sort="ascending"] button::after {
  color: var(--sky);
  content: "↑";
}

#demo-table th[aria-sort="descending"] button::after {
  color: var(--sky);
  content: "↓";
}

#demo-table tbody tr {
  transition: background-color 130ms ease, box-shadow 130ms ease;
}

#demo-table tbody tr:hover {
  background: #eef2ff;
  box-shadow: inset 3px 0 0 var(--cobalt);
}

#demo-table td {
  height: 56px;
  border-top-color: #e2e7ef;
}

.demo-badge {
  display: inline-flex;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid currentColor;
  border-radius: 999px;
  align-items: center;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.2;
}

.demo-badge--neutral {
  border-color: #aeb9ca;
  background: var(--paper);
  color: var(--ink-soft);
}

.demo-badge--positive {
  border-color: #8fc7b1;
  background: var(--positive-soft);
  color: var(--positive);
}

.demo-badge--signal,
.demo-badge--attention {
  border-color: #efb2bd;
  background: var(--signal-soft);
  color: #a62c46;
}

.demo-badge--quiet {
  border-color: #c7d2e2;
  background: var(--ice);
  color: var(--muted);
}

.demo-badge[data-card-context],
.demo-badge[data-table-context] {
  border-radius: 5px;
  text-align: left;
}

.is-missing {
  color: var(--muted);
  font-style: italic;
}

.demo-record-cards {
  display: none;
}

.demo-pagination {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
}

.demo-pagination__range {
  color: var(--muted);
  justify-self: start;
}

.demo-audit-bridge {
  display: grid;
  margin-top: 28px;
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid #b9c7dc;
  border-left: 5px solid var(--cobalt);
  background: var(--white);
  grid-template-columns: minmax(230px, 0.8fr) minmax(0, 1.2fr);
  gap: 28px;
}

.demo-audit-bridge strong {
  color: var(--navy);
  font-size: clamp(21px, 2.4vw, 30px);
  line-height: 1.2;
}

.demo-audit-bridge p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 17px;
}

.demo-dashboard-cta {
  border-radius: 8px;
  box-shadow: var(--shadow-strong);
}

.demo-dashboard-cta h3 {
  max-width: 28ch;
}

[data-active-view] .demo-kpis,
[data-active-view] .demo-dashboard-grid,
[data-active-view] .demo-table-section {
  animation: demo-refresh 160ms ease both;
}

@keyframes demo-refresh {
  from {
    opacity: 0.72;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 1080px) {
  .demo-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .demo-active-filters {
    grid-column: 1 / -1;
  }

  .demo-reset {
    grid-column: 1 / -1;
    width: auto;
    justify-self: end;
  }

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

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

  .demo-kpi {
    min-height: 154px;
    padding: 20px 18px;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .demo-audit-bridge {
    grid-template-columns: 1fr;
  }

  .demo-diagnosis dl > div,
  .demo-diagnosis dl > div:nth-child(even),
  .demo-diagnosis dl > div:nth-child(odd) {
    padding-left: 42px;
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .demo-view-switch {
    align-items: stretch;
  }

  .demo-view-switch > div {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .demo-view-switch button {
    min-height: 78px;
    padding: 9px 5px;
    font-size: 16px;
    overflow-wrap: anywhere;
  }

  .demo-dashboard-panel__header {
    gap: 12px;
  }

  .demo-scroll-hint {
    display: block;
  }
}

@media (max-width: 640px) {
  .demo-summary-section,
  .demo-details-section,
  .demo-dashboard-grid,
  .demo-dashboard-panel,
  .demo-table-section,
  .demo-record-cards,
  .demo-record-card {
    min-width: 0;
    max-width: 100%;
  }

  .demo-record-card,
  .demo-record-card * {
    overflow-wrap: anywhere;
  }

  .demo-filter-shell > summary {
    padding-inline: 16px;
  }

  .demo-filter-shell > summary span {
    font-size: 16px;
  }

  .demo-filter-shell > summary strong {
    font-size: 14px;
    text-align: right;
  }

  .demo-filters {
    padding: 16px;
    grid-template-columns: 1fr;
  }

  .demo-control > span {
    min-height: 0;
  }

  .demo-active-filters,
  .demo-reset {
    grid-column: auto;
  }

  .demo-reset {
    width: 100%;
    justify-self: stretch;
  }

  .demo-dashboard-panel,
  .demo-table-section {
    padding: 20px;
  }

  .demo-dashboard-panel__header {
    flex-direction: column;
  }

  .demo-clear-drilldown {
    width: 100%;
  }

  .demo-table-wrap,
  .demo-scroll-hint {
    display: none;
  }

  .demo-record-cards {
    display: grid;
    gap: 12px;
  }

  .demo-record-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--cobalt);
    border-radius: 5px;
    background: var(--white);
  }

  .demo-record-card header {
    display: flex;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--line);
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .demo-record-card header strong {
    color: var(--navy);
    font-family: "IBM Plex Mono", monospace;
  }

  .demo-record-card header time {
    color: var(--muted);
    font-size: 14px;
  }

  .demo-record-card dl {
    display: grid;
    margin: 0;
  }

  .demo-record-card dl > div {
    display: grid;
    padding: 11px 0;
    border-bottom: 1px solid #e5e9f0;
    grid-template-columns: minmax(112px, 0.8fr) minmax(0, 1.2fr);
    gap: 12px;
  }

  .demo-record-card dl > div:last-child {
    border-bottom: 0;
  }

  .demo-record-card dt {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
  }

  .demo-record-card dd {
    margin: 0;
    color: var(--navy);
    font-size: 14px;
    text-align: right;
  }

  .demo-record-card .demo-badge {
    justify-self: end;
  }

  .demo-pagination {
    grid-template-columns: repeat(2, 1fr);
  }

  .demo-pagination__range,
  #page-status {
    grid-column: 1 / -1;
    justify-self: center;
  }

  .demo-pagination button {
    width: 100%;
  }
}

@media (max-width: 390px) {
  .demo-kpis {
    gap: 8px;
  }

  .demo-kpi {
    min-height: 142px;
    padding: 16px 13px;
  }

  .demo-kpi__label {
    min-height: 38px;
    font-size: 14px;
  }

  .demo-kpi__value {
    margin: 9px 0 6px;
    font-size: clamp(27px, 9vw, 36px);
  }

  .demo-kpi:last-child .demo-kpi__value {
    font-size: 22px;
    letter-spacing: -0.025em;
  }

  .demo-kpi__note {
    font-size: 14px;
  }

  .demo-view-switch button {
    min-height: 88px;
    font-size: 16px;
  }

  .demo-chart-row--step-1 .demo-chart-button,
  .demo-chart-row--step-2 .demo-chart-button,
  .demo-chart-row--step-3 .demo-chart-button,
  .demo-chart-row--step-4 .demo-chart-button,
  .demo-chart-row--step-5 .demo-chart-button {
    width: 100%;
    margin-left: 0;
  }

  .demo-chart-row__heading {
    gap: 8px;
  }

  .demo-record-card dl > div {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .demo-record-card dd,
  .demo-record-card .demo-badge {
    justify-self: start;
    text-align: left;
  }
}

@media (max-width: 330px) {
  .demo-kpis {
    grid-template-columns: 1fr;
  }

  .demo-view-switch button {
    padding-inline: 3px;
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .demo-chart-row progress,
  .demo-chart-row progress::-webkit-progress-value,
  .demo-chart-row progress::-moz-progress-bar,
  .demo-lollipop-point,
  [data-active-view] .demo-kpis,
  [data-active-view] .demo-dashboard-grid,
  [data-active-view] .demo-table-section {
    animation: none !important;
    transition: none !important;
  }
}

/* V3.5: eksplorator otwierany na żądanie i bardziej namacalne sterowanie. */
.demo-explorer {
  overflow: clip;
  margin-top: clamp(34px, 5vw, 58px);
  border: 1px solid #9eacc3;
  border-radius: 10px;
  background: var(--white);
  box-shadow: 0 24px 64px rgba(8, 20, 49, 0.14);
}

.demo-dashboard-cta .v3-eyebrow--light {
  color: var(--white);
}

.demo-explorer > summary {
  display: flex;
  min-height: 72px;
  padding: 16px 22px;
  background: var(--navy);
  color: var(--white);
  cursor: pointer;
  list-style: none;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  font-size: 19px;
  font-weight: 760;
}

.demo-explorer > summary::-webkit-details-marker {
  display: none;
}

.demo-explorer > summary::after {
  display: grid;
  width: 36px;
  height: 36px;
  border: 1px solid #6f7d98;
  color: #cfe8ff;
  content: "↓";
  font-family: "IBM Plex Mono", monospace;
  place-items: center;
  transition: transform 160ms ease;
}

.demo-explorer[open] > summary::after {
  transform: rotate(180deg);
}

.demo-explorer__body {
  padding: clamp(18px, 3vw, 30px);
}

.demo-explorer:not([open]) > .demo-explorer__body {
  display: none;
}

.demo-explorer[open] > .demo-explorer__body {
  display: block;
}

.demo-explorer .demo-filter-shell {
  margin-top: 0;
  border-color: #aebbd0;
  border-radius: 8px;
  box-shadow: none;
}

.demo-filter-shell > summary::after {
  color: var(--cobalt-dark);
  content: "+";
  font-family: "IBM Plex Mono", monospace;
  font-size: 22px;
}

.demo-filter-shell[open] > summary::after {
  content: "−";
}

.demo-filter-shell > summary strong {
  margin-left: auto;
}

.demo-filters {
  background:
    linear-gradient(135deg, rgba(49, 92, 255, 0.055), rgba(139, 203, 255, 0.02)),
    var(--white);
}

.demo-control {
  padding: 12px;
  border: 1px solid #d4ddeb;
  border-radius: 7px;
  background: var(--white);
}

.demo-control > span {
  min-height: 32px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 14px;
  font-weight: 500;
}

.demo-control select {
  border: 0;
  border-bottom: 2px solid #9facbf;
  border-radius: 0;
  background-color: #f8faff;
}

.demo-view-switch > div {
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  gap: 10px;
}

.demo-view-switch button,
.demo-view-switch button:last-child {
  min-height: 62px;
  border: 1px solid #aeb9ca;
  border-radius: 7px;
  background: var(--white);
  box-shadow: 0 8px 20px rgba(8, 20, 49, 0.05);
}

.demo-view-switch button[aria-pressed="true"] {
  border-color: var(--navy);
  box-shadow: inset 0 -4px 0 #8bcbff, 0 10px 24px rgba(8, 20, 49, 0.14);
}

.demo-record-card__details {
  margin-top: 6px;
  border-top: 1px solid var(--line);
}

.demo-record-card__details > summary {
  display: flex;
  min-height: 46px;
  color: var(--cobalt-dark);
  cursor: pointer;
  list-style: none;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 750;
}

.demo-record-card__details > summary::-webkit-details-marker {
  display: none;
}

.demo-record-card__details > summary::after {
  content: "+";
  font-family: "IBM Plex Mono", monospace;
  font-size: 20px;
}

.demo-record-card__details[open] > summary::after {
  content: "−";
}

.demo-record-card__details dl {
  border-top: 1px solid #e5e9f0;
}

@media (max-width: 760px) {
  .demo-explorer {
    margin-top: 26px;
  }

  .demo-explorer > summary {
    min-height: 62px;
    padding: 13px 15px;
    font-size: 17px;
  }

  .demo-explorer__body {
    padding: 12px;
  }

  .demo-filter-shell > summary {
    min-height: 58px;
    padding: 12px 14px;
    flex-wrap: wrap;
  }

  .demo-filter-shell > summary span {
    font-size: 16px;
  }

  .demo-filter-shell > summary strong {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .demo-filters {
    grid-template-columns: 1fr;
  }

  .demo-control {
    padding: 10px;
  }

  .demo-view-switch {
    min-width: 0;
    grid-template-columns: minmax(0, 1fr);
  }

  .demo-view-switch > div {
    display: grid;
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    overflow: visible;
    padding: 2px;
    grid-auto-columns: auto;
    grid-auto-flow: row;
    grid-template-columns: 1fr;
    gap: 8px;
    scroll-snap-type: none;
  }

  .demo-view-switch button {
    width: 100%;
    min-width: 0;
    min-height: 62px;
    scroll-snap-align: none;
  }

  .demo-scroll-hint {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .demo-explorer > summary::after {
    transition: none;
  }
}

@media (forced-colors: active) {
  .demo-explorer,
  .demo-control,
  .demo-view-switch button,
  .demo-record-card__details {
    border: 1px solid ButtonText;
  }

  .demo-control select:focus-visible {
    outline: 3px solid Highlight;
    outline-offset: 3px;
  }
}

/* V3.5: dashboard respects a strict no-motion preference. */
@media (prefers-reduced-motion: reduce) {
  .demo-page *,
  .demo-page *::before,
  .demo-page *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
