/* Assembled stylesheet. Edit the ordered parts listed in source/manifest.json, then run npm run build:gui from the repository root. */
/*
 * Source section 1/12: overview and initialization.
 * Assembles into styles/ui-harmony.css.
 * Rules remain in their original cascade order; later sections may intentionally override these
 * declarations.
 */
/**
 * styles/ui-harmony.css
 *
 * Consolidates interface alignment and visual refinements: panel rails, active ribbons, icon controls, settings
 * rows, compact column editors, metadata headers and responsive toolbar/display presentation.
 */
/* r75 restrained harmonization. Original layout, palette and button geometry retained. */
body #app :is(button, input, select, textarea),
body dialog {
  font-family: var(--cm-font-ui) !important;
}

/* r77 save-before-close dialog: shared offline fonts, theme colors and controls. */
.project-close-dialog {
  box-sizing: border-box;
  width: min(440px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-panel-radius);
  background: var(--cm-surface);
  color: var(--cm-text);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.2);
  font-size: 12px;
  line-height: 1.5;
}
.project-close-dialog::backdrop {
  background: rgba(15, 23, 42, 0.3);
}
.project-close-dialog h2 {
  margin: 0 0 12px;
  font-size: 17px;
  line-height: 1.3;
}
.project-close-dialog p {
  margin: 8px 0;
}
.project-close-projects {
  font-weight: 600;
  overflow-wrap: anywhere;
  max-height: 120px;
  overflow: auto;
}
.project-close-note {
  color: var(--cm-muted);
}
.project-close-error {
  color: var(--error, #b42318);
  overflow-wrap: anywhere;
}
.project-close-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}
.project-close-actions .mini-btn {
  min-height: 30px;
  padding: 5px 10px;
  background: var(--cm-surface-2);
  color: var(--cm-text);
  border: 1px solid var(--cm-border);
  border-radius: var(--cm-control-radius);
  font: inherit;
  cursor: pointer;
}
.project-close-actions .primary {
  background: var(--cm-accent);
  border-color: var(--cm-accent);
  color: #fff;
}
.project-close-actions button:disabled {
  opacity: 0.6;
  cursor: wait;
}
.project-close-actions button:focus-visible {
  outline: 2px solid var(--cm-accent);
  outline-offset: 2px;
}
body :is(code, pre, .log-output, .command-preview, .sm-mono, .mono) {
  font-family: var(--cm-font-mono) !important;
}
body
  #app
  :is(
    .mini-btn,
    .wide-btn,
    .bench-actions button,
    .clademap-mst-toolbar button,
    .fast-export button,
    .tree-settings-profile-actions button
  ) {
  border-radius: var(--cm-control-radius) !important;
}
body #app .tree-toolbar-lock-btn {
  height: 28px !important;
  padding: 0 7px !important;
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-weight: 500;
}
body #app .tree-toolbar-lock-btn .ui-icon {
  width: 16px;
  height: 16px;
}
body #app .tree-toolbar-lock-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}
body :is(button, input, select, textarea):focus-visible {
  outline: 2px solid var(--cm-accent);
  outline-offset: 1px;
}
/* Wrapping is local to labels; no changes to panel widths or global spacing. */
body #app .unified-settings label.settings-control-row > span {
  white-space: normal !important;
  overflow-wrap: anywhere;
  min-width: 0 !important;
}
body #app .unified-settings label.settings-control-row > select {
  min-width: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
  padding-right: 22px !important;
}
body #app .unified-settings label.settings-control-row {
  gap: 6px !important;
}

/* Only narrow windows: prevent the existing minimum canvas width pushing Settings off screen. */
@media (max-width: 1024px) {
  body #app {
    grid-template-columns: minmax(0, 1fr);
  }
  body.pane-maximized.inputs-collapsed:not(.controls-collapsed) #app .workspace-grid,
  body.inputs-collapsed:not(.controls-collapsed) #app .workspace-grid {
    grid-template-columns: var(--pw-side-rail-width, 44px) minmax(0, 1fr) minmax(240px, min(340px, 42vw)) !important;
  }
  body.pane-maximized:not(.inputs-collapsed):not(.controls-collapsed) #app .workspace-grid,
  body:not(.inputs-collapsed):not(.controls-collapsed) #app .workspace-grid {
    grid-template-columns: minmax(150px, min(260px, 25vw)) minmax(0, 1fr) minmax(240px, min(340px, 42vw)) !important;
  }
  body #app .workspace-grid > :is(.plot-shell, .right-panel) {
    min-width: 0 !important;
    max-width: 100% !important;
  }
}
@container settings-pane (max-width:280px) {
  body
    #app
    #tab-appearance.tree-settings.unified-settings
    label.settings-control-row:not(:has(input[type='checkbox'])) {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 3px !important;
  }
}
/* One stroke scale on controls only; figure and gallery drawings are untouched. */
body :is(.ui-icon, .clademap-plugin-inline-icon) {
  stroke-width: var(--cm-icon-stroke) !important;
  stroke-linecap: round;
  stroke-linejoin: round;
}
/* Both active vertical rail controls follow the existing Projects appearance. */
body #app .project-tab-rail .project-tab.active,
body #app .settings-tab-rail .control-tab.active {
  color: var(--active-tab-accent, #4b5563) !important;
  background: var(--active-tab-accent-soft, #f3f4f6) !important;
  border-color: var(--active-tab-accent-border, #cbd0d6) !important;
  box-shadow: none !important;
}
body #app .project-tab-rail .project-tab.active > span,
body #app .settings-tab-rail .control-tab.active > .rail-icon {
  color: var(--active-tab-accent, #4b5563) !important;
  background: #e5e7eb !important;
  box-shadow: none !important;
  border: 0 !important;
  border-radius: 5px !important;
}
body #app :is(.project-tab-rail .project-tab, .settings-tab-rail .control-tab) {
  position: relative !important;
}
body #app .project-tab-rail .project-tab.active::before,
body #app .settings-tab-rail .control-tab.active::before {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 3px !important;
  height: auto !important;
  background: #5271ff !important;
  border-radius: 1px !important;
  transform: none !important;
  pointer-events: none;
}
body #app .project-tab-rail .project-tab.active::before {
  left: auto !important;
  right: 0 !important;
}
body #app .settings-tab-rail .control-tab.active::before {
  left: 0 !important;
  right: auto !important;
}
body #app :is(.project-tab-rail .project-tab, .settings-tab-rail .control-tab).active::after {
  content: none !important;
}
/* A single consistently centered icon tile inside each right-rail target. */
body #app .settings-tab-rail {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  gap: 4px !important;
  padding: 5px 0 !important;
  box-sizing: border-box !important;
  border-radius: 0 5px 5px 0 !important;
}
body #app .settings-tab-rail .control-tab {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  width: calc(100% - 6px) !important;
  max-width: 36px !important;
  min-width: 0 !important;
  height: 36px !important;
  min-height: 36px !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
  border-radius: 5px !important;
}
body #app .settings-tab-rail .control-tab:not(.active) {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}
body #app .settings-tab-rail .control-tab:not(.active) > .rail-icon {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
body #app .settings-tab-rail .control-tab > .rail-icon {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  width: 26px !important;
  height: 26px !important;
  flex: 0 0 26px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 1px solid var(--border-strong, #c8d3e3) !important;
  border-radius: 5px !important;
  background: var(--panel, #fff) !important;
}
body #app .settings-tab-rail .control-tab > .rail-icon > .ui-icon {
  display: block !important;
  width: 17px !important;
  height: 17px !important;
  margin: 0 !important;
  transform: none !important;
}
/* Reserve scrollbar space only in the scrolling content, not the Projects frame. */
body #app .left-panel,
body #app .project-explorer-layout {
  scrollbar-gutter: auto !important;
}
/* One enclosing frame joins the Settings header, pages and rail in either state. */
body #app .workspace-grid {
  padding-right: 5px !important;
  box-sizing: border-box !important;
}
body #app .right-panel {
  box-sizing: border-box !important;
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
  border: 1px solid var(--border, #cbd3de) !important;
  border-radius: 6px !important;
  background: var(--panel, #fff) !important;
  overflow: hidden !important;
  scrollbar-gutter: auto !important;
}
body #app .right-panel .side-panel-topbar {
  border: 0 !important;
  border-bottom: 1px solid var(--border, #cbd3de) !important;
  border-radius: 0 !important;
}
body #app .right-panel .settings-inspector {
  border: 0 !important;
  border-radius: 0 !important;
}
/* Collapsed Settings mirrors the Projects enclosure; arrow and icons share its center. */
body.controls-collapsed #app .right-panel {
  background: var(--panel-2, #f5f7fa) !important;
}
body.controls-collapsed #app .right-panel .side-panel-topbar {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 3px 0 !important;
  display: flex !important;
  justify-content: center !important;
}
body.controls-collapsed #app .right-panel .settings-inspector {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  display: flex !important;
  flex-direction: column !important;
  margin: 0 !important;
  padding: 0 !important;
}
body.controls-collapsed #app .right-panel .settings-tab-rail {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  flex: 1 1 auto !important;
  margin: 0 !important;
  padding: 5px 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
}
/* One setting per row in the field editor, with complete dropdown labels. */
body #app #tab-appearance.tree-settings .metadata-field-block:not(.is-collapsed-setting),
body #app #tab-appearance.tree-settings .metadata-field-block .settings-inline-grid {
  grid-template-columns: minmax(0, 1fr) !important;
}
body #app #tab-appearance.tree-settings .field-header-style-options {
  grid-column: 1/-1 !important;
  width: 100%;
  min-width: 0;
}
body #app #tab-appearance.tree-settings .metadata-field-block label:not(.check-row) {
  display: grid !important;
  grid-template-columns: minmax(95px, 42%) minmax(0, 1fr) !important;
  gap: 6px !important;
  align-items: center !important;
  min-width: 0 !important;
}
body
  #app
  #tab-appearance.tree-settings
  .metadata-field-block
  label:not(.check-row)
  > :is(input, select, textarea) {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
/* Zoom SVGs are centered inside their original controls, including Compact tree. */
body #app :is(#zoomOutBtn, #zoomInBtn, #compactZoomOutBtn, #compactZoomInBtn) {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  line-height: 1 !important;
}
body #app :is(#zoomOutBtn, #zoomInBtn, #compactZoomOutBtn, #compactZoomInBtn) > .ui-icon {
  display: block !important;
  width: 14px !important;
  height: 14px !important;
  flex: 0 0 14px !important;
  margin: 0 !important;
  transform: none !important;
  vertical-align: middle !important;
}
/* Extensions are reordered visually; original IDs, activation and APIs are unchanged. */
body #app #pluginMenuList {
  display: flex !important;
  flex-direction: column !important;
}
body #app #pluginMenuList [data-plugin-id='interactive-tree'] {
  order: 1;
}
body #app #pluginMenuList [data-plugin-id='metadata'] {
  order: 2;
}
body #app #pluginMenuList [data-plugin-id='analysis'] {
  order: 3;
}
body #app #pluginMenuList [data-plugin-id='maps'] {
  order: 4;
}
body #app #pluginMenuList [data-plugin-id='metadata-plots'] {
  order: 5;
}
body #app #pluginMenuList [data-plugin-id='profile-mst'] {
  order: 6;
}
body #app #pluginMenuList .plugin-menu-name {
  white-space: normal !important;
  overflow-wrap: anywhere;
}
/* Identical label/value columns for nested rows, including numeric inputs. */
body #app #tab-appearance.tree-settings .nested-setting > .settings-module-body {
  grid-template-columns: minmax(0, 1fr) !important;
}
body
  #app
  #tab-appearance.tree-settings
  :is(.settings-module-body, .settings-compact-body)
  .settings-inline-grid {
  grid-template-columns: minmax(0, 1fr) !important;
}
body
  #app
  #tab-appearance.tree-settings
  :is(.settings-module-body, .settings-compact-body)
  > label:not(.check-row):not(.full-setting-row),
body
  #app
  #tab-appearance.tree-settings
  :is(.settings-module-body, .settings-compact-body)
  .settings-inline-grid
  > label:not(.check-row):not(.full-setting-row) {
  display: grid !important;
  grid-template-columns: minmax(0, 42%) minmax(0, 1fr) !important;
  gap: 6px !important;
  min-width: 0 !important;
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 2px 3px !important;
}
body
  #app
  #tab-appearance.tree-settings
  :is(.settings-module-body, .settings-compact-body)
  label:not(.check-row)
  > :is(input, select, textarea) {
  min-width: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
@container settings-pane (max-width:280px) {
  body
    #app
    #tab-appearance.tree-settings
    :is(.settings-module-body, .settings-compact-body)
    label:not(.check-row) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
.tree-hover-target {
  position: fixed;
  z-index: 90;
  box-sizing: border-box;
  pointer-events: none;
  overflow: hidden;
}
.tree-hover-target > svg {
  display: block;
  overflow: hidden;
}
.tree-hover-shape {
  fill: rgba(96, 165, 250, 0.16);
  stroke: none;
  pointer-events: none;
}
.tree-hover-info {
  position: fixed;
  z-index: 91;
  width: 250px;
  max-width: calc(100vw - 12px);
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid var(--cm-border, #dce3ef);
  border-radius: 6px;
  background: var(--cm-surface, #fff);
  color: var(--cm-text, #172033);
  box-shadow: 0 3px 10px #00000012;
  font: 11px/1.4 var(--cm-font-ui);
  pointer-events: none;
  overflow-wrap: anywhere;
}
.tree-hover-info-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--cm-muted, #6f7b91);
}
.tree-hover-info-head > .ui-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}
/*
 * Source section 2/12: tree hover info count.
 * Assembles into styles/ui-harmony.css.
 * Rules remain in their original cascade order; later sections may intentionally override these
 * declarations.
 */
.tree-hover-info-count {
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 9px;
  background: var(--cm-accent-soft, #eef2ff);
  color: var(--cm-accent, #375dfb);
  font-size: 10px;
  white-space: nowrap;
}
.tree-hover-info-title {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
}
.tree-hover-info-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.tree-hover-info-metrics > div {
  display: grid;
  gap: 2px;
}
.tree-hover-info-metrics span {
  color: var(--cm-muted, #6f7b91);
  font-size: 10px;
}
.tree-hover-info-metrics strong {
  font-family: var(--cm-font-mono);
  font-weight: 500;
}
.tree-hover-info-hint {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--cm-border, #dce3ef);
  font-size: 10px;
  color: var(--cm-muted, #6f7b91);
}
.tree-hover-target[hidden],
.tree-hover-info[hidden] {
  display: none;
}

/* Export branch arrows share one right-hand column, including short labels. */
:is(#app, body) [data-menu-panel='export'] .menu-branch-trigger > .menu-arrow-icon {
  flex: 0 0 11px !important;
  width: 11px !important;
  height: 11px !important;
  margin-left: auto !important;
}

/* Explicit three-pane layout: two upper views, one full-width lower view. */
:is(#app, body) #workspaceDocumentArea.split-mode.three-pane-mode {
  display: grid !important;
  grid-template-columns: minmax(0, var(--split-ratio, 50%)) 5px minmax(
      0,
      calc(100% - var(--split-ratio, 50%) - 5px)
    ) !important;
  grid-template-rows: minmax(0, calc(var(--split-upper-height, 60%) - 3px)) 6px 30px minmax(0, 1fr) !important;
  gap: 0 !important;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
:is(#app, body) #workspaceDocumentArea.three-pane-mode > .plot-view.split-primary {
  grid-column: 1 !important;
  grid-row: 1 !important;
}
:is(#app, body) #workspaceDocumentArea.three-pane-mode > .plot-view.split-secondary {
  grid-column: 3 !important;
  grid-row: 1 !important;
}
:is(#app, body) #workspaceDocumentArea.three-pane-mode > .plot-view.active.split-tertiary {
  display: flex !important;
  grid-column: 1/-1 !important;
  grid-row: 4 !important;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--cm-surface, #fff) !important;
  border-left: 0 !important;
  border-top: 1px solid var(--cm-border, #dce3ef);
}
:is(#app, body) #workspaceDocumentArea.three-pane-mode > #splitDivider {
  grid-column: 2 !important;
  grid-row: 1 !important;
  min-height: 0;
}
:is(#app, body) #workspaceDocumentArea > #splitRowDivider {
  grid-column: 1/-1 !important;
  grid-row: 2 !important;
  width: auto !important;
  height: 6px !important;
  min-height: 6px !important;
  cursor: row-resize !important;
  touch-action: none;
  background: var(--cm-border, #dce3ef) !important;
}
:is(#app, body) #splitRowDivider:hover,
:is(#app, body) #splitRowDivider:focus-visible {
  background: var(--cm-accent, #375dfb) !important;
  outline: none;
}
:is(#app, body) .workspace-tab-group-bottom {
  display: none !important;
}
:is(#app, body) #workspaceDocumentArea.three-pane-mode > .workspace-tab-group-bottom {
  display: flex !important;
  grid-column: 1/-1 !important;
  grid-row: 3 !important;
  height: 30px !important;
  min-height: 30px !important;
  align-items: center;
  padding: 0 5px !important;
  gap: 3px;
  min-width: 0;
  box-sizing: border-box !important;
  overflow: hidden !important;
  border: 1px solid var(--cm-border, #dce3ef) !important;
  border-left: 0 !important;
  border-right: 0 !important;
  background: var(--cm-surface, #fff) !important;
  color: var(--cm-text, #172033) !important;
}
:is(#app, body) #workspaceDocumentArea.three-pane-mode > .workspace-tab-group-bottom .clademap-tab-strip {
  flex: 1 1 auto;
  min-width: 0;
}
:is(#app, body) .workspace-tab-group-bottom .workspace-group-label {
  font-size: 10px;
  white-space: nowrap;
  color: var(--cm-muted, #6f7b91);
}
:is(#app, body) #workspaceDocumentArea.three-pane-mode.pane-closed-left > .split-secondary,
:is(#app, body) #workspaceDocumentArea.three-pane-mode.pane-min-left > .split-secondary,
:is(#app, body) #workspaceDocumentArea.three-pane-mode.pane-closed-right > .split-primary,
:is(#app, body) #workspaceDocumentArea.three-pane-mode.pane-min-right > .split-primary {
  grid-column: 1/-1 !important;
}
:is(#app, body) #workspaceDocumentArea.three-pane-mode.pane-min-left > .split-primary,
:is(#app, body) #workspaceDocumentArea.three-pane-mode.pane-min-right > .split-secondary,
:is(#app, body) #workspaceDocumentArea.three-pane-mode.pane-min-bottom > .split-tertiary,
:is(#app, body) #workspaceDocumentArea.three-pane-mode.pane-closed-bottom > .split-tertiary {
  display: none !important;
}
:is(#app, body) #workspaceDocumentArea.three-pane-mode:is(.pane-min-bottom, .pane-closed-bottom) {
  grid-template-rows: minmax(0, 1fr) 0 30px 0 !important;
}
:is(#app, body)
  #workspaceDocumentArea.three-pane-mode:is(.pane-closed-left, .pane-min-left):is(
    .pane-closed-right,
    .pane-min-right
  ) {
  grid-template-rows: 0 0 30px minmax(0, 1fr) !important;
}
:is(#app, body) #workspaceDocumentArea.three-pane-mode:is(.pane-max-left, .pane-max-right, .pane-max-bottom) {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: 30px minmax(0, 1fr) !important;
}
:is(#app, body) #workspaceDocumentArea.three-pane-mode.pane-max-left > .split-primary,
:is(#app, body) #workspaceDocumentArea.three-pane-mode.pane-max-right > .split-secondary {
  grid-column: 1 !important;
  grid-row: 1/-1 !important;
}
:is(#app, body) #workspaceDocumentArea.three-pane-mode.pane-max-bottom > .split-tertiary {
  grid-column: 1 !important;
  grid-row: 2 !important;
}
:is(#app, body) #workspaceDocumentArea.three-pane-mode.pane-max-bottom > .workspace-tab-group-bottom {
  grid-column: 1 !important;
  grid-row: 1 !important;
}
:is(#app, body)
  #workspaceDocumentArea.three-pane-mode.pane-max-left
  > :is(.split-secondary, .split-tertiary, .workspace-tab-group-bottom),
:is(#app, body)
  #workspaceDocumentArea.three-pane-mode.pane-max-right
  > :is(.split-primary, .split-tertiary, .workspace-tab-group-bottom),
:is(#app, body)
  #workspaceDocumentArea.three-pane-mode.pane-max-bottom
  > :is(.split-primary, .split-secondary) {
  display: none !important;
}
:is(#app, body) #workspaceDocumentArea.workspace-empty > .workspace-tab-group-bottom {
  display: none !important;
}
:is(#app, body) .split-layout-switch {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}
:is(#app, body) .split-layout-switch > button {
  min-width: 0;
  white-space: normal;
  line-height: 1.2;
}
body.resizing-workspace-rows,
body.resizing-workspace-rows * {
  cursor: row-resize !important;
  user-select: none !important;
}
@media (max-width: 640px) {
  :is(#app, body) .split-view-popover {
    max-width: calc(100vw - 16px);
  }
  :is(#app, body) .split-layout-switch > button {
    padding: 5px 3px !important;
  }
}
/* SVG artwork for legacy glyph controls; event-handler nodes are kept intact. */
body
  :is(
    [data-close-tree-export],
    [data-close-map-export],
    [data-appearance-close],
    [data-search-clear],
    [data-focus-close],
    [data-fast-remove-stage],
    .popover-close
  ) {
  --cm-control-icon: url('../assets/icons/x.svg');
}
body :is(#mapUnifiedZoomIn, [data-preview-plus]) {
  --cm-control-icon: url('../assets/icons/plus.svg');
}
body :is(#mapUnifiedZoomOut, [data-preview-minus]) {
  --cm-control-icon: url('../assets/icons/minus.svg');
}
body #mapUnifiedPlay {
  --cm-control-icon: url('../assets/icons/play.svg');
}
body #mapUnifiedPlay[aria-pressed='true'] {
  --cm-control-icon: url('../assets/icons/pause.svg');
}
body #mapUnifiedStop {
  --cm-control-icon: url('../assets/icons/square.svg');
}
body :is(#mapUnifiedPlay, #mapUnifiedStop) > svg {
  display: none !important;
}
body
  :is(
    [data-close-tree-export],
    [data-close-map-export],
    [data-appearance-close],
    [data-search-clear],
    [data-focus-close],
    [data-fast-remove-stage],
    .popover-close,
    #mapUnifiedZoomIn,
    #mapUnifiedZoomOut,
    [data-preview-plus],
    [data-preview-minus],
    #mapUnifiedPlay,
    #mapUnifiedStop
  ) {
  font-size: 0 !important;
}
body
  :is(
    [data-close-tree-export],
    [data-close-map-export],
    [data-appearance-close],
    [data-search-clear],
    [data-focus-close],
    [data-fast-remove-stage],
    .popover-close,
    #mapUnifiedZoomIn,
    #mapUnifiedZoomOut,
    [data-preview-plus],
    [data-preview-minus],
    #mapUnifiedPlay,
    #mapUnifiedStop
  )::before {
  content: '';
  display: inline-block;
  vertical-align: middle;
  width: 16px;
  height: 16px;
  background: currentColor;
  mask: var(--cm-control-icon) center/contain no-repeat;
}

/* Keep shortcut hit areas above the full-width menu bar (z-index:80). */
body #app .topbar-quick-controls {
  position: absolute;
  right: 7px;
  top: 2px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 90;
}
body #app .topbar-save-controls {
  display: flex;
  align-items: center;
  gap: 9px;
}
body #app .topbar-save-controls + .app-layout-shortcuts {
  padding-left: 12px;
  border-left: 1px solid var(--cm-border, #d8e0e8);
}
body #app #topbarSaveProjectBtn {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  max-width: none;
  height: 22px;
  min-height: 22px;
  max-height: 22px;
  padding: 1px 5px;
  gap: 5px;
  color: var(--cm-text);
  cursor: pointer;
}
body #app #topbarSaveProjectBtn > span {
  font: 600 11px/16px var(--cm-font-ui);
  white-space: nowrap;
}
body #app #topbarSaveProjectBtn > .ui-icon {
  width: 14px;
  height: 14px;
}
body #app #topbarSaveProjectBtn:disabled {
  opacity: 0.4;
  cursor: default;
}
body #app #topbarSaveProjectBtn[aria-busy='true'] {
  color: var(--cm-accent);
}
body #app .app-layout-shortcuts {
  display: flex;
  align-items: center;
  gap: 3px;
}
body #app .topbar > .menubar {
  padding-right: 240px;
}
body #app .app-layout-button {
  box-sizing: border-box;
  flex: 0 0 20px;
  width: 20px;
  min-width: 20px;
  max-width: 20px;
  height: 18px;
  min-height: 18px;
  max-height: 18px;
  padding: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--cm-muted);
}
body #app .app-layout-button:is(:hover, :focus-visible) {
  background: var(--cm-control-hover);
  color: var(--cm-text);
  border-color: var(--cm-border);
}
body #app .app-layout-button.active {
  background: var(--cm-accent-soft);
  color: var(--cm-accent);
  border-color: var(--cm-border-strong);
}
body #app .app-layout-button .ui-icon {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
}
body #app .split-layout-switch > button.preview-active {
  border-color: var(--cm-accent);
  background: var(--cm-accent-soft);
}
body #app .display-pane-preview {
  display: grid;
  gap: 7px;
  padding: 8px 0 0;
  border-top: 1px solid var(--cm-border);
  margin-top: 8px;
}
body #app .display-pane-preview[hidden] {
  display: none !important;
}
body #app .display-pane-preview-heading {
  font-size: 11px;
  color: var(--cm-text);
}
body #app .display-pane-preview-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
body #app .display-pane-preview-layout:is([data-layout='single'], [data-layout='vertical']) {
  grid-template-columns: minmax(0, 1fr);
}
body #app .display-pane-preview-layout[data-layout='three'] > label:nth-child(3) {
  grid-column: 1 / -1;
}
body #app .display-pane-preview-layout > label {
  display: grid;
  min-width: 0;
  min-height: 72px;
  padding: 8px;
  border: 1px solid var(--cm-border);
  border-radius: 5px;
  background: var(--cm-accent-soft);
  align-items: center;
  gap: 5px;
  margin: 0;
  color: var(--cm-muted);
}
body #app .display-pane-preview select {
  min-width: 0;
  width: 100%;
  height: 28px;
}
body #app .display-pane-preview > button {
  justify-self: end;
}
body
  #app
  .split-view-popover.has-pane-preview
  :is(.split-pane-selectors, #splitTertiaryRow, #splitQuaternaryRow, #splitLayoutTools, #splitQuickLayouts) {
  display: none !important;
}
/* Hovering a layout shows only its compact, matching pane picker. */
body #app #splitViewPopover.display-layout-compact {
  width: min(315px, calc(100vw - 16px));
  padding: 8px;
}
body #app #splitViewPopover.display-layout-compact[data-preview-layout='single'] {
  width: min(265px, calc(100vw - 16px));
}
body #app #splitViewPopover.display-layout-compact :is(.split-layout-switch, .header-popover-title span, .display-pane-preview-heading) {
  display: none !important;
}
body #app #splitViewPopover.display-layout-compact .display-pane-preview {
  margin-top: 0;
  padding-top: 6px;
  border-top: 0;
  gap: 6px;
}
body #app #splitViewPopover.display-layout-compact .display-pane-preview-layout > label {
  box-sizing: border-box;
  min-height: 58px;
  padding: 6px;
  gap: 3px;
  font-size: 10px;
}
body #app #splitViewPopover.display-layout-compact .display-pane-preview select {
  height: 26px;
  font-size: 11px;
}
body #app .project-tab-rail :is(.feature-rail-tab, .plugin-rail-tab):disabled {
  opacity: 0.34 !important;
  cursor: default;
  box-shadow: none !important;
  background: transparent !important;
}
body #app .project-tab-rail :is(.feature-rail-tab, .plugin-rail-tab):disabled::after {
  display: none !important;
}
body #app .settings-tab-rail .control-tab:disabled {
  opacity: 0.34 !important;
  cursor: default;
  box-shadow: none !important;
  background: transparent !important;
}
body #app .settings-tab-rail .control-tab:disabled::before,
body #app .settings-tab-rail .control-tab:disabled::after {
  display: none !important;
}

