/* ==========================================================================
   Live demo hub (demo.html): the app shell and the shared "d-" UI kit.
   Loaded after style.css, which supplies the fonts, color tokens and theme.
   Each system adds its own styles in assets/css/demo/<id>.css, under its own
   prefix, and sets --accent / --accent-soft on [data-system="<id>"].
   ========================================================================== */

:root {
  --header-h: 60px;
  --demo-top-h: 60px;
  --demo-nav-w: 268px;
  --demo-dock: 0px; /* height of the open API console, kept up to date by core.js */

  /* status colors: text on the matching -soft background passes AA in both themes */
  --d-ok: #047857;
  --d-ok-soft: #e1f5ec;
  --d-warn: #975a00;
  --d-warn-soft: #fcf0d8;
  --d-danger: #c12a2a;
  --d-danger-soft: #fdeaea;
  --d-info: #2140e6;
  --d-info-soft: #e8edff;
  --d-violet: #6a3dd1;
  --d-violet-soft: #efe9ff;
  --d-on-solid: #fff; /* text on solid danger/ok fills */
  --d-control-line: #a3abc1; /* input and switch borders: stronger than --line */
  --d-zebra: #f8faff;
  --d-hover: #f0f3fe;
  --d-code-bg: #0b1024;
  --d-code-ink: #dce3fb;
  --d-code-line: #1f2847;
  --d-overlay: rgba(4, 7, 18, 0.5);

  /* a system recolors these on [data-system="<id>"]; the brand is the fallback */
  --accent: var(--brand);
  --accent-soft: var(--brand-soft);
  --accent-on: #fff;
}

:root[data-theme="dark"] {
  --d-ok: #4ade80;
  --d-ok-soft: #0e2a22;
  --d-warn: #fbbf24;
  --d-warn-soft: #2b2310;
  --d-danger: #f87171;
  --d-danger-soft: #35151c;
  --d-info: #9aabff;
  --d-info-soft: #18214d;
  --d-violet: #c4b5fd;
  --d-violet-soft: #221a47;
  --d-on-solid: #060a18;
  --d-control-line: #46537c;
  --d-zebra: #0f162f;
  --d-hover: #151d3b;
  --d-code-bg: #070b1c;
  --d-code-line: #1a2240;
  --d-overlay: rgba(0, 0, 0, 0.6);
  --accent-on: #060a18;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --d-ok: #4ade80;
    --d-ok-soft: #0e2a22;
    --d-warn: #fbbf24;
    --d-warn-soft: #2b2310;
    --d-danger: #f87171;
    --d-danger-soft: #35151c;
    --d-info: #9aabff;
    --d-info-soft: #18214d;
    --d-violet: #c4b5fd;
    --d-violet-soft: #221a47;
    --d-on-solid: #060a18;
    --d-control-line: #46537c;
    --d-zebra: #0f162f;
    --d-hover: #151d3b;
    --d-code-bg: #070b1c;
    --d-code-line: #1a2240;
    --d-overlay: rgba(0, 0, 0, 0.6);
    --accent-on: #060a18;
  }
}

@media (prefers-contrast: more) {
  :root {
    --d-control-line: #6b7390;
  }

  :root[data-theme="dark"] {
    --d-control-line: #8490b8;
  }
}

@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --d-control-line: #8490b8;
  }
}

/* the accessibility menu's high contrast wins over every system's accent */
html:root.a11y-contrast {
  --d-ok: #3dff8b;
  --d-ok-soft: #000;
  --d-warn: #ffe600;
  --d-warn-soft: #000;
  --d-danger: #ff8a8a;
  --d-danger-soft: #000;
  --d-info: #7fd4ff;
  --d-info-soft: #000;
  --d-violet: #dcc2ff;
  --d-violet-soft: #000;
  --d-on-solid: #000;
  --d-control-line: #fff;
  --d-zebra: #000;
  --d-hover: #1c1c1c;
  --d-code-bg: #000;
  --d-code-ink: #fff;
  --d-code-line: #fff;
}

html.a11y-contrast [data-system],
html.a11y-contrast .demo-page {
  --accent: #ffe600 !important;
  --accent-soft: #262100 !important;
  --accent-on: #000 !important;
}

/* ==========================================================================
   Shell
   ========================================================================== */

html {
  scroll-padding-top: calc(var(--demo-top-h) + 16px);
}

/* a component's display value must never beat the hidden attribute */
.demo-page [hidden] {
  display: none !important;
}

.demo-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  font-size: 0.95rem;
  line-height: 1.6;
}

/* ---------- top bar ---------- */

.demo-top {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.demo-top__inner {
  display: flex;
  flex-wrap: wrap; /* only with the accessibility menu's biggest text sizes; core.js tracks the height */
  align-items: center;
  gap: 6px 10px;
  min-height: 60px;
  padding: 10px clamp(12px, 2.2vw, 24px);
}

.demo-top__home {
  flex: none;
  border-radius: 12px;
}

.demo-top__home .brand__mark {
  width: 36px;
  height: 36px;
  transition: transform 0.2s ease;
}

.demo-top__home:hover .brand__mark {
  transform: translateY(-1px);
}

.demo-top__sep {
  flex: none;
  width: 1px;
  height: 24px;
  background: var(--line);
}

.demo-top__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
}

.demo-top__live {
  position: relative;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}

.demo-top__live::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--ok);
  opacity: 0;
  animation: ping 2.4s cubic-bezier(0, 0, 0.2, 1) infinite;
}

.demo-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  margin: 0;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--d-warn-soft);
  color: var(--d-warn);
  border: 1px solid color-mix(in srgb, var(--d-warn) 30%, transparent);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.demo-top__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
}

.demo-tbtn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.demo-tbtn:hover {
  color: var(--brand);
  border-color: var(--brand);
}

.demo-tbtn .icon {
  width: 18px;
  height: 18px;
}

.demo-tbtn[aria-expanded="true"] {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-soft);
}

.demo-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.demo-count.is-bump {
  background: var(--brand);
  color: var(--accent-on);
}

/* the failure switch is armed: a warning dot on the console button */
.demo-tbtn--console.is-armed::after {
  content: "";
  position: absolute;
  top: -4px;
  inset-inline-end: -4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--d-warn);
  border: 2px solid var(--surface);
}

.demo-top__theme {
  width: 40px;
  height: 40px;
}

.demo-top__back .icon {
  width: 16px;
  height: 16px;
}

/* ---------- layout: switcher + main ---------- */

.demo-app {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: var(--demo-nav-w) minmax(0, 1fr);
  width: 100%;
  max-width: 1640px;
  margin-inline: auto;
}

.demo-nav {
  position: sticky;
  top: var(--demo-top-h);
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: calc(100vh - var(--demo-top-h) - var(--demo-dock));
  max-height: calc(100dvh - var(--demo-top-h) - var(--demo-dock));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 22px 14px 24px;
  border-inline-end: 1px solid var(--line);
}

.demo-nav__label {
  margin: 0 10px 2px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

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

.demo-nav__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--ink-2);
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.demo-nav__link:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.demo-nav__link[aria-current="page"] {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.demo-nav__link[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  inset-inline-start: -9px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.demo-nav__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.demo-nav__icon .icon {
  width: 18px;
  height: 18px;
}

.demo-nav__text {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}

.demo-nav__title {
  font-size: 0.92rem;
  font-weight: 600;
}

.demo-nav__org {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-nav__help {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.82rem;
  line-height: 1.6;
}

.demo-nav__help p {
  margin: 0 0 10px;
}

.demo-nav__help-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 700;
}

.demo-nav__help-title .icon {
  color: var(--brand);
}

.demo-main {
  min-width: 0;
  padding: 22px clamp(16px, 3vw, 40px) 48px;
}

.demo-main:focus {
  outline: none;
}

.demo-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 20px;
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--d-warn-soft);
  border: 1px solid color-mix(in srgb, var(--d-warn) 28%, transparent);
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.55;
}

.demo-disclaimer .icon {
  margin-top: 2px;
  color: var(--d-warn);
}

/* ---------- system header ---------- */

.demo-sys {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px 18px;
  margin-bottom: 22px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.demo-sys__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 62%, var(--brand-2)));
  color: var(--accent-on);
  box-shadow: 0 12px 24px -14px var(--accent);
}

.demo-sys__icon .icon {
  width: 26px;
  height: 26px;
}

.demo-sys__main {
  min-width: 0;
}

