/* ==========================================================================
   RailCore — interaktywne demo aplikacji (odwzorowanie UI tabletu, APK 3.2.21)
   ========================================================================== */

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

/* --------------------------------------------------------------- sekcja --- */

.section-demo {
  background:
    radial-gradient(900px 420px at 12% 0%, rgba(61, 123, 208, 0.14), transparent 62%),
    radial-gradient(700px 360px at 88% 100%, rgba(224, 147, 47, 0.08), transparent 58%),
    var(--bg-alt);
}

.demo-layout {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  align-items: start;
}

@media (min-width: 1040px) {
  .demo-layout {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
    gap: clamp(2rem, 4vw, 3.5rem);
  }
}

.demo-copy h2 {
  max-width: 18ch;
}

.demo-features {
  display: grid;
  gap: 0.8rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.demo-features li {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  color: var(--ink-soft);
  font-size: 0.95rem;
  line-height: 1.55;
}

.demo-features li::before {
  content: "";
  flex: 0 0 0.55rem;
  width: 0.55rem;
  height: 0.55rem;
  margin-top: 0.5rem;
  border-radius: 50%;
  background: var(--blue-bright);
}

.demo-features strong {
  color: var(--navy-deep, #0b1f3a);
}

.demo-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.2rem;
}

.demo-badge-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  background: var(--white);
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--navy-mid);
}

.demo-badge-pill--live {
  border-color: rgba(45, 125, 70, 0.35);
  background: rgba(45, 125, 70, 0.08);
  color: #1f6b3f;
}

.demo-privacy {
  margin: 1.15rem 0 0;
  padding: 0.75rem 0.9rem;
  border-left: 3px solid var(--blue-bright);
  border-radius: 0 8px 8px 0;
  background: rgba(61, 123, 208, 0.07);
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

/* ---------------------------------------------------------------- tablet -- */

.demo-tablet-shell {
  position: relative;
  width: min(100%, 480px);
  margin-inline: auto;
}

.demo-tablet-shell::before {
  content: "";
  position: absolute;
  inset: -6% -5%;
  background: radial-gradient(circle, rgba(43, 94, 167, 0.2), transparent 68%);
  pointer-events: none;
}

.demo-tablet {
  position: relative;
  aspect-ratio: 10 / 16;
  padding: 0.7rem 0.55rem;
  border-radius: 26px;
  background: linear-gradient(155deg, #333a48, #141a24 55%, #0a0e16);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.09),
    0 26px 64px rgba(7, 19, 34, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.demo-tablet__cam {
  position: absolute;
  top: 0.3rem;
  left: 50%;
  transform: translateX(-50%);
  width: 52px;
  height: 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  z-index: 3;
}

.demo-tablet__screen {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: #0d1219;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  container-type: inline-size;
}

.demo-tablet__screen [data-demo-app] {
  height: 100%;
  overflow: hidden;
}

.demo-frame-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.9rem;
}

.demo-frame-controls button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.42rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--white);
  color: var(--navy-mid);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
}

.demo-frame-controls button:hover,
.demo-frame-controls button:focus-visible {
  border-color: var(--blue-bright);
  background: rgba(61, 123, 208, 0.08);
}

.demo-frame-controls svg {
  width: 1rem;
  height: 1rem;
}

.demo-frame-controls button[aria-pressed="false"] {
  color: var(--ink-mute);
}

.demo-hint {
  margin: 0.7rem 0 0;
  text-align: center;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--ink-mute);
}

/* ----------------------------------------------------------------- toast -- */

.demo-toast {
  position: fixed;
  left: 50%;
  bottom: clamp(1rem, 3vw, 1.75rem);
  transform: translateX(-50%);
  z-index: 240;
  max-width: min(92vw, 540px);
  padding: 0.85rem 1.1rem;
  border-radius: 12px;
  background: rgba(7, 19, 34, 0.95);
  color: #fff;
  font-size: 0.92rem;
  line-height: 1.45;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  animation: demo-toast-in 0.28s var(--ease) both;
}

.demo-toast[hidden] {
  display: none;
}

@keyframes demo-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ==========================================================================
   UI aplikacji w ramce tabletu
   ========================================================================== */