/* Use real SVGs on Map controls: CSS masks previously left these buttons blank. */
body
  #app
  :is(
    #mapUnifiedZoomIn,
    #mapUnifiedZoomOut,
    #mapUnifiedPlay,
    #mapUnifiedStop,
    #mapUnifiedUndo,
    #mapUnifiedRedo
  ) {
  width: 28px;
  height: 27px;
  min-width: 28px;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: none;
  font-size: 12px !important;
  color: var(--cm-text);
}
body #app :is(#mapUnifiedZoomIn, #mapUnifiedZoomOut, #mapUnifiedPlay, #mapUnifiedStop)::before {
  display: none !important;
  content: none !important;
}
body
  #app
  :is(
    #mapUnifiedZoomIn,
    #mapUnifiedZoomOut,
    #mapUnifiedPlay,
    #mapUnifiedStop,
    #mapUnifiedUndo,
    #mapUnifiedRedo
  )
  > .ui-icon {
  display: block !important;
  width: 16px !important;
  height: 16px !important;
  overflow: visible;
  fill: none;
  stroke: currentColor;
}
body
  #app
  :is(
    #mapUnifiedZoomIn,
    #mapUnifiedZoomOut,
    #mapUnifiedPlay,
    #mapUnifiedStop,
    #mapUnifiedUndo,
    #mapUnifiedRedo
  ):disabled {
  opacity: 0.4 !important;
}
body #app #mapUnifiedPlay[aria-pressed='true'] {
  color: var(--cm-accent);
  background: var(--cm-accent-soft);
}
body #app .map-action-tools {
  align-items: center;
  gap: 4px;
}
body #app .map-zoom-readout {
  min-width: 4.2ch;
  white-space: nowrap;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* A single scroll container owns the sticky header and stable colgroup widths. */
/*
 * Source section 3/12: body app metadata editor table metadata grid virtual.
 * Assembles into styles/ui-harmony.css.
 * Rules remain in their original cascade order; later sections may intentionally override these
 * declarations.
 */
body #app #metadataEditor table.metadata-grid-virtual {
  table-layout: fixed !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
}
body #app #metadataEditor table.metadata-grid-virtual thead {
  position: sticky !important;
  top: 0 !important;
  z-index: 8 !important;
}
body #app #metadataEditor table.metadata-grid-virtual thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 8 !important;
  background: var(--cm-surface-2) !important;
  color: var(--cm-text) !important;
}
body #app #metadataEditor table.metadata-grid-virtual thead th.selection-col {
  top: 0 !important;
  left: 0 !important;
  z-index: 10 !important;
  background: var(--cm-surface-2) !important;
}
body #app #metadataEditor table.metadata-grid-virtual thead th.sample-col {
  z-index: 9 !important;
}
body #app #metadataEditor table.metadata-grid-virtual td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body #app #metadataEditor table.metadata-grid-virtual .sample-col {
  min-width: 0 !important;
}
body #app #metadataEditor .metadata-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: calc(100% - 23px);
  min-width: 0;
  vertical-align: middle;
}
body #app #metadataEditor .metadata-sort-btn > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body #app #metadataEditor th[data-column] {
  position: sticky;
  padding-right: 16px !important;
}
body #app #metadataEditor .metadata-column-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  bottom: 0;
  width: 8px;
  cursor: col-resize;
  z-index: 12;
  touch-action: none;
}
body #app #metadataEditor .metadata-column-resizer:hover {
  background: var(--cm-accent-soft);
  border-right: 2px solid var(--cm-accent);
}

body .tree-table-header-settings {
  cursor: pointer;
  opacity: 0.75;
}
body .tree-table-header-settings:is(:hover, :focus-visible) {
  opacity: 1;
  outline: none;
}
body .tree-polar-header {
  paint-order: stroke;
  stroke: var(--cm-surface, #fff);
  stroke-width: 2.5px;
  stroke-linejoin: round;
}
@media (max-width: 620px) {
  body #app .topbar-quick-controls {
    right: 5px;
    gap: 12px;
  }
  body #app .topbar > .menubar {
    padding-right: 236px;
  }
  body #app .app-layout-button {
    width: 20px;
  }
}

/* r76 follow-up: the Settings frame grows exactly like the Projects frame. */
body #app .right-panel {
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
}
body #app .right-panel .side-panel-topbar {
  flex: 0 0 auto !important;
  min-height: 35px !important;
}
body #app .right-panel .settings-inspector {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  height: auto !important;
  grid-template-columns: minmax(0, 1fr) var(--pw-side-rail-width, 46px) !important;
  align-items: stretch !important;
}
body #app .right-panel .settings-pages {
  min-height: 0 !important;
  height: auto !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}
body #app .right-panel .settings-tab-rail {
  box-sizing: border-box !important;
  min-height: 0 !important;
  height: auto !important;
  min-width: 0 !important;
  width: var(--pw-side-rail-width, 46px) !important;
  max-width: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
}
body.controls-collapsed #app .right-panel .settings-inspector {
  display: flex !important;
}
body.controls-collapsed #app .right-panel .settings-pages {
  display: none !important;
}
body.controls-collapsed #app .right-panel .settings-tab-rail {
  width: 100% !important;
}
/* Keep opening the tree inspector proportional to the visible controls. The
   browser remembers measured section heights and lays out offscreen sections
   when scrolled or focused, instead of rebuilding every open section at once. */
body #app .right-panel #tab-appearance > details.settings-compact-section {
  content-visibility: auto;
  contain-intrinsic-size: auto 36px;
}
/* Header and column settings share one compact editor and one Save action. */

/* Shared by every Edit-mode column menu in Explorer and Studio. */
body .tree-table-filter-menu {
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow: hidden;
  border-radius: 8px;
  font-family: var(--cm-font-ui, 'Segoe UI', sans-serif);
}
body .tree-table-filter-menu > strong,
body .tree-table-filter-menu > small,
body .tree-table-filter-menu > .tree-table-filter-actions {
  flex: 0 0 auto;
}
body .tree-table-filter-menu > p {
  flex: 0 0 auto;
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
}
body .tree-table-filter-menu > input[type='search'] {
  flex: 0 0 auto;
  min-width: 0;
  height: 29px;
  margin: 2px 0;
  padding: 5px 7px;
}
body .tree-table-filter-menu > .tree-table-filter-values {
  flex: 0 1 auto;
  min-height: 0;
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0;
  padding: 3px 0;
  scrollbar-gutter: stable;
}
body .tree-table-filter-menu .tree-table-filter-value {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  min-height: 30px;
  padding: 3px 2px;
  border-radius: 4px;
}
body .tree-table-filter-menu .tree-table-filter-value:hover {
  background: #f4f7fc;
}
body .tree-table-filter-menu .tree-table-filter-value > label {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  width: 100%;
  margin: 0;
  cursor: pointer;
}
body .tree-table-filter-menu .tree-table-filter-value input[type='checkbox'] {
  box-sizing: border-box;
  width: 14px;
  min-width: 14px;
  height: 14px;
  min-height: 14px;
  margin: 0;
  padding: 0;
  accent-color: var(--cm-accent, #375dfb);
}
body .tree-table-filter-menu .tree-table-filter-caption {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: normal;
  line-height: 1.4;
}
body .tree-table-filter-menu .tree-table-filter-count {
  white-space: nowrap;
  color: var(--cm-muted, #6f7b91);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
body .tree-table-filter-menu .tree-table-filter-value > input:is([type='color'], [data-color-control]) {
  box-sizing: border-box;
  width: 32px;
  min-width: 32px;
  max-width: 32px;
  height: 24px;
  min-height: 24px;
  padding: 1px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
}
body .tree-table-filter-menu > .tree-table-filter-actions {
  margin: 0;
  padding-top: 2px;
}
body .tree-table-filter-menu > .tree-table-filter-actions > button {
  min-height: 28px;
}

/* One compact editor: explicit label/control rows prevent inherited flex sizing. */
body .tree-header-editor {
  display: flex !important;
  flex-wrap: wrap;
  box-sizing: border-box;
  gap: 6px !important;
  padding: 8px !important;
  max-height: calc(100vh - 16px);
  overflow: auto;
  container-type: inline-size;
  container-name: tree-column-editor;
  background: var(--cm-surface);
  color: var(--cm-text);
  font: 11px/1.35 var(--cm-font-ui) !important;
}
body .tree-header-editor > input {
  flex: 0 0 100% !important;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 28px !important;
  margin: 0 !important;
  background: var(--cm-surface);
  color: var(--cm-text);
  border-color: var(--cm-border);
  font: inherit !important;
}
body .tree-header-edit-options {
  flex: 0 0 100%;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  align-items: start;
  gap: 5px 10px !important;
  border: 1px solid var(--cm-border);
  border-radius: 5px;
  padding: 6px 7px !important;
  margin: 0 !important;
}
body .tree-header-edit-options legend {
  padding: 0 4px;
  font: 600 11px/1.4 var(--cm-font-ui);
  white-space: normal;
}
body .tree-header-edit-options .tree-column-position,
body .tree-header-edit-options .explorer-target-fields,
body .tree-header-edit-options > label:has(select[aria-label='Apply to']) {
  grid-column: 1 / -1;
}
body .tree-header-edit-options .tree-column-edit-heading {
  grid-column: 1/-1;
  font-size: 10px;
  line-height: 1.4;
  color: var(--cm-muted);
  border-top: 1px solid var(--cm-border);
  padding-top: 4px;
}
body .tree-header-edit-options .tree-column-edit-heading:first-of-type {
  border-top: 0;
  padding-top: 0;
}
body .tree-header-edit-options .tree-column-edit-control {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: auto 26px !important;
  align-items: start !important;
  gap: 3px !important;
  min-width: 0 !important;
  margin: 0 !important;
  font: 11px/1.35 var(--cm-font-ui) !important;
}
body .tree-header-edit-options .tree-column-edit-control > span {
  display: block !important;
  min-width: 0;
  min-height: 15px;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  overflow-wrap: break-word;
  line-height: 1.35 !important;
  margin: 0 !important;
  padding: 0 !important;
}
body .tree-header-edit-options :is(input, select) {
  display: block !important;
  flex: 0 0 auto !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
  min-height: 26px !important;
  height: 26px !important;
  margin: 0 !important;
  padding: 3px 6px !important;
  font: 11px/1.2 var(--cm-font-ui) !important;
  border: 1px solid var(--cm-border) !important;
  border-radius: 3px !important;
  background: var(--cm-surface) !important;
  color: var(--cm-text) !important;
}
body .tree-header-edit-options select {
  padding-right: 19px !important;
}
body .tree-header-edit-options .tree-column-edit-check {
  grid-template-columns: minmax(0, 1fr) 14px !important;
  grid-template-rows: 26px !important;
  align-items: center !important;
  gap: 6px !important;
  align-self: end;
}
body .tree-header-edit-options input[type='checkbox'] {
  height: 14px !important;
  min-height: 14px !important;
  width: 14px !important;
  padding: 0 !important;
}
body .tree-header-edit-options input[type='color'] {
  padding: 1px 2px !important;
}
body .tree-header-edit-options :disabled {
  opacity: 0.5;
  cursor: default;
}
body .tree-header-editor > button {
  height: 26px !important;
  margin: 0;
  font: 11px/1.2 var(--cm-font-ui) !important;
  background: var(--cm-surface-2);
  color: var(--cm-text);
  border-color: var(--cm-border);
}
@container tree-column-editor (max-width:285px) {
  .tree-header-edit-options {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}
@media (max-width: 760px) {
  body #app .topbar {
    height: 103px !important;
    min-height: 103px !important;
    max-height: 103px !important;
    grid-template-columns: minmax(0, 1fr) 72px !important;
    grid-template-rows: 24px 27px 49px !important;
    grid-template-areas: 'brand .' 'menu menu' 'toolbar toolbar' !important;
    column-gap: 0 !important;
  }
  body #app .topbar > .menubar {
    padding-right: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  body #app .topbar .brand {
    min-width: 0 !important;
  }
}

/* r78: retain every original quick action in a shorter{
  height: 70px !important;
  min-height: 70px !important;
  max-height: 70px !important;
  grid-template-rows: 24px 44px !important;
  grid-template-areas: 'brand menu' 'toolbar toolbar' !important;
  padding: 0 6px !important;
}


/* Visibility preferences collapse their layout rows, including the lower pane's tabs. */
body.footer-hidden #app .professional-statusbar {
  display: none !important;
}
body.workspace-tabs-hidden #app :is(.dual-workspace-tabs, .workspace-tab-group-bottom) {
  display: none !important;
}
body.workspace-tabs-hidden #app #workspaceDocumentArea > .workspace-tab-group-bottom {
  display: none !important;
}
body.workspace-tabs-hidden #app .plot-shell {
  grid-template-rows: auto 0 minmax(0, 1fr) !important;
}
body.workspace-tabs-hidden #app .plot-shell:has(> #errorBanner:not(.hidden)) {
  grid-template-rows: auto 0 auto minmax(0, 1fr) !important;
}
body.workspace-tabs-hidden #app .plot-shell > #workspaceDocumentArea {
  grid-row: 3 !important;
}
body.workspace-tabs-hidden #app .plot-shell:has(> #errorBanner:not(.hidden)) > #workspaceDocumentArea {
  grid-row: 4 !important;
}
body.workspace-tabs-hidden #app #workspaceDocumentArea.split-mode.three-pane-mode {
  grid-template-rows: minmax(0, calc(var(--split-upper-height, 60%) - 3px)) 6px 0 minmax(0, 1fr) !important;
}
body.workspace-tabs-hidden
  #app
  #workspaceDocumentArea.three-pane-mode:is(.pane-min-bottom, .pane-closed-bottom) {
  grid-template-rows: minmax(0, 1fr) 0 0 0 !important;
}
body.workspace-tabs-hidden
  #app
  #workspaceDocumentArea.three-pane-mode:is(.pane-closed-left, .pane-min-left):is(
    .pane-closed-right,
    .pane-min-right
  ) {
  grid-template-rows: 0 0 0 minmax(0, 1fr) !important;
}
body.workspace-tabs-hidden
  #app
  #workspaceDocumentArea.three-pane-mode:is(.pane-max-left, .pane-max-right, .pane-max-bottom) {
  grid-template-rows: 0 minmax(0, 1fr) !important;
}
body.workspace-toolbar-hidden
  #app
  #workspaceDocumentArea
  :is(
    .workspace-actionbar-scroll,
    .canvas-action-strip,
    .data-action-strip,
    .analysis-view-actionbar,
    .map-actionbar,
    .clademap-mst-toolbar
  ) {
  display: none !important;
}