.demo-sys__org {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.demo-sys__org .icon {
  width: 15px;
  height: 15px;
}

.demo-sys__title {
  width: fit-content; /* the focus ring after a route change hugs the title */
  max-width: 100%;
  margin: 0 0 6px;
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
  line-height: 1.2;
}

.demo-sys__title:focus {
  outline: none;
}

.demo-sys__title:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.demo-sys__short {
  max-width: 72ch;
  margin: 0 0 12px;
  color: var(--ink-2);
}

.demo-sys__stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.demo-sys__stack li {
  padding: 2px 9px;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.6;
  direction: ltr;
  unicode-bidi: isolate;
}

.demo-sys__link {
  margin-top: 4px;
}

/* ---------- the system's own area ---------- */

.demo-view {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.demo-view > * {
  min-width: 0;
}

/* plain links in a system's content or a dialog: underlined, in the accent color */
.demo-view a:not([class]),
.d-modal a:not([class]),
.d-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.demo-view a:not([class]):hover,
.d-modal a:not([class]):hover,
.d-link:hover {
  text-decoration-thickness: 2px;
}

button.d-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

.demo-view.is-entering {
  animation: demo-view-in 0.28s cubic-bezier(0.2, 0.7, 0.2, 1);
}

@keyframes demo-view-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.demo-boot {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.demo-boot .d-skeleton--wide {
  grid-column: 1 / -1;
  height: 260px;
}

/* The first paint is this placeholder and the footer, until core.js draws the hub in its place.
   A screen tall, it keeps the footer below the fold meanwhile, so the footer isn't seen jumping
   down (it was the hub's layout shift). Only with JS on: without it, the note under it shows. */
html.js .demo-boot {
  align-content: start;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- footer ---------- */

.demo-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  /* the bottom padding keeps the floating accessibility button clear of the text */
  padding: 22px clamp(16px, 3vw, 40px) 88px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

.demo-foot p {
  margin: 0;
}

.demo-foot__note {
  flex-basis: 100%;
}

/* ---------- API console ---------- */

.demo-console {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  height: clamp(220px, 38vh, 440px);
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -20px 44px -28px rgba(10, 17, 40, 0.45);
  animation: demo-console-in 0.24s cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

.demo-console.is-tall {
  height: min(78vh, 820px);
}

@keyframes demo-console-in {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}

.demo-console__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px clamp(12px, 2.2vw, 24px);
  border-bottom: 1px solid var(--line);
}

.demo-console__heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  min-width: 0;
}

.demo-console__title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 0.98rem;
}

.demo-console__title:focus {
  outline: none;
}

.demo-console__title:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

.demo-console__title .icon {
  color: var(--brand);
}

.demo-console__sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.demo-console__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.demo-console__fail {
  margin-inline-end: 6px;
}

.demo-console__shrink,
.demo-console.is-tall .demo-console__grow {
  display: none;
}

.demo-console.is-tall .demo-console__shrink {
  display: block;
}

.demo-console__body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.demo-console__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.demo-console__empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 28px 16px;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

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

.demo-console__empty p {
  max-width: 44ch;
  margin: 0;
}

.demo-console__empty .icon {
  width: 28px;
  height: 28px;
  opacity: 0.7;
}

/* one request */

.demo-log {
  border-bottom: 1px solid var(--line);
}

.demo-log > details > summary {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto auto auto 16px;
  direction: ltr; /* method, path, status, time: read left to right like any devtools network tab */
  align-items: center;
  gap: 10px;
  padding: 7px clamp(12px, 2.2vw, 24px);
  list-style: none;
  cursor: pointer;
  font-size: 0.82rem;
  transition: background-color 0.15s ease;
}

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

.demo-log > details > summary:hover {
  background: var(--d-hover);
}

.demo-log > details > summary:focus-visible {
  outline-offset: -2px;
  border-radius: 0;
}

.demo-log__method {
  justify-self: start;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--d-info-soft);
  color: var(--d-info);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.6;
  direction: ltr;
}

.demo-log__method--post {
  background: var(--d-ok-soft);
  color: var(--d-ok);
}

.demo-log__method--patch,
.demo-log__method--put {
  background: var(--d-warn-soft);
  color: var(--d-warn);
}

.demo-log__method--delete {
  background: var(--d-danger-soft);
  color: var(--d-danger);
}

.demo-log__method--ext {
  background: var(--d-violet-soft);
  color: var(--d-violet);
}

.demo-log__path {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
}

.demo-log__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.demo-log__summary b {
  flex: none;
  font-weight: 600;
  direction: ltr;
  unicode-bidi: isolate;
}

.demo-log__summary span {
  overflow: hidden;
  unicode-bidi: plaintext;
  color: var(--ink-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-log__status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 38px;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 500;
  direction: ltr;
}

.demo-log.is-ok .demo-log__status {
  color: var(--d-ok);
}

.demo-log.is-warn .demo-log__status {
  color: var(--d-warn);
}

.demo-log.is-error .demo-log__status {
  color: var(--d-danger);
}

.demo-log__ms,
.demo-log__time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  direction: ltr;
  white-space: nowrap;
}

.demo-log__ms {
  min-width: 52px;
  text-align: right;
}

.demo-log__chev {
  width: 14px;
  height: 14px;
  color: var(--muted);
  transition: transform 0.2s ease;
}

.demo-log > details[open] .demo-log__chev {
  transform: rotate(180deg);
}

.demo-log.is-error {
  background: color-mix(in srgb, var(--d-danger-soft) 55%, transparent);
}

.demo-log__detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 4px clamp(12px, 2.2vw, 24px) 14px;
}

.demo-log__block h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.demo-log__block .d-code {
  max-height: 280px;
  font-size: 0.74rem;
}

