/* TELEIOS components ("Pop Studio").
   Styles every class the interface kit (js/core/ui/*.js) emits, plus the shared structural classes
   modules rely on (see the builder's brief). Class names follow the JS, not the mock.

   The sticker rule: things you press or drag get a 2px ink outline + a hard offset shadow + an optional
   candy fill. Containers and dense working surfaces stay flat: hairlines, soft tints, colour at the edge.
   Text on any candy fill is var(--on-candy).

   Contents
     1. Utilities (layout, text)
     2. Buttons, icon buttons
     3. Chips, badges, avatars, dots, kbd
     4. Cards, stats, empty states, progress
     5. Page frame, toolbar, sections, key/values, sample banner
     6. Form controls
     7. Overlays: modal, dialogs, menu, popover, toasts
     8. Images
     9. Drag and drop
    10. Shared structures: tables, lists, split, grids, panels, callouts, legend
    11. Stripboard pieces
    12. Canvas pieces and inspector
    13. Responsive */

/* =============================================================== 1. UTILITIES */

.row { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.col { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.stack { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.grow { flex: 1 1 auto; min-width: 0; }
.wrap { flex-wrap: wrap; }
.center { align-items: center; justify-content: center; text-align: center; }
.between { justify-content: space-between; }
.gap-1 { gap: var(--s-1); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.scroll-y { overflow-y: auto; min-height: 0; }
.scroll-x { overflow-x: auto; min-width: 0; }

.muted { color: var(--text-muted); }
.small { font-size: var(--fs-sm); }
.tiny { font-size: var(--fs-xs); }
.strong { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }
.truncate { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* =============================================================== 2. BUTTONS */

/* Sticker face that presses into its shadow: rest 3px up, hover lifts 1px, active sinks to 0. */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-d: 3px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  flex: none;
  max-width: 100%;
  height: var(--control-h);
  padding: 0 14px;
  font: 700 var(--fs-md)/1 var(--font-ui);
  white-space: nowrap;
  text-decoration: none;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--btn-d) var(--btn-d) 0 0 var(--shadow-color);
  cursor: pointer;
  user-select: none;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out, background-color 120ms ease;
}
.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: calc(var(--btn-d) + 1px) calc(var(--btn-d) + 1px) 0 0 var(--shadow-color);
}
.btn:active {
  transform: translate(var(--btn-d), var(--btn-d));
  box-shadow: 0 0 0 0 var(--shadow-color);
}
.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.btn > .icon { margin: 0 -2px; }
.btn-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.btn-primary { --btn-bg: var(--accent); --btn-fg: var(--on-candy); }
.btn-primary[data-color] { --btn-bg: var(--c); }
.btn-secondary:hover { --btn-bg: var(--hover); }
.btn-soft { --btn-bg: var(--c-soft); --btn-fg: var(--text); --btn-d: 2px; }
.btn-soft:hover { --btn-bg: var(--hover); }
.btn-danger { --btn-bg: var(--danger); --btn-fg: var(--on-candy); }
.btn-ai {
  --btn-bg: var(--ai);
  --btn-fg: var(--on-candy);
  background-image:
    radial-gradient(circle at 18% 28%, color-mix(in srgb, var(--paper) 70%, transparent) 0 1.4px, transparent 2px),
    radial-gradient(circle at 84% 72%, color-mix(in srgb, var(--paper) 60%, transparent) 0 1.2px, transparent 1.8px),
    linear-gradient(120deg, var(--violet) 0%, var(--magenta) 100%);
}
.btn-ghost {
  --btn-bg: transparent;
  border-color: transparent;
  box-shadow: none;
}
.btn-ghost:hover {
  --btn-bg: var(--hover);
  border-color: var(--line);
  transform: none;
  box-shadow: none;
}
.btn-ghost:active {
  --btn-bg: var(--surface-sunken);
  transform: translate(1px, 1px);
  box-shadow: none;
}

.btn-sm {
  --btn-d: 2px;
  height: var(--control-h-sm);
  padding: 0 10px;
  gap: 6px;
  font-size: var(--fs-sm);
  border-radius: var(--r-sm);
}
.btn-lg {
  --btn-d: 4px;
  height: var(--control-h-lg);
  padding: 0 20px;
  gap: 10px;
  font: 600 var(--fs-lg)/1 var(--font-display);
  border-radius: var(--r-md);
}
.btn-full { display: flex; width: 100%; }
.btn-icononly { width: var(--control-h); padding: 0; }
.btn-icononly.btn-sm { width: var(--control-h-sm); }
.btn-icononly.btn-lg { width: var(--control-h-lg); }

/* toggled on (aria-pressed): pressed in, tinted with the current colour */
.btn.is-active {
  --btn-bg: var(--c-soft);
  --btn-fg: var(--text);
  transform: translate(calc(var(--btn-d) - 1px), calc(var(--btn-d) - 1px));
  box-shadow: 1px 1px 0 0 var(--shadow-color);
}
.btn-primary.is-active { --btn-bg: var(--c); --btn-fg: var(--on-candy); }
.btn-ghost.is-active { border-color: var(--line); transform: none; box-shadow: none; }

.btn:disabled,
.btn[aria-disabled="true"] {
  --btn-bg: var(--surface-sunken);
  --btn-fg: var(--text-muted);
  background-image: none;
  border-style: dashed;
  border-color: var(--text-muted);
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}
.btn-ghost:disabled { border-color: transparent; --btn-bg: transparent; }

/* busy: keep the face (it is not "unavailable", it is working) */
.btn.is-busy:disabled {
  border-style: solid;
  border-color: var(--line);
  cursor: progress;
  opacity: 0.85;
}
.btn-primary.is-busy:disabled { --btn-bg: var(--accent); --btn-fg: var(--on-candy); }
.btn-primary[data-color].is-busy:disabled { --btn-bg: var(--c); }
.btn-secondary.is-busy:disabled { --btn-bg: var(--surface); --btn-fg: var(--text); }
.btn-soft.is-busy:disabled { --btn-bg: var(--c-soft); --btn-fg: var(--text); }
.btn-danger.is-busy:disabled { --btn-bg: var(--danger); --btn-fg: var(--on-candy); }
.btn-ai.is-busy:disabled { --btn-bg: var(--ai); --btn-fg: var(--on-candy); }
.btn-ghost.is-busy:disabled { --btn-bg: transparent; --btn-fg: var(--text); border-color: transparent; }

/* ----- icon buttons: square, ghost by default ----- */

.iconbtn {
  --ib-size: var(--control-h);
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--ib-size);
  height: var(--ib-size);
  padding: 0;
  color: var(--text-2);
  background: transparent;
  border: var(--bw) solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out, background-color 120ms ease, color 120ms ease;
}
.iconbtn:hover {
  color: var(--text);
  background: var(--hover);
  border-color: var(--line);
}
.iconbtn:active { transform: translate(1px, 1px); background: var(--surface-sunken); }
.iconbtn-sm { --ib-size: var(--control-h-sm); border-radius: var(--r-xs); }
.iconbtn-lg { --ib-size: var(--control-h-lg); border-radius: var(--r-md); }

.iconbtn-secondary,
.iconbtn-primary,
.iconbtn-soft {
  color: var(--text);
  border-color: var(--line);
  box-shadow: 2px 2px 0 0 var(--shadow-color);
}
.iconbtn-secondary { background: var(--surface); }
.iconbtn-soft { background: var(--c-soft); }
.iconbtn-primary { background: var(--accent); color: var(--on-candy); }
.iconbtn-primary[data-color] { background: var(--c); }
.iconbtn-secondary:hover,
.iconbtn-soft:hover,
.iconbtn-primary:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 0 var(--shadow-color);
}
.iconbtn-secondary:hover { background: var(--hover); }
.iconbtn-soft:hover { background: var(--c-soft); }
.iconbtn-primary:hover { background: var(--accent); color: var(--on-candy); }
.iconbtn-primary[data-color]:hover { background: var(--c); }
.iconbtn-secondary:active,
.iconbtn-soft:active,
.iconbtn-primary:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.iconbtn.is-active {
  color: var(--text);
  background: var(--c-soft);
  border-color: var(--line);
}
.iconbtn-primary.is-active { background: var(--c); color: var(--on-candy); }

