/* =====================================================================
   Nested tracks — CSS additions on top of styles.css.
   Loads AFTER styles.css. All rules are scoped to .nest / .child-row / .ctxmenu.
   ===================================================================== */

/* ===================================================================
   Parent row affordance: small "5 stems" chip
   =================================================================== */
.row__nest-chip {
  display: inline-flex; align-items: center; gap: 6px;
  margin-left: 8px;
  padding: 3px 6px 3px 8px;
  border-radius: 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line-strong);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(0);
  transition: opacity 140ms ease, background 140ms ease, color 140ms ease, border-color 140ms ease;
}
.row:hover .row__nest-chip,
.row--hover .row__nest-chip,
.row--expanded .row__nest-chip {
  opacity: 1;
}
.row__nest-chip:hover {
  background: rgba(255,255,255,0.08);
  color: var(--text);
}
.row__nest-chip .icon { color: var(--text-mute); }
.row__nest-chip__caret {
  display: inline-grid; place-items: center;
  color: var(--text-mute);
  margin-left: -2px;
}
.row--expanded .row__nest-chip {
  background: var(--accent-soft);
  border-color: oklch(0.74 0.14 var(--accent-hue) / 0.35);
  color: oklch(0.86 0.05 var(--accent-hue));
}
.row--expanded .row__nest-chip .icon,
.row--expanded .row__nest-chip__caret { color: oklch(0.86 0.05 var(--accent-hue)); }

