

/* Platform reference geometry. See docs/REFERENCE_CARD_CONTRACT.md.
   Keep these rules more specific than historical route styles, regardless of
   whether the route stylesheet or lazy gallery stylesheet loads first. */
:root {
  --aidc-reference-card-size: 150px;
  --aidc-reference-card-gap: 10px;
  --aidc-reference-card-action-size: 32px;
  --aidc-reference-card-inset: 8px;
}

/* Opt-in fluid grids share the same square media/controls contract. The frame
   measures available content width, independently of the viewport/sidebar. */
.aidc-reference-grid-frame {
  container: aidc-reference-grid / inline-size;
}
body .aidc-reference-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--aidc-reference-card-gap);
  align-items: start;
}
body .aidc-reference-grid > :is(.aidc-reference-card, .chat-carousel-slide-tile) {
  width: 100%;
  min-width: 0;
  aspect-ratio: 1;
}
@container aidc-reference-grid (width < 234px) {
  body .aidc-reference-grid { grid-template-columns: minmax(0, 1fr); }
}
/* Two overlay actions need less space than replace/preview/remove controls. */
@container aidc-reference-grid (202px <= width < 234px) {
  body .aidc-reference-grid-frame[data-reference-actions="2"] > .aidc-reference-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@container aidc-reference-grid (width > 310px) {
  body .aidc-reference-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@container aidc-reference-grid (width > 470px) {
  body .aidc-reference-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@container aidc-reference-grid (width > 630px) {
  body .aidc-reference-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@container aidc-reference-grid (width > 790px) {
  body .aidc-reference-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@container aidc-reference-grid (width > 950px) {
  body .aidc-reference-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); }
}
@container aidc-reference-grid (width > 1110px) {
  body .aidc-reference-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}

body :is(.refp-list, .refp-media-group__selection):not(.aidc-reference-grid) {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--aidc-reference-card-size)), var(--aidc-reference-card-size)));
  gap: var(--aidc-reference-card-gap);
  justify-content: start;
  align-items: start;
}
body :is(.chat-attached-files, .chat-image-refs__list, .chat-message__files) {
  gap: var(--aidc-reference-card-gap);
  align-items: flex-start;
}

body .aidc-reference-card,
body .refp-item:not(.refp-item--error) {
  position: relative;
  display: block;
  box-sizing: border-box;
  width: var(--aidc-reference-card-size);
  max-width: 100%;
  min-width: 0;
  height: auto;
  min-height: 0;
  aspect-ratio: 1;
  padding: 0;
  flex: 0 0 var(--aidc-reference-card-size);
  overflow: hidden;
  border: 1px solid var(--aidc-border-default);
  border-radius: 10px;
  background: var(--aidc-bg-elevated);
  color: var(--aidc-text-primary);
}
/* Reference summaries inside completed generation cards use half-size media. */
body .aidc-reference-card--compact {
  width: calc(var(--aidc-reference-card-size) / 2);
  flex-basis: calc(var(--aidc-reference-card-size) / 2);
}
body .aidc-reference-card :is(img, video),
body .refp-item:not(.refp-item--audio):not(.refp-item--error) :is(img, video) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  padding: 0;
  border-radius: 0;
  object-fit: contain;
  object-position: center;
  display: block;
}
body .aidc-reference-card > .chat-attached-file__doc-thumb {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}
/* Leave the native playback controls above the shared filename line. */
body .aidc-reference-card.chat-file-thumb--video video {
  bottom: 36px;
  height: calc(100% - 36px);
}
body .aidc-reference-card > :is(.chat-attached-file__name, .aidc-reference-card__name) {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 4;
  display: block;
  padding: 3px 6px;
  border-radius: 6px;
  background: var(--aidc-bg-card);
  color: var(--aidc-text-primary);
  font-size: 11px;
  line-height: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body .aidc-reference-card > .chat-attached-file__size { display: none; }

body .aidc-reference-card > :is(.aidc-reference-label, .chat-image-refs__tag),
body .refp-item:not(.refp-item--error) > .refp-reference-tag {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 4;
  display: inline-flex;
  width: auto;
  max-width: calc(100% - 16px);
  min-height: 24px;
  padding: 3px 7px;
  margin: 0;
  border: 1px solid var(--aidc-action-focus);
  border-radius: 7px;
  background: var(--aidc-bg-card);
  color: var(--aidc-text-primary);
  font: 700 11px/1.15 ui-monospace, SFMono-Regular, Consolas, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
}
body .aidc-reference-card:has(> .chat-attached-file__name, > .aidc-reference-card__name) > :is(.aidc-reference-label, .chat-image-refs__tag, .refp-reference-tag),
body .refp-item:not(.refp-item--audio):not(.refp-item--error):has(> .aidc-reference-card__name) > .refp-reference-tag {
  bottom: 36px;
}

body .aidc-reference-card > :is(.aidc-reference-preview, .chat-attached-file__remove, .chat-image-refs__remove),
body .refp-item:not(.refp-item--error) > :is(.refp-remove, .refp-replace, .aidc-reference-preview) {
  position: absolute !important;
  top: var(--aidc-reference-card-inset) !important;
  bottom: auto !important;
  left: var(--aidc-reference-card-inset) !important;
  right: auto !important;
  z-index: 5;
  width: var(--aidc-reference-card-action-size) !important;
  height: var(--aidc-reference-card-action-size) !important;
  min-width: var(--aidc-reference-card-action-size) !important;
  min-height: var(--aidc-reference-card-action-size) !important;
  padding: 0 !important;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--aidc-border-default);
  border-radius: 8px;
  background: var(--aidc-bg-card);
  color: var(--aidc-text-primary);
  transform: none;
}
body .aidc-reference-card > :is(.chat-attached-file__remove, .chat-image-refs__remove),
body .refp-item:not(.refp-item--error) > .refp-remove {
  left: auto !important;
  right: var(--aidc-reference-card-inset) !important;
}
body .refp-item:not(.refp-item--error):has(> .refp-replace) > .aidc-reference-preview {
  left: calc(2 * var(--aidc-reference-card-inset) + var(--aidc-reference-card-action-size)) !important;
}

