/* structam.sh hero demo (js/demos/changes.js): one host's changes.
   Recreates, light theme: the Review queue (web/src/pages/Changes.tsx,
   pages/inventory/ChangeList.tsx), the change event drawer (ChangeDetail.tsx,
   app.css .inv-change, .inv-ba, .inv-review), the host page's Configs tab
   (pages/host/Configs.tsx) and Changes tab with the chain verification
   (ChainVerify.tsx, app.css .inv-verify).
   Sizes are the product's px; every caption of 13px or less is written
   max(<px>, var(--sx-fmin, 0px)) so it never renders under 11px.
   Layout per tier: T1-T3 the queue table and the Configs tab's tree + file
   columns; T4 (< 800px) phone cards, the tree and secondary columns hidden,
   the drawer full width. Motion comes from js (painter styles), not CSS. */

.ch-demo .sx-wrap { --sx-h: 600px; }
@container sxapp (max-width: 799px) { .ch-demo .app { --sx-h: 560px; } }

/* Pages stack in the content area; the demo fades between them. */
.ch-demo .ch-layer { position: absolute; inset: 0; overflow: hidden; }
.ch-demo .ch-contents { display: contents; }
.ch-demo .ch-tgt { position: relative; display: inline-flex; vertical-align: middle; }
.ch-demo .ch-change { position: relative; }
.ch-demo .ch-r { text-align: right; }

/* The sidebar follows the page: Review queue, or Hosts on the host page. */
.ch-demo[data-pg="host"] .sx-nav > .sx-nav-a.is-active { background: none; color: var(--sx-ink-subtle); }
.ch-demo[data-pg="host"] .sx-nav > .sx-nav-a.is-active .sx-ic { color: inherit; }
.ch-demo[data-pg="host"] .sx-nav > :nth-child(3) { background: var(--sx-side-active); color: var(--sx-ink); }
.ch-demo[data-pg="host"] .sx-nav > :nth-child(3) .sx-ic { color: var(--sx-brand-text); }

/* ---------- Review queue (ChangeList: filters, bulk row, table) ---------- */
.ch-demo .ch-q { gap: 14px; }
.ch-demo .ch-filters { display: flex; flex-direction: column; gap: 10px; }
.ch-demo .ch-search { width: 340px; flex: 0 1 340px; }
.ch-demo .ch-lbl { display: inline-flex; align-items: center; gap: 8px; color: var(--sx-ink-muted); font-size: max(13px, var(--sx-fmin, 0px)); white-space: nowrap; }
.ch-demo .ch-lbl .sx-select { min-width: 140px; }
.ch-demo .ch-chips { gap: 6px; flex-wrap: nowrap; }
.ch-demo .ch-chip { padding: 0 10px; }
.ch-demo .ch-bulk { min-height: 28px; }
.ch-demo .ch-panel { overflow: hidden; }
.ch-demo .ch-new .sx-cell-title { color: var(--sx-ink); }