/* Import content is bounded by the existing panel at every allowed resize width. */
body #app .project-explorer-layout:not(.import-sidebar-closed) {
  grid-template-rows: minmax(0, 1fr) 6px minmax(
      min-content,
      calc(100% - var(--project-explorer-top, 80%) - 6px)
    ) !important;
}
body #app .project-import-sidebar,
body #app .project-import-sidebar .project-drop-zone {
  box-sizing: border-box !important;
  min-width: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
}
body #app .project-import-sidebar {
  overflow-x: hidden !important;
}
body #app .project-import-sidebar .project-drop-zone {
  flex: 0 0 auto !important;
  height: auto !important;
  min-height: 52px !important;
  overflow: visible !important;
}
body #app .project-import-sidebar .project-drop-zone :is(strong, span) {
  min-width: 0 !important;
  max-width: 100% !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  word-break: normal !important;
}
body #app .project-import-sidebar-head {
  flex: 0 0 auto;
  min-width: 0;
  max-width: 100%;
}
body #app .project-import-sidebar-head > button {
  flex: 0 0 23px;
}

/* Local project status keeps separate, padded title and count rows. */
body #app #projectDatabaseBar {
  box-sizing: border-box !important;
  grid-template-columns: 7px minmax(0, 1fr) auto !important;
  grid-template-rows: auto auto !important;
  gap: 3px 6px !important;
  align-items: start !important;
  padding: 6px 8px !important;
  min-height: 42px !important;
}
body #app #projectDatabaseBar .project-db-dot {
  grid-column: 1;
  grid-row: 1;
  margin-top: 5px;
}
body #app #projectDatabaseLabel {
  grid-column: 2;
  grid-row: 1;
  line-height: 1.4 !important;
}
body #app #projectLibraryCount {
  min-width: 0 !important;
  max-width: 100% !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
  line-height: 1.4 !important;
}

/* Respect the Settings resize floor instead of squeezing it through a media-query width. */
body #app .workspace-grid {
  grid-template-columns: var(--pw-project-panel-width) minmax(0, 1fr) var(--pw-settings-panel-width) !important;
}
body.inputs-collapsed #app .workspace-grid {
  grid-template-columns: var(--pw-side-rail-width, 46px) minmax(0, 1fr) var(--pw-settings-panel-width) !important;
}
body.controls-collapsed #app .workspace-grid {
  grid-template-columns: var(--pw-project-panel-width) minmax(0, 1fr) var(--pw-side-rail-width, 46px) !important;
}
body.inputs-collapsed.controls-collapsed #app .workspace-grid {
  grid-template-columns: var(--pw-side-rail-width, 46px) minmax(0, 1fr) var(--pw-side-rail-width, 46px) !important;
}
body #app .right-panel .settings-pages :is(label, .settings-inline-grid, .field-grid, .control-group) {
  min-width: 0 !important;
  max-width: 100% !important;
}
body #app .right-panel .settings-pages label > span {
  min-width: 0 !important;
  white-space: normal !important;
  overflow-wrap: anywhere !important;
}
body:not(.inputs-collapsed):not(.controls-collapsed) #app .workspace-grid,
body.pane-maximized:not(.inputs-collapsed):not(.controls-collapsed) #app .workspace-grid {
  grid-template-columns: var(--pw-project-panel-width) minmax(0, 1fr) var(--pw-settings-panel-width) !important;
}
body.inputs-collapsed:not(.controls-collapsed) #app .workspace-grid,
body.pane-maximized.inputs-collapsed:not(.controls-collapsed) #app .workspace-grid {
  grid-template-columns: var(--pw-side-rail-width, 46px) minmax(0, 1fr) var(--pw-settings-panel-width) !important;
}
body.controls-collapsed:not(.inputs-collapsed) #app .workspace-grid,
body.pane-maximized.controls-collapsed:not(.inputs-collapsed) #app .workspace-grid {
  grid-template-columns: var(--pw-project-panel-width) minmax(0, 1fr) var(--pw-side-rail-width, 46px) !important;
}
body.pane-maximized.inputs-collapsed.controls-collapsed #app .workspace-grid {
  grid-template-columns: var(--pw-side-rail-width, 46px) minmax(0, 1fr) var(--pw-side-rail-width, 46px) !important;
}

/* Project identity stays above the original boxed workspace tabs. */
body #app #plotHeader {
  display: none !important;
}
body #app .plot-shell {
  grid-template-rows: 0 auto minmax(0, 1fr) !important;
}
body #app .plot-shell > .dual-workspace-tabs {
  grid-row: 2 !important;
  min-width: 0 !important;
}
body #app .plot-shell > #workspaceDocumentArea {
  grid-row: 3 !important;
}
body #app .plot-shell:has(> #errorBanner:not(.hidden)) {
  grid-template-rows: 0 auto auto minmax(0, 1fr) !important;
}
body #app .plot-shell:has(> #errorBanner:not(.hidden)) > #workspaceDocumentArea {
  grid-row: 4 !important;
}
body.workspace-tabs-hidden #app .plot-shell {
  grid-template-rows: 0 0 minmax(0, 1fr) !important;
}
body.workspace-tabs-hidden #app .plot-shell:has(> #errorBanner:not(.hidden)) {
  grid-template-rows: 0 0 auto minmax(0, 1fr) !important;
}
body #app .dual-workspace-tabs .view-tab > span {
  display: inline !important;
  white-space: nowrap !important;
}
body #app .modebar {
  --project-label-accent: #287b79;
  min-width: 0;
}
body #app .active-project-chip {
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  gap: 4px;
  box-sizing: border-box;
  min-width: 0;
  max-width: min(300px, 35vw);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--project-label-accent);
}
body #app .active-project-chip #modePill {
  display: block;
  min-width: 0;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--project-label-accent) !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body #app .project-context-separator {
  flex: 0 0 auto;
  color: var(--cm-muted);
}
body #app #currentAnalysisLabel {
  display: none;
  align-self: center;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 30vw;
  font-size: 11px;
  font-weight: 600;
  color: var(--project-label-accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.workspace-tabs-hidden #app #currentAnalysisLabel {
  display: block;
}
body #app #currentAnalysisLabel::before {
  content: '\00b7';
  margin-right: 6px;
  color: var(--cm-muted);
}
body #app #currentAnalysisLabel[hidden] {
  display: none !important;
}
body #app #projectModeLabel {
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(400px, 30vw);
  font-size: 11px;
  line-height: 1.3;
  color: var(--cm-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body #app #projectModeLabel[hidden] {
  display: none !important;
}
body #app #projectForceRefreshBtn.is-pending {
  color: #946200 !important;
  background: #fff3c4 !important;
  border-color: #dfbd55 !important;
}
body #app #closeActiveProjectBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  padding: 3px;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--cm-muted);
  cursor: pointer;
}
body #app #closeActiveProjectBtn[hidden] {
  display: none !important;
}
body #app #closeActiveProjectBtn:hover {
  background: var(--cm-surface-2);
  border-color: var(--cm-border);
  color: var(--cm-text);
}
body #app #closeActiveProjectBtn .ui-icon {
  width: 15px;
  height: 15px;
}
/* Maximized panes use the full window rather than invisible sidebar columns. */
body.pane-maximized:not(.inputs-collapsed):not(.controls-collapsed) #app .workspace-grid,
body.pane-maximized.inputs-collapsed:not(.controls-collapsed) #app .workspace-grid,
body.pane-maximized.controls-collapsed:not(.inputs-collapsed) #app .workspace-grid,
body.pane-maximized.inputs-collapsed.controls-collapsed #app .workspace-grid {
  grid-template-columns: 0 minmax(0, 1fr) 0 !important;
  gap: 0 !important;
  padding: 0 !important;
}