/* Audio references share the square frame, top controls and bottom token.
   Override the legacy inline wrapper size without changing full audio players. */
body .refp-item--audio .refp-audio {
  display: flex;
  flex-direction: column;
  min-height: 0 !important;
  padding: 46px 8px 40px !important;
  justify-content: flex-start !important;
  gap: 4px !important;
  overflow: hidden;
}
body .refp-item--audio .refp-audio > svg { display: none; }
body .refp-item--audio .refp-audio-name,
body .refp-item--audio .refp-audio-meta {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 16px;
  flex-shrink: 0;
}
body .refp-item--audio .refp-audio-waveform {
  height: 20px;
  min-height: 0;
  flex-shrink: 1;
}
body .refp-item--audio .refp-audio-waveform > i {
  max-height: 100%;
  flex-shrink: 1;
}
body .refp-item--audio:has(> .refp-audio-edit) .refp-audio {
  padding-bottom: 68px !important;
}
body .refp-item--audio:has(> .refp-audio-edit) .refp-audio-waveform {
  display: none;
}
body .refp-item--audio > .refp-audio-edit {
  bottom: 36px;
  height: 28px;
  min-height: 0;
  padding: 4px 6px;
}


.refp-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  gap: 12px;
  padding: 16px;
  border-radius: 16px;
  background: #1a1b1e;
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: none;
}