/* small 'has-children' indicator on the right edge of parent row when collapsed */
.row__expand-bar {
  position: absolute;
  left: 4px; top: 50%;
  width: 8px; height: 28px;
  transform: translateY(-50%);
  display: grid; place-items: center;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  z-index: 4;
}
.row__expand-bar::before {
  content: "";
  display: block;
  width: 3px; height: 16px;
  border-radius: 2px;
  background: var(--line-strong);
  transition: background 160ms ease, height 160ms ease, box-shadow 160ms ease;
}
.row__expand-bar:hover::before,
.row:hover .row__expand-bar::before {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.row--expanded .row__expand-bar::before {
  height: 24px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
/* legacy ::before bar — replaced by the clickable .row__expand-bar above. */
.row--has-children:not(.row--expanded)::before { display: none; }
.row--has-children.row--expanded::before { display: none; }

/* ===================================================================
   Child rows
   =================================================================== */
.nest > .row,
.nest .child-row {
  flex-wrap: nowrap;
}

.nest > .row .cell--title,
.nest .child-row .cell--title {
  flex: 1 1 280px;
  min-width: 0;
  overflow: hidden;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.nest > .row .row__title,
.nest .child-row .row__title,
.nest .child-row .row__title--child {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nest .row__lead,
.nest .row__num,
.nest .row__nest-chip,
.nest .row__chip,
.nest .row__primary-pill,
.nest .child-row__kind,
.nest .child-row__gen {
  flex: 0 0 auto;
  white-space: nowrap;
}

.nest .row__primary-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  margin-left: 8px;
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid color-mix(in oklch, var(--accent) 42%, transparent);
  background: color-mix(in oklch, var(--accent) 12%, transparent);
  color: oklch(0.86 0.05 var(--accent-hue));
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nest .row__primary-pill--child {
  height: 18px;
  padding: 0 6px;
}

.nest .row__waveform {
  min-width: 80px;
  overflow: hidden;
}

.nest__cat-hdr {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 6px 28px 6px 56px;
  background: transparent; border: 0;
  color: var(--text-mute); font: inherit;
  text-transform: uppercase; letter-spacing: 0.08em;
  font-size: 10.5px; font-weight: 600;
  cursor: pointer;
  border-top: 1px solid var(--line);
  transition: color 120ms, background 120ms;
}
.nest__cat-hdr:hover { color: var(--text); background: rgba(255,255,255,0.02); }
.nest__cat-hdr svg { width: 12px; height: 12px; opacity: 0.7; }
.nest__cat-hdr__label { flex-shrink: 0; }
.nest__cat-hdr__count {
  margin-left: auto;
  font-size: 10px;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.nest__cat-hdr.is-collapsed { color: var(--text-mute); }
.nest__children {
  position: relative;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.012) 0%,
    rgba(255,255,255,0.018) 100%
  );
  animation: nest-open 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
  overflow: hidden;
}
@keyframes nest-open {
  from { opacity: 0; transform: translateY(-4px); max-height: 0; }
  to   { opacity: 1; transform: translateY(0);    max-height: 600px; }
}

.child-row {
  display: flex; align-items: center;
  padding: 0 18px;
  height: 44px;
  border-bottom: 1px solid var(--line);
  position: relative;
  isolation: isolate;
  font-size: 12.5px;
  color: var(--text-dim);
  transition: background 200ms ease, opacity 200ms ease;
}
.child-row:last-child { border-bottom-color: transparent; }
.child-row .cell { font-size: 12.5px; color: var(--text-mute); }
.child-row .cell--child { padding: 0 12px; }

/* INDENT child content past the connector zone (connector spans ~6px → 50px) */
.child-row .cell--title.cell--child {
  padding-left: 56px;
}

.row__lead--child  { color: var(--text-mute); width: 18px; height: 18px; }
.row__num--child   { font-size: 10.5px; color: var(--text-mute); opacity: 0.7; }
.row__title--child { color: var(--text-dim); font-weight: 500; font-size: 12.5px; }

.child-row__kind {
  display: inline-block;
  margin-left: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.04);
  color: var(--text-mute);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

.child-row__stemtype {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid color-mix(in oklch, var(--accent) 30%, transparent);
  background: color-mix(in oklch, var(--accent) 9%, transparent);
  color: color-mix(in oklch, var(--accent) 72%, var(--text-dim));
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}

.tag--child {
  opacity: 0.55;
  filter: saturate(0.7);
}

/* hovered child */
.child-row--hover .row__title--child { color: oklch(0.92 0.05 var(--ah, 50)); }
.child-row--hover .child-row__kind { color: var(--text-dim); }
.child-row--hover .child-row__stemtype { color: var(--text); }
.child-row--hover { z-index: 3; }
.child-row--tint {
  background: linear-gradient(
    90deg,
    color-mix(in oklch, var(--accent) 6%, transparent) 0%,
    color-mix(in oklch, var(--accent) 3%, transparent) 50%,
    transparent 100%
  );
}

/* shrinkable cells on child rows (hide some details on narrow viewports) */
@media (max-width: 1280px) {
  .child-row .cell:nth-child(3),
  .child-row .cell:nth-child(4) {
    color: transparent;
  }
}

/* dim siblings under hover */
.tbody--dimming .child-row:not(.child-row--hover) {
  opacity: 0.42;
  filter: saturate(0.7);
}

/* ===================================================================
   Connector graphics (variations live below)
   =================================================================== */
.child-row__connector {
  position: absolute;
  left: 22px;       /* sits in the 56px indent gutter, before the child lead-icon */
  top: 0;
  bottom: 0;
  width: 36px;
  pointer-events: none;
  z-index: 1;
}
.child-row__connector-bar,
.child-row__connector-stub,
.child-row__connector-dot {
  display: none;    /* opt-in per connector style */
}

/* ---------- 1. NONE — pure indent ---------- */
.tbody--connector-none .child-row__connector { display: none; }

/* ---------- 2. LINE — single vertical line down the left ---------- */
.tbody--connector-line .child-row__connector-bar {
  display: block;
  position: absolute;
  left: 11px; top: 0; bottom: 0;
  width: 1.5px;
  background: var(--line-strong);
}
/* draw extension into the gap between rows so it doesn't break */
.tbody--connector-line .child-row--last .child-row__connector-bar {
  bottom: 50%;
}

/* ---------- 3. BRACKET — L per child, vertical line continues ---------- */
.tbody--connector-bracket .child-row__connector-bar {
  display: block;
  position: absolute;
  left: 11px; top: 0;
  width: 1.5px;
  height: 50%;
  background: var(--line-strong);
}
.tbody--connector-bracket .child-row:not(.child-row--last) .child-row__connector-bar {
  height: 100%;
}
.tbody--connector-bracket .child-row__connector-stub {
  display: block;
  position: absolute;
  left: 11px; top: 50%;
  width: 14px; height: 1.5px;
  background: var(--line-strong);
  border-bottom-left-radius: 0;
}
.tbody--connector-bracket .child-row--last .child-row__connector-bar {
  border-bottom-left-radius: 6px;
}
.tbody--connector-bracket .child-row__connector-dot {
  display: block;
  position: absolute;
  left: 24px; top: 50%;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--text-mute);
  transform: translate(-50%, -50%);
}
.tbody--connector-bracket .child-row--hover .child-row__connector-bar,
.tbody--connector-bracket .child-row--hover .child-row__connector-stub {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}
.tbody--connector-bracket .child-row--hover .child-row__connector-dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

/* ---------- 4. DOTTED ---------- */
.tbody--connector-dotted .child-row__connector-bar {
  display: block;
  position: absolute;
  left: 11px; top: 0; bottom: 0;
  width: 1.5px;
  background-image: linear-gradient(
    to bottom,
    var(--line-strong) 0,
    var(--line-strong) 4px,
    transparent 4px,
    transparent 8px
  );
  background-size: 1.5px 8px;
  background-repeat: repeat-y;
}
.tbody--connector-dotted .child-row__connector-dot {
  display: block;
  position: absolute;
  left: 11px; top: 50%;
  width: 14px; height: 1.5px;
  background-image: linear-gradient(
    to right,
    var(--line-strong) 0,
    var(--line-strong) 3px,
    transparent 3px,
    transparent 6px
  );
  background-size: 6px 1.5px;
  background-repeat: repeat-x;
  transform: translateY(-50%);
}
.tbody--connector-dotted .child-row--last .child-row__connector-bar {
  bottom: 50%;
}

/* ---------- 5. GRADIENT — vertical line that fades to nothing ---------- */
.tbody--connector-gradient .child-row__connector-bar {
  display: block;
  position: absolute;
  left: 11px; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(
    180deg,
    var(--accent) 0%,
    color-mix(in oklch, var(--accent) 35%, transparent) 30%,
    color-mix(in oklch, var(--accent) 12%, transparent) 70%,
    transparent 100%
  );
  opacity: 0.55;
  filter: blur(0.2px);
}
.tbody--connector-gradient .child-row__connector-stub {
  display: block;
  position: absolute;
  left: 11px; top: 50%;
  width: 18px; height: 1.5px;
  background: linear-gradient(
    90deg,
    color-mix(in oklch, var(--accent) 50%, transparent),
    transparent 100%
  );
  transform: translateY(-50%);
}

/* ---------- 6. TREE — solid line with end-cap circle ---------- */
.tbody--connector-tree .child-row__connector-bar {
  display: block;
  position: absolute;
  left: 11px; top: 0;
  width: 1.5px;
  background: var(--line-strong);
  height: 100%;
}
.tbody--connector-tree .child-row--last .child-row__connector-bar {
  height: 50%;
  border-bottom-left-radius: 999px;
}
.tbody--connector-tree .child-row__connector-stub {
  display: block;
  position: absolute;
  left: 11px; top: 50%;
  width: 12px; height: 1.5px;
  background: var(--line-strong);
}
.tbody--connector-tree .child-row__connector-dot {
  display: block;
  position: absolute;
  left: 23px; top: 50%;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--line-strong);
  transform: translate(-50%, -50%);
}
.tbody--connector-tree .child-row--hover .child-row__connector-dot {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}

/* ===================================================================
   Filter bar — extras for nested page
   =================================================================== */
.filterbar__spacer { flex: 1; }
.filterbar__hint {
  font-size: 11px;
  color: var(--text-mute);
  display: flex; align-items: center; gap: 4px;
}
.filterbar__hint kbd {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-3);
  color: var(--text-dim);
  border: 1px solid var(--line-strong);
  box-shadow: 0 1px 0 #0006 inset;
}
.chip--ghost {
  border: 1px dashed var(--line-strong);
  color: var(--text-dim);
}
.chip--ghost:hover {
  border-style: solid;
  background: var(--bg-3);
}

