/* Compact picker: user-supplied 282 × 258 reference, scoped to one lazy popup. */
body input[data-color-control] {
  min-width: 28px;
  min-height: 24px;
  cursor: pointer !important;
  caret-color: transparent !important;
  background-color: #fff !important;
  background-image:
    linear-gradient(var(--cp-paint, transparent), var(--cp-paint, transparent)),
    conic-gradient(#e0e5ec 25%, #fff 0 50%, #e0e5ec 0 75%, #fff 0) !important;
  background-size:
    auto,
    10px 10px !important;
  text-shadow: none !important;
}
body input[data-color-control].cm-color-none {
  background-image:
    linear-gradient(135deg, transparent 49%, #e44b59 49% 51%, transparent 51%),
    conic-gradient(#e0e5ec 25%, #fff 0 50%, #e0e5ec 0 75%, #fff 0) !important;
}
body .cm-color-picker {
  position: fixed;
  inset: auto;
  margin: 0;
  padding: 0;
  z-index: 100000;
  box-sizing: border-box;
  width: 282px;
  height: 258px;
  max-width: calc(100vw - 12px);
  max-height: calc(100vh - 12px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #dbe2ec;
  border-radius: 10px;
  background: #fff;
  color: #24304a;
  box-shadow: 0 10px 28px #27364d17;
  font: 11px/1.3 var(--cm-font-ui, 'Segoe UI', sans-serif);
}
body .cm-color-picker * {
  box-sizing: border-box;
}
body .cm-color-picker [hidden],
body .cm-color-picker[hidden] {
  display: none !important;
}
body .cm-color-picker :is(input, select, button) {
  font: inherit;
  color: inherit;
}
body .cm-color-picker button {
  cursor: pointer;
}
body .cm-color-picker :is(button, input, select):focus-visible {
  outline: 2px solid #3265ec;
  outline-offset: 1px;
}
.cm-color-picker .cp-toolbar {
  display: grid;
  grid-template-columns: 24px minmax(28px, 1fr) minmax(60px, 86px) auto 23px;
  align-items: center;
  gap: 5px;
  flex: 0 0 40px;
  padding: 6px 8px;
  border-bottom: 1px solid #edf0f5;
}
.cm-color-picker .cp-title {
  font-size: 12px;
  font-weight: 650;
  margin-right: auto;
}
.cm-color-picker .cp-checker,
.cm-color-picker .cp-none-icon {
  background: #fff conic-gradient(#e0e5ec 25%, #fff 0 50%, #e0e5ec 0 75%, #fff 0);
  background-size: 12px 12px;
}
.cm-color-picker .cp-sample {
  position: relative;
  overflow: hidden;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 6px;
  border: 1px solid #23354d25;
}
.cm-color-picker :is(.cp-sample, .cp-preview) > span {
  position: absolute;
  inset: 0;
}
.cm-color-picker .cp-no-color-mark::after,
.cm-color-picker .cp-none-icon::after,
.cm-color-picker .cp-none::after {
  content: '';
  position: absolute;
  top: 49%;
  left: -20%;
  width: 140%;
  height: 2px;
  background: #e44b59;
  transform: rotate(-42deg);
  pointer-events: none;
  box-shadow: 0 0 0 1px #fff9;
}
.cm-color-picker input.cp-hex {
  width: 100%;
  min-width: 0;
  height: 27px;
  padding: 0 7px;
  border: 1px solid #dce3ed;
  border-radius: 6px;
  font-weight: 650;
}
.cm-color-picker [data-cp='copy'] {
  height: 27px;
  padding: 0 8px;
  border: 1px solid #e0e6ee;
  border-radius: 6px;
  background: #f8fafc;
}
.cm-color-picker .cp-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  flex: 0 0 31px;
  border-bottom: 1px solid #e9edf3;
}
.cm-color-picker .cp-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: #7a879b;
  font-weight: 650;
}
.cm-color-picker .cp-tabs button[aria-selected='true'] {
  color: #3261db;
  border-bottom-color: #3261db;
}
.cm-color-picker .cp-content {
  flex: 1;
  min-height: 0;
  padding: 9px 11px 0;
  overflow: auto;
}
.cm-color-picker select {
  width: 100%;
  height: 28px;
  padding: 0 7px;
  border: 1px solid #dee5ee;
  border-radius: 6px;
  background: #fafcff;
}
.cm-color-picker .cp-swatches {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
  margin-top: 9px;
}
.cm-color-picker .cp-swatch {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 23px;
  padding: 0;
  border: 1px solid #00000017;
  border-radius: 5px;
  background: var(--swatch);
}
.cm-color-picker .cp-swatch.selected {
  outline: 2px solid #3265ec;
  outline-offset: 1px;
}
.cm-color-picker .cp-swatch.selected:not(.cp-none)::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: white;
  text-shadow: 0 1px 3px #000b;
}
.cm-color-picker .cp-none {
  background: conic-gradient(#e0e5ec 25%, #fff 0 50%, #e0e5ec 0 75%, #fff 0);
  background-size: 10px 10px;
}
.cm-color-picker .cp-recent-heading {
  margin: 10px 0 0;
  font-size: 10px;
  font-weight: 650;
  color: #738099;
}
.cm-color-picker .cp-recent {
  margin-top: 6px;
}
.cm-color-picker .cp-recent .cp-swatch {
  height: 22px;
}
.cm-color-picker .cp-custom {
  display: flex;
  align-items: flex-end;
  gap: 13px;
  padding-top: 2px;
}
.cm-color-picker .cp-custom :is(label, div) {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.cm-color-picker .cp-custom :is(label, div) > span {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.045em;
  color: #75849a;
}
.cm-color-picker .cp-custom input[type='color'] {
  width: 64px;
  height: 52px;
  padding: 4px;
  border: 1px solid #e3e9f1;
  border-radius: 7px;
  background: #fff;
}
.cm-color-picker .cp-preview {
  position: relative;
  overflow: hidden;
  width: 64px;
  height: 52px;
  border: 1px solid #e3e9f1;
  border-radius: 7px;
}
.cm-color-picker [data-cp='custom-opacity'] {
  padding-bottom: 20px;
  font-weight: 700;
  color: #4c6290;
}
.cm-color-picker .cp-none-button {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  height: 27px;
  margin-top: 10px;
  padding: 0 8px;
  border: 1px solid #dce3ed;
  border-radius: 6px;
  background: #f9fbff;
  text-align: left;
}
.cm-color-picker .cp-none-button[aria-pressed='true'] {
  background: #eef4ff;
  border-color: #7ca2f5;
  color: #1e4bc4;
}
.cm-color-picker .cp-none-icon {
  position: relative;
  overflow: hidden;
  width: 16px;
  height: 16px;
  border: 1px solid #ccd4df;
  border-radius: 3px;
  background-size: 8px 8px;
}
.cm-color-picker p {
  margin: 6px 0 0;
  font-size: 10px;
  color: #8090a4;
}
.cm-color-picker .cp-rgb-heading {
  margin: 1px 0 6px;
  font-weight: 650;
  color: #63738a;
}
.cm-color-picker .cp-rgb-row {
  display: grid;
  grid-template-columns: 12px 1fr 27px;
  align-items: center;
  gap: 9px;
  height: 28px;
}
.cm-color-picker .cp-rgb-row output {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.cm-color-picker input[type='range'] {
  width: 100%;
  margin: 0;
  accent-color: #3267e8;
  cursor: pointer;
}
.cm-color-picker .cp-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 38px;
  padding: 0 11px;
  border-top: 1px solid #edf0f5;
}
.cm-color-picker .cp-footer input {
  flex: 1;
  min-width: 0;
}
.cm-color-picker .cp-footer output {
  min-width: 31px;
  text-align: right;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

body .color-code-row input[data-color-control] {
  width: 36px;
  flex: 0 0 36px;
  padding: 0 !important;
}

/* Map controls use the same compact active-color swatch as tree controls. */
:is(
    #plugin-settings-maps,
    .map-legend-editor,
    .map-export-dialog,
    .clademap-map-direct-editor,
    .sm-direct-editor
  )
  input[data-color-control] {
  box-sizing: border-box !important;
  justify-self: start;
  width: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  height: 24px !important;
  min-height: 24px !important;
  padding: 1px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 4px !important;
}

/* The close action participates in header layout; it never covers Copy or HEX. */
.cm-color-picker .cp-close {
  position: static;
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  min-height: 23px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #526780;
  font: 18px/1 Arial;
}
.cm-color-picker .cp-close:hover { background: #eaf0fc; color: #2848ad; }
.cm-color-picker [data-cp='copy'] { padding-inline: 5px; }