[data-module="reference-prompt"] {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.panel-block > [data-module="reference-prompt"] {
  height: 100%;
}

.refp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.refp-title {
  font-size: 13px;
  letter-spacing: 0.08em;
  color: #f2f2fa;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
}

.refp-badge {
  display: none;
}

.refp-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* One resizable workspace, two genuine scroll regions.
   Dragging the separator changes both pane heights because they share a grid.
   The prompt is never sticky/fixed over the reference list. */
.refp-references-viewport {
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  min-width: 0;
  min-height: 0;
  max-height: none;
  overflow: visible;
  gap: 12px;
  touch-action: pan-y;
}
.refp-references-viewport > * { flex: 0 0 auto; }

.refp-references-controls {
  display: none;
}
.refp-references-grip {
  width: 100%;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: row-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  border-radius: 8px;
  gap: 12px;
}
.refp-references-grip-label {
  pointer-events: none;
  white-space: nowrap;
  font-size: 11px;
  color: var(--aidc-text-muted, #9aa0be);
}
.refp-references-grip::before {
  content: "";
  width: min(44%, 140px);
  height: 5px;
  border-radius: 999px;
  background: var(--aidc-border-strong, rgba(155,165,190,.55));
  transition: background .16s, width .16s;
}
.refp-references-grip:hover::before,
.refp-references-grip:focus-visible::before,
.refp-body.refp-is-resizing .refp-references-grip::before {
  width: min(55%, 190px);
  background: var(--aidc-action-primary-from, #f92ab7);
}
.refp-references-grip:focus-visible {
  outline: 2px solid var(--aidc-action-primary-from, #f92ab7);
  outline-offset: -2px;
}
/* The lower-right resize mark belongs to the browser's own textarea,
   never to an extra position:sticky control at the bottom of the panel. */

@media (min-width: 1201px) {
  /* The original global aidc-scroll class uses overflow:auto !important.
     Keep that outer fallback for unusually short windows. Under normal height,
     only the two grid children have overflowing content. */
  .refp-body[data-refp-layout="dual"].aidc-scroll {
    display: grid;
    flex: 1 1 0%;
    /* Definite height: percentage grid tracks cannot otherwise be resolved
       reliably inside a flex-column drawer. Flex-grow provides used height. */
    height: 0;
    grid-template-columns: minmax(0,1fr);
    grid-template-rows: minmax(0,var(--refp-reference-pane-height,60%)) 22px minmax(0,1fr);
    gap: 0;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior-y: contain;
    min-height: 0;
  }
  .refp-body[data-refp-layout="dual"].aidc-scroll .refp-references-viewport {
    grid-row: 1;
    min-height: 0;
    max-height: none;
    height: auto;
    flex: initial;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-right: 3px;
  }
  .refp-body[data-refp-layout="dual"].aidc-scroll .refp-references-controls {
    grid-row: 2;
    display: flex;
    align-items: center;
    min-height: 22px;
    margin: 0;
    padding: 0 3px;
  }
  .refp-body[data-refp-layout="dual"].aidc-scroll .refp-prompt {
    grid-row: 3;
    display: flex;
    flex-direction: column;
    flex: initial;
    min-width: 0;
    min-height: 0;
    height: auto;
    max-height: none;
    margin: 0;
    padding: 0 3px 0 0;
    position: static;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    background: transparent;
  }
  /* Native editor resize stays inside the prompt pane without moving the
     separator. The editor scrolls long text; its pane scrolls extra controls. */
  .refp-body[data-refp-layout="dual"].aidc-scroll .refp-prompt .refp-textarea {
    min-height: 180px;
    max-height: var(--refp-native-textarea-max-height, min(60vh, 520px));
    height: auto;
    overflow-y: auto;
    overflow-x: hidden;
    resize: vertical;
  }
  /* The EN translation action must not cover the browser resize corner. */
  .refp-body[data-refp-layout="dual"].aidc-scroll .refp-textarea-shell .refp-translate-en-btn {
    right: 28px;
    bottom: 26px;
  }
  .refp-body[data-refp-layout="dual"].aidc-scroll .refp-prompt > .refp-label {
    position: sticky;
    top: 0;
    z-index: 4;
    background: var(--aidc-bg-card, #1a1b1e);
    padding: 4px 0 6px;
  }
  .refp-body[data-refp-layout="dual"].aidc-scroll .refp-references-viewport > .refp-list-toolbar {
    position: sticky;
    top: 0;
    z-index: 4;
    margin: 0 0 6px;
    background: var(--aidc-bg-card, #1a1b1e);
  }
  .refp-body.refp-is-resizing { cursor: row-resize; }
  /* Models that do not have a prompt keep the full upload panel. */
  .refp-body[data-refp-layout="refs-only"].aidc-scroll .refp-references-viewport {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
  }
}

/* Mobile/TG routes have their own document-level layout and standalone prompt.
   The split is only enabled in fixed-height desktop drawers. */
@media (max-width: 1200px) {
  .refp-references-viewport { max-height: none; overflow: visible; }
  .refp-references-controls { display: none; }
}

.refp-drop {
  position: relative;
  border: 1px dashed rgba(255,255,255,0.25);
  border-radius: 14px;
  background: rgba(255,255,255,0.02);
  padding: 14px;
  text-align: center;
  color: #d9dcef;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.refp-drop:hover {
  border-color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.03);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}

.refp-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.refp-drop strong {
  color: #f6f7ff;
}

.refp-drop small {
  display: block;
  margin-top: 6px;
  color: #9fa3c1;
}

/* Reference geometry is shared with text chat and series previews. */
.refp-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--aidc-reference-card-size)), var(--aidc-reference-card-size)));
  grid-auto-rows: auto;
  gap: 10px;
}