.demo-log__note {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.demo-log--marker {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px clamp(12px, 2.2vw, 24px);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.demo-log--marker::before,
.demo-log--marker::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* the open console takes the bottom of the screen: keep the page and the floating buttons clear of it */
.demo-console-open .a11y {
  bottom: calc(var(--demo-dock) + 16px);
}

@media (min-width: 721px) {
  .demo-console-open .demo-page {
    padding-bottom: var(--demo-dock);
  }
}

/* ---------- toasts ---------- */

.demo-toasts {
  position: fixed;
  bottom: calc(var(--demo-dock) + 18px);
  inset-inline-end: 18px;
  z-index: 70;
  display: grid;
  gap: 8px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}

.d-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 12px 12px 8px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-inline-start: 4px solid var(--d-info);
  box-shadow: var(--shadow-md);
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.5;
  pointer-events: auto;
  animation: d-toast-in 0.24s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.d-toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

@keyframes d-toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

.d-toast__icon {
  margin-top: 1px;
  color: var(--d-info);
}

.d-toast__text {
  flex: 1;
  margin: 0;
}

.d-toast__close {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  margin: -4px 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.d-toast__close:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.d-toast__close .icon {
  width: 16px;
  height: 16px;
}

.d-toast--ok {
  border-inline-start-color: var(--d-ok);
}

.d-toast--ok .d-toast__icon {
  color: var(--d-ok);
}

.d-toast--warn {
  border-inline-start-color: var(--d-warn);
}

.d-toast--warn .d-toast__icon {
  color: var(--d-warn);
}

.d-toast--error {
  border-inline-start-color: var(--d-danger);
}

.d-toast--error .d-toast__icon {
  color: var(--d-danger);
}

/* ---------- modal (built on <dialog>) ---------- */

.d-modal {
  width: min(560px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.d-modal[open] {
  display: flex;
  animation: d-modal-in 0.22s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.d-modal::backdrop {
  background: var(--d-overlay);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

@keyframes d-modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

.d-modal--sm {
  width: min(420px, calc(100vw - 32px));
}

.d-modal--lg {
  width: min(860px, calc(100vw - 32px));
}

.d-modal__box {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.d-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 12px;
}

.d-modal__title {
  margin: 4px 0 0;
  font-size: 1.12rem;
  line-height: 1.35;
}

.d-modal__title:focus {
  outline: none;
}

.d-modal__close {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.d-modal__close:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.d-modal__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 20px 20px;
  color: var(--ink-2);
}

.d-modal__text {
  margin: 0;
}

.d-modal__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

@media (max-width: 480px) {
  .d-modal__foot .d-btn {
    flex: 1 1 auto;
  }
}

/* ==========================================================================
   UI kit: cards, grids, KPIs, tables, controls, badges...
   Everything here is prefixed "d-" and takes its color from --accent.
   ========================================================================== */

.d-card {
  min-width: 0;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.d-card--flush {
  padding: 0;
  overflow: hidden;
}

.d-card--flush > .d-card__head {
  padding: 16px 20px 0;
}

.d-card--soft {
  background: var(--surface-2);
  box-shadow: none;
}

.d-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 14px;
}

.d-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.d-card__title .icon {
  width: 18px;
  height: 18px;
  color: var(--accent);
}

.d-card__sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.d-grid {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.d-grid > * {
  min-width: 0;
}

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

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

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

/* main area + side panel, e.g. a list and the selected item's details */
.d-split {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.d-stack {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.d-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.d-spacer {
  margin-inline-start: auto;
}

.d-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 1.12rem;
}

.d-muted {
  color: var(--muted);
}

.d-small {
  font-size: 0.84rem;
}

.d-mono {
  font-family: var(--mono);
  font-size: 0.86em;
}

/* numbers, codes and IDs: keep their own order inside Hebrew text */
.d-num,
.d-ltr {
  direction: ltr;
  unicode-bidi: isolate;
}

.d-num {
  font-variant-numeric: tabular-nums;
}

.d-divider {
  height: 1px;
  margin: 4px 0;
  border: 0;
  background: var(--line);
}

/* ---------- KPIs ---------- */

.d-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.d-kpi {
  position: relative;
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  padding: 15px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.d-kpi__label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.4;
}

.d-kpi__label .icon {
  width: 15px;
  height: 15px;
  color: var(--accent);
}

.d-kpi__num {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  unicode-bidi: isolate;
}

.d-kpi__delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.d-kpi__delta .icon {
  width: 14px;
  height: 14px;
}

.d-kpi__delta--up {
  color: var(--d-ok);
}

.d-kpi__delta--down {
  color: var(--d-danger);
}

.d-kpi--accent {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 25%, var(--line));
}

/* on tinted surfaces the regular muted gray drops under 4.5:1 in the light theme */
.d-kpi--accent,
.d-note,
.d-chip[aria-pressed="true"],
.d-chip.is-active,
.d-table tr.is-selected,
.d-table tr[aria-selected="true"],
.demo-disclaimer {
  --muted: var(--ink-2);
}

/* ---------- tables ---------- */

.d-table-wrap {
  position: relative;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overscroll-behavior-x: contain;
}

/* a fixed height makes the header row stick while the body scrolls */
.d-table-wrap--scroll {
  max-height: min(62vh, 560px);
}

.d-table-wrap:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.d-card--flush .d-table-wrap,
.d-table-wrap--flush {
  border: 0;
  border-radius: 0;
}

.d-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.87rem;
  line-height: 1.45;
}

.d-table--wide {
  min-width: 720px;
}

.d-table caption {
  padding: 12px 14px 4px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: start;
}

.d-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  text-align: start;
  white-space: nowrap;
}

.d-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.d-table tbody tr:nth-child(even) td {
  background: var(--d-zebra);
}

.d-table tbody tr:hover td {
  background: var(--d-hover);
}

.d-table tbody tr:last-child td {
  border-bottom: 0;
}

.d-table tr.is-selected td,
.d-table tr[aria-selected="true"] td {
  background: var(--accent-soft);
}

.d-table tr.is-clickable {
  cursor: pointer;
}

.d-table .is-num {
  text-align: end;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.d-table .is-nowrap {
  white-space: nowrap;
}

.d-table .is-actions {
  width: 1%;
  text-align: end;
  white-space: nowrap;
}

/* a sortable header: <th aria-sort><button class="d-th-sort">…</button></th> */
.d-th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: -4px -6px;
  padding: 4px 6px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.d-th-sort:hover {
  color: var(--ink);
  background: var(--d-hover);
}

.d-th-sort .icon {
  width: 13px;
  height: 13px;
  opacity: 0.55;
}

th[aria-sort="ascending"] .d-th-sort,
th[aria-sort="descending"] .d-th-sort {
  color: var(--accent);
}

th[aria-sort="ascending"] .d-th-sort .icon,
th[aria-sort="descending"] .d-th-sort .icon {
  opacity: 1;
}

.d-table-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
}

/* ---------- lists ---------- */

.d-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.d-list > li {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.d-list > li:last-child {
  border-bottom: 0;
}

.d-list__main {
  flex: 1;
  min-width: 0;
}

.d-list__title {
  display: block;
  font-weight: 600;
}

.d-list__meta {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.d-dl {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 16px;
  margin: 0;
}

.d-dl dt {
  color: var(--muted);
  font-size: 0.84rem;
}

.d-dl dd {
  margin: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.d-avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

.d-avatar--sm {
  width: 26px;
  height: 26px;
  font-size: 0.7rem;
}

/* ---------- buttons ---------- */

.d-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.d-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.d-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.d-btn .icon {
  width: 17px;
  height: 17px;
}

.d-btn--primary {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-on);
  box-shadow: 0 10px 22px -14px var(--accent);
}

.d-btn--primary:hover {
  background: color-mix(in srgb, var(--accent) 86%, var(--ink));
  border-color: transparent;
  color: var(--accent-on);
}

.d-btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-2);
}

.d-btn--ghost:hover {
  background: var(--surface-2);
  border-color: transparent;
  color: var(--ink);
}

.d-btn--danger {
  background: var(--d-danger);
  border-color: transparent;
  color: var(--d-on-solid);
}

.d-btn--danger:hover {
  background: color-mix(in srgb, var(--d-danger) 86%, var(--ink));
  border-color: transparent;
  color: var(--d-on-solid);
}

.d-btn--soft {
  background: var(--accent-soft);
  border-color: transparent;
  color: var(--accent);
}

.d-btn--soft:hover {
  border-color: var(--accent);
}

.d-btn--sm {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 0.82rem;
}

.d-btn--sm .icon {
  width: 15px;
  height: 15px;
}

.d-btn--icon {
  width: 40px;
  padding: 0;
}

.d-btn--icon.d-btn--sm {
  width: 32px;
}

.d-btn--block {
  width: 100%;
}

.d-btn[disabled],
.d-btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.d-btn[disabled]:hover,
.d-btn[aria-disabled="true"]:hover {
  border-color: var(--line);
  color: var(--ink);
}

.d-btn--primary[disabled]:hover,
.d-btn--primary[aria-disabled="true"]:hover {
  background: var(--accent);
  border-color: transparent;
  color: var(--accent-on);
}

/* busy: the label stays for screen readers, a spinner shows on top */
.d-btn.is-busy {
  color: transparent !important;
  cursor: progress;
}

.d-btn.is-busy > * {
  visibility: hidden;
}

.d-btn.is-busy::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 16px;
  height: 16px;
  margin: auto;
  border-radius: 50%;
  border: 2px solid var(--ink-2);
  border-top-color: transparent;
  animation: d-spin 0.7s linear infinite;
}

.d-btn--primary.is-busy::after {
  border-color: var(--accent-on);
  border-top-color: transparent;
}

.d-btn--danger.is-busy::after {
  border-color: var(--d-on-solid);
  border-top-color: transparent;
}

.d-spinner {
  display: inline-block;
  flex: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  vertical-align: -2px;
  animation: d-spin 0.7s linear infinite;
}

@keyframes d-spin {
  to {
    transform: rotate(360deg);
  }
}

/* segmented control: a row of <button aria-pressed> */
.d-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 11px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.d-seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.d-seg button:hover {
  color: var(--ink);
}

.d-seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.d-seg .icon {
  width: 15px;
  height: 15px;
}

/* ---------- form controls ---------- */

.d-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.d-field > label,
.d-field__label {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
}

.d-field__opt {
  color: var(--muted);
  font-weight: 500;
}

.d-field__hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.d-field__error {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--d-danger);
  font-size: 0.8rem;
  font-weight: 600;
}

.d-field__error:empty {
  display: none;
}

.d-input,
.d-select,
.d-textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--d-control-line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.d-input:hover,
.d-select:hover,
.d-textarea:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--d-control-line));
}

.d-input:focus,
.d-select:focus,
.d-textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.d-input::placeholder,
.d-textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

.d-input[aria-invalid="true"],
.d-select[aria-invalid="true"],
.d-textarea[aria-invalid="true"] {
  border-color: var(--d-danger);
}

.d-input[disabled],
.d-select[disabled],
.d-textarea[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.d-input--sm,
.d-select--sm {
  min-height: 32px;
  padding: 4px 10px;
  font-size: 0.84rem;
}

.d-textarea {
  min-height: 96px;
  resize: vertical;
}

/* LTR values (phone, email, ID) still sit at the right edge of an RTL form */
.d-input.d-ltr {
  text-align: right;
}

.d-select {
  -webkit-appearance: none;
  appearance: none;
  padding-inline-end: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237c85a3' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 10px center;
  background-size: 16px;
  cursor: pointer;
}

.d-select[multiple] {
  padding-inline-end: 12px;
  background-image: none;
}

/* an input with an icon inside: <span class="d-input-wrap"><svg class="icon"/><input class="d-input"></span> */
.d-input-wrap {
  position: relative;
  display: block;
  min-width: 0;
}

.d-input-wrap > .icon {
  position: absolute;
  top: 50%;
  inset-inline-start: 11px;
  width: 17px;
  height: 17px;
  margin-top: -8.5px;
  color: var(--muted);
  pointer-events: none;
}

.d-input-wrap > .d-input {
  padding-inline-start: 36px;
}

.d-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  cursor: pointer;
}

.d-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

/* switch: <label class="d-switch"><input type="checkbox" role="switch"><span>label</span></label> */
.d-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.d-switch input {
  position: relative;
  flex: none;
  width: 38px;
  height: 22px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid var(--d-control-line);
  background: var(--surface-2);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.d-switch input::before {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.d-switch input:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.d-switch input:checked::before {
  background: var(--accent-on);
  transform: translateX(-16px); /* RTL: the knob travels to the left */
}

.d-switch input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.d-switch--warn input:checked {
  background: var(--d-warn);
  border-color: var(--d-warn);
}

.d-switch--warn input:checked::before {
  background: var(--d-on-solid);
}

/* ---------- toolbar (filters row) ---------- */

.d-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  min-width: 0;
}

.d-toolbar > * {
  min-width: 0;
}

.d-toolbar__grow {
  flex: 1 1 220px;
}

.d-toolbar .d-select,
.d-toolbar .d-input {
  width: auto;
  max-width: 100%;
}

.d-toolbar .d-toolbar__grow .d-input,
.d-toolbar .d-input-wrap .d-input {
  width: 100%;
}

/* ---------- badges and chips ---------- */

.d-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.55;
  white-space: nowrap;
}

.d-badge .icon {
  width: 13px;
  height: 13px;
}

.d-badge--ok {
  background: var(--d-ok-soft);
  color: var(--d-ok);
}

.d-badge--warn {
  background: var(--d-warn-soft);
  color: var(--d-warn);
}

.d-badge--danger {
  background: var(--d-danger-soft);
  color: var(--d-danger);
}

.d-badge--info {
  background: var(--d-info-soft);
  color: var(--d-info);
}

.d-badge--violet {
  background: var(--d-violet-soft);
  color: var(--d-violet);
}

.d-badge--accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.d-badge--muted {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

/* a small status dot before the label */
.d-badge--dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.d-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
}

button.d-chip {
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

button.d-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.d-chip[aria-pressed="true"],
.d-chip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.d-chip .icon {
  width: 14px;
  height: 14px;
}

.d-chip__count {
  color: var(--muted);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.d-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- tabs (built by ctx.tabs) ---------- */

.d-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.d-tabs::-webkit-scrollbar {
  display: none;
}

.d-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  margin-bottom: -1px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.d-tab:hover {
  color: var(--ink);
}

.d-tab[aria-selected="true"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.d-tab:focus-visible {
  outline-offset: -3px;
}

.d-tab .icon {
  width: 16px;
  height: 16px;
}

.d-tab__badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.d-tab[aria-selected="true"] .d-tab__badge {
  background: var(--accent-soft);
  color: var(--accent);
}

.d-tabpanel {
  padding-top: 16px;
}

.d-tabpanel:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 8px;
}

/* ---------- empty state, skeleton, notes ---------- */

.d-empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 36px 16px;
  color: var(--muted);
  text-align: center;
}

.d-empty p {
  max-width: 48ch;
  margin: 0;
}

.d-empty__icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 6px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
}

.d-empty__icon .icon {
  width: 24px;
  height: 24px;
}

.d-empty__title {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
}

.d-skeleton {
  display: block;
  height: 12px;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--d-hover) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: d-shimmer 1.4s linear infinite;
}

.d-skeleton--block {
  height: 96px;
  border-radius: var(--radius);
}

.d-skeleton--text {
  width: 60%;
}

@keyframes d-shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

.d-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--d-info-soft);
  border: 1px solid color-mix(in srgb, var(--d-info) 22%, transparent);
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.6;
}

.d-note > .icon {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  color: var(--d-info);
}

.d-note p {
  margin: 0;
}

.d-note--ok {
  background: var(--d-ok-soft);
  border-color: color-mix(in srgb, var(--d-ok) 22%, transparent);
}

.d-note--ok > .icon {
  color: var(--d-ok);
}

.d-note--warn {
  background: var(--d-warn-soft);
  border-color: color-mix(in srgb, var(--d-warn) 26%, transparent);
}

.d-note--warn > .icon {
  color: var(--d-warn);
}

.d-note--danger {
  background: var(--d-danger-soft);
  border-color: color-mix(in srgb, var(--d-danger) 22%, transparent);
}

