/* BioStudio AI — searchable picker (project context bar) */

.searchable-picker {
  position: relative;
  flex: 0 1 auto;
  min-width: 128px;
  max-width: 240px;
}

.searchable-picker-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  min-width: 128px;
  max-width: 200px;
  height: 23px;
  flex: 0 1 180px;
  cursor: pointer;
  text-align: left;
  border: 1px solid var(--win-border);
  border-radius: 5px;
  padding: 2px 7px;
  background: var(--win-body-bg);
  color: var(--ink);
  font-size: 12px;
  box-sizing: border-box;
}

.searchable-picker-trigger-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.searchable-picker-chevron {
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--ink-soft);
  line-height: 1;
  transition: transform 0.12s ease;
}

.searchable-picker-trigger.is-open .searchable-picker-chevron {
  transform: rotate(180deg);
}

.searchable-picker-trigger.is-placeholder .searchable-picker-trigger-label {
  color: var(--ink-soft);
}

.searchable-picker-trigger:disabled {
  opacity: .72;
  cursor: not-allowed;
}

/* Guide the eye to the next required control in project → subgroup → name. */
.searchable-picker.is-next-step .searchable-picker-trigger {
  border-color: var(--ctx-accent);
  background: color-mix(in srgb, var(--ctx-accent) 28%, var(--win-body-bg));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ctx-accent) 40%, transparent);
  animation: project-context-next-step-blink 0.85s step-start infinite;
}

.project-context-label:has(+ .searchable-picker.is-next-step),
.project-context-name-section.is-next-step > .project-context-label {
  color: var(--ctx-accent);
  font-weight: 700;
  animation: project-context-next-step-label-blink 0.85s step-start infinite;
}

.project-context-name-section.is-next-step:not(.is-inactive) {
  opacity: 1;
}

.project-context-new-name-input.is-next-step,
.project-context-new-name-row.is-next-step .project-context-new-name-input {
  border-color: var(--ctx-accent);
  background: color-mix(in srgb, var(--ctx-accent) 28%, var(--win-body-bg));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ctx-accent) 40%, transparent);
  animation: project-context-next-step-blink 0.85s step-start infinite;
}

@keyframes project-context-next-step-blink {
  0%, 49% {
    border-color: var(--ctx-accent);
    background: color-mix(in srgb, var(--ctx-accent) 32%, var(--win-body-bg));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ctx-accent) 45%, transparent);
  }
  50%, 100% {
    border-color: var(--win-border);
    background: var(--win-body-bg);
    box-shadow: none;
  }
}

@keyframes project-context-next-step-label-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.35; }
}

@media (prefers-reduced-motion: reduce) {
  .searchable-picker.is-next-step .searchable-picker-trigger,
  .project-context-new-name-input.is-next-step,
  .project-context-new-name-row.is-next-step .project-context-new-name-input,
  .project-context-label:has(+ .searchable-picker.is-next-step),
  .project-context-name-section.is-next-step > .project-context-label {
    animation: none;
  }
}

/* Portaled to document.body — fixed position set in JS */
.searchable-picker-panel {
  position: fixed;
  z-index: 10050;
  min-width: 160px;
  max-width: min(320px, 92vw);
  background: var(--win-body-bg);
  border: 1px solid var(--win-border);
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .18);
  padding: 4px;
  box-sizing: border-box;
}

.searchable-picker-search-row {
  padding-bottom: 4px;
  border-bottom: 1px solid var(--win-border);
  margin-bottom: 4px;
}