.demo-screen {
  --bar: #1565c0;
  --ink: #e6eaf0;
  --ink-dim: rgba(230, 234, 240, 0.6);
  --surface: #151c26;
  --hair: rgba(255, 255, 255, 0.07);
  --amber: #f5b52b;
  --cyan: #4fc3f7;

  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  background: #0d1219;
  color: var(--ink);
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 10px;
  line-height: 1.35;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

@supports (font-size: 1cqw) {
  .demo-screen { font-size: 2.72cqw; }
}

.demo-screen ::-webkit-scrollbar { width: 4px; height: 4px; }
.demo-screen ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 4px; }

/* pasek systemowy */
.demo-sysbar {
  display: flex;
  align-items: center;
  gap: 0.5em;
  flex: 0 0 auto;
  padding: 0.25em 0.7em;
  background: var(--bar);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.66em;
  letter-spacing: 0.01em;
}

.demo-sysbar__day { opacity: 0.85; }
.demo-sysbar__right { margin-left: auto; opacity: 0.85; }

/* pasek aplikacji */
.demo-appbar {
  display: flex;
  align-items: center;
  gap: 0.35em;
  flex: 0 0 auto;
  padding: 0.4em 0.35em;
  background: var(--bar);
  color: #fff;
}

.demo-appbar__text {
  min-width: 0;
  flex: 1;
}