/* r79 file import feedback and single-result actions. */
.saved-result-context-menu {
  position: fixed;
  z-index: 22000;
  padding: 4px;
  border: 1px solid var(--cm-border, #c7d3df);
  border-radius: 5px;
  background: var(--cm-surface, #fff);
  box-shadow: 0 4px 16px #0002;
}
.saved-result-context-menu button {
  display: block;
  width: 100%;
  padding: 7px 12px;
  border: 0;
  background: transparent;
  color: var(--cm-text, #172033);
  text-align: left;
  font: inherit;
}
.saved-result-context-menu button:hover {
  background: var(--cm-hover, #eef2f6);
}

/* r79 stacked/four-pane tab rails. Stable pane IDs remain in saved projects. */
:is(#app, body) .workspace-tab-group-fourth {
  display: none !important;
}
:is(#app, body) #workspaceDocumentArea > .workspace-tab-group-fourth,
body.workspace-vertical-enabled #app #workspaceDocumentArea > .workspace-tab-group-right {
  height: 30px;
  min-height: 30px;
  min-width: 0;
  align-items: center;
  padding: 0 5px;
  gap: 3px;
  box-sizing: border-box;
  overflow: hidden;
  border: 1px solid var(--cm-border, #dce3ef);
  background: var(--cm-surface, #fff);
  color: var(--cm-text, #172033);
}
:is(#app, body) .workspace-tab-group-fourth .workspace-tab-strip {
  flex: 1 1 auto;
  min-width: 0;
}
body.workspace-vertical-enabled #app .plot-tabs.dual-workspace-tabs {
  grid-template-columns: minmax(0, 1fr) !important;
}
body.workspace-vertical-enabled #app .plot-tabs > .workspace-tab-group-left {
  width: 100%;
  grid-column: 1/-1;
}
:is(#app, body) .split-layout-switch {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}
.clademap-workspace-tab-shell.is-dragging {
  opacity: 0.5;
}
.about-creator-story {
  margin: 18px 0;
  color: var(--cm-accent, #087e7d);
}
.about-modal .about-creator-story p {
  font-size: 13px;
  line-height: 1.65;
  margin: 0 0 14px;
  color: var(--cm-accent, #087e7d) !important;
}
.about-creator-story .about-creator {
  margin-top: 20px;
  margin-bottom: 0;
}
.about-creator strong {
  font-size: 14px;
}
.about-creator em {
  font-size: 12px;
  color: inherit;
}
.metadata-add-rows-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.metadata-add-rows-action .ui-icon {
  width: 14px;
  height: 14px;
}
#clearTreeHighlightBtn {
  display: inline-flex;
  align-items: center;
  gap: 8px !important;
}
#clearTreeHighlightBtn > .ui-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}
.metadata-filter-selection-hint {
  padding: 3px 9px;
}
.filter-chip :is(.metadata-filter-mode-toggle, .metadata-filter-remove) {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 2px 3px;
}
.metadata-filter-remove {
  display: inline-flex;
  align-items: center;
}
.metadata-row-dialog {
  width: min(460px, calc(100vw - 28px));
  box-sizing: border-box;
  max-height: calc(100vh - 28px);
  overflow: auto;
}
.metadata-row-dialog textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  margin-top: 6px;
  font: 12px/1.5 var(--cm-font-mono, monospace);
  padding: 8px;
  border: 1px solid var(--cm-border, #c7d3df);
  border-radius: 4px;
  background: var(--cm-surface, #fff);
  color: var(--cm-text, #172033);
}
.metadata-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.metadata-row-error {
  color: var(--error, #b42318);
}
.licenses-modal .dependency-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}
.licenses-modal .dependency-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10.5px;
  line-height: 1.35;
  text-align: left;
}
/*
 * Source section 5/12: licenses modal dependency table is th.
 * Assembles into styles/ui-harmony.css.
 * Rules remain in their original cascade order; later sections may intentionally override these
 * declarations.
 */
.licenses-modal .dependency-table :is(th, td) {
  padding: 3px 7px;
  border-bottom: 1px solid var(--cm-border, #dce3ef);
  vertical-align: top;
  font-weight: 400;
  overflow-wrap: anywhere;
}
.licenses-modal .dependency-version {
  font-variant-numeric: tabular-nums;
  font-size: 10px;
  color: var(--cm-muted, #61777c);
  width: 21%;
}
.licenses-modal .dependency-table thead th {
  font-weight: 700;
  background: var(--cm-surface-2, #f5f8fb);
}
.licenses-modal .dependency-table tbody th[scope='row'] {
  font-weight: 600;
  width: 27%;
}
.licenses-modal .dependency-table-section th {
  font-weight: 700;
  background: var(--cm-surface-2, #f5f8fb);
  color: var(--cm-muted, #61777c);
  padding-top: 7px;
}
.licenses-modal .dependency-table a,
.dependency-table-links a {
  color: var(--cm-accent, #087e7d);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.dependency-table-links {
  font-size: 10px;
  line-height: 1.5;
  margin-top: 10px;
}

/* Stacked Pane 2 is itself a rail, so its children need the same flex row as
   the pane groups nested in the main rail. Keep tab captions and close controls
   together above the view toolbar at every window width. */
body.workspace-vertical-enabled #app #workspaceDocumentArea > .workspace-tab-group-right {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  overflow: hidden !important;
}
body #app #workspaceDocumentArea > .workspace-tab-group .view-tab > span {
  display: inline !important;
}

/* Reserve the full attribution; data/status fields may shrink instead. */
body #app .professional-statusbar > .status-copyright {
  display: block !important;
  flex: 0 0 auto !important;
  max-width: none !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: clip !important;
}
body #app .professional-statusbar > .status-copyright-sep {
  display: block !important;
}
body #app .professional-statusbar .status-activity {
  min-width: 54px !important;
}
@media (max-width: 1000px) {
  body #app .professional-statusbar > #metadataMatchStatus,
  body #app .professional-statusbar > #statusRunId,
  body #app .professional-statusbar > .status-separator:not(.status-copyright-sep) {
    display: none !important;
  }
  body #app .professional-statusbar .statusbar-spacer {
    min-width: 0 !important;
    flex: 0 1 8px !important;
  }
}
@media (max-width: 650px) {
  body #app .professional-statusbar {
    flex-wrap: wrap !important;
    height: auto !important;
    min-height: 42px !important;
    overflow: visible !important;
  }
  body #app .professional-statusbar > .status-copyright {
    margin-left: auto !important;
  }
}

.clear-highlights-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.protected-snapshot-dialog {
  width: min(1400px, calc(100vw - 32px));
  height: min(900px, calc(100vh - 48px));
  padding: 0;
  border: 1px solid #c7d3df;
  border-radius: 8px;
  background: #fff;
  color: #243244;
  box-shadow: 0 12px 42px #17203333;
}
.protected-snapshot-dialog::backdrop {
  background: #17203344;
}
.protected-snapshot-dialog > header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #dce4ed;
}
.protected-snapshot-dialog > header > span {
  font-size: 11px;
  color: #60748a;
}
.protected-snapshot-dialog > header > button {
  margin-left: auto;
  border: 0;
  background: transparent;
  font-size: 22px;
  cursor: pointer;
}
.protected-snapshot-viewport {
  height: calc(100% - 46px);
  overflow: auto;
}
/* Simple popup: fixed CSS placement, one message, no animation or toolbar resizing. */
.clademap-notices {
  position: fixed;
  top: 80px;
  right: 12px;
  z-index: 25000;
  width: 460px;
  max-width: calc(100vw - 24px);
  pointer-events: none;
}
.clademap-notices[hidden],
.clademap-notice-actions[hidden] {
  display: none;
}
.clademap-notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #bed2dc;
  border-radius: 5px;
  background: #edf4f7;
  color: #365f72;
  font: 12px/1.4 var(--cm-font-ui, Arial, sans-serif);
  pointer-events: auto;
}
.clademap-notice-content {
  min-width: 0;
  flex: 1;
  max-height: calc(100vh - 112px);
  overflow: auto;
  overflow-wrap: anywhere;
}
.clademap-notice-text {
  white-space: normal;
}
.clademap-notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.clademap-notice-actions button {
  padding: 3px 6px;
  border: 1px solid #b8cede;
  border-radius: 3px;
  background: #fff;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.clademap-notice-dismiss {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 20px;
  line-height: 20px;
  cursor: pointer;
}
.clademap-notice button:focus-visible {
  outline: 2px solid #397bb4;
  outline-offset: 2px;
}
.clademap-notice[data-kind='success'] {
  background: #eaf7ef;
  color: #216947;
  border-color: #a8d3b8;
}
.clademap-notice[data-kind='selection'],
.clademap-notice[data-kind='loading'] {
  background: #edf4ff;
  color: #245d96;
  border-color: #b6d0ec;
}
.clademap-notice[data-kind='archive'] {
  background: #f3edff;
  color: #65418c;
  border-color: #ccb9e5;
}
.clademap-notice[data-kind='warning'] {
  background: #fff5e8;
  color: #895a20;
  border-color: #e8ce9d;
}
.clademap-notice[data-kind='error'] {
  background: #fff0ef;
  color: #9b3434;
  border-color: #e4b6b2;
}

/* Saved figures use an isolated renderer; the working application keeps its layout. */
.figure-snapshot-viewer {
  position: absolute;
  inset: 0;
  z-index: 100;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--panel, #fff);
  color: var(--text, #243244);
}
.figure-snapshot-viewer > header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border, #c7d3df);
  background: var(--panel, #fff);
}
.figure-snapshot-viewer > header > input {
  flex: 1 1 140px;
  min-width: 80px;
  padding: 4px 6px;
  border: 1px solid var(--border, #c7d3df);
  border-radius: 3px;
  font: inherit;
  color: inherit;
  background: inherit;
}
.figure-snapshot-viewer > header > span {
  flex: 1 1 100px;
  font-size: 11px;
  color: var(--muted, #60748a);
}
.figure-snapshot-viewer > header > button {
  padding: 4px 6px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: inherit;
  font: 11px Arial;
  cursor: pointer;
}
.figure-snapshot-viewer > header > button:hover {
  background: #edf3ff;
}
.figure-snapshot-viewer > header > button:disabled {
  opacity: 0.5;
  cursor: default;
}
.figure-snapshot-viewer > iframe {
  display: block;
  flex: 1;
  min-height: 0;
  width: 100%;
  border: 0;
  background: #fff;
}
.figure-inspection-document,
.figure-inspection-document body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}
body.figure-inspection .figure-inspection-path {
  display: block !important;
  position: relative !important;
  inset: auto !important;
  box-sizing: border-box !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}
body.figure-inspection
  .figure-inspection-path
  > :not(.figure-inspection-path):not(#workspaceDocumentArea):not(.error-banner) {
  display: none !important;
}
body.figure-inspection-readonly #workspaceDocumentArea {
  display: block !important;
  box-sizing: border-box;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  overflow: hidden !important;
}
body.figure-inspection-readonly #workspaceDocumentArea > .plot-view.active {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  height: 100% !important;
  max-height: none !important;
  grid-area: auto !important;
}
body.figure-inspection
  :is(
    .workspace-tab-group,
    .split-divider,
    .analysis-save-wrap,
    .workspace-window-controls,
    .workspace-window-titlebar
  ) {
  display: none !important;
}
body.figure-inspection-readonly
  :is(
    .analysis-view-actionbar,
    .sm-direct-editor,
    .clademap-map-figure-editor,
    .columns-popover,
    .figure-card-actions,
    .tree-vertical-handle
  ) {
  display: none !important;
}
body.figure-inspection-readonly .canvas-action-strip > :not(.tree-pane-zoom-controls) {
  display: none !important;
}
body.figure-inspection-readonly #workspaceDocumentArea :is(input, select, textarea, [contenteditable]) {
  pointer-events: none !important;
}
body.figure-inspection .error-banner {
  position: fixed !important;
  bottom: 8px;
  left: 8px;
  right: 8px;
  z-index: 30000;
}
.saved-views-type-filter {
  max-width: 145px;
  padding: 5px;
  border: 1px solid var(--cm-border, #c7d3df);
  border-radius: 3px;
  color: inherit;
  background: var(--cm-surface, #fff);
  font: inherit;
}
body.figure-inspection-readonly
  :is([data-figure-element], .metadata-header-draggable, .tree-table-resize-handle) {
  pointer-events: none !important;
}
.tree-action-strip > button,
.compact-action-strip > button,
.tree-pane-zoom-controls > button {
  width: 32px;
  min-width: 32px;
  height: 30px;
  padding: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.tree-action-strip > button .ui-icon,
.compact-action-strip > button .ui-icon,
.tree-pane-zoom-controls > button .ui-icon {
  width: 18px;
  height: 18px;
  flex: none;
}
.tree-action-strip > .analysis-save-wrap,
.compact-action-strip > .analysis-save-wrap {
  margin-left: auto;
}
.tree-action-strip .tree-pane-zoom-controls,
.compact-action-strip .tree-pane-zoom-controls {
  gap: 2px;
}
.tree-action-strip > button,
.compact-action-strip > button,
.tree-action-strip .tree-pane-zoom-controls,
.compact-action-strip .tree-pane-zoom-controls,
.tree-action-strip .tree-pane-zoom-controls > button,
.compact-action-strip .tree-pane-zoom-controls > button,
.tree-action-strip .workspace-save-btn,
.compact-action-strip .workspace-save-btn {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}
.tree-action-strip > button:hover,
.compact-action-strip > button:hover,
.tree-action-strip .workspace-save-btn:hover,
.compact-action-strip .workspace-save-btn:hover {
  color: var(--cm-accent, #2563eb);
}
.tree-action-strip > button.active,
.compact-action-strip > button.active {
  color: var(--cm-accent, #2563eb);
}
.metadata-layer-ids {
  max-width: 380px;
  max-height: 120px;
  overflow: auto;
  overflow-wrap: anywhere;
  font-size: 10px;
  padding: 4px 0;
}
.tree-action-strip > button[aria-pressed='true'],
.compact-action-strip > button[aria-pressed='true'] {
  position: relative;
  color: #075dcc !important;
  opacity: 1 !important;
}
.tree-action-strip > button[aria-pressed='true'] .ui-icon,
.compact-action-strip > button[aria-pressed='true'] .ui-icon {
  stroke-width: 2.8 !important;
}
.tree-action-strip > button[aria-pressed='true']::after,
.compact-action-strip > button[aria-pressed='true']::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: calc(50% - 3px);
  width: 6px;
  height: 3px;
  background: currentColor;
  border-radius: 2px;
}
.branch-truncation-row {
  display: flex;
  gap: 5px;
  align-items: center;
  margin: 4px 0;
}
.branch-truncation-row > button:first-child {
  flex: 1;
  min-width: 0;
  text-align: left;
  overflow-wrap: anywhere;
}
#compactAnnotationText {
  width: 100%;
  resize: vertical;
  min-height: 60px;
}
#tab-appearance [data-tree-show-when].is-layout-hidden,
#tab-appearance .settings-inline-grid.is-layout-hidden {
  display: none !important;
}
body #app #tab-appearance.tree-settings.unified-settings [data-tree-show-when].is-layout-hidden,
body #app #tab-appearance.tree-settings.unified-settings .settings-inline-grid.is-layout-hidden {
  display: none !important;
}
body #app :is(.tree-action-strip, .compact-action-strip) > button,
body #app :is(.tree-action-strip, .compact-action-strip) .tree-pane-zoom-controls,
body #app :is(.tree-action-strip, .compact-action-strip) .tree-pane-zoom-controls > button,
body #app :is(.tree-action-strip, .compact-action-strip) .workspace-save-btn {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
body #app :is(.tree-action-strip, .compact-action-strip) > button[aria-pressed='true'] {
  color: #075dcc !important;
  position: relative;
  opacity: 1 !important;
}
.metadata-link-status-btn.is-warning {
  background: #fff6d5 !important;
  border-color: #d9aa24 !important;
  color: #805700 !important;
  font-weight: 750;
}
/*
 * Source section 6/12: metadata link status btn is warning metadata link status dot.
 * Assembles into styles/ui-harmony.css.
 * Rules remain in their original cascade order; later sections may intentionally override these
 * declarations.
 */
.metadata-link-status-btn.is-warning .metadata-link-status-dot {
  background: #d59a00 !important;
}
.metadata-link-popover.is-warning {
  background: #fffdf5 !important;
  border-color: #d9aa24 !important;
}
.metadata-link-panel .data-linkage-reference {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 5px;
  background: #eef3fb;
  border-radius: 4px;
  font-size: 9px;
}
.metadata-link-panel .data-linkage-reference span {
  flex: 1;
  overflow-wrap: anywhere;
}
.metadata-link-panel .data-linkage-note {
  margin: 7px 0;
  color: #58677c;
  font-size: 10px;
  line-height: 1.45;
}
.metadata-link-panel .data-linkage-error {
  color: #a32620;
  font-size: 10px;
  line-height: 1.45;
}
.metadata-link-panel tr.is-error > td {
  background: #fff0ee;
  color: #962b25;
}
.metadata-link-panel tr.is-warning > td {
  background: #fff5cf;
  color: #785600;
}
.metadata-link-panel tr.is-good > td {
  background: #f0faf3;
  color: #17613c;
}
.metadata-link-panel .data-linkage-repair {
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid #dce3ed;
}
.metadata-link-panel .data-linkage-repair h4 {
  margin: 0 0 4px;
  font-size: 10px;
}
.metadata-link-panel .data-linkage-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 6px;
  margin: 4px 0;
}
.metadata-link-panel .data-linkage-fields > label {
  display: flex;
  flex: 1;
  min-width: 150px;
  flex-direction: column;
  gap: 2px;
  font-size: 9px;
}
.metadata-link-panel .data-linkage-fields select,
.metadata-link-panel .data-linkage-fields input[type='search'] {
  width: 100%;
  height: 23px;
  min-height: 23px;
  padding: 2px 5px;
  font-size: 10px;
}
.metadata-link-panel .data-linkage-fields .data-linkage-check {
  flex-direction: row;
  align-items: center;
  min-height: 23px;
}
.metadata-link-panel .data-linkage-actions,
.metadata-link-panel .data-linkage-proceed {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}
.metadata-link-panel .data-linkage-actions button,
.metadata-link-panel .data-linkage-proceed button {
  min-height: 23px;
  padding: 2px 6px;
  font-size: 9px;
}
.metadata-link-panel .data-linkage-proceed {
  padding: 6px 0 1px;
  border-top: 1px solid #dce3ed;
}
.metadata-link-panel .data-linkage-proceed > span {
  flex: 1;
  min-width: 200px;
  font-size: 10px;
}
.metadata-link-panel.is-warning .data-linkage-proceed {
  color: #805700;
}
.metadata-link-panel .data-linkage-rows input[data-linkage-target] {
  width: 100%;
  min-width: 90px;
  height: 22px;
  min-height: 22px;
  padding: 2px 4px;
  font-size: 10px;
}
.metadata-link-panel .data-linkage-repair .metadata-link-table-wrap {
  max-height: 180px;
  overflow: auto;
}
.metadata-link-panel .data-linkage-repair .metadata-layer-ids {
  max-height: 65px;
  overflow: auto;
  font-size: 9px;
}
.metadata-link-panel .data-linkage-rows td {
  padding: 3px 5px;
  font-size: 9px;
}
.metadata-link-panel .data-linkage-rows td small {
  display: block;
  color: #748095;
}

.metadata-link-panel .data-linkage-repair h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.metadata-link-panel [data-linkage-close-repair] {
  border: 0;
  background: transparent;
  padding: 0 3px;
  min-height: 18px;
  color: #64748b;
  font-size: 16px;
}
.metadata-link-panel .data-linkage-file-strip {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  overflow-x: auto;
  max-width: 100%;
  padding: 5px 0;
  scrollbar-width: thin;
}
.metadata-link-panel .data-linkage-file {
  flex: 1 0 125px;
  min-width: 125px;
  max-width: 220px;
  padding: 4px 5px;
  border: 1px solid #d5dfeb;
  border-radius: 4px;
  background: #f8fafc;
}
.metadata-link-panel .data-linkage-file.is-good {
  border-color: #b9ddc6;
  background: #f0faf3;
}
.metadata-link-panel .data-linkage-file.is-error {
  border-color: #e9a19b;
  background: #fff1ef;
}
.metadata-link-panel .data-linkage-file.is-warning {
  border-color: #d9aa24;
  background: #fff6d5;
}
.metadata-link-panel .data-linkage-file-name {
  display: flex !important;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  max-width: 100%;
  width: 100%;
  min-height: 0 !important;
  height: auto !important;
  padding: 0 0 3px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: inherit;
  text-align: left;
  font-size: 9px;
}
.metadata-link-panel .data-linkage-file-name span,
.metadata-link-panel .data-linkage-file-name b {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metadata-link-panel .data-linkage-file > label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 8px;
  color: #657287;
}
.metadata-link-panel .data-linkage-file select {
  width: 100%;
  min-width: 0 !important;
  min-height: 22px !important;
  height: 22px !important;
  padding: 2px 18px 2px 4px !important;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  font-size: 9px;
}
.metadata-link-panel .data-linkage-fixed-id {
  display: flex;
  align-items: center;
  height: 34px;
  font-size: 9px;
  color: #657287;
}
.metadata-link-panel.metadata-link-popover {
  overflow-x: hidden !important;
  box-sizing: border-box;
}
.metadata-link-panel .data-linkage-status-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}
.metadata-link-panel .data-linkage-status-table th {
  height: 23px;
  font-size: 8px;
  white-space: nowrap;
  letter-spacing: 0;
  text-transform: none;
  padding: 2px 4px;
}
.metadata-link-panel .data-linkage-status-table td {
  height: 24px;
  padding: 2px 4px;
  font-size: 9px;
}
.metadata-link-panel .data-linkage-status-table th:nth-child(1) {
  width: 33%;
}
.metadata-link-panel .data-linkage-status-table th:nth-child(2) {
  width: 9%;
}
.metadata-link-panel .data-linkage-status-table th:nth-child(3) {
  width: 10%;
}
.metadata-link-panel .data-linkage-status-table th:nth-child(4) {
  width: 8%;
}
.metadata-link-panel .data-linkage-status-table th:nth-child(5) {
  width: 13%;
}
.metadata-link-panel .data-linkage-status-table th:nth-child(6) {
  width: 18%;
}
.metadata-link-panel .data-linkage-status-table th:nth-child(7) {
  width: 9%;
}
.metadata-link-panel .data-linkage-status-table :is(th, td):nth-child(n + 2) {
  text-align: center;
}
.metadata-link-panel .data-linkage-status-table td:last-child {
  overflow: visible;
}
.metadata-link-panel .data-linkage-repair h4 > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.metadata-link-panel .data-linkage-rows th:nth-child(1) {
  width: 30%;
}
.metadata-link-panel .data-linkage-rows th:nth-child(2) {
  width: 30%;
}
.metadata-link-panel .data-linkage-rows th:nth-child(3) {
  width: 40%;
}
.metadata-link-panel .data-linkage-rows.has-exclude th:nth-child(3) {
  width: 32%;
}
.metadata-link-panel .data-linkage-rows.has-exclude th:nth-child(4) {
  width: 8%;
  min-width: 0;
}
.metadata-link-panel .data-linkage-rows input[data-linkage-target] {
  min-width: 0 !important;
  box-sizing: border-box;
}
.metadata-link-panel .data-linkage-icon-action,
.metadata-link-panel .metadata-link-close,
.metadata-link-panel [data-linkage-close-repair] {
  display: inline-grid !important;
  place-items: center;
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  padding: 3px !important;
  border: 0 !important;
  border-radius: 3px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #5b6c82;
  cursor: pointer;
}
.metadata-link-panel .data-linkage-icon-action:hover,
.metadata-link-panel .metadata-link-close:hover,
.metadata-link-panel [data-linkage-close-repair]:hover {
  background: #e9eff6 !important;
  color: #245c9d;
}
.metadata-link-panel .ui-icon {
  width: 13px;
  height: 13px;
  stroke-width: 1.8;
}
.metadata-link-panel .data-linkage-text-action,
.metadata-link-panel .data-linkage-actions button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 3px;
  color: #475c76;
}
.metadata-link-panel .data-linkage-text-action:hover,
.metadata-link-panel .data-linkage-actions button:hover:not(:disabled) {
  background: #edf2f7;
  color: #245c9d;
}
.metadata-link-panel .metadata-link-headline {
  flex-direction: row !important;
  align-items: center !important;
}
.metadata-link-status-btn > .ui-icon {
  width: 12px;
  height: 12px;
}
.metadata-link-panel .data-linkage-text-action,
.metadata-link-panel .data-linkage-actions button {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.metadata-link-panel .data-linkage-text-action:hover:not(:disabled),
.metadata-link-panel .data-linkage-actions button:hover:not(:disabled) {
  background: #edf2f7 !important;
}
.metadata-link-panel button:disabled {
  opacity: 0.45;
  cursor: default;
}
.metadata-link-panel :is(button, select, input):focus-visible {
  outline: 2px solid #5e86bd;
  outline-offset: 1px;
}
.tree-action-strip > .tree-toolbar-separator,
.compact-action-strip > .tree-toolbar-separator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 7px;
  align-self: center;
  height: 18px;
  padding: 0;
  margin: 0 2px;
  color: #9aa9bc;
  font-size: 13px;
  font-weight: 400;
  line-height: 1;
  user-select: none;
  pointer-events: none;
}

/* r81: compact input matching, explicit active file and one shared ID picker. */
#metadataLinkPanel.linkage-review {
  font-size: 10px;
}
#metadataLinkPanel.linkage-review .linkage-match-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 9px;
  padding: 3px 4px;
  background: #eef3fb;
  border-radius: 3px;
  font-size: 9px;
}
#metadataLinkPanel.linkage-review .linkage-match-options > span {
  flex: 1 1 230px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#metadataLinkPanel.linkage-review .linkage-match-options label,
#metadataLinkPanel.linkage-review .linkage-detail-tools label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  font-size: 9px;
}
#metadataLinkPanel.linkage-review input[type='checkbox'] {
  margin: 0;
  width: 12px;
  height: 12px;
  min-height: 0;
}
#metadataLinkPanel.linkage-review .linkage-editing-banner {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 25px;
  box-sizing: border-box;
  margin: 5px 0;
  padding: 3px 6px;
  border-left: 3px solid #2563b8;
  border-radius: 3px;
  background: #e7f0ff;
  color: #164d94;
  font-size: 10px;
}
#metadataLinkPanel.linkage-review .linkage-editing-banner span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}
#metadataLinkPanel.linkage-review .linkage-editing-banner.is-idle {
  min-height: 20px;
  border-color: transparent;
  background: transparent;
  color: #6d7b8d;
  font-size: 9px;
  font-weight: 400;
}
#metadataLinkPanel.linkage-review .metadata-link-table {
  width: 100% !important;
  min-width: 0 !important;
  table-layout: fixed !important;
}
#metadataLinkPanel.linkage-review .metadata-link-table th {
  height: 22px;
  padding: 2px 4px;
  font-size: 8px;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
}
#metadataLinkPanel.linkage-review .metadata-link-table td {
  padding: 3px 4px;
  font-size: 9px;
  min-width: 0;
}
#metadataLinkPanel.linkage-review .linkage-review-summary {
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
}
#metadataLinkPanel.linkage-review .linkage-review-table th:nth-child(1) {
  width: 24%;
}
#metadataLinkPanel.linkage-review .linkage-review-table th:nth-child(2) {
  width: 32%;
}
#metadataLinkPanel.linkage-review .linkage-review-table th:nth-child(3) {
  width: 11%;
}
#metadataLinkPanel.linkage-review .linkage-review-table th:nth-child(4),
#metadataLinkPanel.linkage-review .linkage-review-table th:nth-child(5) {
  width: 7%;
}
#metadataLinkPanel.linkage-review .linkage-review-table th:nth-child(6) {
  width: 10%;
}
#metadataLinkPanel.linkage-review .linkage-review-table th:nth-child(7) {
  width: 9%;
}
/*
 * Source section 7/12: metadata link panel linkage review linkage review table is th.
 * Assembles into styles/ui-harmony.css.
 * Rules remain in their original cascade order; later sections may intentionally override these
 * declarations.
 */
#metadataLinkPanel.linkage-review .linkage-review-table :is(th, td):nth-child(n + 3) {
  text-align: center;
}
#metadataLinkPanel.linkage-review .linkage-review-table td:nth-child(3) .ui-icon {
  width: 11px;
  height: 11px;
  vertical-align: -2px;
  margin-right: 3px;
}
#metadataLinkPanel.linkage-review .linkage-review-table tr.is-editing > td {
  border-top: 1px solid #467ac0;
  border-bottom: 1px solid #467ac0;
}
#metadataLinkPanel.linkage-review .linkage-review-table tr.is-editing > td:first-child {
  box-shadow: inset 3px 0 #2563b8;
}
#metadataLinkPanel.linkage-review .linkage-review-table tr.is-editing .linkage-file-select {
  color: #164d94;
}
#metadataLinkPanel.linkage-review .linkage-file-select {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  padding: 0 0 0 3px;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
#metadataLinkPanel.linkage-review .linkage-file-select b,
#metadataLinkPanel.linkage-review .linkage-file-caption,
#metadataLinkPanel.linkage-review .linkage-id-preview {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#metadataLinkPanel.linkage-review .linkage-file-caption {
  font-size: 8.5px;
}
#metadataLinkPanel.linkage-review .linkage-id-preview {
  padding-top: 2px;
  font-size: 8px;
  color: #657287;
}
#metadataLinkPanel.linkage-review .linkage-fixed-id {
  font-size: 9px;
  color: #657287;
}
#metadataLinkPanel.linkage-review select[data-linkage-column],
#metadataLinkPanel.linkage-review .linkage-metadata-source select {
  width: 100%;
  min-width: 0 !important;
  height: 23px !important;
  min-height: 23px !important;
  padding: 2px 17px 2px 4px !important;
  font-size: 9px !important;
  border: 1px solid #c2cedd;
  border-radius: 4px;
  background: #fff;
  color: #27364d;
}
#metadataLinkPanel.linkage-review .linkage-metadata-source {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 5px 0;
  font-size: 9px;
}
#metadataLinkPanel.linkage-review .linkage-metadata-source select {
  flex: 1;
}
#metadataLinkPanel.linkage-review .linkage-match-details {
  margin-top: 6px;
  padding-top: 3px;
  border-top: 1px solid #d7e0ec;
}
#metadataLinkPanel.linkage-review .linkage-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  font-size: 10px;
  color: #164d94;
}
#metadataLinkPanel.linkage-review .linkage-detail-head b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#metadataLinkPanel.linkage-review .linkage-detail-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 3px 0 4px;
}
#metadataLinkPanel.linkage-review .linkage-detail-tools input[type='search'] {
  flex: 1;
  min-width: 0;
  height: 23px;
  min-height: 23px;
  padding: 2px 5px;
  font-size: 9px;
  border: 1px solid #c2cedd;
  border-radius: 4px;
  background: #fff;
}
#metadataLinkPanel.linkage-review .linkage-detail-scroll {
  display: block;
  box-sizing: border-box;
  flex: 0 0 auto;
  min-height: 0;
  height: min(200px, 32vh);
  max-height: min(200px, 32vh);
  overflow-y: scroll !important;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  overscroll-behavior-y: contain;
}
#metadataLinkPanel.linkage-review .linkage-detail-scroll.is-empty {
  height: auto;
  overflow-y: auto !important;
}
#metadataLinkPanel.linkage-review .linkage-detail-scroll:focus-visible {
  outline: 2px solid #5e86bd;
  outline-offset: 1px;
}
#metadataLinkPanel.linkage-review .linkage-match-table {
  height: auto !important;
  min-height: 0;
}
#metadataLinkPanel.linkage-review .linkage-match-table td {
  white-space: normal;
  overflow-wrap: anywhere;
  text-overflow: clip;
  line-height: 1.4;
}
#metadataLinkPanel.linkage-review .linkage-missing-sample td {
  background: #fff8ed;
}
#metadataLinkPanel.linkage-review .linkage-missing-sample td:nth-child(2) {
  font-weight: 650;
  color: #694a16;
}
#metadataLinkPanel.linkage-review .linkage-detail-counts {
  margin: 4px 0;
  color: #694a16;
  font-size: 9px;
}
#metadataLinkPanel.linkage-review .linkage-count-action {
  display: inline;
  min-width: 20px;
  min-height: 22px;
  padding: 0 3px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