/* All models with typed uploads share this responsive media-strip geometry.
   A first/last-frame pair shares one row on wide panels and stacks naturally
   when the available reference panel cannot fit both slots. */
.refp-media-groups { min-width: 0; }
.refp-media-groups[data-layout="frame-pair"] {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 370px), 1fr));
}
.refp-media-group {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
}
.refp-media-group__controls {
  display: flex;
  flex: 0 1 265px;
  flex-direction: column;
  gap: 9px;
  min-width: min(100%, 185px);
}
.refp-media-groups[data-layout="frame-pair"] .refp-media-group__controls {
  flex-basis: 188px;
}
.refp-media-group__selection {
  display: flex;
  flex: 1 1 160px;
  flex-wrap: wrap;
  align-content: flex-start;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 8px;
  width: auto;
  min-width: min(100%, var(--aidc-reference-card-size));
}
.refp-media-group__selection:empty { display: none; }
.refp-media-group__selection .refp-item { min-width: 0; }

@media (max-width: 600px) {
  .refp-media-group__controls,
  .refp-media-group__selection { flex-basis: 100%; }
}

.refp-drop-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.refp-drop-block .refp-pick-resources {
  align-self: center;
  margin-top: -4px;
}

.refp-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 10px;
  color: #dbe7ef;
  min-height: 120px;
}
.refp-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255,255,255,0.12);
  border-top-color: #f92ab7;
  border-radius: 50%;
  animation: refp-spin 1s linear infinite;
}
@keyframes refp-spin {
  to { transform: rotate(360deg); }
}

.refp-item {
  position: relative;
  /* padding-top trick instead of aspect-ratio for old WebView compat */
  height: 0;
  padding-top: 100%;
  overflow: hidden;
  border-radius: 8px;
  background: #0d0d0d;
  border: 1px solid rgba(255,255,255,0.12);
  box-sizing: content-box;
}

.refp-item--audio .refp-reference-tag {
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.refp-item--error {
  height: auto;
  min-height: 156px;
  padding-top: 0;
  overflow: visible;
  box-sizing: border-box;
  grid-column: 1 / -1;
}

.refp-item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.refp-item--uploading {
  opacity: 0.9;
}
.refp-uploading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(16,22,31,0.85), rgba(27,35,47,0.92));
}
.refp-uploading-text {
  color: #dbe7ef;
  font-size: 13px;
}

/* Loading overlay shown while a saved reference thumbnail is being fetched */
.refp-thumb-loading {
  z-index: 1;
  pointer-events: none;
  background: rgba(9, 9, 16, 0.85);
}

.refp-index {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 3px 7px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.5);
  color: #f6f6ff;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255,255,255,0.15);
}