/* ===================================================================
   Right-click context menu
   =================================================================== */
.ctxmenu {
  position: fixed;
  z-index: var(--z-overlay, 12000);
  width: 240px;
  background: rgba(20, 20, 24, 0.94);
  backdrop-filter: blur(14px) saturate(1.4);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.55),
    0 4px 12px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  padding: 6px;
  animation: ctxmenu-in 140ms cubic-bezier(0.2, 0.8, 0.2, 1);
  transform-origin: top left;
}
@keyframes ctxmenu-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}
.ctxmenu__header {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px 8px;
  font-size: 12px;
}
.ctxmenu__num {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  color: var(--text-mute);
}
.ctxmenu__title {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ctxmenu__sep {
  height: 1px;
  margin: 4px 6px;
  background: var(--line);
}
.ctxmenu__item {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--text);
  text-align: left;
  transition: background 100ms ease, color 100ms ease;
}
.ctxmenu__item:hover {
  background: var(--bg-3);
}
.ctxmenu__item .icon {
  color: var(--text-dim);
}
.ctxmenu__item:hover .icon { color: var(--text); }
.ctxmenu__kbd {
  margin-left: auto;
  font-size: 10px;
  font-family: "JetBrains Mono", monospace;
  color: var(--text-mute);
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-3);
}
.ctxmenu__item--accent {
  color: oklch(0.88 0.07 var(--accent-hue));
  background: var(--accent-soft);
}
.ctxmenu__item--accent .icon { color: var(--accent); }
.ctxmenu__item--accent:hover {
  background: oklch(0.74 0.14 var(--accent-hue) / 0.22);
}
.ctxmenu__item--danger {
  color: oklch(0.78 0.16 var(--accent-hue));
}
.ctxmenu__item--danger .icon { color: oklch(0.78 0.16 var(--accent-hue)); }
.ctxmenu__item--danger:hover {
  background: oklch(0.4 0.14 var(--accent-hue) / 0.25);
}
.ctxmenu__item--disabled {
  color: var(--text-mute);
  pointer-events: none;
}