.iconbtn:disabled {
  color: var(--text-muted);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  transform: none;
  opacity: 0.5;
  cursor: not-allowed;
}
.iconbtn-secondary:disabled,
.iconbtn-soft:disabled,
.iconbtn-primary:disabled {
  background: var(--surface-sunken);
  border-color: var(--text-muted);
  border-style: dashed;
  opacity: 1;
}

/* =============================================================== 3. CHIPS, BADGES, AVATARS, DOTS, KBD */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  max-width: 100%;
  height: 24px;
  padding: 0 9px;
  font: 700 12px/1 var(--font-ui);
  white-space: nowrap;
  color: var(--text);
  background: var(--surface);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-pill);
  vertical-align: middle;
}
.chip[data-color] { background: var(--c-soft); }
.chip > .icon { margin-left: -2px; }
.chip.is-active {
  color: var(--on-candy);
  background: var(--c);
}
.chip-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.chip-button {
  cursor: pointer;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out, background-color 120ms ease;
}
.chip-button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 2px 2px 0 0 var(--shadow-color);
}
.chip-button:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}
.chip-button:not([data-color]):not(.is-active):hover { background: var(--hover); }
.chip-x {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  margin-right: -5px;
  border-radius: 50%;
  color: inherit;
  cursor: pointer;
  opacity: 0.75;
}
.chip-x:hover {
  opacity: 1;
  color: var(--surface);
  background: var(--text);
}
.chip.is-active .chip-x:hover { color: var(--c); background: var(--on-candy); }
.chip-x:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font: 700 11px/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text);
  background: var(--surface);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-pill);
  vertical-align: middle;
}
.badge[data-color] {
  color: var(--on-candy);
  background: var(--c);
}

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  overflow: hidden;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--on-candy);
  background: var(--c);
  border: var(--bw-thin) solid var(--line);
  border-radius: 50%;
  user-select: none;
  vertical-align: middle;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.dot {
  display: inline-block;
  flex: none;
  background: var(--c);
  border: var(--bw-thin) solid var(--line);
  border-radius: 50%;
  vertical-align: middle;
}

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 22px;
  height: 21px;
  padding: 0 6px;
  font: 700 11px/1 var(--font-ui);
  white-space: nowrap;
  color: var(--text-2);
  background: var(--surface-sunken);
  border: var(--bw-thin) solid var(--field-line);
  border-radius: var(--r-xs);
  box-shadow: 0 2px 0 0 var(--field-line);
}

/* =============================================================== 4. CARDS, STATS, EMPTY, PROGRESS */

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: var(--text);
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px var(--s-4) 10px;
}
.card-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  color: var(--on-candy);
  background: var(--c);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-sm);
  transform: rotate(-4deg);
}
.card-titles { flex: 1 1 auto; min-width: 0; }
.card-title {
  font: 600 var(--fs-lg)/1.2 var(--font-display);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-sub {
  margin-top: 1px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  margin-left: auto;
}
.card-body {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 var(--s-4) var(--s-4);
}
.card-body:first-child { padding-top: var(--s-4); }
.card-body.card-flush {
  padding: 0;
  overflow: hidden;
  border-radius: 0 0 calc(var(--r-md) - var(--bw)) calc(var(--r-md) - var(--bw));
}
.card-body.card-flush:first-child { border-radius: calc(var(--r-md) - var(--bw)); }
.card-head + .card-flush { border-top: 1px solid var(--border); }

.card-click {
  cursor: pointer;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}
.card-click:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 0 var(--shadow-color);
}
.card-click:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}
.card-click:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ----- stat: a candy tile with a big display-face number ----- */

.stat {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  min-width: 0;
  padding: 14px var(--s-4) var(--s-4);
  font: inherit;
  text-align: left;
  color: var(--on-candy);
  background: var(--c);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}