.searchable-picker-search {
  width: 100%;
  height: 26px;
  border: 1px solid var(--win-border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  box-sizing: border-box;
  background: var(--win-body-bg);
  color: var(--ink);
}

.searchable-picker-list {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.searchable-picker-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  width: 100%;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  padding: 5px 8px;
  text-align: left;
  cursor: pointer;
}

.searchable-picker-option:hover,
.searchable-picker-option[aria-selected="true"] {
  background: color-mix(in srgb, var(--accent, #2a78d6) 12%, transparent);
}

.searchable-picker-option.selected {
  font-weight: 600;
}

.searchable-picker-option.inactive {
  color: #7a808a;
  background: rgba(148, 163, 184, 0.08);
  cursor: not-allowed;
}

.searchable-picker-option.inactive:hover,
.searchable-picker-option.inactive[aria-selected="true"] {
  background: rgba(148, 163, 184, 0.1);
}

.searchable-picker-option.inactive .searchable-picker-option-label,
.searchable-picker-option.inactive .searchable-picker-option-meta {
  opacity: 0.68;
}

.searchable-picker-option-badge {
  align-self: flex-end;
  margin-top: -16px;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(107, 114, 128, 0.14);
  color: #6b7280;
}

.searchable-picker-option.create {
  font-weight: 600;
  color: var(--accent, #2a78d6);
}

.searchable-picker-create-row {
  padding-top: 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.searchable-picker-create-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.searchable-picker-create-ok,
.searchable-picker-create-cancel {
  height: 26px;
  flex: 0 0 auto;
  border: 1px solid var(--win-border);
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 12px;
  cursor: pointer;
  background: var(--win-body-bg);
  color: var(--ink);
}

.searchable-picker-create-ok {
  border-color: var(--accent, #2a78d6);
  background: color-mix(in srgb, var(--accent, #2a78d6) 14%, var(--win-body-bg));
  font-weight: 600;
}

.searchable-picker-create-ok:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.searchable-picker-create-name {
  width: 100%;
  height: 26px;
  border: 1px solid var(--accent, #2a78d6);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 12px;
  box-sizing: border-box;
  background: var(--win-body-bg);
  color: var(--ink);
}

.searchable-picker-option-meta {
  font-size: 10px;
  color: var(--ink-soft);
}

.searchable-picker-empty {
  padding: 8px;
  font-size: 12px;
  color: var(--ink-soft);
}

.project-context-move-btn {
  height: 23px;
  flex: 0 0 auto;
  border: 1px solid var(--win-border);
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 11px;
  background: var(--win-body-bg);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}

.project-context-move-panel {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.project-context-move-panel input[type="text"],
.project-context-move-panel select {
  height: 23px;
  font-size: 12px;
  border: 1px solid var(--win-border);
  border-radius: 5px;
  padding: 2px 6px;
  background: var(--win-body-bg);
  color: var(--ink);
}

.project-context-status-section {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.project-context-status-section[hidden] {
  display: none !important;
}

.project-context-name-section {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 0;
  opacity: 1;
  transition: opacity 0.18s ease;
}

.project-context-name-section.is-inactive {
  opacity: 0.45;
  pointer-events: none;
}

.project-context-name-section.is-loading .searchable-picker-trigger {
  opacity: 0.72;
}

.project-context-name-scope {
  font-size: 10px;
  color: var(--ink-soft);
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
  min-width: 0;
}

.project-context-work-item-status-section {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.project-context-work-item-status-section[hidden] {
  display: none !important;
}

.work-item-status-select {
  height: 23px;
  flex: 0 0 auto;
  border: 1px solid var(--win-border);
  border-radius: 5px;
  padding: 2px 6px;
  background: var(--win-body-bg);
  color: var(--ink);
  font-size: 12px;
  min-width: 100px;
}

.work-item-publish-btn {
  height: 23px;
  flex: 0 0 auto;
  border: 1px solid var(--win-border);
  border-radius: 5px;
  padding: 2px 8px;
  background: var(--win-body-bg);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.project-context-private-hint {
  font-size: 10.5px;
  color: var(--ink-soft);
  font-style: italic;
  flex: 0 0 auto;
  white-space: nowrap;
}

.project-context-new-btn {
  height: 23px;
  flex: 0 0 auto;
  border: 1px solid var(--win-border);
  border-radius: 5px;
  padding: 2px 10px;
  background: var(--win-body-bg);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.project-context-new-btn:hover {
  background: var(--win-hover-bg, rgba(0, 0, 0, 0.04));
}

.project-context-new-btn.is-active {
  border-color: var(--ctx-accent);
  background: color-mix(in srgb, var(--ctx-accent) 12%, var(--win-body-bg));
  color: var(--ctx-accent);
}

/* Session actions (Duplicate / Rename / Move-Copy / Delete) — one control for
   every app; see js/platform/org/session-actions.js. */
.session-actions {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
}

.session-actions[hidden] {
  display: none;
}

.session-actions-btn {
  height: 23px;
  flex: 0 0 auto;
  border: 1px solid var(--win-border);
  border-radius: 5px;
  padding: 2px 8px;
  background: var(--win-body-bg);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.session-actions-btn:hover:not(:disabled) {
  background: var(--win-hover-bg, rgba(0, 0, 0, 0.04));
}

.session-actions-btn.is-open {
  border-color: var(--ctx-accent, var(--accent, #2f6bff));
  color: var(--ctx-accent, var(--accent, #2f6bff));
}

.session-actions-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.session-actions-menu {
  --ctx-menu-surface: var(--menu-bg, var(--flyout-bg, var(--win-body-bg, #fff)));
  position: fixed;
  z-index: 10060;
  min-width: 232px;
  max-width: 320px;
  padding: 5px;
  border: 1px solid var(--ctx-tree-line, var(--win-border));
  border-radius: 9px;
  /* Themes ship translucent surfaces; paint an opaque layer underneath so the
     menu never shows the app through it. */
  background-color: var(--win-body-bg, #fff);
  background-image: linear-gradient(var(--ctx-menu-surface), var(--ctx-menu-surface));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.session-actions-menu[hidden] {
  display: none;
}

.session-actions-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 6px 9px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.session-actions-item:hover:not(:disabled) {
  background: var(--ctx-hover, var(--menu-hover, color-mix(in srgb, var(--ink) 6%, transparent)));
}

.session-actions-item.is-danger:not(:disabled) {
  color: var(--ctx-danger, #d03b3b);
}

.session-actions-item:disabled {
  opacity: 0.55;
  cursor: default;
}

.session-actions-item-label {
  font-weight: 600;
}

.session-actions-item-note {
  font-size: 10.5px;
  font-weight: 400;
  color: var(--ink-soft);
  white-space: normal;
}

/* Dialogs shared by the actions above. */
.session-action-dialog {
  width: min(460px, calc(100vw - 32px));
}

.session-action-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
}

.session-action-field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-soft);
}

.session-action-field-hint {
  font-size: 10.5px;
  color: var(--ink-soft);
}

.session-action-error {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--ctx-danger, #d03b3b);
}

.session-action-error[hidden] {
  display: none;
}

.session-action-foot {
  display: flex;
  align-items: center;
  gap: 8px;
}

.session-action-foot-spacer {
  flex: 1 1 auto;
}

.session-action-modes {
  display: inline-flex;
  gap: 6px;
}

.session-action-mode {
  border: 1px solid var(--win-border);
  border-radius: 6px;
  padding: 4px 14px;
  background: var(--win-body-bg);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.session-action-mode[aria-pressed="true"] {
  border-color: var(--ctx-accent, var(--accent, #2f6bff));
  background: color-mix(in srgb, var(--ctx-accent, var(--accent, #2f6bff)) 14%, var(--win-body-bg));
  color: var(--ctx-accent, var(--accent, #2f6bff));
}

/* Unsaved draft: the one affordance for filing a session without closing it. */
.project-context-save-draft-btn {
  height: 23px;
  flex: 0 0 auto;
  border: 1px solid color-mix(in srgb, var(--ctx-warn, #c98a12) 55%, transparent);
  border-radius: 5px;
  padding: 2px 10px;
  background: color-mix(in srgb, var(--ctx-warn, #c98a12) 14%, var(--win-body-bg));
  color: var(--ctx-warn, #c98a12);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.project-context-save-draft-btn:hover {
  background: color-mix(in srgb, var(--ctx-warn, #c98a12) 24%, var(--win-body-bg));
}

.project-context-save-draft-btn[hidden] {
  display: none;
}

/* Save-this-session dialog (js/platform/org/save-draft-session-modal.js). */
.save-draft-dialog {
  width: min(480px, 94vw);
}

.save-draft-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.save-draft-field-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-soft, #5d6470);
}

.save-draft-field .searchable-picker {
  width: 100%;
}

.save-draft-error {
  margin: 0;
  font-size: 12.5px;
  color: var(--danger, #c0392b);
}

.save-draft-error[hidden] {
  display: none;
}

.save-draft-foot {
  align-items: center;
}

.save-draft-foot-spacer {
  flex: 1 1 auto;
}

.project-context-history-btn {
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
  border: 1px solid var(--win-border);
  border-radius: 5px;
  padding: 0;
  background: var(--win-body-bg);
  color: var(--ink);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.project-context-history-btn:hover:not(:disabled) {
  background: var(--win-hover-bg, rgba(0, 0, 0, 0.04));
}

.project-context-history-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.project-context-open-folder-btn {
  height: 23px;
  flex: 0 0 auto;
  border: 1px solid var(--win-border);
  border-radius: 5px;
  padding: 2px 8px;
  background: var(--win-body-bg);
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.project-context-open-folder-btn:hover {
  background: var(--win-hover-bg, rgba(0, 0, 0, 0.04));
}

.project-context-open-folder-btn[hidden] {
  display: none !important;
}

.project-context-new-name-row {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 1 auto;
  min-width: 0;
}

.project-context-new-name-row[hidden] {
  display: none !important;
}

.project-context-new-name-input {
  height: 23px;
  min-width: 160px;
  max-width: 280px;
  flex: 1 1 160px;
  border: 1px solid var(--win-border);
  border-radius: 5px;
  padding: 2px 8px;
  background: var(--win-body-bg);
  color: var(--ink);
  font-size: 12px;
}

.project-context-new-name-start {
  height: 23px;
  flex: 0 0 auto;
  border: 1px solid var(--ctx-accent);
  border-radius: 5px;
  padding: 2px 10px;
  background: color-mix(in srgb, var(--ctx-accent) 14%, var(--win-body-bg));
  color: var(--ctx-accent);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.project-context-legacy-pickers {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 1 auto;
  min-width: 0;
}

.project-context-legacy-pickers[hidden] {
  display: none !important;
}

/* ---------------------------------------------------------------------------
   Session tree menu (project-context bar)
   Surfaces are derived from theme tokens only: mixing a literal #fff into the
   panel used to wash it out under the dark themes, where --win-body-bg is
   already near-black. Mixing --ink into the surface tints in whichever
   direction the active theme needs.
--------------------------------------------------------------------------- */

/* One accent source for the whole component. The panel is a menu, so it takes
   the app's menu tokens — --accent and --menu-hover — rather than inventing its
   own blue; status hues mirror the org platform's work-status badges so a
   "Done" pill means the same color everywhere in the product. */
.ctx-tree,
.ctx-tree-panel,
.ctx-tree-pop {
  --ctx-accent: var(--accent, #2f6bff);
  --ctx-accent-soft: var(--accent-soft, color-mix(in srgb, var(--ctx-accent) 20%, transparent));
  --ctx-hover: var(--menu-hover, color-mix(in srgb, var(--ink) 6%, transparent));
  --ctx-ok: #0ca30c;
  --ctx-danger: #d03b3b;
  --ctx-warn: #d9821a;
  --ctx-review: #5b49c4;
}

.ctx-tree {
  position: relative;
  flex: 1 1 420px;
  min-width: 220px;
  max-width: 720px;
}

.ctx-tree-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  height: 23px;
  cursor: pointer;
  text-align: left;
  border: 1px solid var(--win-border);
  border-radius: 5px;
  padding: 2px 7px;
  background: var(--win-body-bg);
  color: var(--ink);
  font-size: 12px;
  box-sizing: border-box;
  transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}

.ctx-tree-trigger:hover {
  background: color-mix(in srgb, var(--ink) 5%, var(--win-body-bg));
}

.ctx-tree-trigger.is-open,
.ctx-tree-trigger.is-next-step {
  border-color: var(--ctx-accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ctx-accent) 35%, transparent);
}

.ctx-tree-trigger.is-pending {
  opacity: .75;
}

/* Project color, so the current context is identifiable without reading. */
.ctx-tree-trigger-dot {
  flex: 0 0 7px;
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--ctx-accent);
}

.ctx-tree-trigger-dot.is-off {
  background: transparent;
  border: 1.5px solid color-mix(in srgb, var(--ink-soft) 55%, transparent);
}

.ctx-tree-trigger-label {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  white-space: nowrap;
}

/* Closed state is the file address: user/project/subgroup/filename. */
.ctx-tree-trigger-path {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.ctx-tree-trigger-part {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ctx-tree-trigger-part:last-child {
  flex: 0 1 auto;
  font-weight: 650;
}

.ctx-tree-trigger-sep {
  flex: 0 0 auto;
  color: var(--ink-soft);
  opacity: .7;
}

.ctx-tree-trigger-status {
  flex: 0 0 auto;
  padding: 0 5px;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  background: color-mix(in srgb, var(--ctx-accent) 14%, transparent);
  color: var(--ctx-accent);
}

.ctx-tree-trigger.is-placeholder .ctx-tree-trigger-label {
  color: var(--ink-soft);
  font-weight: 500;
}

.ctx-tree-trigger-chevron {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border: solid var(--ink-soft);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  margin-top: -3px;
  transition: transform .15s ease, margin-top .15s ease;
}

.ctx-tree-trigger.is-open .ctx-tree-trigger-chevron {
  transform: rotate(-135deg);
  margin-top: 2px;
}

/* ---- panel ---- */

.ctx-tree-panel {
  /* Take the app's own menu color, falling back the way the rest of the OS
     chrome does, so the panel is the same hue as every other flyout. */
  --ctx-tree-surface: var(--menu-bg, var(--flyout-bg, var(--win-body-bg, #fff)));
  --ctx-tree-raise: color-mix(in srgb, var(--ink) 5%, var(--ctx-tree-surface));
  --ctx-tree-line: color-mix(in srgb, var(--win-border) 85%, transparent);
  --ctx-tree-row-h: 30px;
  --ctx-tree-section-h: 24px;
  --ctx-tree-empty-h: 26px;
  position: fixed;
  z-index: 10050;
  max-height: min(78vh, 660px);
  display: flex;
  flex-direction: column;
  /* Several themes give flyout/menu colors an alpha because their chrome sits
     on a backdrop blur. That is fine behind 34px menu rows and unreadable
     behind a dense tree. So the theme color is painted as four stacked layers
     over an opaque base: the hue stays exactly the theme's, nothing of the
     desktop shows through, and no light/dark branch is needed. `Canvas` is the
     opaque system surface and follows color-scheme, and at ~0.4% of the result
     it only matters if a theme leaves the tint fully transparent. */
  background-color: #fff;
  background-color: Canvas;
  background-image:
    linear-gradient(var(--ctx-tree-surface), var(--ctx-tree-surface)),
    linear-gradient(var(--ctx-tree-surface), var(--ctx-tree-surface)),
    linear-gradient(var(--ctx-tree-surface), var(--ctx-tree-surface)),
    linear-gradient(var(--ctx-tree-surface), var(--ctx-tree-surface));
  border: 1px solid var(--ctx-tree-line);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.22);
  padding: 6px;
  box-sizing: border-box;
}

.ctx-tree-search-row {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 4px 0 10px;
  margin-bottom: 4px;
  border: 1px solid var(--win-border);
  border-radius: 8px;
  background: var(--ctx-tree-raise);
}

.ctx-tree-search-row:focus-within {
  border-color: var(--ctx-accent);
  background: var(--ctx-tree-surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ctx-accent) 16%, transparent);
}

.ctx-tree-search-ico {
  color: var(--ink-soft);
  width: 14px;
  height: 14px;
}

.ctx-tree-search {
  flex: 1 1 auto;
  min-width: 0;
  height: 28px;
  border: 0;
  padding: 0;
  font-size: 12px;
  background: transparent;
  color: var(--ink);
  outline: none;
}

.ctx-tree-search::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* Filters collapse behind one button: three permanent chip rows cost more
   vertical space than the tree could spare. */
.ctx-tree-filter-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.ctx-tree-filter-toggle:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}

.ctx-tree-filter-toggle.is-on {
  border-color: color-mix(in srgb, var(--ctx-accent) 40%, transparent);
  color: var(--ctx-accent);
}

.ctx-tree-filter-badge {
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 99px;
  background: var(--ctx-accent);
  color: #fff;
  font-size: 9px;
  line-height: 14px;
  text-align: center;
}

.ctx-tree-filters {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0 2px 5px;
}

.ctx-tree-filters[hidden] {
  display: none;
}

.ctx-tree-filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.ctx-tree-filter-label {
  flex: 0 0 42px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.ctx-tree-filter-note {
  font-size: 10px;
  color: var(--ink-soft);
}

.ctx-tree-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 19px;
  padding: 1px 7px;
  border: 1px solid var(--win-border);
  border-radius: 999px;
  background: var(--ctx-tree-surface);
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.4;
  cursor: pointer;
}

.ctx-tree-chip:hover {
  border-color: var(--ctx-accent);
  color: var(--ink);
}

.ctx-tree-chip.is-on {
  border-color: var(--ctx-accent);
  background: color-mix(in srgb, var(--ctx-accent) 14%, var(--ctx-tree-surface));
  color: var(--ctx-accent);
  font-weight: 700;
}

.ctx-tree-chip-dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--ctx-accent);
}

.ctx-tree-chip-dot.is-off {
  background: transparent;
  border: 1px solid var(--ink-soft);
}

/* ---- body: list + details ---- */

.ctx-tree-body {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
  gap: 6px;
}

.ctx-tree-list {
  flex: 1 1 auto;
  overflow: auto;
  min-height: 72px;
  max-height: min(62vh, 540px);
  padding: 2px 2px 6px;
  outline: none;
}

.ctx-tree-list.is-virtual {
  position: relative;
}

.ctx-tree-spacer {
  flex: 0 0 auto;
}

.ctx-tree-detail {
  flex: 0 0 268px;
  min-width: 0;
  overflow: auto;
  padding: 8px 10px;
  border-left: 1px solid var(--ctx-tree-line);
  background: var(--ctx-tree-raise);
  border-radius: 8px;
}

.ctx-tree-panel.is-narrow .ctx-tree-detail,
.ctx-tree-detail[hidden] {
  display: none;
}

.ctx-tree-detail-head {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ctx-tree-detail-dot {
  width: 8px;
  height: 8px;
  border-radius: 99px;
  background: var(--ctx-accent);
}

.ctx-tree-detail-dot.is-off {
  background: transparent;
  border: 1.5px solid color-mix(in srgb, var(--ink-soft) 60%, transparent);
}

.ctx-tree-detail-kicker {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.ctx-tree-detail-title {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.ctx-tree-detail-path {
  margin-top: 2px;
  font-size: 10px;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.ctx-tree-detail-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 7px;
}

.ctx-tree-detail-pills .ctx-tree-pill {
  max-width: none;
}

.ctx-tree-pill.is-pinned {
  background: color-mix(in srgb, var(--ctx-warn) 18%, transparent);
  color: var(--ctx-warn);
}

/* Roll-ups get a real bar here: the row only had room for "6/12". */
.ctx-tree-detail-progress {
  margin-top: 10px;
}

.ctx-tree-detail-progress-track {
  height: 5px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--ink-soft) 24%, transparent);
  overflow: hidden;
}

.ctx-tree-detail-progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--ctx-ok);
  transition: width .18s ease;
}

.ctx-tree-detail-flag {
  font-weight: 700;
}

.ctx-tree-detail-flag.is-overdue {
  color: var(--ctx-danger);
}

.ctx-tree-detail-flag.is-blocked {
  color: var(--ctx-warn);
}

.ctx-tree-detail-progress-note {
  margin-top: 4px;
  font-size: 10px;
  color: var(--ink-soft);
}

.ctx-tree-detail-status,
.ctx-tree-detail-note,
.ctx-tree-detail-colors {
  margin-top: 11px;
  padding-top: 9px;
  border-top: 1px solid var(--ctx-tree-line);
}

.ctx-tree-detail-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.ctx-tree-detail-chip {
  height: 20px;
  padding: 0 8px;
  border: 1px solid var(--win-border);
  border-radius: 99px;
  background: var(--ctx-tree-surface);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.ctx-tree-detail-chip:hover {
  border-color: var(--ctx-accent);
  color: var(--ink);
}

.ctx-tree-detail-chip.is-on {
  border-color: var(--ctx-accent);
  background: color-mix(in srgb, var(--ctx-accent) 14%, transparent);
  color: var(--ctx-accent);
}

.ctx-tree-detail-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.ctx-tree-detail-swatch {
  width: 15px;
  height: 15px;
  border-radius: 99px;
  border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  padding: 0;
  cursor: pointer;
}

.ctx-tree-detail-swatch.is-none {
  background: transparent;
  border-style: dashed;
}

.ctx-tree-detail-swatch.is-on {
  box-shadow: 0 0 0 2px var(--ctx-tree-surface), 0 0 0 3.5px var(--ctx-accent);
}

.ctx-tree-detail-preview {
  margin: 8px 0;
  padding: 6px;
  border: 1px solid var(--ctx-tree-line);
  border-radius: 8px;
  /* Graph renderers draw for a light canvas, so the preview card stays light in
     both themes rather than putting dark-on-dark art in front of the user. */
  background: #fff;
  overflow: hidden;
}

.ctx-tree-detail-preview svg,
.ctx-tree-detail-preview img,
.ctx-tree-detail-preview canvas {
  display: block;
  width: 100%;
  height: auto;
}

.ctx-tree-detail-preview.is-empty {
  background: var(--ctx-tree-surface);
  font-size: 10px;
  color: var(--ink-soft);
  text-align: center;
  padding: 14px 6px;
}

.ctx-tree-detail-desc {
  margin: 5px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.ctx-tree-detail-desc.is-empty {
  color: var(--ink-soft);
  font-style: italic;
}

.ctx-tree-detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 8px;
  margin-top: 10px;
}

.ctx-tree-detail-k {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink-soft);
}

.ctx-tree-detail-v {
  font-size: 11px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.ctx-tree-detail-acts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.ctx-tree-detail-act {
  height: 22px;
  padding: 0 9px;
  border: 1px solid var(--win-border);
  border-radius: 6px;
  background: var(--ctx-tree-surface);
  color: var(--ink);
  font-size: 11px;
  cursor: pointer;
}

.ctx-tree-detail-act:hover {
  border-color: var(--ctx-accent);
}

.ctx-tree-detail-act.is-primary {
  border-color: var(--ctx-accent);
  background: var(--ctx-accent);
  color: #fff;
}

.ctx-tree-detail-hint {
  margin-top: 10px;
  font-size: 10px;
  line-height: 1.4;
  color: var(--ink-soft);
}

/* ---- rows ---- */

.ctx-tree-section-row {
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--ctx-tree-section-h);
  padding: 0 2px 0 4px;
  box-sizing: border-box;
}

.ctx-tree-section {
  flex: 1 1 auto;
  margin: 0;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.ctx-tree-section-act {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 10px;
  cursor: pointer;
  padding: 0 4px;
}

.ctx-tree-section-act:hover {
  color: var(--ctx-accent);
}

.ctx-tree-inline-add {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin-left: auto;
  border: 0;
  border-radius: 5px;
  background: color-mix(in srgb, var(--ctx-accent) 10%, transparent);
  color: var(--ctx-accent);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}

.ctx-tree-inline-add:hover,
.ctx-tree-inline-add.is-next-step {
  background: color-mix(in srgb, var(--ctx-accent) 22%, var(--ctx-tree-surface));
}

.ctx-tree-row {
  --row-color: var(--ctx-accent);
  display: flex;
  align-items: center;
  gap: 4px;
  height: var(--ctx-tree-row-h);
  padding: 0 3px 0 1px;
  border-radius: 6px;
  box-sizing: border-box;
  transition: background .1s ease;
}

.ctx-tree-row.is-depth-1 { padding-left: 15px; }
.ctx-tree-row.is-depth-2 { padding-left: 29px; }
.ctx-tree-row.is-depth-3 { padding-left: 43px; }

.ctx-tree-row:hover {
  background: var(--ctx-hover);
}

.ctx-tree-row.is-colored {
  background: color-mix(in srgb, var(--row-color) 7%, transparent);
}

.ctx-tree-row.is-selected {
  background: color-mix(in srgb, var(--ctx-accent) 8%, transparent);
}

.ctx-tree-row.is-current {
  background: color-mix(in srgb, var(--ctx-accent) 20%, transparent);
  box-shadow: inset 2px 0 0 var(--ctx-accent);
}

.ctx-tree-row.is-multi {
  background: color-mix(in srgb, var(--ctx-accent) 10%, transparent);
  box-shadow: inset 2px 0 0 var(--ctx-accent);
}

/* Keyboard cursor is a ring, so it reads differently from selection. */
.ctx-tree-row.is-cursor {
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ctx-accent) 65%, transparent);
}

.ctx-tree-row.is-next-step {
  background: color-mix(in srgb, var(--ctx-accent) 12%, transparent);
}

.ctx-tree-row.is-disabled {
  opacity: .62;
}

.ctx-tree-row.is-dragging {
  opacity: .45;
}

.ctx-tree-row.is-drop-target {
  background: color-mix(in srgb, var(--ctx-accent) 22%, transparent);
  box-shadow: inset 0 0 0 1.5px var(--ctx-accent);
}

.ctx-tree-row.is-shortcut .ctx-tree-row-label {
  font-weight: 600;
}

@keyframes ctx-tree-enter {
  from { opacity: 0; transform: translateY(-2px); }
  to { opacity: 1; transform: none; }
}

.ctx-tree-row.is-entering {
  animation: ctx-tree-enter .14s ease both;
}

@media (prefers-reduced-motion: reduce) {
  .ctx-tree-row.is-entering { animation: none; }
  .ctx-tree-trigger-chevron,
  .ctx-tree-chevron::before { transition: none; }
}

.ctx-tree-chevron {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.ctx-tree-chevron::before {
  content: "";
  width: 5px;
  height: 5px;
  border: solid var(--ink-soft);
  border-width: 1.4px 1.4px 0 0;
  transform: rotate(45deg) translate(-1px, 1px);
  transition: transform .14s ease;
}

.ctx-tree-row.is-open > .ctx-tree-chevron::before {
  transform: rotate(135deg) translate(-1px, 1px);
}

.ctx-tree-chevron.is-leaf,
.ctx-tree-chevron.is-leaf::before {
  border: 0;
  cursor: default;
}

/* One glyph carries both kind and color: the separate swatch column was a
   third icon slot competing for the same 40 px. */
.ctx-tree-icon {
  flex: 0 0 13px;
  width: 13px;
  height: 12px;
  position: relative;
  border-radius: 2px;
  background: color-mix(in srgb, var(--ink-soft) 34%, transparent);
}

.ctx-tree-icon.is-colored {
  background: var(--mark, var(--ctx-accent));
}

.ctx-tree-icon.is-folder::before {
  content: "";
  position: absolute;
  top: -2.5px;
  left: 0;
  width: 6px;
  height: 3px;
  border-radius: 2px 2px 0 0;
  background: inherit;
}

.ctx-tree-icon.is-file {
  width: 11px;
  height: 13px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--ink-soft) 26%, transparent);
}

.ctx-tree-icon.is-file.is-colored {
  background: color-mix(in srgb, var(--mark) 30%, transparent);
  box-shadow: inset 0 0 0 1.2px var(--mark);
}

.ctx-tree-icon.is-group {
  border-radius: 99px;
  width: 11px;
  height: 11px;
}

.ctx-tree-row-btn {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 6px;
  border: 0;
  background: transparent;
  padding: 0 2px;
  text-align: left;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  height: 100%;
}

.ctx-tree-row.is-selected .ctx-tree-row-btn {
  font-weight: 700;
  color: var(--ctx-accent);
}

.ctx-tree-row.is-disabled .ctx-tree-row-btn {
  cursor: default;
}

.ctx-tree-row-label {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ctx-tree-hit {
  background: color-mix(in srgb, var(--ctx-accent) 28%, transparent);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* Pinned / recent rows say where they live, since they sit outside the tree. */
.ctx-tree-row-crumb {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  color: var(--ink-soft);
}

.ctx-tree-note-dot,
.ctx-tree-dirty {
  flex: 0 0 5px;
  width: 5px;
  height: 5px;
  border-radius: 99px;
  align-self: center;
}

.ctx-tree-note-dot {
  background: color-mix(in srgb, var(--ink-soft) 70%, transparent);
}

.ctx-tree-dirty {
  background: var(--ctx-warn);
}

.ctx-tree-side {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.ctx-tree-count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* Roll-up progress: a collapsed project still reports how much of it is done. */
.ctx-tree-bar {
  display: block;
  width: 34px;
  height: 4px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--ink-soft) 26%, transparent);
  overflow: hidden;
}

.ctx-tree-bar-fill {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--ctx-ok);
}

.ctx-tree-count.has-overdue .ctx-tree-count-text {
  color: var(--ctx-danger);
  font-weight: 700;
}

.ctx-tree-pill {
  display: inline-block;
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 6px;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .02em;
  line-height: 15px;
  background: color-mix(in srgb, var(--ink-soft) 16%, transparent);
  color: var(--ink-soft);
}

.ctx-tree-pill.is-inprogress {
  background: color-mix(in srgb, var(--ctx-accent) 16%, transparent);
  color: var(--ctx-accent);
}

.ctx-tree-pill.is-inreview,
.ctx-tree-pill.is-review {
  background: color-mix(in srgb, var(--ctx-review) 16%, transparent);
  color: var(--ctx-review);
}

.ctx-tree-pill.is-done,
.ctx-tree-pill.is-published {
  background: color-mix(in srgb, var(--ctx-ok) 18%, transparent);
  color: var(--ctx-ok);
}

.ctx-tree-pill.is-blocked {
  background: color-mix(in srgb, var(--ctx-danger) 16%, transparent);
  color: var(--ctx-danger);
}

.ctx-tree-pill.is-notstarted {
  opacity: .8;
}

.ctx-tree-pill.is-badge {
  background: color-mix(in srgb, var(--ink) 10%, transparent);
  color: var(--ink-soft);
}

.ctx-tree-due {
  font-size: 10px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.ctx-tree-due.is-overdue,
.ctx-tree-due.is-urgent {
  color: var(--ctx-danger);
  font-weight: 700;
}

.ctx-tree-due.is-soon {
  color: var(--ctx-warn);
}

/* ---- row actions ---- */

/* A fixed-width right column: without it every row's meta lands at a different
   x, because the hover buttons and the recency label are different widths. */
.ctx-tree-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  min-width: 92px;
}

/* Recency is the thing people scan for, so it stays visible; the buttons
   beside it only appear on hover. */
.ctx-tree-updated {
  flex: 1 1 auto;
  text-align: right;
  font-size: 10px;
  color: var(--ink-soft);
  white-space: nowrap;
  padding: 0 2px;
}

.ctx-tree-act {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity .1s ease;
}

.ctx-tree-act.is-text {
  width: auto;
  padding: 0 7px;
  font-size: 10px;
  font-weight: 600;
  color: var(--ctx-accent);
  background: color-mix(in srgb, var(--ctx-accent) 10%, transparent);
}

.ctx-tree-act.is-on,
.ctx-tree-row:hover .ctx-tree-act,
.ctx-tree-row.is-cursor .ctx-tree-act {
  opacity: 1;
}

.ctx-tree-act.is-on {
  color: var(--ctx-warn);
}

.ctx-tree-act:hover {
  background: color-mix(in srgb, var(--ink) 10%, transparent);
  color: var(--ink);
}

.ctx-tree-row .ctx-tree-inline-add {
  opacity: 0;
  transition: opacity .1s ease;
}

.ctx-tree-row:hover .ctx-tree-inline-add,
.ctx-tree-row.is-cursor .ctx-tree-inline-add,
.ctx-tree-row .ctx-tree-inline-add.is-next-step {
  opacity: 1;
}

/* ---- empty, skeleton, inline forms ---- */

.ctx-tree-empty {
  height: var(--ctx-tree-empty-h);
  display: flex;
  align-items: center;
  padding: 0 10px 0 30px;
  color: var(--ink-soft);
  font-size: 11px;
  box-sizing: border-box;
}

.ctx-tree-skeleton {
  height: var(--ctx-tree-row-h);
  display: flex;
  align-items: center;
  padding: 0 6px;
  box-sizing: border-box;
}

.ctx-tree-skeleton-bar {
  display: block;
  width: 60%;
  height: 9px;
  border-radius: 99px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--ink) 8%, transparent) 25%,
    color-mix(in srgb, var(--ink) 15%, transparent) 37%,
    color-mix(in srgb, var(--ink) 8%, transparent) 63%
  );
  background-size: 320% 100%;
  animation: ctx-tree-shimmer 1.3s ease-in-out infinite;
}

@keyframes ctx-tree-shimmer {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ctx-tree-skeleton-bar { animation: none; }
}

.ctx-tree-rename-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 20px;
  border: 1px solid var(--ctx-accent);
  border-radius: 5px;
  padding: 0 6px;
  font: inherit;
  font-size: 12px;
  background: var(--ctx-tree-surface);
  color: var(--ink);
  outline: none;
}

.ctx-tree-create-wrap {
  padding: 2px 4px 2px 26px;
}

.ctx-tree-create-wrap.is-root {
  padding-left: 4px;
}

.ctx-tree-create {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ctx-tree-create-name {
  width: 100%;
  height: 26px;
  box-sizing: border-box;
  border: 1px solid var(--ctx-accent);
  border-radius: 6px;
  padding: 0 8px;
  font: inherit;
  font-size: 12px;
  background: var(--ctx-tree-surface);
  color: var(--ink);
  outline: none;
}

.ctx-tree-create-actions {
  display: flex;
  gap: 6px;
}

.ctx-tree-create-ok,
.ctx-tree-create-cancel {
  height: 22px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--win-border);
  background: var(--ctx-tree-surface);
  color: var(--ink);
  font-size: 11px;
  cursor: pointer;
}

.ctx-tree-create-ok {
  border-color: var(--ctx-accent);
  background: var(--ctx-accent);
  color: #fff;
}

.ctx-tree-create-ok.is-danger {
  border-color: var(--ctx-danger);
  background: var(--ctx-danger);
}

/* ---- bulk bar + footer ---- */

.ctx-tree-bulk {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  padding: 4px 6px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--ctx-accent) 12%, transparent);
}

.ctx-tree-bulk[hidden] {
  display: none;
}

.ctx-tree-bulk-count {
  flex: 1 1 auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--ctx-accent);
}

.ctx-tree-bulk-act {
  height: 20px;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--ctx-accent) 40%, transparent);
  border-radius: 6px;
  background: var(--ctx-tree-surface);
  color: var(--ink);
  font-size: 11px;
  cursor: pointer;
}

.ctx-tree-foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 22px;
  padding: 0 4px;
  margin-top: 4px;
  border-top: 1px solid var(--ctx-tree-line);
}

.ctx-tree-foot-note {
  font-size: 10px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ctx-tree-foot-spacer {
  flex: 1 1 auto;
}

.ctx-tree-foot-act {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 4px;
}

.ctx-tree-foot-act:hover {
  color: var(--ctx-accent);
}

/* ---- popovers ---- */

.ctx-tree-pop {
  --ctx-tree-surface: var(--menu-bg, var(--flyout-bg, var(--win-body-bg, #fff)));
  position: fixed;
  z-index: 10060;
  padding: 10px 12px 12px;
  border: 1px solid var(--ctx-tree-line, var(--win-border));
  border-radius: 10px;
  background-color: #fff;
  background-color: Canvas;
  background-image:
    linear-gradient(var(--ctx-tree-surface), var(--ctx-tree-surface)),
    linear-gradient(var(--ctx-tree-surface), var(--ctx-tree-surface)),
    linear-gradient(var(--ctx-tree-surface), var(--ctx-tree-surface)),
    linear-gradient(var(--ctx-tree-surface), var(--ctx-tree-surface));
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.24);
  box-sizing: border-box;
}

.ctx-tree-pop-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.ctx-tree-pop-hint {
  margin: 4px 0 8px;
  font-size: 10px;
  line-height: 1.4;
  color: var(--ink-soft);
}

.ctx-tree-pop-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--win-border);
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: 12px;
  background: var(--win-body-bg);
  color: var(--ink);
  resize: vertical;
}

.ctx-tree-pop-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
}

.ctx-tree-pop-date {
  width: 100%;
  height: 32px;
  box-sizing: border-box;
  border: 1px solid var(--win-border);
  border-radius: 8px;
  padding: 4px 8px;
  font: inherit;
  font-size: 12px;
  background: var(--win-body-bg);
  color: var(--ink);
}