.d-note--danger > .icon {
  color: var(--d-danger);
}

.d-note--accent {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 22%, transparent);
}

.d-note--accent > .icon {
  color: var(--accent);
}

/* where a number came from, e.g. "רמ״י", "חוברת המכרז, עמ׳ 12" or "חישוב" */
.d-source {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: fit-content;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px dashed var(--d-control-line);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.7;
  white-space: nowrap;
  vertical-align: middle;
}

.d-source .icon {
  width: 11px;
  height: 11px;
}

/* ---------- bars and progress ---------- */

.d-bars {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.d-bar {
  display: grid;
  grid-template-columns: minmax(80px, 9.5rem) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  font-size: 0.84rem;
}

.d-bar__label {
  overflow: hidden;
  color: var(--ink-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.d-bar__track {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

/* modules set the width through el.style.width (CSSOM, allowed by the CSP) */
.d-bar__fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.d-bar__fill--ok {
  background: var(--d-ok);
}

.d-bar__fill--warn {
  background: var(--d-warn);
}

.d-bar__fill--danger {
  background: var(--d-danger);
}

.d-bar__fill--muted {
  background: var(--d-control-line);
}

.d-bar__value {
  min-width: 3ch;
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: end;
}

/* native <progress class="d-progress" value max> */
.d-progress {
  display: block;
  width: 100%;
  height: 8px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--accent);
  overflow: hidden;
  -webkit-appearance: none;
  appearance: none;
}

.d-progress::-webkit-progress-bar {
  background: var(--surface-2);
  border-radius: 999px;
}

.d-progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.d-progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 999px;
}

/* ---------- stepper (wizard) ---------- */

.d-stepper {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: d-step;
}

.d-step {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.d-step::after {
  content: "";
  flex: 1;
  min-width: 12px;
  height: 2px;
  border-radius: 2px;
  background: var(--line);
}

.d-step:last-child {
  flex: none;
}

.d-step:last-child::after {
  display: none;
}

.d-step__num {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.d-step__num .icon {
  width: 15px;
  height: 15px;
}

.d-step__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.d-step.is-current,
.d-step[aria-current="step"] {
  color: var(--ink);
}

.d-step.is-current .d-step__num,
.d-step[aria-current="step"] .d-step__num {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.d-step.is-done .d-step__num {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-on);
}

.d-step.is-done::after {
  background: var(--accent);
}

/* ---------- code (always dark, in both themes) ---------- */

.d-code {
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--d-code-bg);
  border: 1px solid var(--d-code-line);
  color: var(--d-code-ink);
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.65;
  text-align: left;
  white-space: pre;
  tab-size: 2;
  overflow: auto;
  direction: ltr;
  unicode-bidi: isolate;
}

.d-code code {
  font: inherit;
}

.d-code:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.d-code .tok-k {
  color: #c9a6ff;
}

.d-code .tok-s {
  color: #9be3b0;
}

.d-code .tok-n {
  color: #ffc58a;
}

.d-code .tok-c {
  color: #8f99bb;
  font-style: italic;
}

.d-code .tok-f {
  color: #85d4ff;
}

html.a11y-contrast .d-code .tok-k,
html.a11y-contrast .d-code .tok-s,
html.a11y-contrast .d-code .tok-n,
html.a11y-contrast .d-code .tok-c,
html.a11y-contrast .d-code .tok-f {
  color: #fff;
}

/* ctx.code(): a labeled snippet */
.d-codebox {
  display: grid;
  gap: 0;
  min-width: 0;
  margin: 0;
}

.d-codebox__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 8px;
  border-radius: 12px 12px 0 0;
  background: var(--d-code-bg);
  border: 1px solid var(--d-code-line);
  border-bottom: 0;
  color: #b7c1e2;
  font-size: 0.78rem;
}

.d-codebox__title {
  font-family: var(--mono);
  font-size: 0.76rem;
  direction: ltr;
  unicode-bidi: isolate;
}

.d-codebox__label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #d3dbf5;
  font-size: 0.72rem;
  font-weight: 600;
}

.d-codebox__label .icon {
  width: 12px;
  height: 12px;
}

.d-codebox__copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: auto;
  padding: 4px 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: transparent;
  color: #d3dbf5;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

.d-codebox__copy:hover {
  background: rgba(255, 255, 255, 0.08);
}

.d-codebox__copy .icon {
  width: 13px;
  height: 13px;
}

.d-codebox .d-code {
  border-radius: 0 0 12px 12px;
}

.d-codebox__caption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
}

/* ---------- print: the system's content only, with the disclaimer ---------- */

.d-print-only {
  display: none;
}

@media print {
  .demo-top,
  .demo-nav,
  .demo-console,
  .demo-toasts,
  .demo-sys__link,
  .demo-foot nav,
  .d-no-print {
    display: none !important;
  }

  .d-print-only {
    display: block;
  }

  .demo-app {
    display: block;
  }

  .demo-main {
    padding: 0;
  }

  .d-card,
  .d-kpi {
    box-shadow: none;
    break-inside: avoid;
  }

  .d-table-wrap {
    overflow: visible;
    max-height: none;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1280px) {
  .d-grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .d-split {
    grid-template-columns: minmax(0, 1fr);
  }

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

/* below 1080px the switcher becomes a row of tabs that scrolls sideways */
@media (max-width: 1079px) {
  .demo-app {
    grid-template-columns: minmax(0, 1fr);
  }

  .demo-nav {
    position: static;
    max-height: none;
    overflow: visible;
    padding: 10px 0 0;
    border-inline-end: 0;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
  }

  .demo-nav__label,
  .demo-nav__help,
  .demo-nav__org {
    display: none;
  }

  .demo-nav__list {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 0 clamp(12px, 2.2vw, 24px);
    scroll-padding-inline: 24px;
    scrollbar-width: none;
    /* faded edges hint that the row scrolls sideways */
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%);
  }

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

  .demo-nav__list li {
    flex: none;
  }

  .demo-nav__link {
    gap: 8px;
    padding: 6px 10px 12px;
    border: 0;
    border-radius: 10px 10px 0 0;
  }

  .demo-nav__link[aria-current="page"] {
    background: none;
    box-shadow: none;
  }

  .demo-nav__link[aria-current="page"]::before {
    top: auto;
    bottom: 0;
    inset-inline: 8px;
    width: auto;
    height: 3px;
    border-radius: 3px 3px 0 0;
  }

  .demo-nav__icon {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .demo-nav__icon .icon {
    width: 16px;
    height: 16px;
  }

  .demo-nav__title {
    font-size: 0.88rem;
    white-space: nowrap;
  }
}

@media (max-width: 900px) {
  .demo-top__back {
    display: none;
  }

  .demo-sys {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .demo-sys__link {
    grid-column: 2;
    justify-self: start;
    margin-top: 0;
  }

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

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

/* phones: the console becomes a bottom sheet, the top bar tightens */
@media (max-width: 720px) {
  .demo-tbtn__label:not(.demo-tbtn__label--keep) {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .demo-tbtn {
    padding: 0 10px;
  }

  .demo-console {
    height: min(76vh, 640px);
    border-radius: 20px 20px 0 0;
    border: 1px solid var(--line);
    border-bottom: 0;
    box-shadow: 0 -24px 60px -20px rgba(10, 17, 40, 0.5);
  }

  .demo-console.is-tall {
    height: calc(100dvh - var(--demo-top-h));
  }

  .demo-console__head {
    padding-top: 16px;
  }

  /* a grab-handle look for the sheet */
  .demo-console__head::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    width: 40px;
    height: 4px;
    margin-left: -20px;
    border-radius: 4px;
    background: var(--line);
  }

  .demo-console__sub {
    display: none;
  }

  .demo-log > details > summary {
    grid-template-columns: 56px minmax(0, 1fr) auto 14px;
    gap: 8px;
  }

  .demo-log__ms,
  .demo-log__time {
    display: none;
  }

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

  .demo-toasts {
    top: calc(var(--demo-top-h) + 10px);
    bottom: auto;
    inset-inline: 16px;
    width: auto;
  }

  .d-kpi__num {
    font-size: 1.4rem;
  }

  .d-card {
    padding: 16px;
  }
}

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

  .demo-top__sep {
    display: none;
  }

  .demo-sys {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .demo-sys__icon {
    display: none;
  }

  .demo-sys__link {
    grid-column: 1;
  }

  .d-bar {
    grid-template-columns: minmax(64px, 6.5rem) minmax(0, 1fr) auto;
  }

  .d-step__label {
    display: none;
  }

  .d-step.is-current .d-step__label,
  .d-step[aria-current="step"] .d-step__label {
    display: inline;
  }

  .d-dl {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .d-dl dd {
    margin-bottom: 8px;
  }
}

/* the narrowest phones: "דמו חי" steps aside for the fictional-data pill */
@media (max-width: 440px) {
  .demo-top__title {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .demo-top__inner {
    column-gap: 6px;
  }

  .demo-pill {
    padding: 3px 9px;
    font-size: 0.74rem;
  }

  .demo-pill .icon,
  .demo-tbtn__label--keep {
    display: none;
  }

  .demo-tbtn {
    min-height: 38px;
    padding: 0 8px;
    gap: 6px;
  }

  .demo-top__theme {
    width: 38px;
    height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .d-skeleton,
  .demo-top__live::after {
    animation: none;
  }
}

html.a11y-nomotion .d-skeleton {
  background: var(--surface-2);
}

html.a11y-contrast .demo-top__live::after,
html.a11y-contrast .demo-console,
html.a11y-contrast .d-toast {
  box-shadow: none;
}

html.a11y-contrast .d-card,
html.a11y-contrast .d-kpi,
html.a11y-contrast .demo-console,
html.a11y-contrast .d-modal,
html.a11y-contrast .d-toast {
  border-width: 2px;
}

/* ==========================================================================
   Hub additions: home, access gate, guided tries, loading, palette,
   shortcuts, console filters, view transitions, mobile polish
   ========================================================================== */

/* ---------- safe areas (viewport-fit=cover) ---------- */

.demo-top {
  padding-top: env(safe-area-inset-top);
}

.demo-top__inner {
  padding-inline: max(clamp(12px, 2.2vw, 24px), env(safe-area-inset-left), env(safe-area-inset-right));
}

.demo-console__body {
  padding-bottom: env(safe-area-inset-bottom);
}

/* ---------- keyboard keys ---------- */

.demo-kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  line-height: 1.5;
  text-align: center;
  white-space: nowrap;
  direction: ltr;
  unicode-bidi: isolate;
}

/* ---------- top bar additions ---------- */

.demo-tbtn__kbd {
  margin-inline-start: 2px;
}

.demo-top__current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--ink-2);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  animation: demo-fade-in 0.2s ease;
}

.demo-top__current .icon {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

@keyframes demo-fade-in {
  from {
    opacity: 0;
  }
}

/* outside the top bar in the markup, so it also opens in app mode, where the bar is hidden;
   it sits under whichever bar is showing (--demo-bar-h is the app-mode bar, see the end of the file) */
.demo-keys {
  position: fixed;
  top: calc(var(--demo-top-h) + var(--demo-bar-h, 0px) + 6px);
  inset-inline-end: clamp(12px, 2.2vw, 24px);
  z-index: 61;
  width: min(380px, calc(100vw - 32px));
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: d-modal-in 0.18s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.demo-keys__title {
  margin: 0 0 10px;
  font-size: 0.98rem;
}

.demo-keys__title:focus {
  outline: none;
}

.demo-keys__list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.demo-keys__list > div {
  display: grid;
  gap: 3px;
}

.demo-keys__list dt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}

.demo-keys__list dd {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.84rem;
}

.demo-keys__or {
  color: var(--muted);
  font-size: 0.78rem;
}

.demo-nav__keys {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

/* ---------- switcher: home item, locks, placeholders ---------- */

.demo-nav__ghost {
  height: 54px;
  border-radius: 12px;
  background: var(--surface-2);
  opacity: 0.6;
}

.demo-nav__link--home .demo-nav__icon {
  background: var(--brand-soft);
  color: var(--brand);
}

.demo-nav__link--home[aria-current="page"]::before {
  background: var(--brand);
}

.demo-nav__lock {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  margin-inline-start: auto;
  border-radius: 8px;
  background: var(--d-warn-soft);
  color: var(--d-warn);
}

.demo-nav__lock .icon {
  width: 13px;
  height: 13px;
}

/* ---------- home ---------- */

.demo-home {
  display: grid;
  gap: 22px;
}

.demo-home__hero {
  position: relative;
  overflow: hidden;
  padding: clamp(22px, 4vw, 40px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--visual-bg);
}

.demo-home__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  padding: 5px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.84rem;
  font-weight: 600;
}

.demo-home__title {
  max-width: 22ch;
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 3.4vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.demo-home__title:focus {
  outline: none;
}

.demo-home__title:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
}

.demo-home__lead {
  max-width: 68ch;
  margin: 0 0 18px;
  color: var(--ink-2);
  font-size: 1.02rem;
  line-height: 1.7;
}

.demo-home__facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-2);
  font-size: 0.86rem;
  font-weight: 500;
}

.demo-home__facts li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.demo-home__facts .icon {
  width: 17px;
  height: 17px;
  color: var(--brand);
}

.demo-home__note {
  flex-wrap: wrap;
  align-items: center;
}

.demo-home__note > p {
  flex: 1 1 280px;
}

.demo-home__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.demo-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.22s ease, border-color 0.22s ease;
}

.demo-card:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 18px 40px -24px var(--accent), var(--shadow-sm);
  transform: translateY(-3px);
}

.demo-card:focus-within {
  border-color: var(--accent);
}

.demo-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.demo-card__icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 62%, var(--brand-2)));
  color: var(--accent-on);
  box-shadow: 0 12px 24px -14px var(--accent);
}