.stat-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  color: var(--paper-ink);
  background: var(--paper);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-sm);
  transform: rotate(-5deg);
}
.stat-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.stat-value {
  order: 2;
  font: 700 34px/1.05 var(--font-display);
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stat-label {
  order: 1;
  margin-bottom: 4px;
  font: 800 11.5px/1.2 var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.stat-sub {
  order: 3;
  margin-top: 4px;
  font-size: var(--fs-sm);
  font-weight: 700;
  opacity: 0.85;
}
.stat-click {
  cursor: pointer;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}
.stat-click:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-lg);
}
.stat-click:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 0 var(--shadow-color);
}
.stat-click:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* ----- empty state: a candy blob, a friendly title, the first step ----- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-width: 0;
  margin: 0 auto;
  padding: var(--s-7) var(--s-6);
  text-align: center;
}
.empty-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 76px;
  height: 72px;
  margin-bottom: var(--s-3);
  color: var(--on-candy);
  background: var(--c);
  border: var(--bw) solid var(--line);
  border-radius: 46% 54% 52% 48% / 55% 48% 52% 45%;
  box-shadow: var(--shadow-md);
  transform: rotate(-6deg);
}
.empty-icon .icon { transform: rotate(6deg); }
/* confetti: a yellow spark and a pink dot stuck to the blob */
.empty-icon::before,
.empty-icon::after {
  content: "";
  position: absolute;
  border: var(--bw-thin) solid var(--line);
}
.empty-icon::before {
  top: -9px;
  right: -11px;
  width: 16px;
  height: 16px;
  background: var(--yellow);
  border-radius: 4px;
  transform: rotate(24deg);
}
.empty-icon::after {
  bottom: -3px;
  left: -12px;
  width: 11px;
  height: 11px;
  background: var(--pink);
  border-radius: 50%;
}
.empty[data-color="pink"] .empty-icon::after,
.empty[data-color="magenta"] .empty-icon::after,
.empty[data-color="red"] .empty-icon::after { background: var(--cyan); }
.empty[data-color="yellow"] .empty-icon::before,
.empty[data-color="amber"] .empty-icon::before { background: var(--blue); }
.empty-title {
  font: 600 var(--fs-xl)/1.2 var(--font-display);
  color: var(--text);
}
.empty-text {
  max-width: 46ch;
  font-size: var(--fs-md);
  color: var(--text-2);
  line-height: 1.5;
}
.empty-action {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.empty-compact {
  gap: 6px;
  padding: var(--s-5) var(--s-4);
}
.empty-compact .empty-icon {
  width: 50px;
  height: 48px;
  margin-bottom: var(--s-2);
  box-shadow: var(--shadow-sm);
}
.empty-compact .empty-icon::before { top: -6px; right: -8px; width: 11px; height: 11px; }
.empty-compact .empty-icon::after { left: -8px; width: 8px; height: 8px; }
.empty-compact .empty-title { font-size: var(--fs-lg); }
.empty-compact .empty-text { font-size: var(--fs-sm); }
.empty-compact .empty-action { margin-top: var(--s-2); }

/* ----- progress ----- */

.progress {
  display: flex;
  width: 100%;
  min-width: 24px;
  overflow: hidden;
  background: var(--surface-sunken);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-pill);
  box-sizing: content-box;
}
.progress-fill {
  display: block;
  flex: none;
  height: 100%;
  background: var(--c);
  /* the ink edge only shows when the fill has width */
  box-shadow: var(--bw-thin) 0 0 0 var(--line);
  transition: width 140ms ease-out;
}

/* =============================================================== 5. PAGE FRAME */

.page {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}
.page-head {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
  min-width: 0;
  min-height: 68px;
  padding: 12px var(--s-6);
  background:
    linear-gradient(var(--c-soft), var(--c-soft)) left bottom / 100% 5px no-repeat,
    var(--surface-2);
  border-bottom: var(--bw) solid var(--line);
}
.page-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  color: var(--on-candy);
  background: var(--c);
  border: var(--bw) solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
  transform: rotate(-5deg);
}
.page-titles {
  flex: 1 1 auto;
  min-width: 0;
}
.page-title {
  font: 600 25px/1.1 var(--font-display);
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.page-sub {
  margin-top: 2px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--s-2);
  flex: 0 1 auto;
  min-width: 0;
  margin-left: auto;
  padding: 2px 3px 3px 0; /* room for the button shadows */
}
.page-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-2);
  flex: none;
  min-width: 0;
  padding: 9px var(--s-6) 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.page-main {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}
.page-body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: var(--s-5) var(--s-6) var(--s-7);
}
.page-flush .page-body {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}
.page-aside {
  flex: none;
  max-width: 50%;
  min-height: 0;
  overflow: auto;
  padding: var(--s-4);
  background: var(--surface);
  border-left: 1px solid var(--border);
}
.page-aside > .inspector:first-child { margin: calc(-1 * var(--s-4)); }

.toolbar-spacer { flex: 1 1 auto; }
.toolbar-divider {
  flex: none;
  align-self: center;
  width: 0;
  height: 22px;
  margin: 0 var(--s-1);
  border-left: var(--bw) dotted var(--text-muted);
}

/* ----- sections ----- */

.section { min-width: 0; }
.section + .section { margin-top: var(--s-7); }
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: var(--control-h-sm);
  margin-bottom: var(--s-3);
}
.section-title {
  font: 600 var(--fs-xl)/1.2 var(--font-display);
  white-space: nowrap;
}
.section-hint {
  min-width: 0;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.section-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  margin-left: auto;
}

/* ----- key / values ----- */

.kv { display: flex; flex-direction: column; min-width: 0; }
.kv-row {
  display: grid;
  grid-template-columns: minmax(84px, 38%) minmax(0, 1fr);
  gap: var(--s-3);
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
}
.kv-row:last-child { border-bottom: 0; }
.kv-row dt {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
}
.kv-row dd {
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* ----- sample banner ----- */

.sample-banner {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-width: 0;
  margin-bottom: var(--s-4);
  padding: 8px 8px 8px 10px;
  font-size: var(--fs-sm);
  color: var(--text);
  background: var(--yellow-soft);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-md);
}
.sample-banner > .icon {
  box-sizing: content-box;
  padding: 5px;
  color: var(--on-candy);
  background: var(--yellow);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-xs);
  transform: rotate(-6deg);
}
.sample-banner > span { flex: 1 1 auto; min-width: 0; }
.sample-banner > .btn { margin-right: 3px; }

/* =============================================================== 6. FORM CONTROLS */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field-row {
  display: grid;
  grid-template-columns: minmax(96px, 34%) minmax(0, 1fr);
  align-items: center;
  column-gap: var(--s-3);
  row-gap: 4px;
}
.field-row .field-hint,
.field-row .field-error { grid-column: 2; }
.field-label {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  cursor: default;
}
.field-row .field-label { color: var(--text-2); font-weight: 600; }
.field-control {
  display: block;
  min-width: 0;
}
.field-hint {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--text-muted);
}
.field-error {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--danger-text);
}

/* ----- text boxes ----- */

.input {
  display: block;
  width: 100%;
  min-width: 0;
  height: var(--control-h);
  padding: 0 11px;
  font: 500 var(--fs-md)/1.2 var(--font-ui);
  color: var(--text);
  background: var(--field-bg);
  border: var(--bw-thin) solid var(--field-line);
  border-radius: var(--r-sm);
  outline: none;
  transition: background-color 120ms ease, box-shadow 120ms ease;
}
.input:hover { background: var(--surface); }
.input:focus,
.input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}
.input:disabled,
.input[readonly] {
  color: var(--text-muted);
  background: var(--surface-sunken);
  border-style: dashed;
}
.input:disabled { cursor: not-allowed; }
/* TextInput puts the size class on the input; Select / NumberInput put it on their wrapper */
.input.input-sm,
.input-sm > .input {
  height: var(--control-h-sm);
  padding: 0 9px;
  font-size: var(--fs-sm);
  border-radius: var(--r-xs);
}
.input.input-lg,
.input-lg > .input {
  height: var(--control-h-lg);
  padding: 0 14px;
  font-size: var(--fs-lg);
}
.textarea,
.input.textarea {
  height: auto;
  min-height: calc(var(--control-h) * 2);
  padding: 8px 11px;
  line-height: 1.5;
  resize: vertical;
}
.has-error .input,
.has-error .input-wrap.number,
.input[aria-invalid="true"] {
  border-color: var(--danger-text);
  box-shadow: 2px 2px 0 0 var(--danger-text);
}