#metadataLinkPanel.linkage-review .linkage-count-action:hover {
  background: #e7f0ff;
  color: #164d94;
}
#metadataLinkPanel.linkage-review .linkage-match-table th:nth-child(1) {
  width: 33%;
}
#metadataLinkPanel.linkage-review .linkage-match-table th:nth-child(2) {
  width: 40%;
}
#metadataLinkPanel.linkage-review .linkage-match-table th:nth-child(3) {
  width: 27%;
}
#metadataLinkPanel.linkage-review .linkage-id-choice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  width: 100%;
  min-width: 0;
  min-height: 23px;
  height: auto;
  padding: 2px 4px;
  border: 1px solid #c2cedd;
  border-radius: 4px;
  background: #fff;
  color: #304765;
  font-size: 9px;
  cursor: pointer;
}
#metadataLinkPanel.linkage-review .linkage-id-choice span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#metadataLinkPanel.linkage-review .linkage-id-choice .ui-icon {
  flex: 0 0 11px;
  width: 11px;
  height: 11px;
}
#metadataLinkPanel.linkage-review .metadata-layer-ids {
  max-height: 65px;
  overflow: auto;
  font-size: 9px;
}
#metadataLinkPanel.linkage-review .data-linkage-error {
  margin: 3px 0;
  font-size: 9px;
}
#metadataLinkPanel.linkage-review .linkage-review-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding-top: 5px;
  border-top: 1px solid #d7e0ec;
  font-size: 9px;
}
#metadataLinkPanel.linkage-review .linkage-review-footer > span {
  flex: 1;
  min-width: 0;
}
#metadataLinkPanel.linkage-review .linkage-review-footer button {
  min-height: 25px;
  padding: 3px 5px;
  font-size: 10px;
  color: #1b589c;
  font-weight: 650;
  white-space: nowrap;
}
#metadataLinkPanel.linkage-review .linkage-tree-picker {
  position: fixed;
  inset: 0;
  margin: auto;
  width: min(360px, calc(100vw - 30px));
  max-height: calc(100vh - 40px);
  padding: 9px 11px;
  border: 1px solid #9fb9db;
  border-radius: 7px;
  background: #fff;
  color: #27364d;
  box-shadow: 0 9px 28px #1c2b4230;
  font: 11px/1.4 var(--app-font-family, 'Noto Sans', 'Segoe UI', sans-serif);
}
#metadataLinkPanel.linkage-review .linkage-tree-picker::backdrop {
  background: #172c4526;
}
#metadataLinkPanel.linkage-review .linkage-picker-head,
#metadataLinkPanel.linkage-review .linkage-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
}
#metadataLinkPanel.linkage-review .linkage-picker-sample {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 5px;
  font-size: 9px;
  color: #526782;
}
#metadataLinkPanel.linkage-review .linkage-tree-picker input[type='search'] {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 26px;
  height: 26px;
  padding: 3px 5px;
  font: inherit;
  border: 1px solid #bbc9db;
  border-radius: 4px;
}
#metadataLinkPanel.linkage-review .linkage-tree-picker select {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0 !important;
  height: 190px !important;
  min-height: 190px !important;
  max-height: 40vh;
  margin: 5px 0;
  padding: 3px !important;
  font: inherit;
  border: 1px solid #bbc9db;
  border-radius: 4px;
  background: #fff;
}
#metadataLinkPanel.linkage-review .linkage-tree-picker option {
  padding: 3px 5px;
}
#metadataLinkPanel.linkage-review .linkage-picker-footer > span {
  flex: 1;
  color: #657287;
  font-size: 9px;
}
#metadataLinkPanel.linkage-review .linkage-picker-footer button {
  min-height: 24px;
  font-size: 10px;
}

#metadataLinkPanel.linkage-review .linkage-editing-banner {
  position: sticky;
  top: 0;
  z-index: 3;
}

#metadataLinkPanel.linkage-review select.linkage-inline-id {
  box-sizing: border-box;
  width: 100%;
  min-width: 0 !important;
  height: 23px !important;
  min-height: 23px !important;
  padding: 2px 17px 2px 4px !important;
  border: 1px solid #c2cedd;
  border-radius: 4px;
  background: #fff;
  color: #304765;
  font-size: 9px !important;
}

/* Geometry child controls stay hidden when their selected layout does not use them. */
#treeLayoutSettings label.is-layout-hidden {
  display: none !important;
}

/* Tip hover follows the terminal branch, including circular and curved paths. */
.tree-hover-shape.is-tip-edge {
  fill: none;
  stroke: rgba(96, 165, 250, 0.35);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* r82 grouped tree editing. */
.node-menu {
  width: 264px;
  max-width: calc(100vw - 16px);
  max-height: 72vh;
  overflow: auto;
}
.node-menu button,
.node-menu summary {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.node-menu summary {
  list-style: none;
  font-weight: 600;
}
.node-menu summary::-webkit-details-marker {
  display: none;
}
.node-menu summary:after {
  content: '›';
  margin-left: auto;
}
.node-menu details[open] > summary:after {
  transform: rotate(90deg);
}
.node-menu details > button {
  padding-left: 30px;
}
.node-menu button:hover,
.node-menu summary:hover {
  background: #edf3ff;
}
.node-menu .ui-icon {
  width: 15px;
  height: 15px;
  flex: none;
}
.node-menu [hidden] {
  display: none !important;
}
.tree-node-editor-dialog {
  width: min(620px, 94vw);
  max-height: 88vh;
  border: 1px solid #bdcce1;
  border-radius: 9px;
  padding: 0;
  color: #263548;
  background: #fff;
}
.tree-node-editor-dialog::backdrop {
  background: #26354844;
}
.tree-node-editor-dialog > header,
.tree-node-editor-dialog > footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: #f5f8fc;
}
.tree-node-editor-dialog > header strong {
  flex: 1;
}
.tree-node-editor-dialog > footer {
  justify-content: flex-end;
}
.tree-node-editor-body {
  padding: 14px 16px;
  overflow: auto;
  max-height: 65vh;
}
.tree-node-field {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(140px, 2fr);
  align-items: center;
  gap: 12px;
  margin: 8px 0;
}
.tree-node-field input,
.tree-node-field select,
.tree-node-field textarea {
  min-width: 0;
  width: 100%;
}
.tree-node-field input[type='checkbox'] {
  width: auto;
  justify-self: start;
}
.tree-node-editor-error {
  margin: 0 16px;
  color: #b42318;
}
.tree-node-hint {
  font-size: 12px;
  color: #667085;
}
.tree-node-segment {
  display: grid;
  grid-template-columns: 1fr 22px 22px 40px 24px;
  gap: 6px;
  align-items: center;
  margin: 6px 0;
}
.tree-node-segment input {
  min-width: 0;
}
.tree-node-metadata-table {
  font-size: 12px;
  border-collapse: collapse;
}
.tree-node-metadata-table td,
.tree-node-metadata-table th {
  padding: 5px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.tree-node-id-list {
  max-height: 220px;
  overflow: auto;
}

/* Lazy, isolated drawing workspace. */
.figure-drawing-editor {
  position: absolute;
  right: auto !important;
  bottom: auto !important;
  z-index: 25;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: transparent;
  isolation: isolate;
  contain: layout style paint;
  will-change: transform;
}
.figure-drawing-editor > iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}
.figure-drawing-editor > .figure-drawing-close {
  position: absolute;
  right: 12px;
  top: 60px;
  z-index: 2;
  width: 30px;
  height: 30px;
  border: 1px solid #dce4ef;
  border-radius: 5px;
  background: #fff;
  color: #53647a;
  font: 20px Arial;
  cursor: pointer;
}
/*
 * Source section 8/12: map interactive view.
 * Assembles into styles/ui-harmony.css.
 * Rules remain in their original cascade order; later sections may intentionally override these
 * declarations.
 */
#mapInteractiveView,
#mapStaticView {
  position: relative;
}
.figure-drawing-toggle img {
  width: 18px;
  height: 18px;
}
.figure-drawing-toggle.active {
  background: none !important;
  box-shadow: inset 0 -3px #2563eb !important;
}
.node-menu > .node-menu-name {
  position: sticky;
  top: 0;
  background: #f5f8fc;
  z-index: 1;
}
.node-menu .node-menu-group {
  border-top: 1px solid #e5ebf4;
}
.node-menu button,
.node-menu summary {
  min-height: 27px;
}

.tree-cluster-colors {
  grid-column: 1/-1;
}
.tree-cluster-colors > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
  max-height: 190px;
  overflow: auto;
  padding: 5px 0;
}
.tree-cluster-colors label {
  display: flex !important;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.tree-cluster-colors label span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tree-cluster-colors input[type='color'] {
  flex: none;
  width: 30px !important;
  min-width: 30px !important;
  height: 24px;
  padding: 1px;
}
.tree-cluster-settings [hidden] {
  display: none !important;
}

.figure-drawing-map-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none !important;
  overflow: visible;
}
[data-figure-annotations] {
  pointer-events: none !important;
}

.tree-annotation-menu {
  position: fixed;
  z-index: 31003;
  box-sizing: border-box;
  width: 220px;
  max-width: calc(100vw - 16px);
  padding: 6px;
  background: var(--panel, #fff);
  border: 1px solid var(--border, #c7d3df);
  border-radius: 5px;
  box-shadow: 0 4px 14px #17203320;
  color: var(--text, #243244);
  font: 12px Arial;
}
.tree-annotation-menu label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  cursor: pointer;
}
.tree-annotation-menu label:hover {
  background: #edf3ff;
}
.tree-annotation-menu input {
  accent-color: #2563eb;
}
#savedViewsPopover {
  box-sizing: border-box;
  padding: 10px;
  border: 1px solid var(--border, #c7d3df);
  border-radius: 6px;
  background: var(--panel, #fff);
  color: var(--text, #243244);
  box-shadow: 0 4px 18px #17203326;
}
#savedViewsPopover.snapshot-save-mode
  :is(.saved-views-search, .saved-views-list, .saved-view-create > summary, .header-popover-title span) {
  display: none !important;
}
#savedViewsPopover.snapshot-save-mode .saved-view-create {
  border: 0;
  margin: 0;
  padding: 0;
}
#savedViewsPopover .saved-view-name-row {
  display: flex;
  gap: 6px;
  min-width: 0;
}
#savedViewsPopover .saved-view-name-row > input {
  width: 0 !important;
  min-width: 0;
  flex: 1;
}
#savedViewsPopover .saved-view-name-row > button {
  flex: none;
  max-width: 50%;
  white-space: normal;
}

/* Isolated saved figures have their own full-height editor layout. */
body.figure-inspection :is(.tab-window-controls, .tab-action-cluster) {
  display: none !important;
}
body.figure-inspection-editing {
  display: block !important;
  height: 100% !important;
  margin: 0 !important;
  overflow: hidden !important;
}
body.figure-inspection-editing #app.app-shell {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
}
body.figure-inspection-editing #app > :not(.workspace-grid) {
  display: none !important;
}
/* Use two flex children so the main window's three-column grid cannot squeeze the figure. */
body.figure-inspection.figure-inspection-editing #app.app-shell > .workspace-grid {
  display: flex !important;
  align-items: stretch !important;
  gap: 6px !important;
  box-sizing: border-box !important;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 0 !important;
}
body.figure-inspection-editing .workspace-grid > :not(.plot-shell):not(.right-panel) {
  display: none !important;
}
body.figure-inspection.figure-inspection-editing #app.app-shell > .workspace-grid > .plot-shell {
  display: block !important;
  flex: 1 1 0 !important;
  width: auto !important;
  height: 100% !important;
  min-height: 0 !important;
  min-width: 0 !important;
}
body.figure-inspection-editing .plot-shell > :not(#workspaceDocumentArea):not(.error-banner) {
  display: none !important;
}
body.figure-inspection.figure-inspection-editing #app.app-shell > .workspace-grid > .right-panel {
  display: flex !important;
  flex: 0 0 min(42%, var(--pw-settings-panel-width, 380px)) !important;
  height: 100% !important;
  min-height: 0 !important;
  min-width: 0 !important;
  width: auto !important;
}
body.figure-inspection-editing #workspaceDocumentArea {
  display: block !important;
  position: relative !important;
  box-sizing: border-box !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}
body.figure-inspection-editing #workspaceDocumentArea > .plot-view.active {
  display: flex !important;
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  grid-area: auto !important;
}
body.figure-inspection :is(#mapUnifiedMetadata, #mapResolveLocations) {
  display: none !important;
}

body.figure-inspection.figure-inspection-editing.controls-collapsed
  #app.app-shell
  > .workspace-grid
  > .right-panel {
  flex-basis: var(--pw-side-rail-width, 46px) !important;
}

/* Shared tree workspace: only the visible mode renders; the switch matches Maps. */
.tree-mode-tab-inactive,
#projectCompactDockBtn {
  display: none !important;
}
.tree-workspace-mode {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  color: var(--text, #173452);
}
.tree-workspace-mode > .ui-icon {
  width: 17px;
  height: 17px;
}
.tree-legend-value {
  cursor: pointer;
  outline: none;
}
.tree-legend-value:hover > .tree-legend-value-hit,
.tree-legend-value:focus-visible > .tree-legend-value-hit {
  fill: #dbeafe;
  fill-opacity: 0.55;
}
.tree-legend-value[aria-pressed='true'] > .tree-legend-value-hit {
  fill: #bfdbfe;
  fill-opacity: 0.55;
  stroke: #2563eb;
  stroke-width: 0.7;
}

.figure-inspection .tree-workspace-mode,
.figure-inspection .tree-workspace-mode + .tree-toolbar-separator {
  display: none !important;
}

/* Tree and Map share a compact toolbar; presentation changes require no measurements. */
#app #workspaceDocumentArea .figure-toolbar:is(.canvas-action-strip, .map-actionbar) {
  box-sizing: border-box !important;
  flex: 0 0 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  padding: 3px 6px !important;
  gap: 4px !important;
  align-items: center !important;
  background: var(--panel-alt, #f8fafc) !important;
  border-bottom: 1px solid var(--border, #d8e0e8) !important;
  box-shadow: none !important;
}
#app #workspaceDocumentArea .figure-toolbar > button,
#app #workspaceDocumentArea .figure-toolbar > .tree-pane-zoom-controls > button,
#app #workspaceDocumentArea .figure-toolbar > .map-action-tools > button {
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px !important;
  width: 30px !important;
  min-width: 30px !important;
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  padding: 4px 5px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--cm-text, #46576f);
  cursor: pointer;
}
#app
  #workspaceDocumentArea
  .figure-toolbar
  :is(.tree-toolbar-icon-btn, .map-icon-action, .canvas-toggle, .tree-pane-zoom-controls > button)
  > .ui-icon {
  width: 18px !important;
  height: 18px !important;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#app
  #workspaceDocumentArea
  .figure-toolbar
  :is(#zoomInBtn, #zoomOutBtn, #compactZoomInBtn, #compactZoomOutBtn, #mapUnifiedZoomIn, #mapUnifiedZoomOut)
  > .ui-icon {
  width: 14px !important;
  height: 14px !important;
}
#app
  #workspaceDocumentArea
  .figure-toolbar
  :is(#clearTreeHighlightBtn, #clearCompactHighlightBtn, #mapUnifiedClear)
  > .ui-icon {
  width: 15px !important;
  height: 15px !important;
}
#app
  #workspaceDocumentArea
  .figure-toolbar
  :is(.tree-toolbar-icon-btn, .map-icon-action, .canvas-toggle):hover:not(:disabled) {
  color: #075dcc !important;
  background: transparent !important;
  box-shadow: none !important;
}
#app
  #workspaceDocumentArea
  .figure-toolbar
  :is(.tree-toolbar-icon-btn, .map-icon-action, .canvas-toggle):is(.active, [aria-pressed='true'], [aria-expanded='true']) {
  position: relative;
  color: #075dcc !important;
  opacity: 1 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#app
  #workspaceDocumentArea
  .figure-toolbar
  :is(.tree-toolbar-icon-btn, .map-icon-action, .canvas-toggle):is(.active, [aria-pressed='true'], [aria-expanded='true'])
  > .ui-icon {
  stroke-width: 2.8 !important;
}
#app
  #workspaceDocumentArea
  .figure-toolbar
  :is(.tree-toolbar-icon-btn, .map-icon-action, .canvas-toggle):is(.active, [aria-pressed='true'], [aria-expanded='true'])::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: calc(50% - 3px);
  width: 6px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
}
#app #workspaceDocumentArea .figure-toolbar :is(.tree-toolbar-separator, .map-action-sep) {
  display: inline-flex;
  flex: 0 0 7px !important;
  align-items: center;
  justify-content: center;
  width: 7px;
  height: 18px;
  margin: 0 2px;
  padding: 0;
  background: none;
  color: #9aa9bc;
  font: 400 13px/1 var(--app-font-family, Arial, sans-serif);
  user-select: none;
  pointer-events: none;
}
#app #workspaceDocumentArea .figure-toolbar .workspace-save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 38px !important;
  height: 28px !important;
  min-height: 28px !important;
  padding: 4px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #46576f;
}
#app #workspaceDocumentArea .figure-toolbar .workspace-save-btn > .ui-icon {
  width: 16px;
  height: 16px;
}
#app #workspaceDocumentArea .figure-toolbar .workspace-save-btn > .save-chevron {
  width: 10px;
  height: 10px;
}
#app
  #workspaceDocumentArea
  .figure-toolbar
  :is(.tree-toolbar-icon-btn, .map-icon-action, .canvas-toggle, .workspace-save-btn):focus-visible {
  outline: 2px solid #7599d4 !important;
  outline-offset: -2px;
}
#app #workspaceDocumentArea .figure-toolbar [hidden] {
  display: none !important;
}
#app #workspaceDocumentArea .figure-toolbar > .map-action-tools {
  height: 30px;
  gap: 3px;
  scrollbar-width: thin;
  scrollbar-color: #c4cfdf transparent;
}
#app #workspaceDocumentArea .figure-toolbar::-webkit-scrollbar,
#app #workspaceDocumentArea .figure-toolbar > .map-action-tools::-webkit-scrollbar {
  height: 2px;
}
#app #workspaceDocumentArea .figure-toolbar .figure-mode-label {
  font: 600 11px/1 var(--app-font-family, Arial, sans-serif);
  color: #40536b;
}
#app #workspaceDocumentArea .figure-toolbar .figure-mode-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  padding: 2px !important;
  border: 1px solid #cbd6e4 !important;
  border-radius: 6px !important;
  background: var(--panel, #fff) !important;
  box-sizing: border-box;
  height: 30px;
}
#app #workspaceDocumentArea.split-mode .figure-toolbar .figure-mode-switch {
  display: none !important;
}
#app #workspaceDocumentArea .figure-toolbar .figure-mode-switch > button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-sizing: border-box;
  height: 24px !important;
  min-height: 24px !important;
  max-height: 24px !important;
  min-width: 0 !important;
  padding: 0 8px !important;
  border: 1px solid transparent !important;
  border-radius: 4px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #61728a !important;
  font: 400 11px/1 var(--app-font-family, Arial, sans-serif) !important;
  white-space: nowrap;
  cursor: pointer;
}
#app #workspaceDocumentArea .figure-toolbar .figure-mode-switch > button > .ui-icon {
  width: 14px !important;
  height: 14px !important;
  stroke-width: 1.75;
}
#app #workspaceDocumentArea .figure-toolbar .figure-mode-switch > button.active {
  border-color: #91b4eb !important;
  background: #e8f0fd !important;
  color: #1559b7 !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}