/* ---------- LIGHT MODE ---------- */
:root[data-theme="light"] .ctxmenu {
  background: rgba(252, 248, 240, 0.96);
  border-color: var(--line-strong);
  box-shadow:
    0 16px 40px rgba(60, 40, 20, 0.18),
    0 4px 12px rgba(60, 40, 20, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
}
:root[data-theme="light"] .ctxmenu__title { color: var(--text); }
:root[data-theme="light"] .ctxmenu__num { color: var(--text-mute); }
:root[data-theme="light"] .ctxmenu__sep { background: var(--line); }
:root[data-theme="light"] .ctxmenu__item { color: var(--text); }
:root[data-theme="light"] .ctxmenu__item .icon { color: var(--text-dim); }
:root[data-theme="light"] .ctxmenu__item:hover { background: rgba(0, 0, 0, 0.06); }
:root[data-theme="light"] .ctxmenu__item:hover .icon { color: var(--text); }
:root[data-theme="light"] .ctxmenu__item--accent {
  color: oklch(0.36 0.14 var(--accent-hue));
  background: oklch(0.74 0.14 var(--accent-hue) / 0.18);
}
:root[data-theme="light"] .ctxmenu__item--accent .icon { color: var(--accent); }
:root[data-theme="light"] .ctxmenu__item--accent:hover {
  background: oklch(0.74 0.14 var(--accent-hue) / 0.28);
}
:root[data-theme="light"] .ctxmenu__item--danger { color: oklch(0.48 0.18 var(--accent-hue)); }
:root[data-theme="light"] .ctxmenu__item--danger .icon { color: oklch(0.55 0.20 var(--accent-hue)); }
:root[data-theme="light"] .ctxmenu__item--danger:hover {
  background: oklch(0.78 0.16 var(--accent-hue) / 0.18);
}
:root[data-theme="light"] .ctxmenu__item--disabled { color: var(--text-mute); }
:root[data-theme="light"] .ctxmenu__kbd {
  background: rgba(0, 0, 0, 0.06);
  border-color: var(--line);
  color: var(--text-mute);
}
:root[data-theme="light"] .ctxmenu__group-label { color: var(--text-mute); }
  opacity: 0.55;
}

/* ===================================================================
   Tooltip variant for nested
   =================================================================== */