.refp-thumb {
  /* Inherits position:absolute from .refp-item img */
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.refp-preview-note {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(6, 8, 14, 0.75);
  color: #b8c0d6;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.refp-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(20,20,28,0.75);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.16s, transform 0.16s;
}

.refp-remove:hover {
  background: rgba(255,255,255,0.12);
  transform: translateY(-1px);
}

.refp-replace {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(20,20,28,0.75);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.16s, transform 0.16s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 2;
}

.refp-replace:hover {
  background: rgba(255,255,255,0.12);
  transform: translateY(-1px);
}

/* Shared gallery preview action. The behavior is owned by
   AIDC_REFERENCE_GALLERY_CONTRACT; ReferencePrompt owns only card geometry. */
.refp-gallery-preview {
  position: absolute;
  top: 6px;
  left: 38px;
  width: 26px;
  height: 26px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: transform 0.16s;
}
.refp-gallery-preview svg {
  width: 15px;
  height: 15px;
  pointer-events: none;
}
.refp-gallery-preview:hover {
  transform: translateY(-1px);
}

/* Reload preview button — shown on saved cards when preview fails to load */
.refp-reload-preview {
  position: absolute;
  bottom: 6px;
  left: 6px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(20,20,28,0.75);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.16s, transform 0.16s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  z-index: 2;
  padding: 0;
}
.refp-reload-preview:hover {
  background: rgba(100,120,255,0.55);
  transform: translateY(-1px);
}

.refp-prompt {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 0;
  min-width: 0;
}

.refp-textarea-shell {
  position: relative;
  min-width: 0;
}

.refp-textarea-shell.refp-token-highlight-active {
  background: var(--aidc-bg-elevated, rgba(255,255,255,0.02));
  border-radius: 12px;
}

/* TG's standalone prompt has no overlaid translate button, so it keeps
   its normal compact padding rather than the desktop 52px button clearance. */
.refp-textarea-shell--standalone > .refp-textarea { padding-bottom: 12px; }

/* Non-editable text mirror: regular characters retain the theme text color,
   reference labels gain the pink accent without altering textarea.value.
   There is no padding on spans: highlighting must not move the caret/wrap. */
.refp-token-highlight {
  position: absolute;
  z-index: 0;
  box-sizing: border-box;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  color: var(--aidc-text-primary, #f3f5ff);
  font: 400 16px/1.5 var(--aidc-font-family-ui, "Inter", "Segoe UI", system-ui, sans-serif);
  scrollbar-width: none;
}
.refp-token-highlight[hidden] { display: none; }
/* A textarea keeps an empty line after its final newline. A pre-wrap div
   drops that last line unless it has following inline content. Keep identical
   scroll extents so visible words and native caret hit-testing stay aligned. */
.refp-token-highlight::after { content: '\200b'; }
.refp-token-highlight__tag {
  color: var(--aidc-action-primary-from, #f92ab7);
  -webkit-text-fill-color: var(--aidc-action-primary-from, #f92ab7);
  background: color-mix(in srgb, var(--aidc-action-primary-from, #f92ab7) 15%, transparent);
  border-radius: 3px;
  font-weight: inherit;
}
.refp-textarea--with-tags {
  position: relative;
  z-index: 1;
  background: transparent !important;
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  caret-color: var(--aidc-text-primary, #f3f5ff);
}
/* In high-contrast/forced-color mode, native text always wins over decoration. */
@media (forced-colors: active) {
  .refp-token-highlight { display: none !important; }
  .refp-textarea--with-tags {
    color: CanvasText !important;
    -webkit-text-fill-color: CanvasText !important;
    caret-color: CanvasText;
  }
}

.refp-textarea-shell .refp-textarea {
  display: block;
  padding-bottom: 52px;
}

.refp-textarea-shell .refp-translate-en-btn {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  border-color: rgba(84, 210, 255, 0.4);
  background: rgba(13, 33, 49, 0.94);
  color: #9deaff;
}

.refp-translation-preview {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid rgba(84, 210, 255, 0.3);
  border-radius: 12px;
  background: rgba(13, 33, 49, 0.72);
  color: #e8f8ff;
}

.refp-translation-preview[hidden] {
  display: none;
}

.refp-translation-preview__title {
  color: #9deaff;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.refp-translation-preview__text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.55;
}

.refp-translation-preview__note {
  color: #aebdca;
  line-height: 1.4;
}

.refp-label {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
  /* allow actions to wrap to next line when container is too narrow */
  flex-wrap: wrap;
  width: 100%;
  min-width: 0;
  font-size: 12px;
  color: #b3b6d1;
  letter-spacing: 0.04em;
}

.refp-label-text {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  flex: 1 1 auto;
  /* keep the label text from pushing actions out of view: truncate with ellipsis */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.refp-label-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  /* prefer no shrinking for action buttons so they remain visible */
  flex: 0 0 auto;
  min-width: 0;
  flex-wrap: wrap;
}

.refp-label-actions .smart-prompt-btn,
.refp-label-actions .refp-icon-btn {
  flex: 0 0 auto;
}

.refp-label-actions .refp-expand-btn {
  margin-left: 0;
}

.refp-action-label {
  display: none;
}

@media (max-width: 560px) {
  .refp-label {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .refp-label-text,
  .refp-label-actions {
    width: 100%;
  }

  .refp-label-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    justify-content: stretch;
    gap: 6px;
  }

  .refp-label-actions .smart-prompt-btn {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    margin-left: 0;
    padding: 6px 4px;
    justify-content: center;
    gap: 4px;
    font-size: clamp(9px, 2.7vw, 11px);
    line-height: 1.05;
    text-align: center;
  }

  .refp-label-actions .smart-prompt-btn svg {
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
  }

  .refp-label-actions .refp-smart-prompt-primary {
    grid-column: auto;
  }

  .refp-label-actions .refp-expand-btn {
    display: none;
  }

  .refp-action-label {
    display: inline;
    white-space: normal;
  }
}

.refp-textarea {
  font-family: var(--aidc-font-family-ui, "Inter", "Segoe UI", system-ui, sans-serif);
  font-weight: 400;
  font-style: normal;
  letter-spacing: normal;
  width: 100%;
  min-height: 240px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  color: #f3f5ff;
  padding: 12px;
  resize: vertical;
  font-size: 16px;
  line-height: 1.5;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

.refp-textarea:focus {
  border-color: rgba(255,255,255,0.25);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}

.refp-prompt-limit {
  margin-top: 7px;
  font-size: 12px;
  color: rgba(255,255,255,.56);
  text-align: right;
}

.refp-prompt-limit.is-warning { color: #f4be62; }
.refp-prompt-limit.is-error { color: #ff6b7a; font-weight: 600; }
.refp-textarea[aria-invalid="true"] { border-color: rgba(255,80,105,.75); }

/* ── Expand prompt button ───────────────────────────────────── */
.refp-expand-btn {
  margin-left: auto; /* push to the right end of the label row */
}

/* ── Expand prompt modal ────────────────────────────────────── */
.refp-expand-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: refpModalFadeIn 0.22s ease;
}
@keyframes refpModalFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.refp-expand-modal__container {
  display: flex;
  flex-direction: column;
  width: min(96vw, 820px);
  height: min(88vh, 720px);
  background: #181a26;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 0, 140, 0.08);
  overflow: hidden;
  animation: refpModalSlideUp 0.25s ease;
}
@keyframes refpModalSlideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.refp-expand-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.refp-expand-modal__title {
  font-size: 15px;
  font-weight: 600;
  color: #f0f2ff;
  letter-spacing: 0.02em;
}

.refp-expand-modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(240, 242, 255, 0.72);
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s, color 0.18s, box-shadow 0.18s;
}
.refp-expand-modal__close:hover {
  border-color: rgba(255, 0, 140, 0.50);
  background: rgba(255, 0, 140, 0.08);
  color: #ff008c;
  box-shadow: 0 0 14px rgba(255, 0, 140, 0.22);
}

.refp-expand-modal__editor {
  display: flex;
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.refp-expand-modal__editor > .refp-expand-modal__textarea { min-height: 0; }

.refp-expand-modal__textarea {
  font-weight: 400;
  font-style: normal;
  letter-spacing: normal;
  flex: 1 1 auto;
  width: 100%;
  padding: 18px 20px;
  border: none;
  outline: none;
  background: transparent;
  color: #f3f5ff;
  font-size: 17px;
  line-height: 1.65;
  resize: none;
  font-family: var(--aidc-font-family-ui, "Inter", "Segoe UI", system-ui, sans-serif);
  overflow-y: auto;
}
.refp-expand-modal__textarea::placeholder {
  color: rgba(179, 182, 209, 0.45);
}
.refp-expand-modal__textarea::-webkit-scrollbar {
  width: 6px;
}
.refp-expand-modal__textarea::-webkit-scrollbar-track {
  background: transparent;
}
.refp-expand-modal__textarea::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.10);
  border-radius: 3px;
}

.refp-expand-modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.refp-expand-modal__counter {
  font-size: 12px;
  color: rgba(179, 182, 209, 0.50);
  font-variant-numeric: tabular-nums;
}

.refp-expand-modal__done {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 22px;
  border-radius: 12px;
  border: 1px solid rgba(255, 0, 140, 0.45);
  background: rgba(255, 0, 140, 0.10);
  color: #ff5cad;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, box-shadow 0.18s, color 0.18s;
}
.refp-expand-modal__done:hover {
  background: rgba(255, 0, 140, 0.18);
  border-color: rgba(255, 0, 140, 0.65);
  color: #ff79bf;
  box-shadow: 0 0 18px rgba(255, 0, 140, 0.30);
}

/* Mobile: full-screen modal */
@media (max-width: 600px) {
  .refp-expand-modal__container {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border: none;
  }
}

/* Toolbar row between file-list and prompt: shows count + clear button */
.refp-list-toolbar {
  display: flex;
  align-items: center;
  align-content: flex-start;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  padding: 4px 0 10px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  min-height: 0;
  box-sizing: border-box;
  overflow: hidden;
}
.refp-list-toolbar:empty,
.refp-list-toolbar:not(:has(> *:not([style*="display: none"]):not([style*="display:none"]))) {
  display: none;
}

.refp-list-toolbar > * {
  flex: 0 1 auto;
  max-width: 100%;
}

/* Match the file-count chip to "Clear selection" without changing other hints. */
.refp-list-toolbar > .refp-hint.aidc-hint,
.refp-list-toolbar > .refp-clear-all {
  box-sizing: border-box;
  min-height: 24px;
  margin: 0;
  padding: 4px 10px;
  line-height: 14px;
}

.refp-list-toolbar > .refp-hint.aidc-hint {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.refp-list-toolbar + .refp-prompt {
  margin-top: 6px;
}

.refp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.refp-hint {
  font-size: 12px;
  color: #9aa0be;
}

.refp-btn {
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  width: 100%;
  display: block;
  text-align: center;
  color: #f5f6ff;
  background: linear-gradient(120deg, #4a5166, #2f3646);
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,0,0,0.35);
  transition: transform 0.12s, box-shadow 0.18s, filter 0.18s;
  position: relative;
}

.refp-btn.is-hidden {
  display: none;
}

.refp-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(0,0,0,0.4);
}

.refp-btn:disabled {
  filter: grayscale(0.4);
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
  box-shadow: 0 10px 16px rgba(0,0,0,0.3);
}

.refp-btn[data-tokens]::after {
  content: " ⚡ " attr(data-tokens);
  font-weight: 900;
  color: #f5f6ff;
  text-shadow: 0 0 10px rgba(255,255,255,0.6);
}

.refp-item-error {
  width: 100%;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 6px;
  color: #ffb4b4;
  background: rgba(180,30,30,0.06);
  border: 1px dashed rgba(255,100,100,0.12);
  padding: 14px 42px 14px 14px;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  text-align: left;
  box-sizing: border-box;
}

.refp-audio {
  position: absolute;
  inset: 0;
  box-sizing: border-box;
}

.refp-audio-waveform {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  height: 38px;
}

.refp-audio-waveform > i {
  width: 3px;
  min-height: 4px;
  border-radius: 3px;
  background: linear-gradient(180deg, #70e7ff, #ef49b4);
  opacity: 0.9;
}

.refp-audio-meta {
  color: #a9bad0;
  font: 600 11px/1.35 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.refp-audio-edit {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 42px;
  z-index: 4;
  border: 1px solid rgba(255, 77, 178, 0.5);
  border-radius: 7px;
  background: rgba(61, 21, 48, 0.92);
  color: #ff9fd5;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.refp-retry {
  margin: 6px 8px 6px 8px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: linear-gradient(180deg,#2b6bff,#1f4fd6);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}
.refp-retry:disabled { opacity: 0.6; cursor: default; }

.refp-error-hint {
  font-size: 12px;
  color: #ffd7d7;
  margin-top: 6px;
}
.refp-error-meta {
  font-size: 11px;
  color: #ffefef;
  margin-top: 6px;
  opacity: 0.9;
}

.refp-count {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  color: #b3b6d1;
  min-width: 0;
}

.refp-bad {
  color: #ffb9c9;
}

/* Manage errors button (visible when there are errored refs) */
.refp-manage-errors {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.12);
  background: linear-gradient(120deg, #4a5166, #2f3646);
  color: #f5f6ff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,0,0,0.35);
  transition: transform 0.12s, box-shadow 0.18s, filter 0.18s;
}
.refp-manage-errors:hover { transform: translateY(-1px); box-shadow: 0 14px 24px rgba(0,0,0,0.4); }

/* Clear all refs button */
.refp-clear-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 90, 90, 0.25);
  background: rgba(255, 60, 60, 0.10);
  color: #ff7b7b;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.12s;
  white-space: nowrap;
  flex-shrink: 0;
}
.refp-clear-all:hover {
  background: rgba(255, 60, 60, 0.22);
  color: #ff5a5a;
  transform: translateY(-1px);
}
.refp-clear-all:active {
  transform: translateY(0);
  background: rgba(255, 60, 60, 0.30);
}

/* ── Midjourney extra reference slots (sref / oref) with sw/ow sliders ── */
.rp-mj-extra {
  margin: 6px 0 4px;
  padding: 10px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}
.rp-mj-extra__title {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
}
.rp-mj-extra__group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.rp-mj-extra__group:last-child {
  margin-bottom: 0;
}
.rp-mj-extra__slot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px dashed rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-height: 44px;
  position: relative;
}
.rp-mj-extra__slot:hover {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.05);
}
.rp-mj-extra__slot.is-dragover {
  border-color: rgba(99, 102, 241, 0.7);
  background: rgba(99, 102, 241, 0.1);
}
.rp-mj-extra__slot.has-file {
  border-style: solid;
  border-color: rgba(99, 102, 241, 0.3);
}
.rp-mj-extra__slot.is-disabled {
  opacity: 0.35;
  pointer-events: none;
  filter: grayscale(0.6);
}
.rp-mj-extra__icon {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.45);
  line-height: 1;
}
.rp-mj-extra__text {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.rp-mj-extra__label {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
}
.rp-mj-extra__sublabel {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
}
.rp-mj-extra__preview {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  overflow: hidden;
}
.rp-mj-extra__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.rp-mj-extra__remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(248, 113, 113, 0.9);
  border: 2px solid #0b0b14;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
}
.rp-mj-extra__slot.has-file .rp-mj-extra__remove {
  display: flex;
}
.rp-mj-extra__error {
  color: #f87171;
  font-size: 11px;
}
.rp-mj-extra__slider-wrap {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 2px;
}
.rp-mj-extra__slider-wrap.is-disabled {
  opacity: 0.35;
  pointer-events: none;
}
.rp-mj-extra__slider-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  letter-spacing: 0.02em;
}
.rp-mj-extra__slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rp-mj-extra__range {
  flex: 1;
  height: 3px;
  appearance: none;
  background: linear-gradient(90deg, rgba(90,140,255,0.35), rgba(255,120,200,0.32));
  border-radius: 999px;
  outline: none;
  padding: 0;
}
.rp-mj-extra__range::-webkit-slider-thumb {
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f4ff6a;
  border: 1.5px solid #0b0b14;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.15);
  cursor: pointer;
}
.rp-mj-extra__range::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f4ff6a;
  border: 1.5px solid #0b0b14;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.15);
  cursor: pointer;
}
.rp-mj-extra__slider-value {
  font-size: 12px;
  color: #d8dcff;
  min-width: 36px;
  text-align: right;
}
.rp-mj-extra__hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  text-align: center;
  padding: 6px 0 2px;
  font-style: italic;
}

/* ── sref multi-image support ── */
.rp-mj-extra__multi-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}
.rp-mj-extra__multi-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}
.rp-mj-extra__multi-grid:empty {
  display: none;
}
.rp-mj-extra__thumb {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: visible;
  flex: 0 0 auto;
}
.rp-mj-extra__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(99, 102, 241, 0.3);
}
.rp-mj-extra__thumb-remove {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(248, 113, 113, 0.9);
  border: 2px solid #0b0b14;
  color: #fff;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  padding: 0;
}
.rp-mj-extra__thumb-remove:hover {
  background: #ef4444;
}
.rp-mj-extra__add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px dashed rgba(99, 102, 241, 0.35);
  border-radius: 8px;
  background: rgba(99, 102, 241, 0.06);
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.rp-mj-extra__add-btn:hover {
  border-color: rgba(99, 102, 241, 0.6);
  background: rgba(99, 102, 241, 0.12);
  color: rgba(255, 255, 255, 0.8);
}
.rp-mj-extra__add-btn svg {
  opacity: 0.6;
}