#app #workspaceDocumentArea .figure-toolbar .figure-mode-switch > button.active > .ui-icon {
  stroke-width: 2.3 !important;
}
#app #workspaceDocumentArea .figure-toolbar .figure-mode-switch > button:hover:not(.active) {
  background: #f1f5fa !important;
  color: #304f77 !important;
}
#app #workspaceDocumentArea .figure-toolbar .figure-mode-switch > button:focus-visible {
  outline: 2px solid #7599d4 !important;
  outline-offset: 1px;
}

#app #workspaceDocumentArea .figure-toolbar > .tree-toolbar-search {
  box-sizing: border-box;
  flex: 0 1 240px !important;
  width: 240px;
  min-width: 160px !important;
  max-width: 280px;
  height: 26px;
  padding: 0 5px;
}
#app #workspaceDocumentArea .figure-toolbar > .tree-toolbar-search > button {
  box-sizing: border-box;
  width: 20px !important;
  min-width: 20px !important;
  height: 20px !important;
  min-height: 20px !important;
  max-height: 20px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#app #workspaceDocumentArea .figure-toolbar > .tree-toolbar-search > button > .ui-icon {
  width: 13px;
  height: 13px;
}

/*
 * Source section 9/12: app workspace document area figure toolbar is hidden.
 * Assembles into styles/ui-harmony.css.
 * Rules remain in their original cascade order; later sections may intentionally override these
 * declarations.
 */
#app #workspaceDocumentArea .figure-toolbar :is(.hidden, .plugin-hidden) {
  display: none !important;
}
body.figure-inspection-readonly
  #app
  #workspaceDocumentArea
  .figure-toolbar.canvas-action-strip
  > :not(.tree-pane-zoom-controls) {
  display: none !important;
}

/* Footer loading feedback shares the existing activity lifecycle. */
body #app .status-activity-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: min(34vw, 340px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--cm-muted, #6f7b91);
  font-size: 11px;
}
body #app .status-activity-text.busy {
  color: var(--cm-accent, #375dfb);
  font-weight: 650;
}
body #app .status-activity-text.busy::before {
  content: '';
  flex: 0 0 10px;
  width: 10px;
  height: 10px;
  box-sizing: border-box;
  border: 2px solid var(--cm-border, #dce3ef);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: clademap-footer-loading 0.8s linear infinite;
}
@keyframes clademap-footer-loading {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  body #app .status-activity-text.busy::before {
    animation: none;
  }
}

/* Canvas tools own pointer gestures; SVG labels never start browser text selection. */
#plotScroller svg,
#plotScroller svg *,
#compactScroller svg,
#compactScroller svg * {
  -webkit-user-select: none !important;
  user-select: none !important;
}
:is(#plotScroller, #compactScroller):is([data-tree-canvas-tool='pan'], [data-tree-canvas-tool='both']),
:is(#plotScroller, #compactScroller):is([data-tree-canvas-tool='pan'], [data-tree-canvas-tool='both']) svg,
:is(#plotScroller, #compactScroller):is([data-tree-canvas-tool='pan'], [data-tree-canvas-tool='both']) svg * {
  cursor: grab !important;
  touch-action: none;
}
#plotScroller.is-panning,
#compactScroller.is-panning {
  cursor: grabbing !important;
}

/* Centered activity: CSS animations only, with a short entrance delay for quick work. */
body .cm-loading-popup {
  resize: none !important;
  position: fixed;
  inset: auto;
  left: 50%;
  top: 50%;
  margin: 0;
  width: min(360px, calc(100vw - 40px));
  box-sizing: border-box;
  padding: 18px 20px 15px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 5px 12px;
  border: 1px solid var(--cm-border, #dbe3ef);
  border-radius: 14px;
  background: var(--cm-surface, #fff);
  color: var(--cm-text, #24304a);
  box-shadow:
    0 16px 48px #243b5b24,
    0 3px 10px #243b5b0c;
  font: 12px/1.45 var(--cm-font-ui, 'Segoe UI', sans-serif);
  z-index: 100001;
  pointer-events: none;
  transform: translate(-50%, -50%);
  contain: layout style;
  animation: clademap-loading-in 0.18s ease-out 0.12s both;
}
/* Synchronous analysis work needs an opaque first paint before it blocks the UI thread. */
body .cm-loading-popup.is-immediate:not(.is-finishing) {
  animation: none;
}
body .cm-loading-popup[hidden] {
  display: none !important;
}
body .cm-loading-popup::backdrop {
  background: transparent;
  pointer-events: none;
}
.cm-loading-popup .cm-loading-spinner {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-self: center;
  width: 26px;
  height: 26px;
  box-sizing: border-box;
  border: 3px solid var(--cm-border, #dce3ef);
  border-top-color: var(--cm-accent, #375dfb);
  border-right-color: var(--cm-accent, #375dfb);
  border-radius: 50%;
  animation: clademap-footer-loading 0.85s linear infinite;
}
.cm-loading-popup .cm-loading-title {
  grid-column: 2;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.01em;
}
.cm-loading-popup .cm-loading-percent {
  grid-column: 3;
  color: var(--cm-accent, #375dfb);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.cm-loading-popup .cm-loading-message {
  grid-column: 2 / -1;
  color: var(--cm-muted, #6f7b91);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.cm-loading-popup .cm-loading-track {
  grid-column: 1 / -1;
  height: 3px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 10px;
  background: var(--cm-border, #dce3ef);
}
.cm-loading-popup .cm-loading-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--cm-accent, #375dfb);
  transform-origin: left;
  transform: scaleX(var(--loading-progress, 0));
  transition: transform 0.18s ease;
}
.cm-loading-popup.is-indeterminate .cm-loading-fill {
  width: 40%;
  transform: none;
  animation: clademap-loading-track 1.2s ease-in-out infinite;
}
body .cm-loading-popup.is-finishing {
  animation: clademap-loading-out 0.14s ease-in both;
}
@keyframes clademap-loading-in {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 6px)) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}
@keyframes clademap-loading-out {
  from {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
  to {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 4px));
  }
}
@keyframes clademap-loading-track {
  from {
    transform: translateX(-105%);
  }
  to {
    transform: translateX(355%);
  }
}
@media (prefers-reduced-motion: reduce) {
  body .cm-loading-popup,
  body .cm-loading-popup.is-finishing,
  .cm-loading-popup .cm-loading-spinner,
  .cm-loading-popup.is-indeterminate .cm-loading-fill {
    animation: none;
  }
  .cm-loading-popup .cm-loading-fill {
    transition: none;
  }
}

/* Logical groups initialize once; display/export controls retain the right edge. */
#app #workspaceDocumentArea .figure-toolbar-modes {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 4px;
  align-self: stretch;
  background: var(--panel-alt, #f8fafc);
}
#app #workspaceDocumentArea .figure-toolbar > .figure-toolbar-tools {
  display: flex;
  align-items: center;
  flex: 1 1 0 !important;
  gap: 3px;
  min-width: 0 !important;
  max-width: 100%;
  height: 30px;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  white-space: nowrap;
  scrollbar-width: thin;
}
#app #workspaceDocumentArea .figure-toolbar .figure-toolbar-group {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 3px;
  min-width: 0;
  height: 30px;
}
#app #workspaceDocumentArea .figure-toolbar > .figure-toolbar-pinned {
  position: sticky;
  right: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 3px;
  height: 30px;
  margin-left: auto;
  padding-left: 3px;
  background: var(--panel-alt, #f8fafc);
}
#app #workspaceDocumentArea .figure-toolbar :is(.figure-toolbar-group, .figure-toolbar-pinned) > button,
#app #workspaceDocumentArea .figure-toolbar .tree-pane-zoom-controls > button {
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 30px !important;
  width: 30px !important;
  min-width: 30px !important;
  height: 28px !important;
  min-height: 28px !important;
  max-height: 28px !important;
  padding: 4px 5px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--cm-text, #46576f);
  cursor: pointer;
}
#app #workspaceDocumentArea .figure-toolbar .figure-toolbar-group > .tree-toolbar-search {
  box-sizing: border-box;
  flex: 0 1 240px !important;
  width: 240px;
  min-width: 160px !important;
  max-width: 280px;
  height: 26px;
  padding: 0 5px;
}
#app #workspaceDocumentArea .figure-toolbar .figure-toolbar-group > .tree-toolbar-search > button {
  box-sizing: border-box;
  width: 20px !important;
  min-width: 20px !important;
  height: 20px !important;
  min-height: 20px !important;
  max-height: 20px !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#app #workspaceDocumentArea .figure-toolbar .figure-toolbar-group > .tree-toolbar-search > button > .ui-icon {
  width: 13px;
  height: 13px;
}

#app #workspaceDocumentArea .figure-toolbar:has(> .figure-toolbar-tools) {
  overflow: hidden !important;
}
#app #workspaceDocumentArea .figure-toolbar .figure-toolbar-group > button:disabled,
#app #workspaceDocumentArea .figure-toolbar .tab-window-btn:disabled {
  opacity: 0.36;
  cursor: default;
}
body.figure-inspection-readonly
  #app
  #workspaceDocumentArea
  .figure-toolbar.canvas-action-strip
  > .figure-toolbar-tools {
  display: flex !important;
}
body.figure-inspection-readonly
  #app
  #workspaceDocumentArea
  .figure-toolbar.canvas-action-strip
  .figure-toolbar-group:not([aria-label='Navigation']),
body.figure-inspection-readonly
  #app
  #workspaceDocumentArea
  .figure-toolbar.canvas-action-strip
  .figure-toolbar-tools
  > .tree-toolbar-separator,
body.figure-inspection-readonly
  #app
  #workspaceDocumentArea
  .figure-toolbar.canvas-action-strip
  .figure-toolbar-group[aria-label='Navigation']
  > :not(.tree-pane-zoom-controls) {
  display: none !important;
}

/* Tree, Map and metadata toolbars share two rows without a JavaScript layout loop. */
#app #workspaceDocumentArea .figure-toolbar.compact-toolbar-two-rows {
  box-sizing: border-box !important;
  padding: 3px 6px !important;
  background: var(--panel-alt, #f8fafc) !important;
  border-bottom: 1px solid var(--border, #d8e0e8) !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  grid-template-rows: 30px 34px !important;
  grid-auto-flow: row !important;
  grid-auto-columns: auto !important;
  flex: 0 0 70px !important;
  height: 70px !important;
  min-height: 70px !important;
  max-height: 70px !important;
  gap: 0 4px !important;
  overflow: hidden !important;
  scrollbar-gutter: auto !important;
}
#app #workspaceDocumentArea .compact-toolbar-two-rows > .figure-toolbar-modes {
  grid-area: 1 / 1;
  min-width: 0;
  min-height: 0 !important;
  height: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: thin;
}
#app #workspaceDocumentArea .compact-toolbar-two-rows > .figure-toolbar-pinned {
  grid-area: 1 / 2;
}
/* The four pinned actions use the bundled ISC-licensed Lucide symbols. */
#app #workspaceDocumentArea .analysis-save-wrap[data-workspace-actions] :is(.tab-window-controls > button, [data-workspace-export]) {
  width: 32px !important;
  min-width: 32px !important;
  height: 30px !important;
  min-height: 30px !important;
  padding: 4px !important;
}
#app #workspaceDocumentArea .analysis-save-wrap[data-workspace-actions] :is(.tab-window-controls > button, [data-workspace-export]) .ui-icon {
  width: 22px !important;
  height: 22px !important;
  flex: 0 0 22px;
}
#app #workspaceDocumentArea .compact-toolbar-two-rows > .figure-toolbar-tools {
  grid-area: 2 / 1 / 3 / -1;
  align-self: stretch;
  height: 34px;
  border-top: 1px solid var(--border, #d8e0e8);
}
#app #workspaceDocumentArea .compact-toolbar-two-rows .tree-toolbar-find {
  flex: 0 1 auto !important;
  max-width: 316px;
  min-width: 30px;
}
#app #workspaceDocumentArea .compact-toolbar-two-rows.toolbar-narrow .tree-toolbar-find:has(input:focus) {
  flex-shrink: 0;
  min-width: 300px;
}
#app #workspaceDocumentArea .compact-toolbar-two-rows.toolbar-narrow .tree-toolbar-find:has(> .tree-toolbar-search.hidden, > #metadataSearchInput[hidden], > .map-place-search-inline[hidden]) {
  position: sticky;
  right: 0;
  z-index: 3;
  background: var(--panel-alt, #f8fafc);
}
#app #workspaceDocumentArea .compact-toolbar-two-rows .tree-toolbar-find > .tree-toolbar-search {
  flex: 1 1 240px !important;
  min-width: 0 !important;
  width: auto;
}
#app #workspaceDocumentArea .compact-toolbar-two-rows .tree-toolbar-search input {
  min-width: 0;
  width: 100%;
}
#app #workspaceDocumentArea .compact-toolbar-two-rows .tree-pane-zoom-controls {
  display: inline-flex;
  flex: none;
  gap: 3px;
}
#app #workspaceDocumentArea .compact-toolbar-two-rows .figure-toolbar-group .tree-tool-labeled {
  flex: 0 0 auto !important;
  width: auto !important;
  gap: 4px;
  padding: 4px 6px !important;
}
#app #workspaceDocumentArea .compact-toolbar-two-rows .tree-tool-label {
  display: inline !important;
  font: 11px/1 var(--app-font-family, Arial, sans-serif);
  white-space: nowrap;
}
/* Collapse Search first, then drop labels before scrolling the remaining icons.
   The toolbar observer changes these states only when the pane width changes. */
body #app #workspaceDocumentArea .figure-toolbar.compact-toolbar-two-rows.toolbar-icons-only .tree-tool-label,
body #app #workspaceDocumentArea .figure-toolbar.compact-toolbar-two-rows.toolbar-icons-only .figure-mode-label,
body #app #workspaceDocumentArea .figure-toolbar.compact-toolbar-two-rows.toolbar-icons-only .figure-mode-switch button > span {
  display: none !important;
}
body #app #workspaceDocumentArea .figure-toolbar.compact-toolbar-two-rows.toolbar-icons-only .tree-tool-labeled {
  flex: 0 0 30px !important;
  width: 30px !important;
  min-width: 30px !important;
  gap: 0;
  padding: 4px 5px !important;
}
#app #workspaceDocumentArea .figure-toolbar.compact-toolbar-two-rows.toolbar-top-overflowing {
  grid-template-rows: 38px 34px !important;
  height: 78px !important;
  min-height: 78px !important;
  max-height: 78px !important;
  flex-basis: 78px !important;
}
#app #workspaceDocumentArea .compact-toolbar-two-rows .tree-toolbar-find > .map-place-search-inline {
  flex: 0 0 360px !important;
  width: 360px;
  min-width: 360px !important;
  max-width: 360px;
}
#app #workspaceDocumentArea .map-actionbar.compact-toolbar-two-rows .tree-toolbar-find {
  flex: 0 0 auto !important;
  max-width: none;
}
body #app #metadataView .compact-toolbar-two-rows .metadata-search-control {
  flex: 0 3 316px;
  min-width: 30px;
}
body #app #metadataView .compact-toolbar-two-rows #metadataSearchInput {
  flex: 1 1 auto;
  width: 240px;
  min-width: 0;
  max-width: 280px;
}
body #app #metadataView .compact-toolbar-two-rows .figure-toolbar-modes > .data-toolbar-group {
  padding: 0;
  border: 0;
}
body #app #metadataView .compact-toolbar-two-rows .figure-toolbar-group .tree-tool-labeled {
  height: 28px !important;
  min-height: 28px !important;
}
body #app #metadataView .compact-toolbar-two-rows:not(.toolbar-icons-only) .figure-toolbar-group .tree-tool-label {
  display: inline !important;
}
body #app #metadataView .compact-toolbar-two-rows.toolbar-narrow .metadata-link-column-control > span,
body #app #metadataView .compact-toolbar-two-rows.toolbar-icons-only .figure-toolbar-group .tree-tool-label {
  display: none !important;
}
body #app #metadataView .compact-toolbar-two-rows .ui-icon {
  width: 18px;
  height: 18px;
}
body #app #metadataView .compact-toolbar-two-rows .metadata-link-column-control {
  flex-direction: row;
  align-items: center;
  margin: 0;
  font-size: 11px;
  min-width: 0;
  flex: 1 1 auto;
}
body #app #metadataView .compact-toolbar-two-rows #metadataSourceSelect {
  max-width: 180px;
  min-width: 50px;
  flex: 0 1 auto;
}
body #app #metadataView .compact-toolbar-two-rows .metadata-toolbar-source {
  flex: 0 1 auto;
  flex-shrink: 1 !important;
  min-width: 120px;
  padding-right: 6px;
  margin-right: 2px;
  border-right: 1px solid var(--border, #d8e0e8);
}
#app #workspaceDocumentArea .figure-toolbar.compact-toolbar-two-rows [hidden] {
  display: none !important;
}
#app #workspaceDocumentArea .compact-toolbar-two-rows .tree-toolbar-separator:has(+ .tree-toolbar-find[hidden]) {
  display: none !important;
}
/* Read-only figure windows retain only viewport navigation. */
body.figure-inspection-readonly #app #workspaceDocumentArea .tree-toolbar-two-rows > .figure-toolbar-modes {
  display: flex !important;
  grid-area: 1 / 1 / 3 / -1;
}
body.figure-inspection-readonly #app #workspaceDocumentArea .tree-toolbar-two-rows > .figure-toolbar-tools,
body.figure-inspection-readonly #app #workspaceDocumentArea .tree-toolbar-two-rows .figure-toolbar-modes > :not([aria-label='Navigation']) {
  display: none !important;
}