.preview-tooltip--nested .preview-tooltip__label {
  font-variant-numeric: tabular-nums;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===================================================================
   Nested editor modal
   =================================================================== */
.nested-editor {
  position: fixed;
  inset: 0;
  z-index: 10080;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  color: var(--text);
}
.nested-editor__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(18px);
}
.nested-editor__panel {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100vw - 32px));
  height: min(780px, calc(100dvh - 32px));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), transparent 34%),
    #101010;
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.62);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.nested-editor__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.nested-editor__head-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.nested-editor__eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 7px;
}
.nested-editor__head h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: 0;
}
.nested-editor__head p {
  margin: 7px 0 0;
  color: var(--text-mute);
  font-size: 13px;
}
.nested-editor__close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(255, 255, 255, 0.7);
}
.nested-editor__close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.nested-editor__done {
  height: 36px;
  padding: 0 15px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent, #19d3ff) 42%, rgba(255, 255, 255, 0.14));
  background: color-mix(in srgb, var(--accent, #19d3ff) 18%, rgba(255, 255, 255, 0.06));
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}
.nested-editor__done:hover {
  background: color-mix(in srgb, var(--accent, #19d3ff) 28%, rgba(255, 255, 255, 0.08));
  border-color: color-mix(in srgb, var(--accent, #19d3ff) 60%, rgba(255, 255, 255, 0.2));
}
.nested-editor__grid {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
}
.nested-editor__main,
.nested-editor__library {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}
.nested-editor__library {
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.025);
}
.nested-editor__section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nested-editor__section-head strong {
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-mute);
  font-size: 11px;
}
.nested-editor__versions,
.nested-editor__candidates {
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nested-editor__version {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}
.nested-editor__version.is-primary {
  border-color: oklch(0.7 0.12 var(--accent-hue) / 0.42);
}
.nested-editor__version.is-dragging {
  opacity: 0.62;
  outline: 1px solid oklch(0.7 0.12 var(--accent-hue) / 0.5);
}
.nested-editor__version-play {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text);
  padding: 0;
}
.nested-editor__version-icon,
.nested-editor__candidate-art {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
}
.nested-editor__version-main,
.nested-editor__candidate span:last-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nested-editor__version-main span,
.nested-editor__candidate strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nested-editor__version-main small,
.nested-editor__candidate small {
  color: var(--text-mute);
  font-size: 12px;
}
.nested-editor__version-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
}
.nested-editor__version-actions button {
  min-height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
}
.nested-editor__version-actions button:hover {
  border-color: oklch(0.7 0.12 var(--accent-hue) / 0.48);
  background: oklch(0.35 0.08 var(--accent-hue) / 0.2);
}
.nested-editor__version-actions button.is-danger {
  color: #ff9a9a;
}
.nested-editor__version-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.nested-editor__chip {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font-size: 11px;
}
.nested-editor__drop {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-radius: 16px;
  padding: 18px;
  border: 1px dashed oklch(0.72 0.13 var(--accent-hue) / 0.52);
  background: oklch(0.35 0.06 var(--accent-hue) / 0.18);
}
.nested-editor__drop.is-over {
  border-color: var(--accent);
  background: oklch(0.45 0.09 var(--accent-hue) / 0.28);
}
.nested-editor__drop > .icon {
  width: 40px;
  height: 40px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
}
.nested-editor__drop strong,
.nested-editor__drop span {
  display: block;
}
.nested-editor__drop span {
  margin-top: 3px;
  color: var(--text-mute);
  font-size: 13px;
}
.nested-editor__drop button,
.nested-editor__ai-btn {
  min-height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 0 14px;
}
.nested-editor__drop button:hover,
.nested-editor__ai-btn:hover,
.nested-editor__candidate:hover {
  background: rgba(255, 255, 255, 0.1);
}
.nested-editor__ai {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.nested-editor__ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nested-editor__ai-btn small {
  margin-left: 4px;
  color: var(--accent);
  font-size: 11px;
}
.nested-editor__search {
  width: 100%;
  min-height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.24);
  color: var(--text);
  padding: 0 12px;
  font-size: 16px;
}
.nested-editor__upsell {
  border-radius: 12px;
  padding: 12px;
  background: oklch(0.38 0.08 var(--accent-hue) / 0.22);
  border: 1px solid oklch(0.72 0.12 var(--accent-hue) / 0.24);
}
.nested-editor__upsell strong,
.nested-editor__upsell span {
  display: block;
}
.nested-editor__upsell span {
  margin-top: 4px;
  color: var(--text-mute);
  font-size: 12px;
}
.nested-editor__candidate {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  padding: 9px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
}
.nested-editor__library.is-locked .nested-editor__candidate {
  opacity: 0.55;
}
.nested-editor__empty {
  border-radius: 12px;
  padding: 16px;
  color: var(--text-mute);
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
}
@media (max-width: 760px) {
  .nested-editor {
    padding: 0;
    place-items: stretch;
  }
  .nested-editor__panel {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }
  .nested-editor__head {
    padding-top: max(18px, env(safe-area-inset-top));
  }
  .nested-editor__grid {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .nested-editor__main,
  .nested-editor__library {
    min-height: auto;
  }
  .nested-editor__library {
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
  }
  .nested-editor__drop {
    grid-template-columns: 40px minmax(0, 1fr);
  }
  .nested-editor__version {
    flex-wrap: wrap;
  }
  .nested-editor__version-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .nested-editor__drop button {
    grid-column: 1 / -1;
  }
}