/* ---------- Change event drawer (ChangeDetail) ---------- */
.ch-demo .ch-drawer { width: min(760px, 100%); }
.ch-demo .ch-drawer .sx-drawer-body { display: block; padding: 0; }
.ch-demo .ch-dscroll { display: flex; flex-direction: column; gap: 16px; padding: 20px 24px 32px; will-change: transform; }
.ch-demo .ch-dbadges { gap: 8px; }
.ch-demo .ch-dtitle { font: 600 16px/22px var(--sx-sans); color: var(--sx-ink); overflow-wrap: anywhere; }
.ch-demo .ch-dtitle .sx-mono { font-weight: 500; }
.ch-demo .ch-dkv { align-items: center; }
/* Before and after, field by field (app.css .inv-ba): − / + glyphs, so never colour alone. */
.ch-demo .ch-ba { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.ch-demo .ch-ba-t { display: grid; grid-template-columns: 150px minmax(0, 1fr) minmax(0, 1fr); width: 100%; border: 1px solid var(--sx-line); border-radius: 6px; overflow: hidden; }
.ch-demo .ch-ba-r { display: contents; }
.ch-demo .ch-ba-r > span { padding: 7px 10px; border-top: 1px solid var(--sx-line); font-size: max(12px, var(--sx-fmin, 0px)); line-height: 18px; min-width: 0; overflow-wrap: anywhere; }
.ch-demo .ch-ba-r.is-head > span { border-top: 0; background: var(--sx-surface); color: var(--sx-ink-muted); font: 500 max(12px, var(--sx-fmin, 0px))/16px var(--sx-sans); letter-spacing: .04em; text-transform: uppercase; }
.ch-demo .ch-ba-v.is-del { background: var(--sx-diff-del); }
.ch-demo .ch-ba-v.is-add { background: var(--sx-diff-add); }
/* --sx-ink-muted, not -subtle: on the 12% diff tints -subtle is 3.9 to 4.1:1. */
.ch-demo .ch-ba-v > span:first-child, .ch-demo .ch-ba-v .sx-dim { color: var(--sx-ink-muted); }
/* Review form and comments (app.css .inv-review, .inv-comments) */
.ch-demo .ch-review, .ch-demo .ch-comments { display: flex; flex-direction: column; gap: 10px; padding-top: 12px; border-top: 1px solid var(--sx-line); }
.ch-demo .ch-flabel { font: 500 max(13px, var(--sx-fmin, 0px))/18px var(--sx-sans); color: var(--sx-ink-muted); }
.ch-demo .ch-textarea {
  display: block; min-height: 60px; padding: 8px 12px; border: 1px solid var(--sx-line-strong); border-radius: 6px;
  background: var(--sx-surface); color: var(--sx-ink); font: 400 14px/20px var(--sx-sans); white-space: pre-wrap;
}
.ch-demo .ch-textarea .sx-caret { vertical-align: -3px; }
.ch-demo .ch-empty { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border: 1px dashed var(--sx-line); border-radius: 8px; font-size: max(13px, var(--sx-fmin, 0px)); color: var(--sx-ink-subtle); }
.ch-demo .ch-empty b { color: var(--sx-ink-muted); font-weight: 600; }
.ch-demo .ch-chainsum { display: flex; align-items: center; gap: 4px; }

/* ---------- Host page ---------- */
.ch-demo .ch-host { gap: 14px; will-change: transform; }
.ch-demo .ch-hosthead { display: flex; flex-direction: column; gap: 8px; }
.ch-demo .ch-hbadges { gap: 6px; }
.ch-demo .ch-tabbody { min-height: 0; }

/* Configs tab: tree | file (host/Configs.tsx) */
.ch-demo .ch-cfg { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.ch-demo .ch-tree { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.ch-demo .ch-tree-q { width: 100%; }
.ch-demo .ch-tree-list { display: flex; flex-direction: column; gap: 1px; }
.ch-demo .ch-tree-r { display: flex; align-items: center; gap: 6px; height: 30px; padding-right: 8px; border-radius: 6px; color: var(--sx-ink-muted); font-size: max(13px, var(--sx-fmin, 0px)); }
.ch-demo .ch-tree-r .sx-ic { color: var(--sx-ink-subtle); }
.ch-demo .ch-tree-r .sx-badge { margin-left: auto; }
.ch-demo .ch-tree-r.is-sel { background: var(--sx-surface-overlay); color: var(--sx-ink); box-shadow: inset 3px 0 0 var(--sx-brand-text); }
.ch-demo .ch-file { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.ch-demo .ch-fpanel, .ch-demo .ch-dpanel { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px 16px; }
.ch-demo .ch-fhead { gap: 8px; flex-wrap: nowrap; }
.ch-demo .ch-fpath { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ch-demo .ch-ver { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .9fr) minmax(0, 1.5fr) minmax(0, .6fr) minmax(0, .8fr); border: 1px solid var(--sx-line); border-radius: 8px; overflow: hidden; }
.ch-demo .ch-ver-r { display: contents; }
.ch-demo .ch-ver-r > span { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 6px 10px; border-top: 1px solid var(--sx-line); font-size: max(13px, var(--sx-fmin, 0px)); line-height: 18px; }
.ch-demo .ch-ver-r > span.sx-row { flex-direction: row; flex-wrap: nowrap; justify-content: flex-start; align-items: center; gap: 6px; }
.ch-demo .ch-ver-r > span > .sx-badge { align-self: flex-start; }
.ch-demo .ch-ver-r > .ch-r { align-items: flex-end; }
.ch-demo .ch-ver-r.is-head > span { border-top: 0; background: var(--sx-surface); color: var(--sx-ink-muted); font: 500 max(12px, var(--sx-fmin, 0px))/16px var(--sx-sans); letter-spacing: .04em; text-transform: uppercase; }
.ch-demo .ch-ver-r.is-sel > span { background: var(--sx-surface-overlay); }
.ch-demo .ch-ver-r.is-sel > span:first-child { box-shadow: inset 3px 0 0 var(--sx-brand-text); }
.ch-demo .ch-modes { gap: 8px; }
.ch-demo .ch-dpanel .sx-diff-head { justify-content: space-between; }

/* Changes tab: chain verification above the timeline (ChainVerify compact) */
.ch-demo .ch-tl { display: flex; flex-direction: column; gap: 12px; }
.ch-demo .ch-verify { gap: 10px; min-height: 28px; flex-wrap: nowrap; }
.ch-demo .ch-vres { gap: 10px; flex-wrap: nowrap; min-width: 0; }
.ch-demo .ch-vres .sx-caption { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-demo .ch-rv { display: flex; flex-direction: column; gap: 2px; }

/* ---------- Narrower tiers ---------- */
@container sxapp (max-width: 1039px) {
  .ch-demo .ch-search { width: 260px; flex-basis: 260px; }
  .ch-demo .ch-cfg { grid-template-columns: 220px minmax(0, 1fr); }
  .ch-demo .ch-ver { grid-template-columns: minmax(0, 1.3fr) minmax(0, .9fr) minmax(0, 1.5fr) minmax(0, .8fr); }
}
@container sxapp (max-width: 799px) {
  .ch-demo .ch-q, .ch-demo .ch-host { gap: 10px; }
  .ch-demo .sx-ph-sub { display: none; }
  .ch-demo .ch-q .sx-ph-actions { display: none; }
  .ch-demo .ch-search { width: auto; flex: 1 1 0; min-width: 0; }
  .ch-demo .ch-cfg { grid-template-columns: minmax(0, 1fr); }
  .ch-demo .ch-ver { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr); }
  .ch-demo .ch-fmeta { display: none; }
  .ch-demo .ch-ver-r:nth-child(n + 4) { display: none; } /* the two newest versions */
  .ch-demo .ch-dpanel { padding: 10px; }
  .ch-demo .ch-dpanel .sx-diff-head .sx-dim { display: none; }
  .ch-demo .ch-dpanel .sx-dl > .sx-ln { min-width: 26px; padding: 0 4px; }
  .ch-demo .ch-dscroll { padding: 14px 14px 24px; gap: 12px; }
  .ch-demo .ch-dkv { grid-template-columns: 96px minmax(0, 1fr) !important; }
  .ch-demo .ch-ba-t { grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr); }
  .ch-demo .ch-ba-r > span { padding: 6px 6px; }
  .ch-demo .ch-hosthead .sx-h1 { font-size: 18px; line-height: 26px; }
  .ch-demo .ch-hosthead .sx-ph-sub { display: block; font-size: max(13px, var(--sx-fmin, 0px)); }
  .ch-demo .ch-hosthead .sx-ph-actions { display: none; }
  .ch-demo .ch-hbadges .sx-badge.is-plain { display: none; }
  .ch-demo .ch-verify { flex-wrap: wrap; }
  .ch-demo .ch-vres .sx-caption { white-space: normal; }
  /* Each event as a card: severity and review side by side under the change. */
  .ch-demo .sx-t.sx-stack-sm .sx-td[data-label="Detected"] { display: none; }
}
@container sxapp (max-width: 559px) {
  .ch-demo .sx-tabs .sx-tab { padding: 10px 10px; }
  .ch-demo .ch-dtitle { font-size: 15px; }
}
/* The kit's hide-md / hide-sm win over this file's display rules. */
@container sxapp (max-width: 1039px) { .ch-demo .sx-hide-md { display: none !important; } }
@container sxapp (max-width: 799px) { .ch-demo .sx-hide-sm { display: none !important; } }