/* Legend key editing shares one compact row in both tree views. */
.clustering-download-dialog { width: min(420px, calc(100vw - 24px)); }
.clustering-download-dialog label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 7px 0; font-size: 12px; }
.clustering-download-dialog :is(input, select) { box-sizing: border-box; min-width: 0; max-width: 210px; min-height: 28px; font: inherit; }
.clustering-download-dialog fieldset { border: 1px solid var(--border, #dce3ed); border-radius: 5px; margin: 8px 0; padding: 7px 10px; }
.clustering-download-range { display: flex; gap: 10px; }
.clustering-download-range label { flex: 1; flex-direction: column; align-items: stretch; }
.clustering-download-range input { width: 100%; }
.clustering-download-dialog output { display: block; min-height: 20px; font-size: 12px; overflow-wrap: anywhere; }
.tree-legend-editor .tree-legend-edit-columns,
.tree-legend-editor .tree-legend-edit-row {
  grid-template-columns: minmax(110px, 1fr) 38px 84px 26px;
}
.tree-legend-editor .tree-legend-edit-row select {
  width: 100%;
  min-width: 0;
  height: 26px;
  padding: 2px 4px;
}

.tree-table-editor.tree-header-editor {
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.tree-header-edit-options .tree-field-settings-link {
  grid-column: 1/-1;
  justify-self: start;
}
.metadata-group-colors {
  padding-top: 4px;
}
#treeClusterFieldSettings .nested-setting-head {
  margin-bottom: 4px;
}
#metadataFieldSections label[hidden] {
  display: none !important;
}

/* Tree toolbar popovers share the compact inspector appearance. */
.tree-annotation-menu {
  width: 252px;
  padding: 7px;
  border: 1px solid var(--cm-border, #d5dfeb);
  border-radius: 10px;
  background: var(--panel, #fff);
  box-shadow: 0 8px 28px #263a5524;
  font: 12px/1.4 var(--app-font-family, 'Noto Sans', Arial, sans-serif);
  color: var(--cm-text, #33465f);
}
.tree-popover-heading {
  padding: 5px 8px 7px;
  color: var(--cm-muted, #72829a);
  font-size: 11px;
  font-weight: 650;
}
.tree-annotation-menu label {
  min-height: 30px;
  box-sizing: border-box;
  margin: 0;
  padding: 6px 8px;
  gap: 9px;
  border-radius: 6px;
  line-height: 1.35;
  user-select: none;
}
.tree-annotation-menu label:hover {
  background: var(--cm-hover, #edf3fc);
}
.tree-annotation-menu label:has(input:checked) {
  color: #245dae;
}
.tree-annotation-menu input[type='checkbox'] {
  flex: none;
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: #3275d8;
  cursor: pointer;
}
.tree-annotation-menu input:focus-visible {
  outline: 2px solid #85ade9;
  outline-offset: 3px;
}
.tree-annotation-menu .tree-popover-separated {
  margin-top: 5px;
  padding-top: 9px;
  border-top: 1px solid var(--cm-border, #e0e7f0);
  border-radius: 0 0 6px 6px;
}
.tree-annotation-menu .is-disabled {
  opacity: 0.5;
  cursor: default;
}
.tree-movable-legend {
  cursor: default !important;
}
.legend-drag-enabled .tree-movable-legend {
  cursor: grab !important;
  touch-action: none;
}
.legend-drag-enabled .tree-movable-legend.figure-dragging {
  cursor: grabbing !important;
}
:is(#plotSvg, #compactSvg) .tree-movable-legend .tree-legend-value,
:is(#plotSvg, #compactSvg) .tree-movable-legend .tree-legend-value * {
  cursor: pointer !important;
}
:is(#plotSvg, #compactSvg) .tree-movable-legend.figure-dragging .tree-legend-value,
:is(#plotSvg, #compactSvg) .tree-movable-legend.figure-dragging .tree-legend-value * {
  cursor: grabbing !important;
}

/* A bounded column list; only the chosen field expands its extra controls. */
.columns-popover.global-floating-panel.tree-column-picker {
  display: flex;
  flex-direction: column;
  gap: 7px;
  box-sizing: border-box;
  width: 320px !important;
  min-width: min(280px, calc(100vw - 16px)) !important;
  max-width: min(320px, calc(100vw - 16px)) !important;
  max-height: min(550px, calc(100vh - 16px)) !important;
  overflow: hidden !important;
  padding: 10px;
  border: 1px solid #cfdceb;
  border-radius: 10px;
  background: var(--panel, #fff);
  box-shadow: 0 8px 28px #263a5524;
  color: #33465f;
  font: 12px/1.4 var(--app-font-family, 'Noto Sans', Arial, sans-serif);
}
.tree-column-picker .columns-panel-head {
  flex: none;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 0 7px;
  border-bottom: 1px solid #e4eaf2;
}
.tree-column-picker .columns-panel-head strong {
  color: #2c405c;
  font-size: 12px;
  font-weight: 650;
}
.tree-column-picker .columns-panel-head span {
  font-size: 10.5px !important;
  color: #7a8ba2;
}
.tree-column-picker .tree-column-search {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 1px solid #d8e1ed;
  border-radius: 6px;
  background: #f8fafd;
}
.tree-column-search > .ui-icon {
  width: 14px;
  height: 14px;
  color: #7b8ea8;
  flex: none;
}
.tree-column-picker .tree-column-search input {
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  height: 29px;
  border: 0;
  background: transparent;
  padding: 3px 0;
  font: inherit;
  color: inherit;
  outline: none;
}
.tree-column-search:focus-within {
  border-color: #8cb1e6;
  box-shadow: 0 0 0 2px #3275d811;
}
.tree-column-quick {
  display: flex;
  flex: none;
  align-items: center;
  gap: 5px;
}
/*
 * Source section 10/12: tree column quick button.
 * Assembles into styles/ui-harmony.css.
 * Rules remain in their original cascade order; later sections may intentionally override these
 * declarations.
 */
.tree-column-quick button {
  height: 25px;
  padding: 2px 7px;
  border: 1px solid #dce4ef;
  border-radius: 5px;
  background: #fff;
  color: #536c8c;
  font: inherit;
  font-size: 10.5px;
  cursor: pointer;
}
.tree-column-quick button:last-child {
  margin-left: auto;
}
.tree-column-quick button:hover {
  background: #edf3fc;
  color: #245dae;
  border-color: #afc8eb;
}
.tree-column-quick button:disabled {
  opacity: 0.4;
  cursor: default;
}
.tree-column-list {
  min-height: 0;
  max-height: 370px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  flex: 1 1 auto;
  border-top: 1px solid #edf1f7;
}
.tree-column-item {
  border-bottom: 1px solid #edf1f7;
}
.tree-column-row {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  border-radius: 5px;
}
.tree-column-row:hover {
  background: #f3f7fc;
}
.tree-column-picker .tree-column-row > label {
  display: flex;
  flex: 1;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  min-width: 0;
  margin: 0;
  padding: 4px 3px;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.tree-column-picker .tree-column-row input[type='checkbox'] {
  box-sizing: border-box;
  flex: none;
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
  accent-color: #3275d8;
  cursor: pointer;
}
.tree-column-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.is-column-hidden .tree-column-name {
  color: #94a1b4;
}
.tree-column-row-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 1px;
}
.tree-column-picker .tree-column-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-sizing: border-box;
  width: 23px;
  height: 24px;
  min-height: 24px;
  padding: 4px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  box-shadow: none;
  color: #7b8da6;
  cursor: pointer;
}
.tree-column-icon > .ui-icon {
  width: 14px;
  height: 14px;
}
.tree-column-picker .tree-column-icon:hover,
.tree-column-picker .tree-column-icon[aria-expanded='true'] {
  background: #e5efff;
  color: #2563b9;
}
.tree-column-picker .tree-column-icon:disabled {
  opacity: 0.25;
  cursor: default;
}
.tree-column-picker :is(button, input, select):focus-visible {
  outline: 2px solid #85ade9;
  outline-offset: 1px;
}
.tree-column-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
  padding: 8px;
  margin: 0 0 6px;
  border: 1px solid #e2e9f4;
  border-radius: 6px;
  background: #f7fafe;
}
.tree-column-picker .tree-column-options > label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
  font-size: 10.5px;
  color: #71839b;
  min-width: 0;
}
.tree-column-picker .tree-column-options :is(input, select) {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 27px;
  padding: 3px 5px;
  border: 1px solid #d5dfed;
  border-radius: 4px;
  background: #fff;
  color: #364e70;
  font: inherit;
  font-size: 11px;
}
.tree-column-options > label:first-child {
  grid-column: 1/-1;
}
.tree-column-empty {
  padding: 12px 7px;
  color: #8392a8;
  text-align: center;
  font-size: 11px;
}
.tree-column-picker :is(.tree-column-item, .tree-column-options, .tree-column-empty, label)[hidden] {
  display: none !important;
}

/* Scaling uses the same compact popover and native +/- actions in both trees. */
.columns-popover.global-floating-panel.tree-scaling-menu {
  box-sizing: border-box;
  width: 252px !important;
  min-width: min(252px, calc(100vw - 16px)) !important;
  max-width: min(252px, calc(100vw - 16px)) !important;
  padding: 10px !important;
  border: 1px solid #cfdceb;
  border-radius: 10px;
  background: var(--panel, #fff);
  box-shadow: 0 8px 28px #263a5524;
  color: #33465f;
  font: 12px/1.4 var(--app-font-family, 'Noto Sans', Arial, sans-serif);
}
.tree-scaling-menu .compact-popover-head {
  align-items: center;
  margin: 0 0 9px !important;
  padding: 0 0 8px !important;
  border-bottom: 1px solid #e4eaf2;
}
.tree-scaling-menu .columns-panel-head strong {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #2c405c;
  font-size: 12px !important;
  font-weight: 650;
}
.tree-scaling-menu .columns-panel-head strong > .ui-icon {
  width: 15px;
  height: 15px;
  color: #6783ab;
}
.tree-scaling-menu .columns-panel-head > .icon-btn {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 4px;
  border: 0;
  background: transparent;
  color: #8091a8;
  border-radius: 4px;
  box-shadow: none;
}
.tree-scaling-menu .columns-panel-head > .icon-btn:hover {
  background: #edf3fc;
  color: #245dae;
}
.tree-scaling-menu .scaling-popover-grid {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px !important;
  padding: 0 !important;
}
.tree-scale-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  min-height: 31px;
}
.tree-scale-caption {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #526a89;
  font-size: 11.5px;
}
.tree-scale-axis {
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  border: 1px solid #e5ecf6;
  border-radius: 6px;
  background: #f2f6fc;
  color: #6082b2;
  font-size: 13px;
  font-weight: 550;
}
.tree-scale-row:last-child .tree-scale-axis {
  font-size: 11px;
}
.tree-scale-stepper {
  box-sizing: border-box;
  width: 100px;
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr) 27px;
  align-items: center;
  border: 1px solid #dbe4f0;
  border-radius: 6px;
  background: #fbfcfe;
  overflow: hidden;
}
.tree-scaling-menu .scaling-popover-grid .tree-scale-stepper > button {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  height: 27px !important;
  min-height: 27px !important;
  min-width: 0;
  padding: 0 !important;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #6b82a2;
  font: 15px var(--app-font-family, 'Noto Sans', Arial, sans-serif);
  cursor: pointer;
}
.tree-scaling-menu .scaling-popover-grid .tree-scale-stepper > button:hover {
  background: #e8f0fc;
  color: #2563b9;
}
.tree-scaling-menu .scaling-popover-grid .tree-scale-stepper > strong {
  box-sizing: border-box;
  min-width: 0;
  padding: 4px 0;
  border-left: 1px solid #e2e9f3;
  border-right: 1px solid #e2e9f3;
  color: #365578;
  text-align: center;
  font-size: 11px !important;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tree-scaling-menu .compact-scale-reset {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  width: 100%;
  height: 27px !important;
  min-height: 27px !important;
  margin: 10px 0 0;
  padding: 3px 7px !important;
  border: 1px solid #dbe4f0;
  border-radius: 6px;
  background: #f6f9fd;
  color: #5b7598;
  box-shadow: none;
  font: 11px var(--app-font-family, 'Noto Sans', Arial, sans-serif) !important;
  cursor: pointer;
}
.tree-scaling-menu .compact-scale-reset > .ui-icon {
  width: 13px;
  height: 13px;
}
.tree-scaling-menu .compact-scale-reset:hover {
  background: #e8f0fc;
  color: #2563b9;
  border-color: #b9ceeb;
}
.tree-scaling-menu button:focus-visible {
  outline: 2px solid #85ade9;
  outline-offset: -2px;
}

/* Standalone whiteboards reuse the on-demand local editor in a workspace tab. */
#workspaceDocumentArea > .whiteboard-view {
  padding: 0;
  overflow: hidden;
  background: #fff;
  min-height: 0;
}
#workspaceDocumentArea > .whiteboard-view.active {
  display: flex;
  flex-direction: column;
}
.whiteboard-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: 34px;
  padding: 3px 10px;
  border-bottom: 1px solid #dce5f0;
  background: #f7fafe;
  color: #557193;
  font: 12px var(--app-font-family, 'Noto Sans', Arial, sans-serif);
}
.whiteboard-toolbar > .ui-icon {
  width: 16px;
  height: 16px;
  flex: none;
  color: #6683aa;
}
.whiteboard-toolbar input {
  box-sizing: border-box;
  min-width: 100px;
  max-width: 280px;
  width: 200px;
  height: 27px;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #2f4a6e;
  font: inherit;
}
.whiteboard-toolbar input:hover,
.whiteboard-toolbar input:focus {
  border-color: #c6d7ee;
  background: #fff;
  outline: none;
}
.whiteboard-project-note {
  color: #8395ae;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.whiteboard-stage {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  background: #fff;
  overflow: hidden;
}
.whiteboard-frame {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}
.whiteboard-placeholder {
  display: grid;
  place-items: center;
  height: 100%;
  color: #9baac0;
  font: 12px var(--app-font-family, 'Noto Sans', Arial, sans-serif);
}
.whiteboard-load-error {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  padding: 20px;
  box-sizing: border-box;
  color: #7a5b56;
  font: 12px var(--app-font-family, 'Noto Sans', Arial, sans-serif);
}
.whiteboard-load-error > button {
  border: 1px solid #c8d7ea;
  border-radius: 6px;
  background: #f5f9ff;
  padding: 6px 12px;
  color: #426998;
  cursor: pointer;
}
#whiteboardMenuList > button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
}
#whiteboardMenuList .menu-command-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#whiteboardMenuList[hidden],
#whiteboardMenuSeparator[hidden] {
  display: none !important;
}

/* Compact ordered label-field picker and project save chooser. */
.tree-tip-fields-picker {
  position: relative;
  display: block;
  min-width: 0;
  width: 100%;
}
#treeTipMetadataFieldsButton {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 4px 22px 4px 7px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid #cbd9ed;
  border-radius: 6px;
  background: #fff;
  color: #36577f;
  font: inherit;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBo\
x='0 0 12 12'%3E%3Cpath d='m3 4 3 3 3-3' fill='none' stroke='%236681a4' stroke-width='1.4'\
/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
}
#treeTipMetadataFieldsMenu {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin-top: 5px;
  padding: 8px;
  border: 1px solid #c8d7ec;
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 6px 22px #25496c24;
  color: #395675;
  font: 12px var(--app-font-family, 'Noto Sans', Arial, sans-serif);
}
#treeTipMetadataFieldsMenu[hidden] {
  display: none !important;
}
#treeTipMetadataFieldsMenu > input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 27px;
  padding: 4px 7px;
  border: 1px solid #d4dfed;
  border-radius: 5px;
  font: inherit;
}
/*
 * Source section 11/12: tree tip fields list.
 * Assembles into styles/ui-harmony.css.
 * Rules remain in their original cascade order; later sections may intentionally override these
 * declarations.
 */
.tree-tip-fields-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow: auto;
  overscroll-behavior: contain;
}
.tree-tip-field-option {
  display: flex;
  align-items: center;
  gap: 3px;
  min-height: 28px;
  padding: 1px 3px;
  border-radius: 5px;
}
.tree-tip-field-option:hover {
  background: #f1f6fd;
}
#treeTipMetadataFieldsMenu .tree-tip-field-check {
  display: flex !important;
  align-items: center;
  gap: 7px;
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}
#treeTipMetadataFieldsMenu .tree-tip-field-check > input {
  flex: none;
  width: 14px !important;
  height: 14px !important;
  margin: 0;
  accent-color: #397bd2;
}
.tree-tip-field-check > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#treeTipMetadataFieldsMenu .tree-tip-field-option > button {
  flex: none;
  width: 23px;
  min-height: 23px;
  padding: 1px;
  border: 1px solid #dce5f1;
  border-radius: 4px;
  background: #fff;
  color: #5f80aa;
  font: inherit;
  cursor: pointer;
}
#treeTipMetadataFieldsMenu .tree-tip-field-option > button:disabled {
  opacity: 0.3;
  cursor: default;
}

.whiteboard-save-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  flex: none;
}

.whiteboard-save-actions > .analysis-save-menu-btn {
  border: 0;
  background: transparent;
  color: #5275a5;
  box-shadow: none;
  cursor: pointer;
}
.whiteboard-save-actions > .analysis-save-menu-btn:hover {
  background: #e8f0fd;
  color: #2462b5;
}
.whiteboard-save-menu {
  max-height: min(320px, calc(100vh - 24px));
  overflow: auto;
  overscroll-behavior: contain;
}
.whiteboard-save-menu > button:disabled {
  opacity: 0.45;
  cursor: default;
}
.project-whiteboard-row {
  display: flex;
  align-items: center;
  gap: 3px;
}
.project-whiteboard-row > [data-whiteboard-open] {
  flex: 1;
  min-width: 0;
  width: auto;
}
.project-whiteboard-row > .project-more-btn {
  display: grid !important;
  place-items: center;
  flex: 0 0 24px;
  width: 24px !important;
  min-width: 24px;
  padding: 0 !important;
  grid-template-columns: none !important;
}
.whiteboard-context-menu {
  z-index: 32000;
  max-width: calc(100vw - 16px);
}

/* Project utilities stay at the bottom; workspace shortcuts scroll independently. */
body #app .project-tab-rail {
  overflow: hidden !important;
  box-sizing: border-box !important;
}
body #app .project-rail-workspaces {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
body #app .project-rail-workspaces > button {
  flex-shrink: 0;
}
body #app .project-rail-utilities {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  margin-top: auto;
  padding: 5px 0 2px;
  border-top: 1px solid var(--border, #d7dde7);
}
body #app .project-rail-utilities > .project-tab {
  flex: 0 0 36px !important;
  min-height: 36px !important;
  height: 36px !important;
}

/* Interface and Storage are real Projects pages, with their own body scroll. */
body #app .project-utility-settings {
  min-width: 0 !important;
  container-type: inline-size;
  container-name: settings-pane;
  --settings-label-column: 42%;
}
body #app .project-utility-settings > .settings-page-titlebar {
  position: sticky;
  top: -7px;
  z-index: 4;
  flex: 0 0 auto;
  background: var(--panel, #fff);
  margin: 0 0 7px;
  padding: 5px 2px;
  min-width: 0;
}
body #app .project-utility-settings :is(label, select, input, .settings-inline-grid) {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
body #app .project-utility-settings .settings-compact-body {
  padding: 7px;
  min-width: 0;
}
body #app .project-utility-settings .settings-compact-body > label:not(.check-row) {
  display: grid;
  grid-template-columns: minmax(0, 42%) minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}
body #app .project-utility-settings label > span {
  white-space: normal;
  overflow-wrap: anywhere;
}
body #app .project-utility-settings :is(.settings-subsection, .settings-compact-section) {
  min-width: 0;
}
@container settings-pane (max-width:235px) {
  body #app .project-utility-settings .settings-compact-body > label:not(.check-row) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* Compact Auto-save ON/OFF switch; color also communicates its actual save status. */
body #app .topbar-quick-controls #autoSaveControl {
  --auto-save-color: #94a3b8;
  box-sizing: content-box;
  height: 22px;
  min-width: 50px;
  margin: 0;
  padding: 0;
  gap: 0;
  border: 0;
  border-radius: 0;
  opacity: 1 !important;
  color: var(--auto-save-color);
  background: transparent !important;
  cursor: pointer;
}
body #app .topbar-quick-controls #autoSaveControl .switch-track {
  box-sizing: border-box;
  flex: 0 0 50px;
  width: 50px;
  height: 22px;
  border: 1px solid currentColor;
  border-radius: 12px;
  background: var(--cm-surface-2, #f3f6f9) !important;
  transform: none;
  box-shadow: none;
}
body #app .topbar-quick-controls #autoSaveControl .switch-track::before {
  content: 'OFF';
  position: absolute;
  right: 5px;
  top: 2px;
  font: 700 9px/16px var(--cm-font-ui);
  letter-spacing: 0.02em;
  color: currentColor;
}
body #app .topbar-quick-controls #autoSaveToggle:checked + .switch-track::before {
  content: 'ON';
  left: 6px;
  right: auto;
}
body #app .topbar-quick-controls #autoSaveControl .switch-knob {
  box-sizing: border-box;
  width: 16px;
  height: 16px;
  top: 2px;
  left: 2px;
  border: 0;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 1px 2px #24324420;
  transform: translateX(0) !important;
  transition:
    transform 0.15s ease,
    background-color 0.15s ease,
    border-color 0.15s ease;
}
body #app .topbar-quick-controls #autoSaveToggle:checked + .switch-track .switch-knob {
  transform: translateX(28px) !important;
}
body #app .topbar-quick-controls #autoSaveControl:has(input:disabled) {
  opacity: 1 !important;
  cursor: default;
}
body #app .topbar-quick-controls #autoSaveControl[data-save-state='on'] {
  --auto-save-color: #148565;
}
body #app .topbar-quick-controls #autoSaveControl[data-save-state='off'] {
  --auto-save-color: #64748b;
}
body
  #app
  .topbar-quick-controls
  #autoSaveControl:is([data-save-state='paused'], [data-save-state='permission']) {
  --auto-save-color: #c08016;
}
body #app .topbar-quick-controls #autoSaveControl[data-save-state='error'] {
  --auto-save-color: #d44545;
}
body #app .topbar-quick-controls #autoSaveControl[data-save-state='connecting'] {
  --auto-save-color: #3478cf;
}
body #app .topbar-quick-controls #autoSaveControl[data-save-state='connecting'] .switch-knob {
  background: transparent;
  border: 3px solid currentColor;
  border-top-color: transparent;
  animation: cm-auto-connecting 0.8s linear infinite;
}
body #app .topbar > .menubar {
  padding-right: 336px;
}
@keyframes cm-auto-connecting {
  to {
    rotate: 360deg;
  }
}
@media (prefers-reduced-motion: reduce) {
  body #app .topbar-quick-controls #autoSaveControl .switch-knob {
    animation: none !important;
    transition: none !important;
  }
}