/* date and time: consistent in both themes (color-scheme comes from the tokens) */
.input[type="date"],
.input[type="time"],
.input[type="datetime-local"] {
  font-variant-numeric: tabular-nums;
  padding-right: 6px;
}
.input::-webkit-calendar-picker-indicator {
  padding: 3px;
  border-radius: var(--r-xs);
  opacity: 0.7;
  cursor: pointer;
}
.input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
  background-color: var(--hover);
}
.input::-webkit-datetime-edit-fields-wrapper { padding: 0; }
.input::-webkit-datetime-edit-text { color: var(--text-muted); }

/* ----- wrappers: icon, search, number with prefix / suffix ----- */

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}
.input-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.input.input-hasicon { padding-left: 33px; }

.search .input {
  padding-right: 30px;
  border-radius: var(--r-pill);
}
.search .input-icon { left: 12px; }
.search .input.input-hasicon { padding-left: 34px; }
.search input::-webkit-search-cancel-button,
.search input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.input-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  color: var(--text-2);
  background: var(--surface-sunken);
  border: 0;
  border-radius: 50%;
  transform: translateY(-50%);
}
.input-clear:hover { color: var(--surface); background: var(--text); }

/* the number wrapper is the box; the input inside is borderless so the affix sits inline */
.input-wrap.number {
  height: var(--control-h);
  background: var(--field-bg);
  border: var(--bw-thin) solid var(--field-line);
  border-radius: var(--r-sm);
  transition: background-color 120ms ease;
}
.input-wrap.number:hover { background: var(--surface); }
.input-wrap.number:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}
.input-wrap.number .input {
  flex: 1 1 auto;
  height: 100%;
  background: transparent;
  border: 0;
  border-radius: inherit;
  font-variant-numeric: tabular-nums;
}
.input-wrap.number .input:focus { outline: none; }
.input-wrap.number .input.has-prefix { padding-left: 4px; }
.input-wrap.number .input.has-suffix { padding-right: 4px; }
.input-affix {
  flex: none;
  padding-left: 10px;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  user-select: none;
}
.input-affix.input-suffix { padding: 0 10px 0 0; }
.input-wrap.number.input-sm { height: var(--control-h-sm); border-radius: var(--r-xs); }
.input-wrap.number.input-sm .input { height: 100%; padding: 0 8px; }
.input-wrap.number.input-lg { height: var(--control-h-lg); }
.input-wrap.number.input-lg .input { height: 100%; }

/* ----- select ----- */

.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}
.select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 32px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.select:disabled { cursor: not-allowed; }
.select-caret {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-2);
  pointer-events: none;
}
.select-wrap.input-sm .select { padding-right: 26px; }
.select-wrap.input-sm .select-caret { right: 7px; }
/* in rows of controls (toolbars, action bars) boxes size to a sensible width instead of filling the row */
/* (all at the same specificity so a module's .grow on the control still wins: it comes last) */
:is(.page-toolbar, .page-actions, .section-actions, .card-actions, .row) > :is(.input-wrap, .select-wrap, .input) {
  flex: 0 1 auto;
  width: auto;
}
:is(.page-toolbar, .page-actions, .section-actions, .card-actions, .row) > .search { flex: 0 1 240px; }
:is(.page-toolbar, .page-actions, .section-actions, .card-actions, .row) > .number { flex: 0 1 120px; }
:is(.page-toolbar, .page-actions, .section-actions, .card-actions, .row) > .input { flex: 0 1 200px; }
:is(.page-toolbar, .page-actions, .section-actions, .card-actions, .row) > .textarea { flex: 1 1 auto; }
:is(.page-toolbar, .page-actions, .section-actions, .card-actions, .row) > .grow { flex: 1 1 auto; }
.page-toolbar > .select-wrap .select,
.page-actions > .select-wrap .select { max-width: 260px; }

.select option,
.select optgroup {
  color: var(--text);
  background: var(--surface);
}

/* ----- checkbox ----- */

.check,
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-width: 0;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  user-select: none;
  vertical-align: middle;
}
.check > input,
.toggle > input {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.check-box {
  display: grid;
  place-items: center;
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--on-candy);
  background: var(--field-bg);
  border: var(--bw) solid var(--field-line);
  border-radius: var(--r-xs);
  transition: background-color 100ms ease, transform 80ms ease-out;
}
.check-box .icon {
  stroke-width: 3.2;
  opacity: 0;
  transform: scale(0.4) rotate(-12deg);
  transition: opacity 100ms ease, transform 120ms ease-out;
}
.check:hover .check-box { background: var(--hover); }
.check > input:checked + .check-box {
  background: var(--c);
  border-color: var(--line);
  box-shadow: 1.5px 1.5px 0 0 var(--shadow-color);
}
.check > input:checked + .check-box .icon { opacity: 1; transform: none; }
.check:active .check-box { transform: translate(1px, 1px); }
.check > input:focus-visible + .check-box { outline: 2px solid var(--focus); outline-offset: 2px; }
.check-label { min-width: 0; }

/* ----- toggle ----- */

.toggle-track {
  position: relative;
  display: inline-block;
  flex: none;
  width: 42px;
  height: 24px;
  background: var(--surface-sunken);
  border: var(--bw) solid var(--field-line);
  border-radius: var(--r-pill);
  transition: background-color 120ms ease;
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--surface);
  border: var(--bw) solid var(--field-line);
  border-radius: 50%;
  transition: transform 120ms ease-out;
}
.toggle:hover .toggle-track { background: var(--hover); }
.toggle > input:checked + .toggle-track {
  background: var(--lime);
  border-color: var(--line);
}
.toggle > input:checked + .toggle-track .toggle-thumb {
  background: var(--paper);
  border-color: var(--line);
  transform: translateX(18px);
}
.toggle > input:focus-visible + .toggle-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.toggle-label { min-width: 0; }

.check.is-disabled,
.toggle.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.check.is-disabled:hover .check-box,
.toggle.is-disabled:hover .toggle-track { background: var(--surface-sunken); }

/* ----- segmented ----- */

