.theme-menu { position: relative; flex: 0 0 auto; }
.theme-menu-button.is-active { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.theme-menu-panel {
  display: none;
  position: absolute;
  z-index: 40;
  top: calc(100% + 7px);
  right: 0;
  width: min(380px, calc(var(--mattdom-viewport-width, 100vw) - 16px));
  max-height: min(78vh, calc(var(--mattdom-viewport-height, 100dvh) - 72px));
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line-bright);
  background: var(--chrome);
  box-shadow: 0 18px 55px rgba(0, 0, 0, .8);
  color: var(--text);
}
.theme-menu.is-open .theme-menu-panel { display: block; }
.theme-menu-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 2px 8px;
  color: var(--text);
  font-size: 9px;
  letter-spacing: .06em;
}
.theme-menu-heading small { color: var(--dim); font-size: 8px; letter-spacing: 0; text-align: right; }
.theme-menu-subheading { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.theme-presets,
.theme-custom-list { display: grid; gap: 4px; }
.theme-presets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.theme-choice {
  width: 100%;
  min-height: 26px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-size: 9px;
}
.theme-choice > span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.theme-choice.is-active { border-color: var(--accent); color: var(--accent); }
.theme-choice:hover { border-color: var(--line-bright); }
.theme-dots { display: inline-flex; gap: 2px; margin-left: auto; }
.theme-dots i { width: 8px; height: 12px; display: block; border: 1px solid color-mix(in srgb, var(--text) 25%, transparent); }
.theme-empty { margin: 0; color: var(--dim); font-size: 8px; line-height: 1.4; }
.theme-name-label {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  margin: 8px 0;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .04em;
}
.theme-name-label input {
  height: 24px;
  min-width: 0;
  padding: 0 6px;
  border: 1px solid var(--line-bright);
  background: var(--input);
  color: var(--text);
  outline: none;
}
.theme-swatches {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
}
.theme-swatches label {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 8px;
  letter-spacing: .03em;
}
.theme-swatches input[type="color"] {
  width: 22px;
  height: 18px;
  padding: 0;
  border: 1px solid var(--line-bright);
  background: transparent;
  cursor: pointer;
}
.theme-editor-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.theme-editor-actions button {
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line-bright);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 8px;
}
.theme-editor-actions button:hover { border-color: var(--bid); color: var(--bid); }
.theme-editor-actions .theme-delete { color: var(--sell); }
.theme-editor-actions .theme-delete:hover { border-color: var(--sell); color: var(--sell); }

body.mattdom-embed .theme-menu-panel {
  left: 0;
  right: auto;
  width: min(340px, calc(100vw - 12px));
}

.split-toolbar .theme-menu-button {
  height: 23px;
  padding: 0 8px;
  border: 1px solid var(--line-bright);
  background: var(--input);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 9px;
  letter-spacing: .04em;
}
.split-toolbar .theme-menu-button.is-active { color: var(--accent); }
.split-toolbar .theme-menu-panel { right: 0; }