.demo-appbar__title {
  display: block;
  font-size: 1.05em;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-appbar__sub {
  display: block;
  margin-top: 0.1em;
  font-size: 0.68em;
  color: rgba(255, 255, 255, 0.82);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-appbar__trail {
  flex: 0 0 auto;
  font-size: 0.95em;
  font-weight: 600;
  white-space: nowrap;
}

.demo-iconbtn {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 2em;
  height: 2em;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.demo-iconbtn.is-empty { pointer-events: none; }
.demo-iconbtn svg { width: 1.3em; height: 1.3em; }

.demo-iconbtn:hover,
.demo-iconbtn:focus-visible { background: rgba(255, 255, 255, 0.16); }

/* ------------------------------------------------------------ menu główne -- */

.demo-brand {
  margin: 0.7em 0 0.6em;
  text-align: center;
  font-family: var(--font-display, inherit);
  font-size: 1.5em;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.demo-seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  flex: 0 0 auto;
  margin: 0 0.7em;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  overflow: hidden;
}

.demo-seg__btn {
  border: 0;
  padding: 0.62em 0.2em;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-size: 0.85em;
  cursor: pointer;
  transition: background 0.16s var(--ease);
}

.demo-seg__btn + .demo-seg__btn { border-left: 1px solid rgba(255, 255, 255, 0.14); }

.demo-seg__btn.is-active {
  background: #3b3547;
  color: #fff;
  font-weight: 600;
}

.demo-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45em;
  padding: 0.6em 0.6em 0.2em;
}

.demo-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3em;
  min-height: 7.5em;
  padding: 0.9em 0.4em 0.7em;
  border: 0;
  border-radius: 0.85em;
  background: var(--surface);
  color: inherit;
  text-align: center;
  cursor: pointer;
  transition: background 0.16s var(--ease), transform 0.16s var(--ease);
}

.demo-tile:hover,
.demo-tile:focus-visible {
  background: #1c2532;
  transform: translateY(-1px);
}

.demo-tile.is-locked { color: rgba(230, 234, 240, 0.78); }

.demo-tile__icon {
  display: grid;
  place-items: center;
  width: 2.3em;
  height: 2.3em;
}

.demo-tile__icon svg { width: 100%; height: 100%; }

.demo-tile__icon--plain { color: #e8eaf0; }
.demo-tile__icon--steel { color: #8bb0dd; }
.demo-tile__icon--blue { color: #2f7bd6; }
.demo-tile__icon--teal { color: #14a98c; }
.demo-tile__icon--red { color: #e14b4b; }
.demo-tile__icon--amber { color: #f2a030; }
.demo-tile__icon--cyan { color: #35b8d8; }
.demo-tile__icon--grey { color: #8b929c; }

.demo-tile__title {
  font-size: 0.95em;
  font-weight: 600;
  line-height: 1.2;
}

.demo-tile__sub {
  font-size: 0.72em;
  line-height: 1.3;
  color: rgba(230, 234, 240, 0.55);
}

.demo-legal {
  margin: auto 0 0.8em;
  padding-top: 1.4em;
  text-align: center;
  font-size: 0.7em;
  line-height: 1.6;
  color: rgba(230, 234, 240, 0.42);
}

.demo-bottombar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55em;
  padding: 0.6em;
}

.demo-bottombar button {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 0.7em 0.4em;
  background: transparent;
  color: #7fb0e8;
  font: inherit;
  font-size: 0.9em;
  cursor: pointer;
}

.demo-bottombar button:hover { background: rgba(127, 176, 232, 0.1); }

/* ------------------------------------------------------------------ SWDT -- */

.demo-swdt-top {
  display: flex;
  align-items: flex-start;
  gap: 0.5em;
  flex: 0 0 auto;
  padding: 0.5em 0.7em 0.35em;
}

.demo-swdt-top__left { flex: 1; min-width: 0; }

.demo-swdt-top__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35em;
  flex: 0 0 auto;
}

.demo-dir {
  margin: 0;
  color: #e8a33c;
  font-size: 0.86em;
}

.demo-relation {
  margin: 0.15em 0 0;
  font-size: 0.9em;
  line-height: 1.4;
}

.demo-mask {
  padding: 0 0.15em;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.78);
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: help;
}

.demo-toggle {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  overflow: hidden;
}

.demo-toggle button {
  border: 0;
  padding: 0.4em 0.85em;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-size: 0.82em;
  cursor: pointer;
}

.demo-toggle button + button { border-left: 1px solid rgba(255, 255, 255, 0.16); }

.demo-toggle button.is-active {
  background: #3b3547;
  color: #fff;
  font-weight: 600;
}

.demo-rbadge {
  display: inline-grid;
  place-items: center;
  width: 1.5em;
  height: 1.5em;
  border-radius: 3px;
  background: #1b5e20;
  color: #a5d6a7;
  font-size: 0.85em;
  font-weight: 700;
}

.demo-hud {
  display: flex;
  align-items: center;
  gap: 0.4em;
  flex: 0 0 auto;
  padding: 0.2em 0.7em 0.45em;
}

.demo-hud__dot {
  width: 0.45em;
  height: 0.45em;
  border-radius: 50%;
  background: #42a5f5;
}

.demo-hud__speed {
  font-size: 1.1em;
  font-weight: 700;
  min-width: 1.6em;
}

.demo-hud__unit {
  font-size: 0.8em;
  color: var(--ink-dim);
}

.demo-hud__gps {
  margin-left: auto;
  padding: 0.25em 0.6em;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  font-size: 0.74em;
  color: rgba(255, 255, 255, 0.82);
}

.demo-hud__gps i { font-style: normal; color: #66bb6a; letter-spacing: 0.05em; }

/* profil DEM */
.demo-dem-wrap {
  flex: 0 0 auto;
  padding: 0.2em 0.4em 0.3em;
}

.demo-dem-title {
  margin: 0 0 0.2em 0.3em;
  font-size: 0.76em;
  color: var(--ink-dim);
}

.demo-dem-read {
  margin: 0 0 0.15em;
  text-align: center;
  font-size: 0.88em;
  font-weight: 600;
}

.demo-dem {
  display: block;
  width: 100%;
  height: auto;
  background: #0a0d12;
  border-radius: 3px;
}

.demo-dem__label {
  fill: rgba(255, 255, 255, 0.75);
  font-size: 6.4px;
  font-family: "IBM Plex Sans", sans-serif;
}

.demo-dem__axis {
  fill: rgba(255, 255, 255, 0.55);
  font-size: 6.4px;
  font-family: "IBM Plex Sans", sans-serif;
}

.demo-dem__axis--end { text-anchor: end; }

/* pasek zapowiedzi dźwiękowej */
.demo-alertbar {
  flex: 0 0 auto;
  margin: 0 0.4em 0.3em;
  padding: 0.45em 0.6em;
  border-left: 3px solid var(--amber);
  border-radius: 0 4px 4px 0;
  background: rgba(245, 181, 43, 0.14);
  color: #ffd98a;
  font-size: 0.8em;
  font-weight: 600;
}

.demo-alertbar[hidden] { display: none; }

/* tabela nawigacyjna */
.demo-thead,
.demo-row {
  display: grid;
  grid-template-columns: 3.6em 3.1em minmax(0, 1fr);
  align-items: start;
  gap: 0.3em;
}

.demo-thead {
  flex: 0 0 auto;
  padding: 0.35em 0.5em;
  background: #1a212b;
  border-top: 1px solid var(--hair);
  font-size: 0.78em;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.72);
}

.demo-thead span:last-child { padding-left: 1.5em; }

.demo-tbody {
  flex: 1 1 auto;
  min-height: 9em;
  overflow-y: auto;
  border-top: 1px solid var(--hair);
}

.demo-tbody--static { min-height: 12em; }

.demo-row {
  width: 100%;
  padding: 0.4em 0.5em;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  border-left: 3px solid transparent;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 0.82em;
  text-align: left;
  cursor: pointer;
}

.demo-row.demo-row--km { color: rgba(230, 234, 240, 0.8); }

.demo-row:hover { background: rgba(255, 255, 255, 0.04); }

.demo-row.is-selected {
  background: rgba(21, 66, 122, 0.75);
}

.demo-row.is-gps {
  background: rgba(120, 130, 20, 0.16);
  box-shadow: inset 0 0 0 1.5px #c0ca33;
}

.demo-row.is-restriction {
  border-left-color: #e53935;
  background: rgba(229, 57, 53, 0.13);
}

.demo-cell-km { font-variant-numeric: tabular-nums; }

.demo-cell-v {
  display: flex;
  align-items: center;
  gap: 0.25em;
}

.demo-v {
  color: var(--amber);
  font-weight: 700;
}

.demo-v-limit {
  padding: 0 0.3em;
  border-radius: 3px;
  background: #b71c1c;
  color: #fff;
  font-size: 0.9em;
  font-weight: 700;
}

.demo-cell-name { min-width: 0; }

.demo-stopline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25em;
  line-height: 1.5;
}

.demo-time {
  color: var(--cyan);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.demo-stopname { font-weight: 500; }

.demo-kind,
.demo-chip {
  display: inline-block;
  padding: 0.05em 0.32em;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.78em;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.demo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.22em;
}

.demo-chip--ph { background: #5c1f22; color: #ef9a9a; }
.demo-chip--r6 { background: #4a4520; color: #e8dc86; }
.demo-chip--urgent { background: #7f1d1d; color: #ffb4b4; }
.demo-chip--wos { background: #4a4520; color: #e8dc86; }

.demo-rownote {
  display: block;
  margin-top: 0.2em;
  font-size: 0.9em;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.82);
}

/* linie w okolicy */
.demo-linebar {
  flex: 0 0 auto;
  padding: 0.4em 0.6em 0.6em;
  border-top: 1px solid var(--hair);
  background: #0d1219;
}

.demo-linebar p {
  margin: 0 0 0.35em;
  font-size: 0.74em;
  color: rgba(255, 255, 255, 0.48);
}

.demo-linebar__row {
  display: flex;
  gap: 0.35em;
  overflow-x: auto;
  padding-bottom: 0.15em;
  scrollbar-width: none;
}

.demo-linebar__row::-webkit-scrollbar { display: none; }

.demo-linechip {
  flex: 0 0 auto;
  border: 0;
  border-radius: 0.5em;
  padding: 0.35em 0.8em;
  background: #26314a;
  color: #b9c7e6;
  font: inherit;
  font-size: 0.8em;
  cursor: pointer;
}

.demo-linechip.is-active {
  background: #3949ab;
  color: #fff;
  font-weight: 600;
}

/* przycisk symulacji */
.demo-fab {
  position: absolute;
  right: 0.7em;
  bottom: 4.4em;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  border: 0;
  border-radius: 999px;
  padding: 0.6em 0.9em;
  background: #7e57c2;
  color: #fff;
  font: inherit;
  font-size: 0.85em;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}

.demo-fab svg { width: 1.2em; height: 1.2em; }
.demo-fab.is-on { background: #c62828; }

/* ---------------------------------------------------------------- dialog -- */

.demo-screen--overlay {
  position: relative;
  overflow: hidden;
}

.demo-screen--overlay > .demo-screen {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

.demo-dialog-wrap {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 0.8em;
  background: rgba(4, 7, 12, 0.72);
}

.demo-dialog {
  width: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  padding: 1em 0.9em 0.7em;
  border-radius: 0.9em;
  background: #2a2f38;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.55);
}

.demo-dialog h4 {
  margin: 0;
  font-size: 1.2em;
  font-weight: 600;
}

.demo-dialog__sub {
  margin: 0.3em 0 0.7em;
  font-size: 0.8em;
  color: rgba(255, 255, 255, 0.62);
}

.demo-dialog__count {
  margin: 0.5em 0 0.4em;
  font-size: 0.78em;
  color: rgba(255, 255, 255, 0.62);
}

.demo-dialog__list {
  display: grid;
  gap: 0.5em;
  overflow-y: auto;
  min-height: 6em;
}

.demo-dialog__hint {
  margin: 0.5em 0 0;
  font-size: 0.74em;
  color: rgba(255, 255, 255, 0.5);
}

.demo-dialog__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.3em;
}

.demo-filterchips {
  display: flex;
  gap: 0.4em;
}

.demo-filterchips button {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5em;
  padding: 0.35em 0.7em;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font: inherit;
  font-size: 0.8em;
  cursor: pointer;
}

.demo-filterchips button.is-active {
  background: #3f4552;
  color: #fff;
  font-weight: 600;
}

.demo-rjcard {
  display: grid;
  gap: 0.15em;
  padding: 0.7em 0.75em;
  border: 0;
  border-radius: 0.6em;
  background: #363c46;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.demo-rjcard:hover,
.demo-rjcard.is-active { background: #414954; }

.demo-rjcard__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5em;
  font-size: 0.95em;
}

.demo-badge {
  padding: 0.15em 0.45em;
  border-radius: 4px;
  font-size: 0.75em;
  font-style: normal;
  font-weight: 600;
  white-space: nowrap;
}

.demo-badge--ok { background: #5e35b1; color: #fff; }
.demo-badge--bad { background: #c62828; color: #fff; }

.demo-rjcard__carrier {
  font-size: 0.8em;
  font-weight: 600;
  color: #64b5f6;
  letter-spacing: 0.02em;
}

.demo-rjcard__meta {
  font-size: 0.78em;
  color: rgba(255, 255, 255, 0.72);
}

/* ------------------------------------------------------------------- ARJ -- */

.demo-hinttext {
  flex: 0 0 auto;
  margin: 0.6em 0.7em 0.5em;
  font-size: 0.82em;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.66);
}

.demo-arj-head,
.demo-arj-row {
  display: grid;
  grid-template-columns: 2.4em 3.8em 2.2em minmax(0, 1fr) 3.2em;
  gap: 0.3em;
  align-items: start;
}

.demo-arj-head {
  flex: 0 0 auto;
  padding: 0.4em 0.5em;
  background: #1a212b;
  font-size: 0.72em;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
}

.demo-arj-body {
  flex: 1 1 auto;
  min-height: 8em;
  overflow-y: auto;
}

.demo-arj-row {
  padding: 0.38em 0.5em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.8em;
  font-variant-numeric: tabular-nums;
}

.demo-arj-row.has-name { background: rgba(255, 255, 255, 0.025); }
.demo-arj-v { color: var(--amber); font-weight: 700; }
.demo-arj-time { color: var(--cyan); font-weight: 600; text-align: right; }

/* ------------------------------------------------------ listy i formularze */

.demo-cards {
  display: grid;
  gap: 0.5em;
  padding: 0 0.6em 0.7em;
}

.demo-card {
  display: grid;
  gap: 0.15em;
  padding: 0.75em 0.8em;
  border: 0;
  border-radius: 0.6em;
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.demo-card:hover,
.demo-card:focus-visible { background: #1c2532; }

.demo-card b { font-size: 1em; font-weight: 600; }
.demo-card span { font-size: 0.85em; color: rgba(255, 255, 255, 0.82); }
.demo-card small { font-size: 0.74em; color: rgba(255, 255, 255, 0.5); }

.demo-form {
  display: grid;
  gap: 0.85em;
  padding: 0.3em 0.7em 0.8em;
}

.demo-form__legend {
  margin: 0;
  font-size: 0.9em;
  font-weight: 600;
}

.demo-field {
  position: relative;
  display: block;
}

.demo-field__label {
  position: absolute;
  top: -0.55em;
  left: 0.7em;
  padding: 0 0.3em;
  background: #0d1219;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.72em;
  pointer-events: none;
}

.demo-field input,
.demo-field select {
  width: 100%;
  padding: 0.8em 0.75em;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 0.35em;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.95em;
}

.demo-field select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.6) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.6) 50%, transparent 50%);
  background-position: right 1em center, right 0.65em center;
  background-size: 0.35em 0.35em, 0.35em 0.35em;
  background-repeat: no-repeat;
}

.demo-field input[readonly] { color: rgba(255, 255, 255, 0.85); }

.demo-field input[data-masked] { letter-spacing: 0.14em; }

.demo-field--search { padding: 0 0.7em 0.6em; }

.demo-field--search input {
  border-radius: 0.4em;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.14);
}

.demo-field--search input::placeholder { color: rgba(255, 255, 255, 0.42); }

.demo-btnrow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55em;
}

.demo-btn {
  border-radius: 999px;
  padding: 0.75em 0.5em;
  font: inherit;
  font-size: 0.85em;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
}

.demo-btn--outline {
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: transparent;
  color: #7fb0e8;
}

.demo-btn--outline:hover { background: rgba(127, 176, 232, 0.1); }

.demo-btn--filled {
  border: 0;
  background: #1976d2;
  color: rgba(255, 255, 255, 0.95);
}

.demo-btn--filled:hover { background: #1e88e5; }

/* ------------------------------------------------------- rozkaz pisemny -- */

.demo-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  flex: 0 0 auto;
  background: #171d26;
}

.demo-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 0.75em 0.2em;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  font: inherit;
  font-size: 0.76em;
  cursor: pointer;
}

.demo-tabs button.is-active {
  color: #42a5f5;
  border-bottom-color: #42a5f5;
  font-weight: 600;
}

.demo-orderactions {
  display: flex;
  justify-content: center;
  gap: 0.9em;
  flex: 0 0 auto;
  padding: 0.55em 0.4em 0.35em;
}

.demo-link {
  border: 0;
  background: none;
  color: #64b5f6;
  font: inherit;
  font-size: 0.82em;
  cursor: pointer;
}

.demo-link:hover { text-decoration: underline; }

.demo-ordertimer {
  flex: 0 0 auto;
  margin: 0;
  padding: 0.3em 0.6em 0.45em;
  color: #e8a33c;
  font-size: 0.8em;
}

.demo-orderbody {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 0.6em 0.7em;
}

.demo-paper {
  padding: 1.1em 0.9em;
  background: #fff;
  color: #111;
  font-size: 0.74em;
  line-height: 1.45;
}

.demo-paper h5 {
  margin: 0 0 0.5em;
  font-size: 1.35em;
  font-weight: 700;
}

.demo-paper .demo-mask {
  background: #d8d8d8;
  color: #333;
}

.demo-paper__meta { margin: 0 0 0.8em; }

.demo-paper__table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #333;
}

.demo-paper__table caption {
  padding: 0.35em 0.4em;
  border: 1px solid #333;
  border-bottom: 0;
  font-size: 1em;
  text-align: left;
  caption-side: top;
}

.demo-paper__table th,
.demo-paper__table td {
  border: 1px solid #333;
  padding: 0.35em 0.35em;
  font-size: 0.95em;
  vertical-align: top;
  text-align: left;
}

.demo-paper__table th { font-weight: 600; }
.demo-paper__lp { text-align: right; white-space: nowrap; }
.demo-paper__mid { text-align: center; background: #e6e6e6; white-space: nowrap; }
.demo-paper__ref { font-size: 0.9em; }

.demo-paper__sign {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid #333;
  border-top: 0;
}

.demo-paper__sign > div { padding: 0.5em 0.4em; }
.demo-paper__sign > div + div { border-left: 1px solid #333; }

.demo-paper__signbox {
  display: grid;
  place-items: center;
  text-align: center;
}

.demo-paper__foot {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  margin: 2.5em 0 0;
  font-size: 0.9em;
  color: #333;
}

.demo-panelnote {
  padding: 0.9em;
  border-radius: 0.5em;
  background: var(--surface);
}

.demo-panelnote b { display: block; margin-bottom: 0.35em; font-size: 0.95em; }
.demo-panelnote p { margin: 0; font-size: 0.85em; line-height: 1.55; color: rgba(255, 255, 255, 0.72); }

/* ------------------------------------------------------------- ustawienia -- */

.demo-settings {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.2em 0.7em 1em;
}

.demo-sect {
  margin: 1em 0 0.3em;
  font-size: 1em;
  font-weight: 600;
  color: #7fb0e8;
}

.demo-secthint {
  margin: 0 0 0.7em;
  font-size: 0.78em;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.58);
}

.demo-switchrow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 0.5em;
  padding: 0.55em 0;
  border-bottom: 1px solid var(--hair);
}

.demo-switchrow__text b {
  display: block;
  font-size: 0.86em;
  font-weight: 600;
  line-height: 1.35;
}

.demo-switchrow__text small {
  display: block;
  margin-top: 0.15em;
  font-size: 0.74em;
  color: rgba(255, 255, 255, 0.5);
}

.demo-switch {
  position: relative;
  width: 2.6em;
  height: 1.1em;
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: background 0.18s var(--ease);
}

.demo-switch i {
  position: absolute;
  top: -0.2em;
  left: 0;
  width: 1.5em;
  height: 1.5em;
  border-radius: 50%;
  background: #9aa2ae;
  transition: transform 0.18s var(--ease), background 0.18s var(--ease);
}

.demo-switch.is-on { background: rgba(66, 165, 245, 0.42); }
.demo-switch.is-on i { transform: translateX(1.2em); background: #42a5f5; }

.demo-testbtn {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 0.3em 0.7em;
  background: transparent;
  color: #7fb0e8;
  font: inherit;
  font-size: 0.76em;
  font-weight: 600;
  cursor: pointer;
}

.demo-testbtn:hover { background: rgba(127, 176, 232, 0.12); }

.demo-togglegroup {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 0.4em;
  overflow: hidden;
}

.demo-togglegroup button {
  border: 0;
  padding: 0.6em 0.2em;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font: inherit;
  font-size: 0.85em;
  cursor: pointer;
}

.demo-togglegroup button + button { border-left: 1px solid rgba(255, 255, 255, 0.16); }

.demo-togglegroup button.is-active {
  background: #1976d2;
  color: #fff;
  font-weight: 600;
}

.demo-brakingvalue {
  margin: 0.6em 0 0.4em;
  font-size: 0.88em;
  font-weight: 600;
}

.demo-brakingtable {
  display: grid;
  gap: 0.15em;
  padding: 0.6em 0.7em;
  border-radius: 0.4em;
  background: rgba(255, 255, 255, 0.05);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.82em;
  color: #cfe0f5;
  white-space: pre;
}

/* ------------------------------------------------------------------ TWR -- */

.demo-twr {
  display: grid;
  gap: 0.7em;
  padding: 0 0.7em 1em;
}

.demo-twr__form {
  display: grid;
  gap: 0.5em;
}

.demo-twr .demo-field input {
  font-size: 1.15em;
  letter-spacing: 0.12em;
}

.demo-twr .demo-field.has-error input { border-color: #ef9a9a; }

.demo-twr__hint {
  margin: 0;
  font-size: 0.78em;
  color: rgba(255, 255, 255, 0.55);
}

.demo-twr .demo-field.has-error + .demo-twr__hint { color: #ef9a9a; }

.demo-twr__chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35em;
  font-size: 0.78em;
  color: rgba(255, 255, 255, 0.55);
}

.demo-chipbtn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 0.3em 0.7em;
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  font: inherit;
  font-size: 1em;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.demo-chipbtn:hover { background: rgba(255, 255, 255, 0.08); }

.demo-chipbtn.is-active {
  border-color: #f5b52b;
  background: rgba(245, 181, 43, 0.16);
  color: #f5d78a;
  font-weight: 600;
}

.demo-twr__card {
  padding: 1em 0.9em;
  border: 1px solid rgba(242, 217, 138, 0.2);
  border-radius: 0.8em;
  background: var(--surface);
}

.demo-twr__card h6 {
  margin: 0;
  font-size: 0.95em;
  font-weight: 600;
}

.demo-twr__status {
  margin: 0.45em 0 0;
  font-size: 1.5em;
  font-weight: 700;
  line-height: 1.1;
}

.demo-twr__status.is-twr { color: #f2d98a; }
.demo-twr__status.is-forbidden { color: #ffb4b4; }
.demo-twr__status.is-plain { color: #b8c5d6; }

.demo-twr__summary {
  margin: 0.35em 0 0;
  font-size: 0.85em;
  color: rgba(255, 255, 255, 0.72);
}

.demo-twr__name {
  margin: 0.9em 0 0.6em;
  font-size: 0.9em;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.72);
}

.demo-twr__name b { color: var(--ink); }

.demo-twr__field {
  display: flex;
  justify-content: space-between;
  gap: 0.8em;
  margin: 0.3em 0 0;
  font-size: 0.82em;
  color: rgba(255, 255, 255, 0.6);
}

.demo-twr__field b {
  flex: 0 1 auto;
  color: var(--ink);
  font-weight: 600;
  text-align: right;
}

.demo-twr__note {
  margin: 1em 0 0;
  padding-top: 0.8em;
  border-top: 1px solid var(--hair);
  font-size: 0.82em;
  line-height: 1.5;
  color: #ff8f8f;
  font-weight: 600;
}

/* -------------------------------------------------------- schematy stacji */

.demo-stbar {
  display: flex;
  align-items: center;
  gap: 0.6em;
  flex: 0 0 auto;
  padding: 0.2em 0.7em 0.6em;
}

.demo-stbar__file {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.72em;
  color: rgba(255, 255, 255, 0.5);
}

.demo-stbar .demo-btn {
  flex: 0 0 auto;
  padding: 0.45em 0.9em;
  font-size: 0.76em;
}

.demo-stbody {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 0.7em;
}

.demo-stscheme {
  overflow-x: auto;
  padding: 0.5em 0.4em;
  border-radius: 0.4em;
  background: #fff;
}

.demo-stsvg {
  display: block;
  width: 100%;
  height: auto;
}

.demo-stscheme.is-zoom .demo-stsvg { width: 260%; }

.demo-stsvg .s-main {
  fill: none;
  stroke: #111;
  stroke-width: 1.6;
}

.demo-stsvg .s-side {
  fill: none;
  stroke: #111;
  stroke-width: 0.9;
}

.demo-stsvg .s-dash { stroke-dasharray: 7 3 1.5 3; }

.demo-stsvg .s-branch {
  fill: none;
  stroke: #111;
  stroke-width: 1.4;
}

.demo-stsvg .s-plat { fill: #111; }

.demo-stsvg .s-gapfill { fill: #fff; }

.demo-stsvg .s-gap {
  fill: none;
  stroke: #111;
  stroke-width: 0.9;
}

.demo-stsvg .s-sem line { stroke: #111; stroke-width: 0.9; }
.demo-stsvg .s-sem circle { fill: #111; }

.demo-stsvg text {
  fill: #111;
  font-family: inherit;
  font-size: 9px;
}

.demo-stsvg .s-title { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }
.demo-stsvg .s-meta { font-size: 8px; fill: #555; }
.demo-stsvg .s-tno { font-size: 8.5px; font-weight: 700; }
.demo-stsvg .s-dir { font-size: 8.5px; fill: #333; }
.demo-stsvg .s-blabel { font-size: 8.5px; font-weight: 600; }
.demo-stsvg .s-sem text { font-size: 8px; font-weight: 700; }

.demo-stlegend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25em 0.4em;
  margin: 0.6em 0 0;
  font-size: 0.7em;
  color: rgba(255, 255, 255, 0.55);
}

.demo-stlegend span {
  display: inline-block;
  width: 1.4em;
  height: 0.16em;
  background: rgba(255, 255, 255, 0.75);
}

.demo-stlegend span + span { margin-left: 0.5em; }

.demo-stlegend__main { height: 0.26em !important; }

.demo-stlegend__plat {
  width: 1.1em !important;
  height: 0.5em !important;
}

.demo-stlegend__sem {
  width: 0.5em !important;
  height: 0.5em !important;
  border-radius: 999px;
}

.demo-twr .demo-panelnote,
.demo-panelnote--foot {
  margin: 0.8em 0 0;
  font-size: 0.76em;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.6);
}

.demo-panelnote--foot {
  flex: 0 0 auto;
  margin: auto 0.7em 0.7em;
}

/* --------------------------------------------------------------- a11y ---- */

@media (prefers-reduced-motion: reduce) {
  .demo-toast { animation: none; }
  .demo-tile:hover,
  .demo-tile:focus-visible { transform: none; }
  .demo-switch,
  .demo-switch i { transition: none; }
}