.segmented {
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
  flex: none;
  max-width: 100%;
  height: var(--control-h);
  padding: 2px;
  background: var(--surface-sunken);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-sm);
  vertical-align: middle;
}
.segmented-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  padding: 0 11px;
  font: 700 13px/1 var(--font-ui);
  white-space: nowrap;
  color: var(--text-2);
  background: transparent;
  border: var(--bw-thin) solid transparent;
  border-radius: calc(var(--r-sm) - 3px);
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
.segmented-item > span { overflow: hidden; text-overflow: ellipsis; }
.segmented-item:not(.is-active):hover { color: var(--text); background: var(--hover); }
.segmented-item.is-active {
  color: var(--on-candy);
  background: var(--c);
  border-color: var(--line);
  box-shadow: 1.5px 1.5px 0 0 var(--shadow-color);
  cursor: default;
}
.segmented-item:focus-visible { outline-offset: 0; }
.segmented-sm { height: var(--control-h-sm); }
.segmented-sm .segmented-item { padding: 0 8px; font-size: 12px; gap: 4px; }
.segmented-full { display: flex; width: 100%; }
.segmented-full .segmented-item { flex: 1 1 0; }

/* ----- tabs ----- */

.tabs {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-width: 0;
  padding: 0 var(--s-2);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  /* the baseline is drawn inside the box so the active tab can sit on it */
  box-shadow: inset 0 calc(-1 * var(--bw)) 0 0 var(--line);
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 38px;
  padding: 0 14px;
  font: 700 13.5px/1 var(--font-ui);
  white-space: nowrap;
  color: var(--text-2);
  background: transparent;
  border: var(--bw) solid transparent;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
.tab:hover { color: var(--text); background: var(--hover); }
.tab.is-active {
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
  box-shadow: inset 0 4px 0 0 var(--c);
}
.tab:focus-visible { outline-offset: -4px; }
.tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 18px;
  padding: 0 5px;
  font: 700 11px/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  background: var(--surface-sunken);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-pill);
}
.tab.is-active .tab-count { color: var(--on-candy); background: var(--c); }

/* ----- slider ----- */

.slider {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
}
.slider-label {
  flex: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.slider-value {
  flex: none;
  min-width: 4ch;
  font: 700 12.5px/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--text);
}
.slider input[type="range"] {
  --pct: 0%;
  flex: 1 1 auto;
  min-width: 60px;
  height: 24px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.slider input[type="range"]::-webkit-slider-runnable-track {
  height: 10px;
  background: linear-gradient(to right, var(--c) 0 var(--pct), var(--surface-sunken) var(--pct) 100%);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-pill);
}
.slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -6.5px;
  background: var(--paper);
  border: var(--bw) solid var(--line);
  border-radius: 50%;
  box-shadow: 1.5px 1.5px 0 0 var(--shadow-color);
  transition: transform 80ms ease-out;
}
.slider input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.1); }
.slider input[type="range"]:active::-webkit-slider-thumb { transform: scale(0.95); box-shadow: none; }
.slider input[type="range"]::-moz-range-track {
  height: 7px;
  background: var(--surface-sunken);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-pill);
}
.slider input[type="range"]::-moz-range-progress {
  height: 7px;
  background: var(--c);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-pill);
}
.slider input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--paper);
  border: var(--bw) solid var(--line);
  border-radius: 50%;
  box-shadow: 1.5px 1.5px 0 0 var(--shadow-color);
}
.slider input[type="range"]:focus-visible { outline-offset: 2px; border-radius: var(--r-pill); }
.slider input[type="range"]:disabled { opacity: 0.5; cursor: not-allowed; }

/* ----- colour swatches ----- */

.swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 3px;
}
.swatch {
  flex: none;
  padding: 0;
  background: var(--c);
  border: var(--bw-thin) solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 80ms ease-out;
}
.swatch:hover { transform: scale(1.14); }
.swatch.is-active {
  box-shadow: 0 0 0 2.5px var(--surface), 0 0 0 4.5px var(--line);
}
.swatch-none {
  background:
    linear-gradient(135deg, transparent 0 44%, var(--danger) 44% 56%, transparent 56% 100%),
    var(--surface);
}

/* ----- inline edit ----- */

.inline-edit {
  display: inline-block;
  max-width: 100%;
  margin: -2px -6px;
  padding: 2px 6px;
  border-radius: var(--r-xs);
  overflow-wrap: anywhere;
  cursor: text;
  transition: background-color 120ms ease;
}
.inline-edit:hover {
  background: var(--hover);
  box-shadow: inset 0 0 0 1.5px var(--border);
}
.inline-edit.is-empty {
  color: var(--text-muted);
  font-style: italic;
}
.inline-edit.is-disabled { cursor: default; }
.inline-edit.is-disabled:hover { background: transparent; box-shadow: none; }
.input.inline-edit-input {
  display: inline-block;
  height: auto;
  min-height: 1.9em;
  margin: -3px -7px;
  padding: 2px 6px;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  width: calc(100% + 14px);
  max-width: none;
}
.input.inline-edit-input.textarea { min-height: 4.5em; }

/* =============================================================== 7. OVERLAYS */

.overlay-host { display: contents; }

/* ----- modal ----- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-6);
  background: var(--scrim);
  animation: hs-fade-in 120ms ease-out;
}
/* stacked dialogs: only the top one dims the screen */
.modal-backdrop:not(.is-top) { background: transparent; }

.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 2 * var(--s-6));
  max-height: calc(100dvh - 2 * var(--s-6));
  min-height: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  outline: none;
  animation: hs-pop-in 140ms ease-out;
}
.modal-sm { max-width: 420px; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 1040px; }
.modal-full {
  width: 95vw;
  max-width: none;
  height: 92vh;
  max-height: 92vh;
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  min-width: 0;
  padding: 10px 10px 10px var(--s-4);
  background: var(--c-soft);
  border-bottom: var(--bw) solid var(--line);
}
.modal-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  color: var(--on-candy);
  background: var(--c);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: 1.5px 1.5px 0 0 var(--shadow-color);
  transform: rotate(-5deg);
}
.modal-titles { flex: 1 1 auto; min-width: 0; }
.modal-title {
  font: 600 18px/1.2 var(--font-display);
  overflow-wrap: anywhere;
}
.modal-sub {
  margin-top: 1px;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-2);
}
.modal-head > .iconbtn { color: var(--text); }
.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: var(--s-4) var(--s-5) var(--s-5);
}
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--s-2);
  flex: none;
  padding: var(--s-3) var(--s-5) 14px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

/* quick search: no body padding, nearer the top of the screen */
.modal-palette {
  align-self: flex-start;
  margin-top: 9vh;
  max-height: min(560px, calc(100vh - 12vh));
}
.modal-palette .modal-body {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

/* ----- dialog contents (confirm / prompt / small forms) ----- */

.dialog-text {
  color: var(--text-2);
  line-height: 1.55;
}
.dialog-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dialog-form > .field-label { margin-bottom: -8px; }
.dialog-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-1);
  padding-top: var(--s-3);
  border-top: 1px solid var(--border);
}