.demo-card__icon .icon {
  width: 23px;
  height: 23px;
}

.demo-card__badge-ghost {
  width: 92px;
  height: 22px;
  border-radius: 999px;
}

.demo-card__org {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.demo-card__title {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.3;
}

.demo-card__blurb {
  flex: 1;
  margin: 0;
  color: var(--ink-2);
  font-size: 0.9rem;
  line-height: 1.6;
}

.demo-card__stack {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 4px 0 6px;
  padding: 0;
  list-style: none;
}

.demo-card__stack li {
  padding: 1px 8px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.7;
  direction: ltr;
  unicode-bidi: isolate;
}

.demo-card__open {
  align-self: flex-start;
}

.demo-card__open .icon {
  transition: transform 0.2s ease;
}

.demo-card:hover .demo-card__open .icon {
  transform: translateX(-3px);
}

/* ---------- "מה כדאי לנסות כאן" ---------- */

.demo-tries {
  margin-bottom: 20px;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 70%, var(--surface)), var(--surface));
}

.demo-tries__heading {
  margin: 0;
  font-size: 1rem;
}

.demo-tries__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: start;
  cursor: pointer;
}

.demo-tries__toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.demo-tries__icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
}

.demo-tries__icon .icon {
  width: 17px;
  height: 17px;
}

.demo-tries__count {
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 500;
  direction: ltr;
}

.demo-tries.is-complete .demo-tries__count {
  background: var(--d-ok-soft);
  color: var(--d-ok);
  border-color: transparent;
}

.demo-tries__chev {
  margin-inline-start: auto;
  width: 18px;
  height: 18px;
  color: var(--ink-2);
  transition: transform 0.2s ease;
}

.demo-tries.is-open .demo-tries__chev {
  transform: rotate(180deg);
}

.demo-tries__body {
  padding: 0 16px 14px;
}

.demo-tries__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 8px 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.demo-tries__item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 4px 10px;
  color: var(--ink-2);
  font-size: 0.88rem;
  line-height: 1.55;
}

.demo-tries__item input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.demo-tries__item label {
  cursor: pointer;
}

.demo-tries__item input:checked + label {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent);
}

.demo-tries__go {
  grid-column: 2;
  justify-self: start;
}

/* the reminder that a reload starts over: small, under the list */
.demo-tries__note {
  margin: 12px 0 0;
  color: var(--ink-2);
  font-size: 0.8rem;
  line-height: 1.5;
}

/* ---------- loading and load errors ---------- */

.demo-load {
  display: grid;
  gap: 14px;
}

.demo-load__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink-2);
  font-size: 0.88rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.demo-load__label.is-shown {
  opacity: 1;
}

.demo-load__kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 12px;
}

.demo-load__bar {
  height: 40px;
  border-radius: 11px;
}

.demo-load__table {
  height: 320px;
}

.demo-load-error__actions {
  justify-content: center;
  margin-top: 8px;
}

/* ---------- the gate ---------- */