body #app .tree-movable-summary {
  cursor: default;
  touch-action: auto;
}
body #app .summary-drag-enabled .tree-movable-summary {
  cursor: grab;
  touch-action: none;
}
body #app .summary-drag-enabled .tree-movable-summary.figure-dragging {
  cursor: grabbing;
}
body #app .summary-position-reset {
  margin: 3px 8px 5px;
  max-width: calc(100% - 16px);
}

body #app .compact-range-value {
  cursor: pointer;
}
body #app .summary-drag-enabled .tree-movable-summary {
  pointer-events: all;
}

/* Larger playback glyphs retain the compact action-bar height. */
#mapUnifiedPlay .ui-icon,
#mapUnifiedStop .ui-icon {
  width: 21px;
  height: 21px;
  flex: none;
  stroke-width: 1.65;
}

.tree-column-edit-hint {
  padding: 7px 4px 2px;
  color: #718198;
  font-size: 10.5px;
}
.tree-range-label-editor {
  position: fixed;
  z-index: 40000;
  width: min(290px, calc(100vw - 24px));
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid #bfd1e8;
  border-radius: 10px;
  background: #fff;
  color: #33465f;
  box-shadow: 0 12px 32px #29456324;
  font: 12px/1.4 var(--cm-font-ui, 'Segoe UI', sans-serif);
}
.tree-range-label-editor header,
.tree-range-label-editor footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.tree-range-label-editor header button {
  border: 0;
  background: transparent;
  font-size: 19px;
  color: #6d7f94;
}
.tree-range-label-editor small {
  display: block;
  color: #6e8098;
  overflow-wrap: anywhere;
  margin: 4px 0 9px;
}
.tree-range-label-editor label {
  display: grid;
  gap: 4px;
  margin: 7px 0;
}
.tree-range-label-editor :is(input, select) {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid #ccdaeb;
  border-radius: 5px;
  padding: 6px;
  color: inherit;
  background: #fff;
  font: inherit;
}
.range-label-inline-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 8px;
}
.tree-range-label-editor footer {
  justify-content: flex-end;
  margin-top: 8px;
}
.tree-range-label-editor footer button {
  border: 1px solid #c8d7e8;
  border-radius: 5px;
  background: #f7faff;
  color: #385b85;
  padding: 5px 9px;
  cursor: pointer;
}
.tree-range-label-editor footer [type='submit'] {
  background: #2869b2;
  border-color: #2869b2;
  color: white;
}

/* Compact card editing lives over the canvas and never changes tree layout on drag. */
.metadata-summary-tools {
  position: absolute;
  left: 12px;
  z-index: 45;
  max-width: calc(100% - 30px);
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #bfd1e8;
  border-radius: 10px;
  background: #fffffff5;
  box-shadow: 0 5px 20px #29456320;
  color: #405674;
  font: 11px/1.4 var(--cm-font-ui, 'Segoe UI', sans-serif);
  user-select: none;
}
.metadata-summary-tools[hidden] {
  display: none !important;
}
.summary-tools-heading,
.summary-tools-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}
.summary-tools-heading {
  padding-bottom: 5px;
  border-bottom: 1px solid #e4ebf3;
}
.summary-tools-heading strong {
  font-size: 11px;
}
.summary-tools-heading span {
  color: #73849b;
  margin-left: 4px;
}
.summary-tools-heading button {
  margin-left: auto !important;
  border: 0 !important;
  font-size: 17px !important;
  background: transparent !important;
  padding: 0 3px !important;
}
.summary-tools-row {
  margin-top: 5px;
}
.summary-tools-row small {
  color: #8391a5;
  font-size: 10px;
}
.summary-tools-row label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  margin: 0;
}
.summary-tools-row button,
.summary-tools-row details > summary {
  border: 1px solid #d3dfec;
  background: #f8fbff;
  border-radius: 5px;
  color: #42658c;
  padding: 3px 6px;
  font: inherit;
  cursor: pointer;
}
.summary-tools-row button:hover {
  background: #edf4ff;
}
.summary-tools-row button:disabled {
  opacity: 0.4;
  cursor: default;
}
.summary-tools-row input[type='number'] {
  width: 51px;
  box-sizing: border-box;
  border: 1px solid #d3dfec;
  border-radius: 4px;
  padding: 3px;
  font: inherit;
  color: inherit;
}
.summary-tools-row input[type='checkbox'] {
  margin: 0;
  accent-color: #397ac4;
}
.summary-tools-row > i {
  width: 1px;
  height: 16px;
  background: #dbe4ee;
  margin: 0 3px;
}
.summary-tools-row details {
  position: relative;
}
.summary-tools-row [data-summary-choices] {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 3;
  min-width: 180px;
  max-height: 220px;
  overflow: auto;
  padding: 6px;
  background: white;
  box-shadow: 0 6px 18px #29456324;
  border: 1px solid #cfdbeb;
  border-radius: 6px;
}
/*
 * Source section 12/12: summary tools row data summary choices label.
 * Assembles into styles/ui-harmony.css.
 * Rules remain in their original cascade order; later sections may intentionally override these
 * declarations.
 */
.summary-tools-row [data-summary-choices] label {
  display: flex;
  padding: 4px;
  gap: 6px;
}
.summary-border-row > [data-summary-color] {
  width: 65px;
}
.summary-border-row .cm-color-control {
  max-width: 65px;
}
.metadata-summary-tools .cm-color-trigger {
  min-height: 22px;
}

body #app #workspaceDocumentArea .figure-toolbar :is(#mapUnifiedPlay, #mapUnifiedStop) > .ui-icon {
  width: 21px !important;
  height: 21px !important;
  stroke-width: 1.65 !important;
}

/* One compact legend system and a full-width editor for individual color blocks. */
body #app .unified-legend-options {
  padding: 2px 0;
  display: grid;
  gap: 5px;
  min-width: 0;
}
body #app .unified-legend-options > .settings-subsection {
  margin: 0;
  border: 1px solid var(--cm-border, #dbe4ef);
  border-radius: 8px;
  background: var(--cm-surface, #fff);
  overflow: hidden;
}
body #app .unified-legend-options > .settings-subsection > summary {
  padding: 7px 9px;
  background: var(--cm-surface-2, #f5f8fc);
  font-weight: 600;
  cursor: pointer;
}
body #app .unified-legend-options label:not(.check-row) {
  display: grid;
  grid-template-columns: minmax(0, 46%) minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  margin: 5px 8px;
}
body #app .unified-legend-options .check-row {
  margin: 6px 8px;
}
body #app .unified-legend-options :is(input, select) {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  width: 100%;
}
body #app .unified-legend-options input[type='checkbox'] {
  width: auto;
}
body #app #compactIndividualRangeEditor {
  padding: 8px;
  min-width: 0;
  overflow: visible;
}
body #app #compactIndividualRangeEditor label:not(.check-row) {
  display: grid !important;
  grid-template-columns: minmax(82px, 34%) minmax(0, 1fr) !important;
  gap: 8px;
  align-items: center;
  min-width: 0;
  margin: 5px 0;
}
body #app #compactIndividualRangeEditor :is(select, input:not([type='checkbox'])) {
  width: 100% !important;
  min-width: 0;
  box-sizing: border-box;
  max-width: none;
}
body #app #compactIndividualRangeEditor label > span {
  white-space: normal;
  overflow-wrap: anywhere;
}
body #app #compactIndividualRangeEditor small {
  display: block;
  color: var(--cm-muted, #718098);
  line-height: 1.5;
  margin: 5px 0;
}
body #app #compactIndividualRanges {
  overflow: visible;
}
body #app .metadata-field-legend > .setting-note {
  font-size: 11px;
  line-height: 1.4;
}

/* Transient decisions stay inside the active window and release focus on close. */
.cm-action-dialog {
  width: min(440px, calc(100vw - 40px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 20px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 14px;
  background: var(--panel, #fff);
  color: var(--text, #243244);
  box-shadow: 0 18px 60px #172b4d30;
}
.cm-action-dialog::backdrop {
  background: #15294338;
}
.cm-action-dialog h3 {
  margin: 0 0 10px;
  font-size: 16px;
}
.cm-action-dialog p {
  white-space: pre-line;
  line-height: 1.5;
  margin: 0 0 16px;
}
.cm-action-dialog input {
  width: 100%;
  box-sizing: border-box;
}
.cm-action-dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
.cm-action-dialog-buttons button {
  min-width: 82px;
  padding: 7px 12px;
  border-radius: 7px;
}

.figure-snapshot-viewer.plot-view {
  display: none;
  z-index: auto;
}
.figure-snapshot-viewer.plot-view.active {
  display: flex;
}

/* Consistent confirmation dialogs; destructive actions carry a dedicated warning treatment. */
.cm-action-dialog {
  width: min(460px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 24px;
  border: 1px solid var(--border, #d6dfeb);
  border-radius: 17px;
  background: var(--panel, #fff);
  color: var(--text, #243244);
  box-shadow:
    0 24px 80px #15274338,
    0 4px 14px #15274314;
  font: inherit;
  animation: cm-action-enter 0.16s ease-out;
}
.cm-action-dialog::backdrop {
  background: #14253e61;
  backdrop-filter: blur(3px);
}
.cm-action-dialog-header {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 14px;
}
.cm-action-dialog .cm-action-dialog-icon {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border: 1px solid #c9dcf2;
  border-radius: 11px;
  background: #edf5ff;
  color: #2869ad;
  font-weight: 750;
  font-size: 19px;
  line-height: 1;
}
.cm-action-dialog h3 {
  font-size: 16px;
  line-height: 1.35;
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.15px;
}
.cm-action-dialog p {
  font-size: 12.5px;
  line-height: 1.65;
  margin: 0 0 19px;
  overflow-wrap: anywhere;
  color: var(--text, #4c5d73);
}
.cm-action-dialog form {
  margin: 0;
}
.cm-action-dialog input {
  padding: 9px 11px;
  border: 1px solid var(--border, #cbd6e6);
  border-radius: 8px;
  background: var(--panel, #fff);
  color: var(--text, #243244);
  font: inherit;
  outline-offset: 2px;
}
.cm-action-dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 17px;
  margin-top: 17px;
  border-top: 1px solid var(--border, #e6ecf3);
}
.cm-action-dialog .cm-action-dialog-buttons button {
  min-width: 90px;
  min-height: 35px;
  border: 1px solid var(--border, #cdd8e6);
  border-radius: 8px;
  background: var(--panel, #fff);
  color: var(--text, #4b5e76);
  padding: 8px 15px;
  font: inherit;
  font-size: 12px;
  font-weight: 550;
  box-shadow: 0 1px 2px #1a305509;
  cursor: pointer;
  transition:
    background 0.12s,
    border-color 0.12s;
}
.cm-action-dialog .cm-action-dialog-buttons button:hover {
  background: var(--soft, #f2f6fb);
  border-color: #aebfd5;
}
.cm-action-dialog .cm-action-dialog-buttons .cm-action-confirm {
  background: #2d6bb0;
  border-color: #2d6bb0;
  color: #fff;
}
.cm-action-dialog .cm-action-dialog-buttons .cm-action-confirm:hover {
  background: #225a98;
  border-color: #225a98;
}
.cm-action-dialog.is-danger {
  border-color: #e9cbd0;
}
.cm-action-dialog.is-danger .cm-action-dialog-icon {
  background: #fff0f1;
  border-color: #f0c8cf;
  color: #c4374b;
}
.cm-action-dialog.is-danger .cm-action-dialog-buttons .cm-action-confirm {
  background: #c73549;
  border-color: #c73549;
  color: #fff;
}
.cm-action-dialog.is-danger .cm-action-dialog-buttons .cm-action-confirm:hover {
  background: #aa293c;
  border-color: #aa293c;
}
.cm-action-dialog .cm-action-dialog-buttons button:focus-visible {
  outline: 2px solid #5689cb;
  outline-offset: 3px;
}
.cm-action-dialog.is-danger .cm-action-dialog-buttons .cm-action-confirm:focus-visible {
  outline-color: #c73549;
}
@keyframes cm-action-enter {
  from {
    opacity: 0;
    transform: translateY(5px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@media (prefers-reduced-motion: reduce) {
  .cm-action-dialog {
    animation: none;
  }
  .cm-action-dialog .cm-action-dialog-buttons button {
    transition: none;
  }
}

/* Application menu row after removal of the obsolete main toolbar. */
body #app .topbar{height:26px!important;min-height:26px!important;max-height:26px!important;grid-template-rows:24px!important;grid-template-areas:'brand menu'!important;padding:0 6px!important}
@media(max-width:760px){body #app .topbar{height:53px!important;min-height:53px!important;max-height:53px!important;grid-template-rows:24px 27px!important;grid-template-areas:'brand .' 'menu menu'!important}}
.analysis-help-btn{display:inline-grid;place-items:center;width:26px;height:26px;min-width:26px;padding:4px;border:0;border-radius:6px;background:transparent;color:#52677d;cursor:pointer;flex-shrink:0}
.analysis-help-btn:hover,.analysis-help-btn:focus-visible{background:#eaf0ff;color:#3459d4;outline:2px solid transparent}
.analysis-help-btn .ui-icon{width:16px;height:16px}

.analysis-help-dialog{width:min(540px,calc(100vw - 32px));max-height:calc(100vh - 48px);overflow:auto;border:1px solid #dbe3ef;border-radius:16px;padding:24px;box-shadow:0 20px 70px #172b4d33;color:#25354b;background:#fff}
.analysis-help-dialog::backdrop{background:#172b4d55;backdrop-filter:blur(3px)}.analysis-help-dialog header{display:flex;gap:18px;align-items:flex-start;justify-content:space-between}.analysis-help-dialog h2{font-size:19px;margin:0;line-height:1.35}.analysis-help-dialog header button{border:0;background:#f2f5fa;border-radius:8px;width:28px;height:28px;cursor:pointer;font-size:20px;flex-shrink:0}.analysis-help-dialog h3{font-size:13px;color:#3256ac;margin:22px 0 6px}.analysis-help-dialog p{font-size:13px;line-height:1.65;margin:0}.snapshot-export-menu{position:relative}.snapshot-export-menu>summary{cursor:pointer;list-style:none;padding:5px 9px;border:1px solid #d5deec;border-radius:6px;font-size:12px;white-space:nowrap}.snapshot-export-menu>div{position:absolute;z-index:100;right:0;top:100%;min-width:130px;border:1px solid #d5deec;border-radius:9px;padding:5px;background:white;box-shadow:0 8px 25px #23375526;display:grid}.snapshot-export-menu button{text-align:left;border:0;background:white;padding:7px 9px;cursor:pointer;white-space:nowrap}.snapshot-export-menu button:hover{background:#eef3ff}

.analysis-help-dialog>p{margin-top:18px}.analysis-detail-actions{display:flex;align-items:center;gap:5px}.bench-card>h3{display:flex;align-items:center;gap:5px}.bench-card>h3>.analysis-help-btn{margin-left:auto}


/* Match figure actions across all Cluster analysis tabs and their detail dialogs. */
.analysis-help-btn,
.analysis-section-popout-btn,
.cluster-card-actions button,
.outbreak-card-actions button,
.figure-card-actions button,
.analysis-detail-actions button,
.cluster-modal-actions button,
.outbreak-modal-actions button {
  width: 27px !important;
  min-width: 27px !important;
  height: 27px !important;
  min-height: 27px !important;
  display: inline-grid;
  place-items: center;
  padding: 4px;
  border: 0 !important;
  border-radius: 5px;
  background: transparent !important;
  box-shadow: none !important;
  color: #526780;
  font-size: 10px;
}
.analysis-help-btn .ui-icon,
.analysis-section-popout-btn .ui-icon,
.cluster-card-actions .ui-icon,
.outbreak-card-actions .ui-icon,
.figure-card-actions .ui-icon,
.analysis-detail-actions .ui-icon,
.cluster-modal-actions .ui-icon,
.outbreak-modal-actions .ui-icon {
  width: 17px !important;
  height: 17px !important;
}
.analysis-help-btn:hover,
.analysis-section-popout-btn:hover,
.cluster-card-actions button:hover,
.outbreak-card-actions button:hover,
.figure-card-actions button:hover,
.cluster-modal-actions button:hover,
.outbreak-modal-actions button:hover,
.analysis-detail-actions button:hover {
  background: #eaf0ff !important;
  color: #3459d4;
}
.cluster-interpretation-header > .analysis-help-btn,
.cluster-analytics-header > .analysis-help-btn { margin-left: auto; }
.cluster-interpretation-header > .analysis-section-popout-btn,
.cluster-analytics-header > .analysis-section-popout-btn { margin-left: 0; }

/* Keep title and controls together; descriptions occupy the row below. */
.phylo-explain-figure > figcaption {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 3px 8px;
  text-align: left;
}
.phylo-explain-figure > figcaption > strong { grid-column: 1; align-self: center; min-width: 0; }
.phylo-explain-figure > figcaption > span:not(.analysis-figure-actions) { grid-column: 1 / -1; grid-row: 2; }
.phylo-explain-figure > figcaption > .analysis-figure-actions { grid-column: 2; grid-row: 1; }
.analysis-figure-actions {
  display: inline-flex;
  flex-flow: row nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  flex: 0 0 auto;
  margin-left: auto;
}
.phylo-collapsible > summary,
.bench-card > h3 { display: flex; align-items: center; gap: 8px; }
.analysis-section-title > .analysis-figure-actions { flex: 0 0 auto; order: 3; }
.analysis-section-title > .section-kicker { order: 2; }
.cluster-analytics-card h4 { padding-right: 98px !important; min-height: 27px; }
/* Specificity also clears the older boxed controls on clustering cards. */
body #app .analysis-figure-actions > button,
body #app .cluster-modal-actions > button,
body #app .outbreak-modal-actions > button,
body #app .analysis-detail-actions > button {
  position: static !important;
  display: inline-grid !important;
  place-items: center;
  flex: 0 0 27px;
  width: 27px !important;
  min-width: 27px !important;
  height: 27px !important;
  min-height: 27px !important;
  margin: 0 !important;
  padding: 4px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #526780 !important;
  cursor: pointer;
}
body #app .analysis-figure-actions > button .ui-icon { width: 17px !important; height: 17px !important; }
body #app .analysis-figure-actions > button:hover,
body #app .cluster-modal-actions > button:hover,
body #app .outbreak-modal-actions > button:hover,
body #app .analysis-detail-actions > button:hover { background: #eaf0ff !important; color: #3459d4 !important; }
body #app .analysis-figure-actions > button:focus-visible { outline: 2px solid #5689cb; outline-offset: 1px; }

body #app .analysis-section-title:has(> .analysis-figure-actions) {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center !important;
  gap: 3px 8px;
  text-align: left;
}
body #app .analysis-section-title:has(> .analysis-figure-actions) > div { display: contents; }
body #app .analysis-section-title:has(> .analysis-figure-actions) > div > strong { grid-column: 1; grid-row: 1; min-width: 0; }
body #app .analysis-section-title:has(> .analysis-figure-actions) > div > span { grid-column: 1 / -1; grid-row: 2; }
body #app .analysis-section-title > .section-kicker { grid-column: 2; grid-row: 1; }
body #app .analysis-section-title > .analysis-figure-actions { grid-column: 3; grid-row: 1; }
body #app .cluster-interpretation-header:has(> .analysis-figure-actions),
body #app .cluster-analytics-header:has(> .analysis-figure-actions) { display: flex !important; align-items: center !important; gap: 8px; }
body #app .cluster-interpretation-header > .analysis-figure-actions,
body #app .cluster-analytics-header > .analysis-figure-actions { margin-left: auto !important; }
