.ref-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line, #e4e1da);
  border-radius: 10px;
  background: #faf9f6;
}
.ref-picker.is-busy {
  opacity: 0.65;
  pointer-events: none;
}
.ref-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ref-picker-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink, #1e2329);
}
.ref-picker-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.ref-picker-count {
  font-size: 11px;
  color: var(--muted, #6a727c);
  font-variant-numeric: tabular-nums;
}
.ref-clear-btn {
  border: 0;
  background: none;
  padding: 0;
  font-size: 11px;
  color: var(--primary, #2857e8);
  cursor: pointer;
}
.ref-clear-btn:hover {
  text-decoration: underline;
}
.ref-usage-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.ref-usage-chip {
  flex: 1;
  min-width: 72px;
  padding: 5px 8px;
  border-radius: 7px;
  border: 1px solid var(--line, #dedbd3);
  background: #fff;
  color: var(--muted, #5c6570);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.ref-usage-chip[aria-pressed="true"] {
  background: var(--primary-weak, #edf2ff);
  border-color: var(--primary, #2857e8);
  color: var(--primary, #2857e8);
  font-weight: 600;
}
.ref-thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-radius: 8px;
  transition: background 0.15s ease;
}
.ref-thumb-grid.is-dragover {
  background: rgba(40, 87, 232, 0.08);
  outline: 1.5px dashed var(--primary, #2857e8);
  outline-offset: 2px;
}
.ref-thumb-card {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line, #e0ddd6);
  background: #eceae4;
}
.ref-thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ref-thumb-index {
  position: absolute;
  left: 5px;
  bottom: 5px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(20, 26, 36, 0.72);
  color: #fff;
  font-size: 10px;
  line-height: 1.4;
}
.ref-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 999px;
  background: rgba(20, 26, 36, 0.75);
  color: #fff;
  font-size: 13px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.ref-thumb-remove:hover {
  background: #c93b2b;
}
.ref-upload-tile {
  aspect-ratio: 4 / 3;
  border: 1.5px dashed #c8c4ba;
  border-radius: 8px;
  background: #fff;
  color: var(--muted, #5d6671);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.ref-upload-tile:hover,
.ref-upload-tile:focus-visible {
  border-color: var(--primary, #2857e8);
  color: var(--primary, #2857e8);
  background: #f5f8ff;
  outline: none;
}
.ref-upload-plus {
  font-size: 18px;
  line-height: 1;
  font-weight: 500;
}
.ref-tpl-bar {
  display: flex;
}
.ref-tpl-select {
  width: 100%;
  font-size: 11px;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid var(--line, #dedbd3);
  background: #fff;
  color: var(--ink, #1e2329);
}
.ref-picker-hint {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted, #6f7781);
}
.ref-picker-error {
  font-size: 11px;
  color: #c93b2b;
  line-height: 1.4;
}