.demo-gate {
  display: grid;
  gap: 18px;
  max-width: 820px;
  padding: clamp(18px, 3vw, 30px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.demo-gate__intro {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.demo-gate__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: var(--d-warn-soft);
  color: var(--d-warn);
}

.demo-gate__icon .icon {
  width: 26px;
  height: 26px;
}

.demo-gate__title {
  margin: 2px 0 6px;
  font-size: 1.25rem;
}

.demo-gate__text {
  max-width: 62ch;
  margin: 0;
  color: var(--ink-2);
}

.demo-gate .d-tabpanel {
  padding-top: 16px;
}

.demo-gate__form {
  display: grid;
  gap: 14px;
  max-width: 420px;
}

.demo-gate__pw-wrap {
  position: relative;
}

.demo-gate__pw-wrap .d-input {
  padding-inline-end: 46px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.demo-gate__eye {
  position: absolute;
  top: 50%;
  left: 4px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-top: -17px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}

.demo-gate__eye:hover,
.demo-gate__eye[aria-pressed="true"] {
  background: var(--surface-2);
  color: var(--ink);
}

.demo-gate__eye:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 0;
}

.demo-gate__eye .icon {
  width: 18px;
  height: 18px;
}

.demo-gate__actions {
  gap: 10px 18px;
}

.demo-req {
  display: grid;
  gap: 14px;
}

.demo-req__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.demo-req__demos {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.demo-req__demos legend {
  padding: 0 4px;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 600;
}

.demo-req__demo-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.demo-req__check {
  align-items: flex-start;
}

.demo-req__check input {
  margin-top: 3px;
}

.demo-req__consent {
  display: grid;
  gap: 6px;
}

.demo-req__consent a,
.demo-req__note a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.demo-req__note {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.demo-req__error:focus {
  outline: 2px solid var(--d-danger);
  outline-offset: 2px;
}

.demo-req__done {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 8px 0;
}

.demo-req__done p {
  max-width: 60ch;
  margin: 0;
}

.demo-req__done-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--d-ok-soft);
  color: var(--d-ok);
  animation: demo-pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.demo-req__done-icon .icon {
  width: 26px;
  height: 26px;
  stroke-width: 2.6;
}

.demo-req__done-title {
  margin: 0;
  font-size: 1.15rem;
}

.demo-req__done-title:focus {
  outline: none;
}

@keyframes demo-pop {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
}

/* ---------- command palette ---------- */

.demo-cmdk {
  width: min(640px, calc(100vw - 24px));
  max-width: none;
  max-height: min(70vh, 560px);
  margin: 12vh auto auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.demo-cmdk[open] {
  display: flex;
  animation: d-modal-in 0.18s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.demo-cmdk::backdrop {
  background: var(--d-overlay);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.demo-cmdk__box {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
}

.demo-cmdk__search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.demo-cmdk__search > .icon {
  color: var(--muted);
}

.demo-cmdk__input {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1.02rem;
}

.demo-cmdk__input:focus {
  outline: none;
}

.demo-cmdk__search:focus-within {
  box-shadow: inset 0 -2px 0 var(--brand);
}

.demo-cmdk__input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.demo-cmdk__list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 6px;
}

.demo-cmdk__group-label {
  padding: 8px 10px 4px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
}

.demo-cmdk__opt {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 6px 10px;
  border-radius: 10px;
  color: var(--ink-2);
  cursor: pointer;
}

.demo-cmdk__opt[aria-selected="true"] {
  background: var(--brand-soft);
  color: var(--ink);
  box-shadow: inset 3px 0 0 var(--brand);
}

.demo-cmdk__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink-2);
}

.demo-cmdk__opt[aria-selected="true"] .demo-cmdk__icon {
  background: var(--surface);
  color: var(--brand);
}

.demo-cmdk__icon .icon {
  width: 16px;
  height: 16px;
}

.demo-cmdk__label {
  font-weight: 600;
  white-space: nowrap;
}

.demo-cmdk__hint {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-cmdk__opt .demo-kbd {
  margin-inline-start: auto;
}

.demo-cmdk__empty {
  margin: 0;
  padding: 24px 16px;
  color: var(--muted);
  text-align: center;
}

.demo-cmdk__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0;
  padding: 9px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.76rem;
}

/* ---------- API console additions ---------- */

.demo-console__filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px clamp(12px, 2.2vw, 24px);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.demo-console__search {
  width: 180px;
  min-height: 34px;
  font-family: var(--mono);
}

.demo-console__stats {
  margin: 0 auto 0 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.demo-log__timing {
  display: grid;
  gap: 3px;
  min-width: 60px;
}

.demo-log__timing .demo-log__ms {
  min-width: 0;
}

.demo-log__bar {
  display: block;
  height: 3px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}

.demo-log__bar-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 3px;
  background: var(--d-ok);
  transition: width 0.3s ease;
}

.demo-log.is-warn .demo-log__bar-fill {
  background: var(--d-warn);
}

.demo-log.is-error .demo-log__bar-fill {
  background: var(--d-danger);
}

.demo-log.is-external .demo-log__bar-fill {
  background: var(--d-violet);
}

.demo-log__tools {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

/* ---------- toasts: the time left ---------- */

.d-toast {
  position: relative;
  overflow: hidden;
}

.d-toast__timer {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 2px;
  background: currentColor;
  opacity: 0.25;
  transform-origin: right;
  animation: d-toast-timer linear forwards;
}

.d-toast--ok .d-toast__timer {
  color: var(--d-ok);
}

.d-toast--warn .d-toast__timer {
  color: var(--d-warn);
}

.d-toast--error .d-toast__timer {
  color: var(--d-danger);
}

.d-toast--info .d-toast__timer {
  color: var(--d-info);
}

.d-toast.is-paused .d-toast__timer {
  animation-play-state: paused;
}

@keyframes d-toast-timer {
  to {
    transform: scaleX(0);
  }
}

/* ---------- view transitions between systems ---------- */

.demo-main {
  view-transition-name: demo-main;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}

::view-transition-old(demo-main) {
  animation: demo-vt-out 0.16s ease both;
}

::view-transition-new(demo-main) {
  animation: demo-vt-in 0.26s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes demo-vt-out {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@keyframes demo-vt-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* the theme switch cross-fades the whole page */
.demo-theme-switch::view-transition-old(root),
.demo-theme-switch::view-transition-new(root) {
  animation: demo-fade 0.25s ease both;
}

.demo-theme-switch::view-transition-old(root) {
  animation-direction: reverse;
}

.demo-theme-switch::view-transition-old(demo-main),
.demo-theme-switch::view-transition-new(demo-main) {
  animation: none;
}

@keyframes demo-fade {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }

  .demo-card:hover {
    transform: none;
  }
}

html.a11y-nomotion .demo-card:hover {
  transform: none;
}

/* ---------- responsive ---------- */

@media (max-width: 1079px) {
  .demo-nav__list {
    scroll-snap-type: x proximity;
  }

  .demo-nav__list li {
    scroll-snap-align: start;
  }

  .demo-nav__ghost {
    width: 130px;
    height: 44px;
  }

  .demo-nav__lock {
    width: 20px;
    height: 20px;
  }

  .demo-top__current {
    display: none;
  }
}

@media (max-width: 1180px) {
  .demo-tbtn__kbd {
    display: none;
  }
}

@media (max-width: 720px) {
  .demo-tbtn--keys {
    display: none;
  }

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

  .demo-console__search {
    flex: 1 1 120px;
    width: auto;
  }

  .demo-console__stats {
    display: none;
  }

  .demo-log__timing {
    display: none;
  }

  .demo-toasts {
    top: calc(var(--demo-top-h) + 10px + env(safe-area-inset-top));
  }

  .demo-cmdk {
    margin-top: 10px;
    max-height: calc(100dvh - 20px);
  }

  .demo-gate__intro {
    flex-direction: column;
    gap: 10px;
  }

  .demo-gate__icon {
    width: 44px;
    height: 44px;
  }

  .demo-home__kbd {
    display: none !important;
  }
}

@media (max-width: 440px) {
  .demo-top__home {
    display: none;
  }
}

html.a11y-contrast .demo-card,
html.a11y-contrast .demo-gate,
html.a11y-contrast .demo-cmdk,
html.a11y-contrast .demo-tries {
  border-width: 2px;
  box-shadow: none;
}

html.a11y-contrast .demo-home__hero,
html.a11y-contrast .demo-tries {
  background: var(--surface);
}

.demo-cmdk__opt[aria-selected="true"] .demo-cmdk__hint {
  color: var(--ink-2);
}

/* ==========================================================================
   Copy deterrents (see core.js): watermark, no selection outside fields,
   print notice. Deterrents only; the disclaimer says so honestly.
   ========================================================================== */

.demo-main {
  position: relative;
}

/* The watermark: a layer fixed over the window (under the hub's top bar, which is 0 in app
   mode) and one inside each system dialog. core.js draws each as an SVG the size of the layer,
   with stamps sized to the screen, not the page, so zooming doesn't shrink or blow them up.
   Two masks of the same stamps: the ink (--ink) shows on the theme's own surfaces, and a
   halo in the surface color shows on the others (dark buttons and headers in the light
   theme, light spots in the dark one). Until core.js draws, the masks are empty. */
.demo-wm {
  --wm-ink: linear-gradient(transparent, transparent);
  --wm-halo: linear-gradient(transparent, transparent);
  position: fixed;
  inset: var(--demo-top-h, 0px) 0 0;
  /* over every layer of the systems (the highest, Izaki's full-screen map, is 60), under the
     demo pill (65) and the toasts (70) */
  z-index: 64;
  pointer-events: none;
  user-select: none;
  view-transition-name: demo-wm;
}

.demo-wm::before,
.demo-wm::after {
  content: "";
  position: absolute;
  inset: 0;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
}

.demo-wm::before {
  background-color: var(--surface);
  opacity: 0.11;
  -webkit-mask-image: var(--wm-halo);
  mask-image: var(--wm-halo);
}

.demo-wm::after {
  background-color: var(--ink);
  opacity: 0.08;
  -webkit-mask-image: var(--wm-ink);
  mask-image: var(--wm-ink);
}

/* a dialog sits in the top layer, above the window's layer: it carries its own */
.demo-wm--local {
  position: absolute;
  inset: 0;
  z-index: 2147483000;
  view-transition-name: none;
}

/* the watermark stays put while a view transition changes the page under it */
::view-transition-old(demo-wm) {
  animation: none;
  opacity: 0;
}

::view-transition-new(demo-wm) {
  animation: none;
}

.demo-page {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.demo-page input,
.demo-page textarea,
.demo-page select,
.demo-page [contenteditable]:not([contenteditable="false"]) {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

.demo-page img,
.demo-page svg {
  -webkit-user-drag: none;
}

.demo-print-notice {
  display: none;
}

@media print {
  /* a print the demo didn't start (browser menu): only the notice */
  html:not(.lib-printing):not(.sch-print-doc):not(.d-printing):not(.demo-print-own) body > *:not(.demo-print-notice) {
    display: none !important;
  }

  html:not(.lib-printing):not(.sch-print-doc):not(.d-printing):not(.demo-print-own) .demo-print-notice {
    display: block;
    padding: 30mm 12mm;
    color: #000;
    background: #fff;
    text-align: center;
    font-size: 12pt;
  }

  .demo-print-notice__title {
    font-size: 18pt;
    font-weight: 700;
  }

  .demo-wm {
    display: none;
  }

  /* a module's own printable document carries the watermark text on every page */
  html.lib-printing .lib-report[data-demo-wm]::after,
  html.sch-print-doc .sch-print-root[data-demo-wm]::after {
    content: attr(data-demo-wm);
    position: fixed;
    inset-inline: 0;
    bottom: 2mm;
    text-align: center;
    font-size: 8pt;
    color: #666;
  }

  html.lib-printing .lib-report[data-demo-wm]::before,
  html.sch-print-doc .sch-print-root[data-demo-wm]::before {
    content: attr(data-demo-wm);
    position: fixed;
    top: 45%;
    inset-inline: 0;
    text-align: center;
    font-size: 40pt;
    font-weight: 700;
    color: rgba(0, 0, 0, 0.07);
    transform: rotate(-24deg);
    pointer-events: none;
  }
}

/* ==========================================================================
   App mode: an open system fills the window edge to edge, like the real app.
   The hub's top bar, switcher, system header and disclaimer step aside; the
   corner pill (.demo-dock) keeps the "demo, fictional data" label and every
   hub control one click away. The watermark covers the whole window here.
   ========================================================================== */

.demo-app-mode {
  --demo-top-h: 0px;
}

.demo-app-mode .demo-top,
.demo-app-mode .demo-nav,
.demo-app-mode .demo-disclaimer,
.demo-app-mode .demo-foot {
  display: none;
}

.demo-app-mode .demo-app {
  display: block;
  max-width: none;
}

.demo-app-mode .demo-main {
  padding: 0;
}

/* the system's name stays the page's h1 for screen readers and focus, off screen */
.demo-app-mode .demo-sys {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.demo-app-mode .demo-sys > :not(.demo-sys__main),
.demo-app-mode .demo-sys__main > :not(.demo-sys__title) {
  display: none;
}

/* hub-owned screens inside the view (gate, loading, errors) keep a comfortable frame */
.demo-app-mode .demo-gate,
.demo-app-mode .demo-load,
.demo-app-mode .demo-load-error,
.demo-app-mode .demo-view > .d-empty {
  width: min(820px, calc(100% - 32px));
  margin: clamp(24px, 8vh, 96px) auto;
}

.demo-sys__appmode {
  flex: none;
}

.demo-tries__close {
  display: none;
}

/* "what to try" folds away; the pill's button floats it over the system */
.demo-app-mode .demo-tries {
  display: none;
}

.demo-app-mode.demo-tries-pop .demo-tries:not([hidden]) {
  position: fixed;
  bottom: calc(var(--demo-dock) + 136px);
  inset-inline-start: 20px;
  z-index: 66;
  display: block;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - var(--demo-dock) - 160px);
  max-height: calc(100dvh - var(--demo-dock) - 160px);
  margin: 0;
  overflow-y: auto;
  background: var(--surface);
  box-shadow: 0 24px 60px -20px rgba(10, 17, 40, 0.45);
}

.demo-app-mode.demo-tries-pop .demo-tries__close {
  display: grid;
  float: left;
  margin: 8px 8px 0 0;
}

/* ---------- the corner pill ---------- */

.demo-dock {
  position: fixed;
  bottom: calc(var(--demo-dock) + 88px);
  inset-inline-start: 20px;
  z-index: 65;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  max-width: calc(100vw - 40px);
}

.demo-dock__bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 10px 28px -12px rgba(10, 17, 40, 0.45);
}

.demo-dock__tag {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 10px 0 8px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink-2);
}

.demo-dock__toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--surface);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.demo-dock__toggle:hover,
.demo-dock__toggle[aria-expanded="true"] {
  background: var(--ink-2);
}

.demo-dock__panel {
  width: min(320px, calc(100vw - 40px));
  max-height: calc(100vh - var(--demo-dock) - 150px);
  max-height: calc(100dvh - var(--demo-dock) - 150px);
  overflow-y: auto;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 60px -20px rgba(10, 17, 40, 0.5);
}

.demo-dock__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 6px;
}

.demo-dock__title {
  margin: 0;
  font-size: 0.95rem;
}

.demo-dock__title:focus {
  outline: none;
}

.demo-dock__title:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.demo-dock__systems,
.demo-dock__actions {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.demo-dock__systems {
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.demo-dock__sys,
.demo-dock__btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 6px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}

/* the one way from the demo to a conversation (the site's contact form, topic preselected) */
.demo-dock__btn--cta {
  color: var(--brand);
  font-weight: 600;
}

.demo-dock__sys:hover,
.demo-dock__btn:hover {
  background: var(--d-hover);
}

.demo-dock__sys[aria-current="page"] {
  background: var(--brand-soft);
  font-weight: 700;
}

.demo-dock__sys-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--d-hover);
  color: var(--brand);
}

.demo-dock__sys .demo-nav__lock {
  margin-inline-start: auto;
}

.demo-dock__btn .icon {
  flex: none;
  color: var(--ink-2);
}

.demo-dock__note {
  margin: 8px 4px 2px;
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.demo-dock__note a {
  color: inherit;
}

@media (max-width: 560px) {
  .demo-dock {
    bottom: calc(var(--demo-dock) + 84px);
    inset-inline-start: 16px;
  }

  .demo-app-mode.demo-tries-pop .demo-tries:not([hidden]) {
    inset-inline-start: 16px;
    bottom: calc(var(--demo-dock) + 130px);
  }
}

@media print {
  .demo-dock {
    display: none !important;
  }
}

/* ==========================================================================
   Admin ("כניסת מנהל"): a discreet button in the top bar and the dock, and the
   side sheet it opens. The sheet's content is styled by demo-admin.css, which
   core.js loads with it.
   ========================================================================== */

.demo-tbtn--admin {
  width: 40px;
  padding: 0;
  justify-content: center;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.demo-tbtn--admin:hover {
  color: var(--brand);
  border-color: var(--line);
}

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

.demo-admin {
  width: min(760px, 100vw);
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  margin-inline-start: auto;
  padding: 0;
  border: 0;
  border-inline-start: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.demo-admin[open] {
  display: flex;
  flex-direction: column;
  animation: demo-admin-in 0.24s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.demo-admin::backdrop {
  background: var(--d-overlay);
}

@keyframes demo-admin-in {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .demo-admin[open] {
    animation: none;
  }
}

html.a11y-nomotion .demo-admin[open] {
  animation: none;
}

.demo-admin__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.demo-admin__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 1.05rem;
}

.demo-admin__title .icon {
  width: 20px;
  height: 20px;
  color: var(--brand);
}

.demo-admin__tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.demo-admin__body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.demo-admin__msg {
  display: grid;
  gap: 12px;
  justify-items: start;
}

/* ==========================================================================
   Calm layer: one accent (the site's --brand), quiet surfaces, fewer lines.
   Kept last so it refines the shell above without touching the module kit.
   ========================================================================== */

/* top bar: borderless ghost buttons, like the site header */
.demo-top {
  border-bottom-color: transparent;
  box-shadow: 0 1px 0 var(--line);
}

.demo-tbtn {
  min-height: 38px;
  padding: 0 10px;
  border-color: transparent;
  background: transparent;
  border-radius: var(--radius-sm);
}

.demo-tbtn:hover,
.demo-tbtn[aria-expanded="true"] {
  border-color: transparent;
  background: var(--brand-soft);
  color: var(--brand);
}

.demo-top__back {
  border-color: var(--line);
}

.demo-top__actions {
  gap: 2px;
}

.demo-pill {
  border-color: transparent;
}

/* the disclaimer: a quiet line, not an alert */
.demo-disclaimer {
  padding: 8px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.84rem;
}

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

/* the sidebar help: plain text, no box */
.demo-nav__help {
  margin-top: 18px;
  padding: 16px 6px 0;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.demo-nav__icon {
  background: var(--surface-2);
  color: var(--ink-2);
}

.demo-nav__link[aria-current="page"] .demo-nav__icon {
  background: var(--brand-soft);
  color: var(--brand);
}

/* ---------- home ---------- */

.demo-home {
  gap: 28px;
}

.demo-home__hero {
  padding: clamp(8px, 2vw, 24px) 0 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.demo-home__eyebrow {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-size: 0.86rem;
}

.demo-home__title {
  margin-bottom: 14px;
  font-size: clamp(1.8rem, 3.6vw, 2.75rem);
  letter-spacing: -0.02em;
}

.demo-home__lead {
  max-width: 60ch;
  margin-bottom: 14px;
  font-size: 1.05rem;
}

.demo-home__hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.demo-home__hint .icon {
  width: 16px;
  height: 16px;
}

.demo-home__note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.9rem;
}

.demo-home__note > .icon {
  flex: none;
  color: var(--brand);
}

.demo-home__note > p {
  flex: 1 1 260px;
  margin: 0;
}

.demo-home__grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 20px;
}

/* one accent for every card; the systems keep their colors inside the app */
.demo-card {
  --accent: var(--brand);
  gap: 6px;
  padding: 0 0 20px;
  overflow: hidden;
  border-radius: var(--radius-lg);
  box-shadow: none;
}

.demo-card > :not(.demo-card__shot) {
  margin-inline: 20px;
}

.demo-card:hover {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
  box-shadow: var(--shadow-md);
}

.demo-card__shot {
  aspect-ratio: 16 / 9;
  margin-bottom: 10px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.demo-card__shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.demo-card:hover .demo-card__shot img {
  transform: scale(1.03);
}

.demo-card__top {
  margin-bottom: 2px;
}

.demo-card__icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: none;
}

.demo-card__icon .icon {
  width: 18px;
  height: 18px;
}

.demo-card__title {
  font-size: 1.15rem;
}

.demo-card__stack {
  margin: 6px 20px 8px;
}

.demo-card__stack li {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
}

.demo-card__open {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--brand);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.demo-card__open:hover {
  color: var(--brand-strong);
}

.demo-card__open:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

/* ---------- gate and consent: one centered, quiet card ---------- */

.demo-gate,
.demo-consent {
  width: min(560px, calc(100% - 32px));
  box-sizing: border-box;
  margin: clamp(12px, 6vh, 64px) auto;
  padding: clamp(22px, 4vw, 36px);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.demo-gate__intro {
  flex-direction: column;
  gap: 12px;
}

.demo-gate__icon,
.demo-consent__icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand);
}

.demo-gate__icon .icon,
.demo-consent__icon .icon {
  width: 22px;
  height: 22px;
}

.demo-consent {
  display: grid;
  gap: 14px;
}

/* which system the visitor is about to open */
.demo-consent__sys {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 0.86rem;
  font-weight: 600;
}

.demo-consent__title {
  margin: 0;
  font-size: 1.35rem;
}

.demo-consent__title:focus {
  outline: none;
}

.demo-consent__list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-inline-start: 1.1em;
  color: var(--ink-2);
  line-height: 1.65;
}

.demo-consent__links {
  margin: 0;
  font-size: 0.9rem;
}

.demo-consent__links a {
  color: var(--brand);
}

.demo-consent__form {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.demo-consent__form .d-field__error:empty {
  display: none;
}

.demo-app-mode .demo-consent {
  margin-top: clamp(24px, 10vh, 96px);
}

/* ---------- dock: a single quiet pill ---------- */

.demo-dock__bar {
  padding: 4px;
  box-shadow: var(--shadow-md);
}

.demo-dock__toggle {
  min-height: 36px;
  background: var(--brand);
  color: #fff;
}

.demo-dock__toggle:hover,
.demo-dock__toggle[aria-expanded="true"] {
  background: var(--brand-strong);
}

.demo-dock__panel {
  padding: 8px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.demo-dock__head {
  padding: 6px 8px 8px;
}

.demo-dock__sys-icon {
  background: transparent;
  color: var(--ink-2);
}

.demo-dock__sys[aria-current="page"] .demo-dock__sys-icon {
  color: var(--brand);
}

.demo-dock__note {
  margin: 8px 0 0;
  padding: 10px 8px 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

/* ---------- popovers, palette, console, toasts: the site's radii ---------- */

.demo-keys {
  border-radius: var(--radius);
}

@media (prefers-reduced-motion: reduce) {
  .demo-card__shot img {
    transition: none;
  }

  .demo-card:hover .demo-card__shot img {
    transform: none;
  }
}

html.a11y-nomotion .demo-card__shot img {
  transition: none;
  transform: none !important;
}

/* ==========================================================================
   Simplified shell: one slim top bar (brand, title, switcher, back link),
   one corner "דמו" menu for every secondary tool, and a quiet hub of five
   cards. These rules sit last so they win over the older, busier shell.
   ========================================================================== */

:root {
  --demo-top-h: 56px;
  --demo-gap: 24px;
}

.demo-top {
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}

.demo-top::before,
.demo-top::after {
  display: none;
}

.demo-top__inner {
  gap: 12px;
  min-height: 56px;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--demo-gap);
}

.demo-top__live {
  display: none;
}

.demo-top__name {
  font-size: 0.95rem;
  font-weight: 600;
}

.demo-top__actions {
  margin-inline-start: auto;
}

.demo-top__back {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.88rem;
}

.demo-top__back:hover {
  color: var(--ink);
  background: var(--d-hover);
}

/* the switcher: a single row of quiet text links under the top bar */
.demo-app {
  display: block;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--demo-gap);
}

.demo-nav {
  position: static;
  max-height: none;
  overflow: visible;
  padding: 0;
  border: 0;
  background: none;
}

.demo-nav__list {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  margin: 0;
  padding: 12px 0 0;
  overflow-x: auto;
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
}

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

.demo-nav__list li {
  flex: none;
}

.demo-nav__link {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  background: none;
  box-shadow: none;
  color: var(--ink-2);
  font-size: 0.88rem;
  white-space: nowrap;
}

.demo-nav__link:hover {
  background: none;
  color: var(--ink);
}

.demo-nav__link[aria-current="page"] {
  background: none;
  box-shadow: none;
  color: var(--ink);
  font-weight: 600;
  border-bottom-color: var(--brand);
}

.demo-nav__link[aria-current="page"]::before,
.demo-nav__icon,
.demo-nav__org,
.demo-nav__ghost {
  display: none;
}

/* until core.js draws the tabs, the first placeholder keeps the row a tab high (the tabs' min-height),
   so the hub under it isn't pushed down when they arrive (the rest of the hub's layout shift) */
html.js .demo-nav__ghost:first-child {
  display: block;
  width: 0;
  height: 40px;
  visibility: hidden;
}

.demo-nav__title {
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
}

.demo-main {
  padding: 0;
}

/* ---------- the hub ---------- */

.demo-home {
  padding-block: 48px 64px;
}

.demo-home__hero {
  margin: 0 0 32px;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  text-align: start;
}

.demo-home__hero::before,
.demo-home__hero::after {
  display: none;
}

.demo-home__title {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.1rem);
  letter-spacing: -0.01em;
}

.demo-home__lead {
  margin: 0;
  max-width: 60ch;
  font-size: 1rem;
  color: var(--ink-2);
}

.demo-home__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.demo-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 0 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.demo-card::before,
.demo-card::after {
  display: none;
}

.demo-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: none;
}

.demo-card:focus-within {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.demo-card__shot {
  margin: 0 0 12px;
  aspect-ratio: 16 / 10;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--d-hover);
}

.demo-card__title,
.demo-card__blurb {
  margin: 0;
  padding-inline: 20px;
}

.demo-card__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.02rem;
  font-weight: 600;
}

.demo-card__blurb {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--ink-2);
}