/* ----- menu ----- */

.menu {
  position: fixed;
  z-index: var(--z-menu);
  display: flex;
  flex-direction: column;
  min-width: 200px;
  max-width: min(360px, calc(100vw - 16px));
  max-height: calc(100vh - 16px);
  overflow: auto;
  padding: 6px;
  color: var(--text);
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  outline: none;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 5px 10px 5px 6px;
  font: 600 13.5px/1.25 var(--font-ui);
  text-align: left;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: var(--r-sm);
  cursor: pointer;
}
.menu-item:hover,
.menu-item:focus-visible {
  background: var(--hover);
}
.menu-item:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--focus);
}
.menu-item-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  color: var(--text-2);
  border-radius: var(--r-xs);
}
.menu-item[data-color] .menu-item-icon {
  color: var(--on-candy);
  background: var(--c);
  border: var(--bw-thin) solid var(--line);
}
.menu-item-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-item-hint {
  display: block;
  margin-top: 1px;
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
}
.menu-item-shortcut {
  flex: none;
  margin-left: var(--s-3);
  font-size: var(--fs-xs);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}
.menu-item.is-checked { font-weight: 800; }
.menu-item.is-checked:not([data-color]) .menu-item-icon { color: var(--c-ink); }
.menu-item.is-danger,
.menu-item.is-danger .menu-item-icon { color: var(--danger-text); }
.menu-item.is-danger:hover,
.menu-item.is-danger:focus-visible { background: var(--red-soft); }
.menu-item:disabled {
  opacity: 0.45;
  background: transparent;
  cursor: not-allowed;
}
.menu-divider {
  flex: none;
  height: 0;
  margin: 5px 6px;
  border-top: var(--bw-thin) dotted var(--text-muted);
}
.menu-heading {
  flex: none;
  padding: 8px 8px 4px;
  font: 800 10.5px/1.2 var(--font-ui);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.menu-trigger {
  display: inline-flex;
  flex: none;
  vertical-align: middle;
}

/* ----- popover ----- */

.popover {
  position: fixed;
  z-index: var(--z-popover);
  min-width: 200px;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  overflow: auto;
  padding: 14px;
  color: var(--text);
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
}

/* ----- toasts: bottom-centre stack of sticker pills ----- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: var(--s-5);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-2);
  width: max-content;
  max-width: calc(100vw - 24px);
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  --toast-c: var(--blue);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 240px;
  max-width: min(520px, calc(100vw - 24px));
  min-height: 46px;
  padding: 6px 6px 6px 7px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: hs-pop-in 140ms ease-out;
}
.toast-info { --toast-c: var(--blue); }
.toast-success { --toast-c: var(--green); }
.toast-warn { --toast-c: var(--yellow); }
.toast-error { --toast-c: var(--red); }
.toast > .icon {
  box-sizing: content-box;
  padding: 5px;
  color: var(--on-candy);
  background: var(--toast-c);
  border: var(--bw-thin) solid var(--line);
  border-radius: 50%;
}
.toast-text {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.toast-action {
  flex: none;
  height: 30px;
  padding: 0 12px;
  font: 800 13px/1 var(--font-ui);
  color: var(--on-candy);
  background: var(--toast-c);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: 1.5px 1.5px 0 0 var(--shadow-color);
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
}
.toast-action:hover { transform: translate(-1px, -1px); box-shadow: 2.5px 2.5px 0 0 var(--shadow-color); }
.toast-action:active { transform: translate(1px, 1px); box-shadow: none; }
.toast-x {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--text-2);
  background: transparent;
  border: 0;
  border-radius: 50%;
}
.toast-x:hover { color: var(--text); background: var(--hover); }

/* =============================================================== 8. IMAGES */

img.asset-img {
  display: block;
  max-width: 100%;
}
.asset-img-empty {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 40px;
  color: var(--text-muted);
  background:
    repeating-linear-gradient(-45deg, transparent 0 8px, var(--border) 8px 9px),
    var(--surface-sunken);
}

.imgdrop {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 120px;
  overflow: hidden;
  color: var(--text-2);
  background: var(--surface-sunken);
  border: var(--bw) dashed var(--text-muted);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.imgdrop:hover { background: var(--hover); border-color: var(--line); }
.imgdrop.is-over {
  background: var(--c-soft);
  border-style: solid;
  border-color: var(--focus);
}
.imgdrop.has-image {
  background: var(--surface-sunken);
  border-style: solid;
  border-color: var(--line);
}
.imgdrop > img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
.imgdrop.is-disabled { cursor: default; opacity: 0.6; }
.imgdrop.is-disabled:hover { background: var(--surface-sunken); border-color: var(--text-muted); }
.imgdrop-hint {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: var(--s-3);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
}
.imgdrop-hint > .icon {
  box-sizing: content-box;
  margin-bottom: 4px;
  padding: 7px;
  color: var(--on-candy);
  background: var(--c);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: 2px 2px 0 0 var(--shadow-color);
  transform: rotate(-5deg);
}
.imgdrop-hint small {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
}
.imgdrop-remove {
  position: absolute;
  top: var(--s-2);
  right: var(--s-2);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--text);
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: 2px 2px 0 0 var(--shadow-color);
  opacity: 0;
  transition: opacity 120ms ease, transform 80ms ease-out;
}
.imgdrop:hover .imgdrop-remove,
.imgdrop:focus-within .imgdrop-remove,
.imgdrop-remove:focus-visible { opacity: 1; }
.imgdrop-remove:hover { color: var(--on-candy); background: var(--danger); }
.imgdrop-remove:active { transform: translate(2px, 2px); box-shadow: none; }

/* =============================================================== 9. DRAG AND DROP */

[draggable="true"] { -webkit-user-drag: element; }
.is-dragging {
  opacity: 0.4;
  filter: saturate(0.6);
}
[data-dnd-zone].dnd-over {
  outline: 2px dashed var(--focus);
  outline-offset: -2px;
}

/* the insertion line: above the item (dnd-before) or below the last one (dnd-after) */
.dnd-before:not(tr),
.dnd-after:not(tr) { position: relative; }
.dnd-before:not(tr)::before,
.dnd-after:not(tr)::after {
  content: "";
  position: absolute;
  z-index: 6;
  left: -2px;
  right: -2px;
  height: 4px;
  background: var(--focus);
  border-radius: var(--r-pill);
  box-shadow: 0 0 0 1.5px var(--surface);
  pointer-events: none;
}
.dnd-before:not(tr)::before { top: -4px; }
.dnd-after:not(tr)::after { bottom: -4px; }

/* side-by-side zones draw the line on the left / right */
[data-dnd-zone="horizontal"] .dnd-before:not(tr)::before,
[data-dnd-zone="grid"] .dnd-before:not(tr)::before,
[data-dnd-zone="horizontal"] .dnd-after:not(tr)::after,
[data-dnd-zone="grid"] .dnd-after:not(tr)::after {
  top: -2px;
  bottom: -2px;
  width: 4px;
  height: auto;
}
[data-dnd-zone="horizontal"] .dnd-before:not(tr)::before,
[data-dnd-zone="grid"] .dnd-before:not(tr)::before { left: -5px; right: auto; }
[data-dnd-zone="horizontal"] .dnd-after:not(tr)::after,
[data-dnd-zone="grid"] .dnd-after:not(tr)::after { left: auto; right: -5px; }
/* a vertical list nested inside a horizontal zone (board columns) goes back to top / bottom lines */
[data-dnd-zone] [data-dnd-zone="vertical"] .dnd-before:not(tr)::before,
[data-dnd-zone] [data-dnd-zone="vertical"] .dnd-after:not(tr)::after {
  left: -2px;
  right: -2px;
  width: auto;
  height: 4px;
  bottom: auto;
}
[data-dnd-zone] [data-dnd-zone="vertical"] .dnd-before:not(tr)::before { top: -4px; }
[data-dnd-zone] [data-dnd-zone="vertical"] .dnd-after:not(tr)::after { top: auto; bottom: -4px; }

/* table rows cannot hold positioned pseudo-elements: use the cells' edges */
tr.dnd-before > td,
tr.dnd-before > th { box-shadow: inset 0 3px 0 0 var(--focus); }
tr.dnd-after > td,
tr.dnd-after > th { box-shadow: inset 0 -3px 0 0 var(--focus); }

/* =============================================================== 10. SHARED STRUCTURES */

/* ----- tables: one outlined container, sunken uppercase header, hairline rows, one loud total ----- */

.table-wrap {
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-md);
}
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  line-height: 1.35;
}
.table th,
.table td {
  padding: 8px 12px;
  text-align: left;
  vertical-align: middle;
}
.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  font: 800 10.5px/1.2 var(--font-ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-2);
  background: var(--surface-sunken);
  border-bottom: var(--bw) solid var(--line);
}
.table tbody td,
.table tbody th {
  border-bottom: 1px solid var(--border);
}
.table tbody th { font-weight: 700; }
.table tbody tr:last-child > td,
.table tbody tr:last-child > th { border-bottom: 0; }
.table tbody tr:hover > td,
.table tbody tr:hover > th { background: var(--surface-2); }
.table th.num,
.table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table td.num .input { text-align: right; }