/* ─── Inline Template Picker (used when resources.js is not loaded) ─── */
.refp-tpl-picker {
  position: fixed; inset: 0; z-index: 100000;
  display: flex; align-items: center; justify-content: center;
}
.refp-tpl-picker__backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
}
.refp-tpl-picker__card {
  position: relative; z-index: 1;
  width: min(420px, 90vw); max-height: 70vh;
  background: #1a1c2e; border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.refp-tpl-picker__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,0.08);
  font-weight: 600; font-size: 15px; color: #e4e8f8;
}
.refp-tpl-picker__close {
  background: none; border: none; color: rgba(255,255,255,0.5);
  font-size: 18px; cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.refp-tpl-picker__close:hover { color: #fff; background: rgba(255,255,255,0.08); }
.refp-tpl-picker__list {
  overflow-y: auto; padding: 8px;
  flex: 1 1 auto;
}
.refp-tpl-picker__item {
  display: flex; flex-direction: column; gap: 4px;
  width: 100%; text-align: left;
  padding: 10px 14px; border: none; border-radius: 8px;
  background: transparent; color: #e4e8f8;
  font-family: inherit; font-size: 13px; cursor: pointer;
  transition: background 0.15s;
}
.refp-tpl-picker__item:hover { background: rgba(143,179,255,0.10); }
.refp-tpl-picker__item strong {
  font-size: 14px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.refp-tpl-picker__item span {
  color: rgba(228,232,248,0.5); font-size: 12px;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