.demo-card__open {
  margin: 0;
  color: var(--ink);
  text-decoration: none;
  font-weight: inherit;
}

.demo-card__open:focus-visible {
  outline: none;
}

/* the one link stretches over the whole card */
.demo-card__open::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.demo-home__note {
  margin-bottom: 24px;
}

/* ---------- consent ---------- */

.demo-consent {
  max-width: 480px;
  padding: 28px;
  border-radius: 14px;
  box-shadow: none;
}

.demo-consent__title {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.demo-consent__text {
  margin: 0 0 20px;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--ink-2);
}

.demo-consent__text a {
  color: var(--ink);
}

.demo-consent__form .d-btn--primary {
  box-shadow: none;
  background: var(--brand);
}

/* ---------- footer ---------- */

.demo-foot {
  max-width: 1200px;
  margin-inline: auto;
  padding: 24px var(--demo-gap) 32px;
  border-top: 1px solid var(--line);
  background: none;
  font-size: 0.82rem;
}

.demo-foot__admin {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* ---------- the one demo menu ---------- */

.demo-dock {
  bottom: calc(var(--demo-dock) + 20px);
  inset-inline-start: auto;
  inset-inline-end: 20px;
  align-items: flex-end;
}

.demo-dock__bar {
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

.demo-dock__toggle {
  gap: 6px;
  min-height: 32px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: 0 6px 18px -10px rgba(10, 17, 40, 0.4);
}

.demo-dock__toggle:hover,
.demo-dock__toggle[aria-expanded="true"] {
  background: var(--d-hover);
}

.demo-dock__toggle:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.demo-dock__toggle .icon {
  color: var(--ink-2);
  transition: transform 0.15s ease;
}

.demo-dock__toggle[aria-expanded="true"] .icon {
  transform: rotate(180deg);
}

.demo-dock__sub {
  font-weight: 400;
  color: var(--ink-2);
}

.demo-dock__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--d-ok);
}