.table tr.is-selected > td,
.table tr.is-selected > th,
.table tr.is-selected:hover > td { background: var(--c-soft); }
.table tr.is-selected > :first-child { box-shadow: inset 4px 0 0 0 var(--c); }

.table tr.is-group > td,
.table tr.is-group > th {
  padding-top: 10px;
  padding-bottom: 7px;
  font-weight: 800;
  color: var(--text);
  background: var(--surface-2);
  border-bottom: var(--bw-thin) solid var(--line);
}
.table tbody tr.is-group:not(:first-child) > td,
.table tbody tr.is-group:not(:first-child) > th { border-top: var(--bw-thin) solid var(--line); }

.table tr.is-total > td,
.table tr.is-total > th,
.table tfoot td,
.table tfoot th {
  font-weight: 800;
  color: var(--on-candy);
  background: var(--yellow);
  border-top: var(--bw) solid var(--line);
  border-bottom: 0;
}
.table tr.is-total:hover > td { background: var(--yellow); }

.table td.cell-input { padding: 2px 4px; }
.table td.cell-input .input,
.table td.cell-input .input-wrap.number {
  height: 30px;
  background: transparent;
  border-color: transparent;
  border-radius: var(--r-xs);
  box-shadow: none;
}
.table td.cell-input .input-wrap.number .input { height: 100%; border: 0; }
.table td.cell-input .input:hover,
.table td.cell-input .input-wrap.number:hover { background: var(--field-bg); border-color: var(--border); }
.table td.cell-input .input:focus,
.table td.cell-input .input-wrap.number:focus-within {
  background: var(--field-bg);
  border-color: var(--field-line);
  outline: 2px solid var(--focus);
  outline-offset: -1px;
}
.table td.cell-input .input-wrap.number .input:focus { outline: none; }

.table-compact { font-size: 12.5px; }
.table-compact th,
.table-compact td { padding: 5px 8px; }
.table-compact td.cell-input { padding: 1px 2px; }
.table-compact td.cell-input .input,
.table-compact td.cell-input .input-wrap.number { height: 26px; }

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

.list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 7px 10px;
  font: inherit;
  text-align: left;
  text-decoration: none;
  color: var(--text);
  background: transparent;
  border: var(--bw) solid transparent;
  border-radius: var(--r-sm);
  transition: background-color 100ms ease;
}
:is(button, a).list-item,
.list-item[role="button"],
.list-item[tabindex] { cursor: pointer; }
.list-item:hover { background: var(--hover); }
.list-item.is-active {
  background: var(--c-soft);
  border-color: var(--line);
  box-shadow: 2px 2px 0 0 var(--shadow-color);
}
.list-item-title {
  display: block;
  min-width: 0;
  font-weight: 700;
  font-size: 13.5px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-item-sub {
  display: block;
  min-width: 0;
  margin-top: 1px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-item-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

/* ----- split panes ----- */

.split {
  display: flex;
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}
.split-side {
  display: flex;
  flex-direction: column;
  flex: 0 0 300px;
  width: 300px;
  min-height: 0;
  overflow: auto;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.split-main {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

/* ----- grids ----- */

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--s-4);
}
.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: var(--s-4);
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px var(--s-4);
  align-items: start;
}
.form-grid > .span-2,
.grid-3 > .span-2,
.grid-4 > .span-2 { grid-column: span 2; }
.form-grid > .span-2 { grid-column: 1 / -1; }

/* ----- containers ----- */

.panel {
  min-width: 0;
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.tray {
  min-width: 0;
  padding: var(--s-3);
  background: var(--surface-sunken);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: inset 0 2px 0 0 color-mix(in srgb, var(--line) 8%, transparent);
}
.callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 11px 14px 11px 18px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text);
  background: var(--c-soft);
  border: var(--bw-thin) solid var(--line);
  border-radius: var(--r-md);
  box-shadow: inset 6px 0 0 0 var(--c);
}
.callout > .icon {
  flex: none;
  margin-top: 1px;
  color: var(--c-ink);
}
.callout > :not(.icon) { min-width: 0; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  height: 22px;
  padding: 0 9px;
  font: 700 11.5px/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text-2);
  background: var(--surface-sunken);
  border: var(--bw-thin) solid transparent;
  border-radius: var(--r-pill);
  vertical-align: middle;
}
.pill[data-color] {
  color: var(--text);
  background: var(--c-soft);
  border-color: var(--c);
}
.hint {
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.45;
  color: var(--text-muted);
}
.hint > .icon { margin: -2px 4px 0 0; }
.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.legend-item[data-color]:not(:has(.dot))::before {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  background: var(--c);
  border: var(--bw-thin) solid var(--line);
  border-radius: 4px;
}

/* =============================================================== 11. STRIPBOARD PIECES */

/* 34px rows: soft body, saturated edge tab with the scene number, hairline column rules, no shadow */
.strip {
  display: flex;
  align-items: stretch;
  min-width: 0;
  min-height: 34px;
  font-size: 13px;
  color: var(--text);
  background: var(--c-soft);
  border-bottom: var(--bw-thin) solid var(--line);
  cursor: grab;
}
.strip:hover { filter: brightness(0.97) saturate(1.12); }
.strip:active { cursor: grabbing; }
.strip:focus-visible { outline-offset: -3px; }
.strip.is-selected { box-shadow: inset 0 0 0 2px var(--focus); }
.strip.is-dragging { cursor: grabbing; }
.strip-edge {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  min-width: 46px;
  padding: 0 8px;
  font: 800 14px/1 var(--font-ui);
  font-variant-numeric: tabular-nums;
  color: var(--on-candy);
  background: var(--c);
  border-right: var(--bw-thin) solid var(--line);
}
.strip-main {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 10px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.strip-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--text-2);
  border-left: 1px solid var(--strip-rule);
}
.daybreak {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 32px;
  padding: 0 12px 0 14px;
  font: 600 13.5px/1.1 var(--font-display);
  letter-spacing: 0.01em;
  color: var(--daybreak-fg);
  background: var(--daybreak-bg);
  border-bottom: var(--bw-thin) solid var(--line);
}
.banner-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 34px;
  padding: 0 12px 0 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--on-candy);
  background: var(--c);
  background: repeating-linear-gradient(
    -45deg,
    var(--c) 0 10px,
    color-mix(in srgb, var(--c) 68%, var(--paper)) 10px 20px
  );
  border-bottom: var(--bw-thin) solid var(--line);
}

/* =============================================================== 12. CANVAS PIECES, INSPECTOR */

.canvas-well {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background-color: var(--surface-sunken);
  background-image: radial-gradient(var(--canvas-dot) 1.1px, transparent 1.4px);
  background-size: 18px 18px;
  border: var(--bw) solid var(--line);
  border-radius: var(--r-md);
}
.float-panel {
  position: absolute;
  z-index: 5;
  min-width: 0;
  padding: 10px;
  color: var(--text);
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
}
.tool-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: none;
  padding: 5px;
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.tool-rail.row { flex-direction: row; }
.tool-btn {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--text-2);
  background: transparent;
  border: var(--bw) solid transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background-color 100ms ease, transform 80ms ease-out;
}
.tool-btn:hover { color: var(--text); background: var(--hover); }
.tool-btn:active { transform: translate(1px, 1px); }
.tool-btn.is-active {
  color: var(--on-candy);
  background: var(--c);
  border-color: var(--line);
  box-shadow: 1.5px 1.5px 0 0 var(--shadow-color);
}
.tool-btn:disabled { opacity: 0.4; background: transparent; cursor: not-allowed; }

.inspector {
  display: flex;
  flex-direction: column;
  min-width: 0;
  font-size: 13px;
}
.inspector-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 14px var(--s-4) var(--s-4);
  border-bottom: 1px solid var(--border);
}
.inspector-section:last-child { border-bottom: 0; }
.inspector-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font: 800 10.5px/1.2 var(--font-ui);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* =============================================================== 13. RESPONSIVE */

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

@media (max-width: 860px) {
  .page-head { padding-right: var(--s-4); }
}
/* phones: the title keeps the first row; the page's buttons and tabs get a row of their own */
@media (max-width: 600px) {
  .page-head { flex-wrap: wrap; row-gap: 10px; min-height: 0; padding-top: 10px; padding-bottom: 10px; }
  .page-title { font-size: 21px; }
  .page-icon { width: 36px; height: 36px; border-radius: 11px; }
  .page-actions { flex: 1 1 100%; justify-content: flex-start; margin-left: 0; }
}
@media (max-width: 860px) {
  .page-toolbar { padding-left: var(--s-4); padding-right: var(--s-4); }
  .page-body { padding: var(--s-4) var(--s-4) var(--s-6); }
  .page-flush .page-body { padding: 0; }
  /* narrow: the aside drops below the content */
  .page-main { flex-direction: column; }
  .page-aside {
    /* !important: Page sets the aside width inline for wide screens */
    width: auto !important;
    max-width: none;
    max-height: 45%;
    border-left: 0;
    border-top: var(--bw) solid var(--line);
  }
  .split { flex-direction: column; }
  .split-side {
    flex: 0 0 auto;
    width: auto;
    max-height: 40%;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

@media (max-width: 700px) {
  .grid-2,
  .grid-3,
  .grid-4,
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .grid-3 > .span-2,
  .grid-4 > .span-2,
  .form-grid > .span-2 { grid-column: auto; }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .field-row .field-hint,
  .field-row .field-error { grid-column: 1; }
  .modal-backdrop { padding: var(--s-3); }
}

/* =============================================================== COLOUR KEY */
.legend.is-compact { gap: 4px 10px; font-size: 11px; }
.ck { display: grid; gap: 18px; }
.ck-group { display: grid; gap: 6px; }
.ck-title { margin: 0; font-family: var(--font-display, inherit); font-size: 16px; font-weight: 700; color: var(--text); }
.ck-text { margin: 0; font-size: var(--fs-sm, 13px); color: var(--text-muted); max-width: 62ch; }
.ck .legend { gap: 8px 16px; font-size: 13px; }
/* the INT Day strip is white: show white, not the grey outline colour */
.legend-item[data-color="white"]:not(:has(.dot))::before { background: var(--strip-white, #fff); }
/* INT Day is white wherever a strip colour fills a swatch or bar */
.ins-split-seg[data-color="white"], .ins-swatch[data-color="white"], .ins-len-bar[data-color="white"], .ins-scene-chip[data-color="white"] { background: var(--strip-white, #fff); box-shadow: inset 0 0 0 1.5px var(--line); }