.demo-dock__panel {
  order: -1;
  width: min(280px, calc(100vw - 32px));
  padding: 6px;
  border-radius: 12px;
  box-shadow: 0 18px 40px -18px rgba(10, 17, 40, 0.45);
}

.demo-dock__head {
  padding: 4px 6px 4px 4px;
}

.demo-dock__title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-2);
}

.demo-dock__sys,
.demo-dock__btn {
  min-height: 34px;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 0.86rem;
}

.demo-dock__sys-icon {
  width: auto;
  height: auto;
  background: none;
  color: var(--ink-2);
}

.demo-dock__sys[aria-current="page"] {
  background: var(--d-hover);
  font-weight: 600;
}

.demo-dock__sys[aria-current="page"] .demo-dock__sys-icon {
  color: var(--brand);
}

.demo-dock__systems {
  padding-bottom: 6px;
  margin-bottom: 6px;
}

/* the switcher is already on screen outside a system, so the menu skips it there */
html:not(.demo-app-mode) .demo-dock__systems,
html:not(.demo-app-mode) [data-demo-dock-home] {
  display: none;
}

@media (max-width: 560px) {
  :root {
    --demo-gap: 16px;
  }

  .demo-dock {
    bottom: calc(var(--demo-dock) + 84px);
    inset-inline-end: 16px;
  }

  .demo-home {
    padding-block: 28px 40px;
  }

  .demo-consent {
    padding: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .demo-card,
  .demo-dock__toggle .icon {
    transition: none;
  }

  .demo-card:hover {
    transform: none;
  }
}

html.a11y-nomotion .demo-card:hover {
  transform: none;
}

/* phones keep the brand, the title and the way back: the bar has room now that the tools moved */
@media (max-width: 900px) {
  .demo-top__back {
    display: inline-flex;
  }
}

@media (max-width: 440px) {
  .demo-top__home {
    display: flex;
  }

  .demo-top__title {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
  }
}

/* ---------- the demo pill sits top-right; its menu opens downward ---------- */

.demo-dock,
.demo-app-mode.demo-tries-pop .demo-tries:not([hidden]) {
  /* the logical resets first: in RTL inset-inline-start is `right`, and set after it, it wiped the 20px */
  inset-inline-start: auto;
  inset-inline-end: auto;
  top: calc(var(--demo-top-h) + 12px);
  bottom: auto;
  right: 20px;
  left: auto;
}

.demo-dock {
  align-items: flex-start;
}

.demo-dock__panel {
  order: 2;
  max-height: calc(100vh - var(--demo-top-h) - 80px);
  max-height: calc(100dvh - var(--demo-top-h) - 80px);
}

.demo-app-mode.demo-tries-pop .demo-tries:not([hidden]) {
  top: calc(var(--demo-top-h) + 60px);
  max-height: calc(100dvh - var(--demo-top-h) - 80px);
}

@media (max-width: 560px) {
  .demo-dock,
  .demo-app-mode.demo-tries-pop .demo-tries:not([hidden]) {
    right: 16px;
    bottom: auto;
  }
}

/* ---------- the pill gets room of its own, so it never covers what's under it ---------- */

/* The hub: the pill has a row between the top bar and the systems' tabs, and scrolls away with
   the page, so the tabs, which stay pinned, never pass under it. */
html:not(.demo-app-mode) .demo-dock {
  position: absolute;
}

html:not(.demo-app-mode) .demo-nav {
  margin-top: 44px;
}

/* An open system: a slim bar across the top holds the pill (and, at the other end, the
   accessibility button), and the system starts under it. Before this, the pill sat on the
   systems' own headers: their logos, Project Pro's search, the appointments admin button. */
.demo-app-mode {
  --demo-bar-h: 56px;
}

.demo-app-mode .demo-main {
  padding-top: var(--demo-bar-h);
}

.demo-app-mode .demo-page::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  z-index: 59; /* over the system and its sticky header, under the pill (65) and the accessibility button (60) */
  height: var(--demo-bar-h);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

/* a system's sticky parts stick under the bar, not behind it */
.demo-app-mode .iz-top {
  top: var(--demo-bar-h);
}

.demo-app-mode .iz-tpage__side {
  top: calc(101px + var(--demo-bar-h));
}

/* the site's accessibility button moves into the bar, so it no longer covers a system's own
   bottom bars (Project Pro's tabs, Izaki's compare bar and round buttons); its menu opens downward */
html.demo-app-mode .a11y {
  top: 10px;
  bottom: auto;
  inset-inline-start: auto;
  inset-inline-end: 16px;
}

html.demo-app-mode .a11y__fab {
  width: 36px;
  height: 36px;
  border-width: 2px;
  box-shadow: none;
}

html.demo-app-mode .a11y__fab svg {
  width: 22px;
  height: 22px;
}

html.demo-app-mode .a11y__panel {
  top: 46px;
  bottom: auto;
  inset-inline-start: auto;
  inset-inline-end: 0;
}
