@import url("/starvault-theme.css");

:root {
  font-family: var(--font);
}

* {
  box-sizing: border-box;
}
html {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  height: 100%;
  overflow: hidden;
}

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.pm-user-bar {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}
.pm-user-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.upload-label.disabled {
  opacity: 0.45;
  pointer-events: none;
}
.sidebar h1 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}
.cat-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.cat-nav-footer-spacer {
  flex: 1 1 auto;
  min-height: 0.75rem;
}
.cat-item.cat-item--trash.active {
  border-color: rgba(232, 93, 93, 0.55);
  background: rgba(232, 93, 93, 0.1);
}
.cat-item {
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
}
.cat-item:hover {
  background: rgba(255, 255, 255, 0.06);
}
.cat-item.cat-drop-target {
  border-color: var(--accent);
  background: rgba(215, 247, 42, 0.2);
}
.cat-item.active {
  border-color: var(--accent);
  background: rgba(215, 247, 42, 0.12);
}
.cat-item.cat-level-2 {
  margin-left: 12px;
  font-size: 0.86rem;
  color: #c6d0df;
}
.cat-l2-with-l3 {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cat-group-l3-children {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-left: 10px;
  margin: 0 0 2px 8px;
  border-left: 1px dashed rgba(215, 247, 42, 0.22);
}
.cat-item.cat-level-3 {
  margin-left: 0;
  font-size: 0.82rem;
  color: #aeb8c8;
}
.cat-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cat-group-head {
  display: flex;
  align-items: stretch;
  gap: 3px;
}
.cat-group-head .cat-item.cat-level-1 {
  flex: 1;
  min-width: 0;
  margin-left: 0;
}
.cat-toggle {
  flex-shrink: 0;
  width: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.65rem;
  line-height: 1;
  padding: 0;
}
.cat-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border-color: var(--border);
}
.cat-group-children {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 6px;
  margin-left: 4px;
  border-left: 2px solid rgba(42, 49, 64, 0.85);
}
.cat-group-children .cat-item.cat-level-2 {
  margin-left: 0;
}
.cat-group-collapsed .cat-group-children {
  display: none;
}
.sidebar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  margin-top: auto;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  height: 100%;
}

.main-grid-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.main-grid-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
.asset-load-more-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.5rem 1rem 0.75rem;
  pointer-events: none;
}
.asset-load-more-wrap.hidden {
  display: none;
}
.asset-load-more-hint {
  font-size: 0.78rem;
  color: var(--muted);
}
.asset-load-more-wrap.is-loading .asset-load-more-hint {
  color: var(--text);
}
.grid-scroll-end {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 1.1rem 1rem 2rem;
  color: var(--muted);
  font-size: 0.82rem;
  user-select: none;
  pointer-events: none;
}
.grid-scroll-end.is-visible {
  display: flex;
}
.grid-scroll-end-icon {
  display: grid;
  place-items: center;
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 999px;
  border: 1px solid rgba(125, 147, 180, 0.28);
  background: rgba(255, 255, 255, 0.04);
  color: #a8b4c8;
  font-size: 0.95rem;
  line-height: 1;
}
.grid-scroll-end-text {
  letter-spacing: 0.02em;
}
.toolbar {
  display: block;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: rgba(22, 26, 34, 0.85);
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}
.toolbar-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem 0.9rem;
  flex-wrap: wrap;
}
.toolbar-main-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  min-width: 0;
}
.toolbar-spacer {
  flex: 1 1 12px;
  min-width: 4px;
}
.toolbar-trailing {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  margin-left: auto;
}
.toolbar-top-link {
  text-decoration: none;
  text-align: center;
  white-space: nowrap;
}
.toolbar-search {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: 0.2rem;
}
.toolbar-search input {
  min-width: 260px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
}
.toolbar-count {
  font-size: 0.86rem;
  white-space: nowrap;
  padding: 0 0.15rem;
  flex-shrink: 0;
}
.batch-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 0.88rem;
  color: var(--text);
  white-space: nowrap;
}
.thumb-title-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 0.88rem;
  color: var(--text);
  white-space: nowrap;
}
.thumb-title-toggle input {
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
  cursor: pointer;
}
.batch-toggle input {
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
  cursor: pointer;
}
.studio-upload-bar {
  display: none;
}
.studio-upload-modal-panel {
  max-width: 28rem;
}
.studio-upload-modal-title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
}
.studio-upload-kind {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.85rem;
}
.studio-upload-kind-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.88rem;
  cursor: pointer;
}
.studio-upload-pane {
  margin-bottom: 0.75rem;
}
.studio-upload-pane.hidden {
  display: none;
}
.studio-upload-search {
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.25rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(125, 147, 180, 0.35);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
}
.studio-upload-order-results {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 9rem;
  overflow: auto;
  margin-top: 0.5rem;
}
.studio-upload-order-item {
  text-align: left;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(125, 147, 180, 0.28);
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  cursor: pointer;
  font-size: 0.85rem;
}
.studio-upload-order-item.is-selected,
.studio-upload-order-item:hover {
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(96, 165, 250, 0.12);
}
.studio-upload-dropzone {
  margin-top: 0.35rem;
  padding: 1.25rem 1rem;
  border: 1px dashed rgba(125, 147, 180, 0.45);
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.studio-upload-dropzone.drag-over {
  border-color: rgba(96, 165, 250, 0.75);
  background: rgba(96, 165, 250, 0.08);
}
.studio-upload-dropzone p {
  margin: 0.15rem 0;
}
.card-order-no {
  padding: 0 8px 6px;
  font-size: 11px;
  color: #8ab4ff;
  letter-spacing: 0.02em;
}
.tag-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 1rem;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(14, 19, 28, 0.86);
  flex-shrink: 0;
  position: relative;
}
.tag-filter-bar.collapsed {
  flex-wrap: nowrap;
}
.tag-filter-bar.collapsed .tag-filter-expand {
  display: none;
}
.tag-filter-bar:not(.collapsed) .tag-filter-expand {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  width: 100%;
  padding-top: 0.35rem;
  border-top: 1px solid rgba(125, 147, 180, 0.1);
}
.tag-filter-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.15rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  flex-shrink: 0;
}
.tag-filter-trigger:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(215, 247, 42, 0.35);
}
.tag-filter-trigger-label {
  font-weight: 600;
}
.tag-filter-trigger-summary {
  max-width: min(28vw, 220px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag-filter-trigger-chevron {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1;
}
.tag-filter-bar:not(.collapsed) .tag-filter-trigger {
  border-color: rgba(215, 247, 42, 0.45);
  background: rgba(215, 247, 42, 0.1);
}
.tag-filter-group--pinned {
  border-radius: 8px;
  padding: 0.12rem 0;
}
.tag-filter-group--pinned .tag-filter-group-title {
  color: #b8ccff;
  font-weight: 600;
}
.tag-filter-trailing {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
  flex-shrink: 0;
}
.gallery-sort-select-input {
  margin-left: 6px;
  min-width: 118px;
  max-width: 148px;
  padding: 0.22rem 0.35rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
}
.gallery-sort-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  font-size: 0.82rem;
  color: var(--muted);
}
.gallery-sort-toggle input {
  accent-color: var(--accent);
  width: 17px;
  height: 17px;
  cursor: pointer;
}
.gallery-sort-toggle:has(input:checked) {
  color: var(--text);
}
.tag-filter-bar.collapsed .tag-filter-trailing {
  flex-wrap: nowrap;
}
.gallery-top-search {
  flex: 1 1 420px;
  min-width: min(320px, 48vw);
  max-width: min(760px, 62vw);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.gallery-top-search input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border-radius: 999px;
  padding: 0.58rem 1.05rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(125, 147, 180, 0.22);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}
.gallery-top-search input:focus {
  outline: none;
  border-color: rgba(215, 247, 42, 0.55);
  background: rgba(255, 255, 255, 0.08);
}
.gallery-top-search input::placeholder {
  color: var(--muted);
}
.btn-compact {
  padding: 0.28rem 0.65rem;
  font-size: 0.82rem;
}
.tag-filter-label {
  flex-shrink: 0;
  min-width: 4.5rem;
}
.tag-filter-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.tag-filter-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: nowrap;
  width: 100%;
  min-width: 0;
}
.tag-filter-group-title {
  min-width: 4.2rem;
  white-space: nowrap;
}
.tag-filter-group .tag-filter-btns {
  flex: 1;
  min-width: 0;
}
.tag-filter-btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.82rem;
  cursor: pointer;
}
.tag-filter-btn:hover {
  filter: brightness(1.08);
}
.tag-filter-btn.active {
  border-color: var(--accent);
  background: rgba(215, 247, 42, 0.22);
  color: #fff;
}
.tag-filter-btn.exclude {
  border-color: rgba(255, 126, 126, 0.82);
  background: rgba(255, 99, 99, 0.16);
  color: #ffd6d6;
}
.compose-mode .tag-filter-group--compose-row {
  padding: 0.35rem 0.5rem 0.5rem;
  margin: 0.15rem 0 0.35rem;
  border-radius: 10px;
  border: 1px solid rgba(215, 247, 42, 0.45);
  background: rgba(215, 247, 42, 0.08);
}
.compose-mode .tag-filter-group--compose-row .tag-filter-group-title {
  color: #b8ccff;
}

#catSortModal.modal {
  z-index: 56;
}
.cat-sort-panel {
  display: flex;
  flex-direction: column;
  max-height: 88vh;
}
.cat-sort-title {
  margin: 0 2.2rem 0.35rem 0;
  font-size: 1.05rem;
  font-weight: 600;
}
.cat-sort-desc {
  margin: 0 0 0.65rem;
  line-height: 1.45;
}
.cat-sort-scroll {
  flex: 1;
  min-height: 140px;
  max-height: 56vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.5rem 0.55rem;
  background: rgba(0, 0, 0, 0.22);
}
.cat-sort-section-label {
  font-size: 0.76rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin: 0 0 0.35rem;
}
.cat-sort-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 6px;
  background: var(--bg);
  cursor: grab;
}
.cat-sort-row:active {
  cursor: grabbing;
}
.cat-sort-row--root {
  margin-top: 8px;
}
.cat-sort-section-label + .cat-sort-row--root {
  margin-top: 0;
}
.cat-sort-children-block {
  margin: 0 0 14px 6px;
  padding-left: 10px;
  border-left: 2px solid rgba(215, 247, 42, 0.28);
}
.cat-sort-subhead {
  margin: 0.2rem 0 0.4rem;
  font-size: 0.78rem;
}
.cat-sort-row--child {
  margin-bottom: 5px;
}
.cat-sort-l3-block {
  margin: 0 0 10px 10px;
  padding-left: 10px;
  border-left: 1px dashed rgba(255, 255, 255, 0.1);
}
.cat-sort-subhead--l3 {
  margin-top: 0.3rem;
}
.cat-sort-row--l3 {
  margin-bottom: 4px;
  font-size: 0.86rem;
}
.cat-sort-grip {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: -0.05em;
  user-select: none;
  opacity: 0.85;
}
.cat-sort-name {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
}
.cat-sort-row.cat-sort-dragging {
  opacity: 0.5;
}
.cat-sort-footer {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

#personTagEditorModal.modal {
  z-index: 55;
}
.modal-panel.modal-panel--narrow {
  max-width: 420px;
  width: min(94vw, 420px);
  padding: 1rem 1.15rem 1.2rem;
  max-height: 86vh;
  overflow: auto;
}
#modalComfyActionBatch .modal-panel--narrow {
  max-width: 480px;
  width: min(94vw, 480px);
}
.comfy-action-node-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem 0.75rem;
  margin-bottom: 0.35rem;
}
.comfy-action-node-row .lbl {
  margin-bottom: 0;
}
.modal-panel.modal-panel--tag-editor {
  max-width: min(96vw, 1080px);
  width: min(96vw, 1080px);
  padding: 1.1rem 1.35rem 1.25rem;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.person-tag-editor-panel {
  box-sizing: border-box;
}
.person-tag-editor-layout {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.15fr);
  gap: 1rem 1.25rem;
  flex: 1;
  min-height: 0;
  margin-top: 0.35rem;
}
@media (max-width: 720px) {
  .person-tag-editor-layout {
    grid-template-columns: 1fr;
    max-height: none;
  }
}
.person-tag-editor-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}
.person-tag-editor-list--scroll {
  flex: 1;
  min-height: 12rem;
  max-height: min(52vh, 520px);
  overflow-y: auto;
  padding-right: 4px;
}
.person-tag-editor-row--active {
  border-color: var(--accent);
  background: rgba(215, 247, 42, 0.12);
}
.person-tag-editor-row--clickable {
  cursor: pointer;
}
.person-tag-editor-row--clickable:hover {
  filter: brightness(1.06);
}
.person-tag-editor-inline-input {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  padding: 0.32rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--bg);
  color: var(--text);
}
.person-tag-editor-footer--inline {
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}
.person-tag-editor-footer--done {
  margin-top: 0.75rem;
  justify-content: flex-end;
}
.person-tag-editor-title {
  margin: 0 2.2rem 0.35rem 0;
  font-size: 1.05rem;
  font-weight: 600;
}
.person-tag-editor-desc {
  margin: 0 0 0.75rem;
}
.person-tag-editor-subtitle {
  margin: 0.35rem 0 0.45rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #cfd7e6;
}
.person-tag-editor-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.person-tag-editor-group-hdr {
  list-style: none;
  margin: 0.5rem 0 0.2rem;
  padding: 0.2rem 0.35rem 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: #9aa7bc;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.person-tag-editor-list .person-tag-editor-group-hdr:first-child {
  margin-top: 0;
}
.person-tag-editor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 6px;
  background: rgba(0, 0, 0, 0.15);
}
.person-tag-editor-row.person-tag-editor-row--drop-target {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(215, 247, 42, 0.35);
}
.person-tag-editor-grip {
  flex-shrink: 0;
  width: 1.35rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: -0.05em;
  user-select: none;
  pointer-events: none;
  opacity: 0.9;
}
.person-tag-editor-row--draggable {
  cursor: grab;
  touch-action: none;
}
.person-tag-editor-row.person-tag-editor-row--dragging {
  opacity: 0.45;
  cursor: grabbing;
  z-index: 2;
  position: relative;
}
.person-tag-editor-row--draggable .person-tag-editor-name,
.person-tag-editor-row--draggable .person-tag-editor-row-actions button {
  cursor: inherit;
}
.person-tag-editor-row--draggable .person-tag-editor-row-actions button {
  cursor: pointer;
}
.person-tag-editor-name {
  flex: 1;
  font-size: 0.9rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.person-tag-editor-row-actions {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
}
.btn-xs {
  padding: 0.28rem 0.55rem;
  font-size: 0.78rem;
}
.btn-ghost-danger {
  border-color: rgba(232, 93, 93, 0.45);
  color: #ffb4b4;
}
.btn-ghost-danger:hover {
  background: rgba(232, 93, 93, 0.15);
}
.person-tag-editor-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}
.person-tag-editor-footer--groups {
  margin-top: 0.55rem;
  margin-bottom: 0.8rem;
}
.category-dedupe-panel .lbl {
  margin-top: 0.4rem;
}
.category-dedupe-list {
  margin-top: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  max-height: 42vh;
  overflow: auto;
  padding: 0.5rem 0.55rem;
  background: rgba(0, 0, 0, 0.16);
}
.category-dedupe-item {
  padding: 0.45rem 0.35rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
}
.category-dedupe-item:last-child {
  border-bottom: none;
}
.category-dedupe-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
}
.category-dedupe-col {
  width: 96px;
  flex-shrink: 0;
}
.category-dedupe-thumb {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
}
.category-dedupe-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.category-dedupe-cap {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.category-dedupe-col--drop .category-dedupe-thumb {
  border-color: rgba(232, 93, 93, 0.5);
}
.category-dedupe-col--keep .category-dedupe-thumb {
  border-color: rgba(215, 247, 42, 0.5);
}
.category-dedupe-arrow {
  font-size: 1rem;
  color: var(--muted);
  line-height: 96px;
  flex-shrink: 0;
}
.assign-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: rgba(14, 18, 24, 0.78);
}
.assign-bar .toolbar-search {
  margin-left: auto;
}
select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  min-width: 140px;
  color-scheme: dark;
}
select option {
  background-color: #141515;
  color: var(--text);
}

.grid {
  position: relative;
  padding: 1rem;
  padding-bottom: 1.5rem;
  min-height: 0;
}
.grid.grid-marquee {
  user-select: none;
}

.grid .card {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  will-change: top, left;
}

.card {
  border-radius: 16px;
  overflow: hidden;
  border: none;
  background: var(--panel);
  cursor: pointer;
  box-shadow: none;
  transition: box-shadow 0.15s ease;
}
.card:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}
.card-media {
  position: relative;
  width: 100%;
  aspect-ratio: var(--card-ar, 3 / 4);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}
.card-source-link {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 2;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #1f1f1f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.12s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  text-decoration: none;
  pointer-events: auto;
}
.card-source-link svg {
  flex-shrink: 0;
}
.card-source-link svg path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.card-media:hover .card-source-link,
.card-source-link:focus-visible {
  opacity: 1;
  transform: scale(1);
}
.card-source-link:hover {
  background: #fff;
  transform: scale(1.06);
}
.grid.grid-sort-mode .card-source-link,
body.compose-queue-pick-active .card-source-link {
  display: none;
}
.grid.grid-sort-mode .card {
  cursor: grab;
}
.grid.grid-sort-mode .card:active {
  cursor: grabbing;
}
.grid.grid-sort-mode .card-dragging {
  opacity: 0.82;
  border-color: var(--accent);
  transform: scale(0.98);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(215, 247, 42, 0.65);
}
.grid.grid-sort-mode .card-drop-before {
  box-shadow: inset 0 3px 0 0 var(--accent);
}
.grid.grid-sort-mode .card-drop-after {
  box-shadow: inset 0 -3px 0 0 var(--accent);
}
.grid.grid-sort-mode .card .chk {
  pointer-events: auto;
}
.card.selected {
  box-shadow: 0 0 0 2px var(--accent), 0 6px 20px rgba(215, 247, 42, 0.25);
}
.card-media img,
.card-media video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.card-media video {
  object-fit: cover;
}
.card-title {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  padding: 0.32rem 0.45rem;
  font-size: 0.78rem;
  line-height: 1.25;
  color: #fff;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.12));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.card-title:empty {
  display: none !important;
}
.grid.grid-show-thumb-title .card-title {
  display: block;
}
.card .chk {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  z-index: 1;
}
.main:not(.batch-mode) .card .chk {
  display: none;
}
.card-heart-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  min-width: 36px;
  height: 36px;
  padding: 0 0.45rem;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: #1f1f1f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  cursor: pointer;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.15s ease, transform 0.15s ease, color 0.12s ease, background 0.12s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
}
.card-heart-btn .card-heart-count {
  min-width: 0.65rem;
  text-align: center;
}
.card-heart-btn .card-heart-count:empty {
  display: none;
}
.card-heart-btn svg {
  flex-shrink: 0;
}
.card-heart-btn svg path {
  fill: transparent;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linejoin: round;
  transition: fill 0.12s ease, stroke 0.12s ease;
}
.card:hover .card-heart-btn,
.card-heart-btn:focus-visible,
.card-heart-btn.is-liked,
.card-heart-btn.has-count {
  opacity: 1;
  transform: scale(1);
}
.card-heart-btn:hover {
  background: #fff;
  transform: scale(1.06);
}
.card-heart-btn.is-liked {
  color: #e60023;
}
.card-heart-btn.is-liked svg path {
  fill: currentColor;
  stroke: currentColor;
}
.grid.grid-sort-mode .card-heart-btn,
body.compose-queue-pick-active .card-heart-btn {
  display: none;
}
.grid.grid-sort-mode .card .chk {
  display: block;
}

/* 推理模板卡片选择器（AI 提示词页 / LLM 弹窗）— 勿用图库 masonry 的 .grid .card 绝对定位 */
.ai-template-card-picker.grid,
.modal-ai-template-picker.grid {
  display: grid;
  position: relative;
  padding: 0.35rem 0 0.5rem;
  gap: 8px;
}
.ai-template-card-picker.grid .card,
.modal-ai-template-picker.grid .card {
  position: relative;
  top: auto;
  left: auto;
  width: 100%;
  margin: 0;
  will-change: auto;
}
.ai-tpl-pick-card {
  aspect-ratio: 1;
  min-height: 0;
}
.ai-tpl-pick-card > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ai-tpl-pick-card.selected {
  box-shadow: 0 0 0 2px rgba(215, 247, 42, 0.95);
}
.ai-tpl-pick-card .ai-tpl-card-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 26px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  padding: 4px 4px 2px;
  z-index: 3;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.78), transparent);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.16s ease, visibility 0.16s ease;
}
/* 先点击选中卡片，再显示「查看」，避免满屏按钮 */
.ai-tpl-pick-card.selected .ai-tpl-card-actions {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.ai-tpl-pick-card .ai-tpl-card-actions .btn {
  font-size: 0.72rem;
  padding: 0.2rem 0.4rem;
}
.ai-tpl-pick-card .ai-tpl-card-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--muted);
  background: linear-gradient(145deg, rgba(215, 247, 42, 0.12), rgba(0, 0, 0, 0.28));
}
.ai-tpl-pick-card--none .ai-tpl-card-placeholder {
  font-size: 0.82rem;
  font-weight: 500;
}
.modal-ai-template-picker.grid {
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)) !important;
  max-height: min(42vh, 240px);
  overflow-y: auto;
  padding-right: 4px;
}
.modal-ai-drawer .modal-ai-template-select-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.modal-ai-tpl-picker-wrap {
  margin-top: 0.35rem;
}

.btn {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}
.btn:hover {
  filter: brightness(1.08);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent-dim);
  color: #fff;
}
.btn.danger {
  border-color: rgba(232, 93, 93, 0.55);
  color: #ffb4b4;
  background: rgba(40, 18, 18, 0.45);
}
.btn.danger:hover {
  border-color: #e85d5d;
  color: #fff;
  background: rgba(180, 50, 50, 0.35);
}

.btn.secondary {
  opacity: 0.92;
}
.upload-label {
  display: inline-block;
  cursor: pointer;
  margin: 0;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 0.78rem;
  line-height: 1.35;
}

/** �?classList.toggle("hidden") 配合；单独使�?.hidden 的元素依赖此规则（如 LLM 侧栏内的图片尺寸区） */
.hidden {
  display: none !important;
}

.modal.hidden {
  display: none;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2vh 2vw;
  box-sizing: border-box;
}
#modal.modal--stack-above-compose {
  z-index: 62;
}
/* 参考图预览/管理：默认高于叠在创作队列上的卡片模态（59）；打开�?JS 会再 raiseModalToTop */
#modalRefPreview.modal,
#modalRefEditor.modal {
  z-index: 61;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.modal-panel {
  position: relative;
  margin: 0;
  flex-shrink: 0;
  max-width: 1200px;
  width: min(96vw, 1200px);
  max-height: 94vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-title-input {
  width: 100%;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}
.modal-filename-left {
  margin: 0;
  padding: 0.4rem 0.55rem;
  word-break: break-all;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  background: var(--panel);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.modal-close {
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;
  border: none;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.modal-body {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 0;
  flex: 1;
  min-height: 0;
  max-height: 94vh;
}
.modal-img-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: #000;
}
.modal-img-col .modal-img-wrap {
  flex: 1;
  min-height: 240px;
}
@media (max-width: 820px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow: auto;
  }
  .layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--border);
    height: auto;
    overflow: visible;
  }
  .sidebar-actions {
    margin-top: 0;
  }
  .main {
    height: auto;
    overflow: visible;
    min-height: 0;
  }
  .main-grid-scroll {
    overflow: visible;
    flex: none;
  }
  .modal-body {
    grid-template-columns: 1fr;
  }
}
.main-grid-scroll.asset-drop-target {
  box-shadow: inset 0 0 0 2px rgba(215, 247, 42, 0.45);
  background: rgba(215, 247, 42, 0.06);
}
.modal-img-wrap {
  position: relative;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  min-width: 0;
  cursor: default;
}
.modal-replace-img,
.modal-crop-img,
.modal-open-capture-link {
  position: static;
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}
.modal-img-tools {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.modal-replace-img:disabled,
.modal-crop-img:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.modal-open-capture-link {
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  align-items: center;
}
.modal-open-capture-link.hidden {
  display: none !important;
}
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  line-height: 1.4;
}
.modal-xhs-note-link {
  color: #7eb8ff;
  text-decoration: none;
}
.modal-xhs-note-link:hover {
  text-decoration: underline;
}
.modal-ref-strip {
  position: absolute;
  left: 10px;
  bottom: 52px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(45vh, 360px);
  overflow-y: auto;
  padding-right: 2px;
}
.modal-ref-thumb {
  width: 66px;
  height: 66px;
  border-radius: 8px;
  border: 2px solid rgba(255, 120, 120, 0.95);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
  cursor: zoom-in;
}
.modal-ref-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.modal-ref-thumb--failed::after {
  content: "!";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: rgba(255, 200, 200, 0.9);
  pointer-events: none;
}
.modal-ref-thumb--failed {
  position: relative;
}
.modal-ref-thumb {
  position: relative;
}
.modal-ref-thumb--outfit {
  border-color: rgba(72, 187, 120, 0.95);
}
.modal-ref-thumb--action {
  border-color: rgba(96, 165, 250, 0.95);
}
.modal-ref-thumb-badge--action {
  background: rgba(96, 165, 250, 0.88);
  color: #0f172a;
}
.modal-ref-thumb-badge {
  position: absolute;
  left: 2px;
  top: 2px;
  z-index: 2;
  font-size: 0.58rem;
  line-height: 1.1;
  padding: 0.08rem 0.22rem;
  border-radius: 4px;
  background: rgba(72, 187, 120, 0.88);
  color: #0f1a12;
  font-weight: 600;
  pointer-events: none;
}
.modal-img-wrap:focus {
  outline: none;
}
.modal-img-wrap:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(215, 247, 42, 0.4);
}
.modal-img-wrap img,
.modal-img-wrap video {
  max-width: 100%;
  max-height: min(78vh, 900px);
  width: auto;
  height: auto;
  object-fit: contain;
}
.modal-image-counter {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 1;
  max-width: calc(100% - 70px);
  padding: 0.34rem 0.62rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(9, 13, 22, 0.72);
  color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(8px);
  font-size: 0.8rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.modal-image-counter.hidden {
  display: none;
}
.modal-meta {
  padding: 1rem 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  overflow: auto;
}
.modal-meta--studio {
  padding: 0;
  gap: 0;
  background:
    radial-gradient(circle at 18% 0%, rgba(199, 166, 88, 0.11), transparent 26%),
    linear-gradient(180deg, #111820 0%, #0d131a 100%);
}
.modal-meta--studio > :not(#modalStudioPanel) {
  display: none !important;
}
.modal-meta--studio #modalStudioPanel {
  min-height: 100%;
}
.studio-curation-loading {
  padding: 1.15rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.studio-curation {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  color: #edf4f6;
}
.studio-curation-head {
  display: grid;
  gap: 0.8rem;
  padding: 1.15rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(225, 235, 238, 0.08);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
    rgba(255, 255, 255, 0.015);
}
.studio-curation-title {
  font-size: 1.05rem;
  font-weight: 760;
  letter-spacing: 0;
}
.studio-curation-sync,
.studio-help-text,
.studio-muted-note {
  margin-top: 0.22rem;
  color: rgba(205, 217, 218, 0.62);
  font-size: 0.74rem;
  line-height: 1.35;
}
.studio-context-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.studio-context-chips span,
.studio-auto-save {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0.18rem 0.52rem;
  border: 1px solid rgba(205, 217, 218, 0.13);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(234, 242, 242, 0.82);
  font-size: 0.74rem;
  white-space: nowrap;
}
.studio-auto-save {
  color: #93d7be;
  border-color: rgba(65, 176, 132, 0.26);
  background: rgba(37, 129, 95, 0.12);
}
.studio-curation-section {
  padding: 1.08rem 1.25rem;
  border-bottom: 1px solid rgba(225, 235, 238, 0.08);
}
.studio-feature-section {
  padding-top: 1.2rem;
}
.studio-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.studio-section-head h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 720;
  letter-spacing: 0;
}
.studio-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.62rem;
}
.studio-feature-chip,
.studio-mini-chip {
  position: relative;
  min-width: 0;
  border: 1px solid rgba(220, 232, 234, 0.13);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  color: rgba(238, 246, 246, 0.88);
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease, color 0.16s ease;
}
.studio-feature-chip {
  min-height: 82px;
  padding: 0.76rem 0.68rem;
  display: grid;
  align-content: center;
  justify-items: start;
  gap: 0.42rem;
  text-align: left;
  font: inherit;
}
.studio-feature-chip:hover,
.studio-mini-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(199, 166, 88, 0.45);
  background: rgba(255, 255, 255, 0.045);
}
.studio-feature-chip:disabled,
.studio-mini-chip:disabled {
  opacity: 0.65;
  cursor: wait;
}
.studio-feature-icon {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: #d8bc72;
  background: rgba(216, 188, 114, 0.11);
  font-size: 1.05rem;
}
.studio-feature-check {
  position: absolute;
  top: 0.55rem;
  right: 0.58rem;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  color: transparent;
  border: 1px solid rgba(220, 232, 234, 0.14);
  font-size: 0.72rem;
}
.studio-feature-chip.is-selected {
  color: #fff8e4;
  border-color: rgba(216, 178, 82, 0.86);
  background:
    linear-gradient(135deg, rgba(216, 178, 82, 0.2), rgba(20, 122, 96, 0.12)),
    rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 0 0 1px rgba(216, 178, 82, 0.1), 0 10px 28px rgba(0, 0, 0, 0.18);
}
.studio-feature-chip.is-selected .studio-feature-check {
  color: #12241d;
  background: #d8bc72;
  border-color: #d8bc72;
}
.studio-creator-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border: 1px solid rgba(220, 232, 234, 0.09);
  border-radius: 8px;
  overflow: hidden;
}
.studio-creator-list div,
.studio-kv-row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.64rem 0.7rem;
  background: rgba(255, 255, 255, 0.022);
}
.studio-creator-list div:nth-child(odd) {
  border-right: 1px solid rgba(220, 232, 234, 0.08);
}
.studio-creator-list div:nth-child(n + 3) {
  border-top: 1px solid rgba(220, 232, 234, 0.08);
}
.studio-creator-list span,
.studio-kv-row span {
  color: rgba(205, 217, 218, 0.62);
  font-size: 0.78rem;
}
.studio-creator-list strong,
.studio-kv-row strong {
  min-width: 0;
  color: rgba(242, 248, 248, 0.92);
  font-size: 0.82rem;
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.studio-text-btn {
  border: 0;
  padding: 0;
  background: transparent;
  color: #6fd0a7;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
}
.studio-kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid rgba(220, 232, 234, 0.09);
  border-radius: 8px;
  overflow: hidden;
}
.studio-kv-row {
  border-top: 1px solid rgba(220, 232, 234, 0.08);
}
.studio-kv-row:nth-child(-n + 2) {
  border-top: 0;
}
.studio-kv-row:nth-child(odd) {
  border-right: 1px solid rgba(220, 232, 234, 0.08);
}
.studio-mini-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.studio-mini-chip {
  min-height: 36px;
  padding: 0.42rem 0.72rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.36rem;
  font: inherit;
  font-size: 0.82rem;
}
.studio-mini-chip .studio-feature-icon {
  display: none;
}
.studio-mini-chip .studio-feature-check {
  position: static;
  width: 15px;
  height: 15px;
  font-size: 0.62rem;
}
.studio-mini-chip.is-selected {
  color: #eafff8;
  border-color: rgba(75, 196, 150, 0.72);
  background: rgba(33, 136, 103, 0.22);
}
.studio-mini-chip.is-selected .studio-feature-check {
  color: #072117;
  background: #73d6b3;
  border-color: #73d6b3;
}
.lbl {
  font-size: 0.85rem;
  color: var(--muted);
}
.modal-prompt-rev-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.modal-prompt-rev-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.modal-prompt-rev-select {
  flex: 1;
  min-width: 180px;
  max-width: 100%;
  padding: 0.4rem 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  color-scheme: dark;
  font-size: 0.88rem;
}
.modal-prompt-rev-select option {
  background-color: #141515;
  color: var(--text);
}
.modal-prompt-rev-hint {
  margin: 0;
  line-height: 1.35;
}
.modal-prompt-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.modal-prompt-head .lbl {
  margin: 0;
}
textarea {
  width: 100%;
  resize: vertical;
  min-height: 200px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.65rem;
  font-size: 0.9rem;
  line-height: 1.45;
}
.modal-actions {
  margin-top: 0.25rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.modal-ai-drawer {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 3;
  width: min(520px, 92vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--panel);
  box-shadow: -16px 0 32px rgba(0, 0, 0, 0.35);
}
.modal-ai-drawer.hidden {
  display: none;
}
.modal-ai-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
}
.modal-ai-drawer-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.85rem;
}
.modal-ai-current {
  display: grid;
  gap: 0.15rem;
  padding: 0.65rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(215, 247, 42, 0.08);
  word-break: break-all;
}
.modal-ai-input,
.modal-ai-textarea,
.modal-ai-result {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  padding: 0.5rem 0.6rem;
  font: inherit;
}
.modal-ai-textarea {
  min-height: 110px;
}
.modal-ai-result {
  flex: 1;
  min-height: 220px;
  resize: vertical;
}
.modal-ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}
.modal-ai-status {
  min-height: 1.2em;
}
.modal-person-tags {
  display: flex;
  flex-direction: column;
  gap: 0.48rem;
  margin-bottom: 0.35rem;
}
.modal-person-tag-group {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  align-items: stretch;
}
.modal-person-tag-group-head {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.28rem 0.15rem;
  width: 100%;
  max-width: 100%;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}
.modal-person-tag-group-head:hover {
  background: rgba(255, 255, 255, 0.06);
}
.modal-person-tag-group-chev {
  flex: 0 0 auto;
  width: 1em;
  text-align: center;
  opacity: 0.75;
  font-size: 0.72rem;
  line-height: 1;
}
.modal-person-tag-group-head-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal-person-tag-select-all {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 0.12rem 0.45rem;
  font-size: 0.72rem;
  line-height: 1.2;
}
.modal-person-tag-group-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  padding-left: 1.15rem;
}
.modal-person-tag-group-chips[hidden] {
  display: none !important;
}
.modal-person-tag-hotkey {
  margin-left: 0.15rem;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.68rem;
  line-height: 1.2;
  opacity: 0.75;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-size: 0.84rem;
  user-select: none;
}
.tag-chip input {
  accent-color: var(--accent);
  cursor: pointer;
}
.tag-chip input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
.tag-chip:has(input:checked) {
  border-color: var(--accent);
  background: rgba(215, 247, 42, 0.14);
}

.modal-ref-editor-title {
  margin: 0 2.2rem 0.4rem 0;
  font-size: 1.05rem;
  font-weight: 600;
}
.modal-ref-editor-desc {
  margin: 0 0 0.7rem;
}
.export-zip-opts {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0.6rem 0 1rem;
}
.export-zip-opt {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  cursor: pointer;
  user-select: none;
}
.export-zip-opt input {
  accent-color: var(--accent);
}
.modal-ref-dropzone {
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
  padding: 0.85rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
  cursor: pointer;
  margin-bottom: 0.7rem;
}
.modal-ref-dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(215, 247, 42, 0.14);
  color: #d9e4ff;
}
.modal-ref-list {
  min-height: 80px;
  max-height: 46vh;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem;
  background: rgba(0, 0, 0, 0.12);
}
.modal-ref-card {
  width: 86px;
}
.modal-ref-card-thumb {
  width: 86px;
  height: 86px;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  cursor: zoom-in;
}
.modal-ref-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.modal-ref-card-name {
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal-ref-card-del {
  margin-top: 4px;
  width: 100%;
  font-size: 0.74rem;
  padding: 0.25rem 0.3rem;
}
.modal-ref-editor-footer {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.8rem;
}

.modal-ref-preview-panel {
  max-width: min(94vw, 1280px);
  width: min(94vw, 1280px);
  max-height: 92vh;
  background: rgba(10, 12, 16, 0.98);
  border-radius: 14px;
}
.modal-ref-preview-wrap {
  width: 100%;
  height: 100%;
  min-height: 260px;
  max-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem;
}
.modal-ref-preview-wrap img {
  max-width: 100%;
  max-height: calc(92vh - 1.6rem);
  width: auto;
  height: auto;
  object-fit: contain;
}

.batch-picker-panel {
  max-height: min(88vh, 720px);
  display: flex;
  flex-direction: column;
}
.batch-picker-list {
  flex: 1;
  min-height: 120px;
  max-height: min(52vh, 420px);
  overflow-y: auto;
  margin: 0.65rem 0 0.85rem;
  padding: 0.35rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.18);
}
.batch-picker-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.6rem;
  margin: 0.15rem 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
}
.batch-picker-item:hover {
  background: rgba(122, 162, 255, 0.12);
  border-color: rgba(122, 162, 255, 0.25);
}
.batch-picker-item--active {
  background: rgba(122, 162, 255, 0.16);
  border-color: rgba(122, 162, 255, 0.55);
  box-shadow: inset 0 0 0 1px rgba(122, 162, 255, 0.35);
}
.batch-picker-panel .person-tag-editor-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.batch-picker-item--muted {
  color: var(--muted);
}
.batch-tag-picker-list {
  padding: 0.55rem 0.65rem;
}
.batch-tag-picker-group + .batch-tag-picker-group {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}
.batch-tag-picker-group-title {
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.batch-tag-picker-opt {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.28rem 0;
  font-size: 0.88rem;
  cursor: pointer;
}
.batch-tag-picker-opt input {
  accent-color: var(--accent, #7aa2ff);
}

.ctx-menu.hidden {
  display: none;
}
.ctx-menu {
  position: fixed;
  z-index: 100;
  min-width: 170px;
  max-width: min(92vw, 360px);
  background: #121720;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.ctx-menu--cascade {
  overflow: visible;
}
.ctx-cascade-item {
  position: relative;
  width: 100%;
}
.ctx-cascade-item:hover,
.ctx-cascade-item:focus-within {
  z-index: 80;
}
.ctx-cascade-panel {
  position: absolute;
  /* 默认向上展开：子菜单底边与当前行对齐，避免靠屏幕底部时被裁切 */
  top: auto;
  bottom: -1px;
  left: calc(100% - 2px);
  min-width: 210px;
  max-width: min(80vw, 320px);
  overflow: visible;
  display: none;
  background: #121720;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  padding: 4px 0;
}
/* 鼠标移向右侧子菜单时经过的透明桥，避免 hover 断开 */
.ctx-cascade-panel::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -10px;
  width: 12px;
}
.ctx-cascade-item--panel-down > .ctx-cascade-panel {
  top: -1px;
  bottom: auto;
}
.ctx-cascade-panel--leaf {
  max-height: min(78vh, 560px);
  overflow-y: auto;
  overflow-x: hidden;
}
.ctx-cascade-item:hover > .ctx-cascade-panel,
.ctx-cascade-item:focus-within > .ctx-cascade-panel {
  display: block;
}
.ctx-cascade-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.ctx-cascade-caret {
  color: var(--muted);
  font-size: 0.72rem;
}
.ctx-menu button.ctx-tag-select-all {
  font-weight: 600;
  color: #b8ccff;
}
.ctx-menu button.ctx-tag-select-all:hover {
  background: rgba(215, 247, 42, 0.14);
}
.ctx-menu button {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  font-size: 0.88rem;
}
.ctx-menu button:hover {
  background: rgba(215, 247, 42, 0.18);
}
.ctx-menu button.danger {
  color: #ffb4b4;
}
.ctx-menu button.danger:hover {
  background: rgba(232, 93, 93, 0.2);
}
.ctx-menu button:disabled {
  color: var(--muted);
  cursor: not-allowed;
}
.ctx-menu button:disabled:hover {
  background: transparent;
}
.ctx-title {
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.45rem 0.7rem;
  border-bottom: 1px solid var(--border);
}
.ctx-subtitle {
  font-size: 0.72rem;
  color: var(--muted);
  padding: 0.35rem 0.7rem 0.2rem;
  line-height: 1.3;
}
.ctx-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

.ctx-accordion-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  font-size: 0.88rem;
}
.ctx-accordion-head:hover {
  background: rgba(215, 247, 42, 0.12);
}
.ctx-accordion-head .ctx-acc-hint {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: normal;
}
.ctx-accordion-head .ctx-acc-caret {
  color: var(--muted);
  font-size: 0.7rem;
  transition: transform 0.12s ease;
  display: inline-block;
}
.ctx-accordion.ctx-open .ctx-accordion-head .ctx-acc-caret {
  transform: rotate(90deg);
}
.ctx-accordion-panel {
  display: none;
  padding: 0 0 0.35rem 0.5rem;
}
.ctx-accordion.ctx-open .ctx-accordion-panel {
  display: block;
}
.ctx-accordion-note {
  padding: 0.15rem 0.65rem 0.35rem;
  line-height: 1.35;
}
.ctx-accordion-item {
  width: calc(100% - 0.25rem);
  margin-left: 0.25rem;
  border: none;
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  text-align: left;
  padding: 0.42rem 0.65rem 0.42rem 0.85rem;
  cursor: pointer;
  font-size: 0.84rem;
  border-radius: 6px;
  margin-bottom: 3px;
}
.ctx-accordion-item:hover {
  background: rgba(215, 247, 42, 0.2);
}

.compose-bar {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--border);
  background: rgba(215, 247, 42, 0.08);
}
.compose-bar.hidden {
  display: none !important;
}
.compose-summary {
  margin: 0 0 0.4rem;
}
.compose-preview-lbl {
  margin: 0.35rem 0 0.25rem;
}
.compose-bar .compose-result-preview {
  width: 100%;
  min-height: 72px;
  max-height: 28vh;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  padding: 0.45rem 0.55rem;
  font: inherit;
  line-height: 1.45;
  margin-bottom: 0.45rem;
}
.compose-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.main.compose-mode .card {
  cursor: pointer;
}
.main.compose-mode .card .chk {
  opacity: 1;
}

.marquee.hidden {
  display: none;
}
.marquee {
  position: fixed;
  z-index: 40;
  border: 1px solid var(--accent);
  background: rgba(215, 247, 42, 0.12);
  pointer-events: none;
  box-sizing: border-box;
}

.modal-panel.modal-panel--wide {
  max-width: min(98vw, 1480px);
  width: min(98vw, 1480px);
  max-height: 92vh;
  min-height: 72vh;
}
#composeQueueModal .modal-panel.modal-panel--wide {
  max-width: min(98vw, 1760px);
  width: min(98vw, 1760px);
}
#composeQueueModal.modal {
  z-index: 54;
}
#composeQueuePromptModal.modal {
  z-index: 56;
}
#composeQueueGenModal.modal {
  z-index: 58;
}
#composeQueuePolishModal.modal {
  z-index: 57;
}
.compose-queue-panel {
  padding: 1rem 1.15rem 1.1rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(18, 24, 34, 0.98), rgba(14, 18, 26, 0.98));
  border: 1px solid rgba(125, 147, 180, 0.18);
}
.compose-queue-prompt-panel {
  padding: 1rem 1.35rem 1.2rem;
  max-height: 88vh;
}
.compose-queue-prompt-view {
  width: 100%;
  min-height: 50vh;
  max-height: calc(88vh - 7rem);
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  padding: 0.55rem 0.65rem;
  font: inherit;
  line-height: 1.45;
  margin: 0.5rem 0 0.75rem;
  box-sizing: border-box;
}
.compose-queue-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.55rem 0 0.75rem;
}
.compose-queue-toolbar .btn {
  min-height: 2rem;
}
.compose-queue-toolbar .compose-queue-select-all {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 0.25rem;
  cursor: pointer;
  user-select: none;
}
.compose-queue-row--selected {
  outline: 1px solid rgba(215, 247, 42, 0.45);
  background: rgba(215, 247, 42, 0.06);
}
.compose-queue-row-chk {
  margin: 0 0 0.15rem;
}
.compose-queue-row-polished {
  font-size: 0.68rem;
  line-height: 1.2;
  padding: 0.12rem 0.35rem;
  border-radius: 999px;
  background: rgba(72, 187, 120, 0.18);
  color: #8ae6a8;
  text-align: center;
}
.compose-queue-row-run-status {
  font-size: 0.72rem;
  line-height: 1.2;
  padding: 0.16rem 0.42rem;
  border-radius: 999px;
  text-align: center;
  border: 1px solid rgba(125, 147, 180, 0.18);
  font-variant-numeric: tabular-nums;
}
.compose-queue-row-run-status--queued {
  color: #b9c6d8;
  background: rgba(148, 163, 184, 0.11);
}
.compose-queue-row-run-status--running {
  color: #8fb7ff;
  border-color: rgba(215, 247, 42, 0.42);
  background: rgba(215, 247, 42, 0.16);
}
.compose-queue-row-run-status--success {
  color: #94e5ad;
  border-color: rgba(34, 197, 94, 0.28);
  background: rgba(34, 197, 94, 0.12);
}
.compose-queue-row-run-status--failed {
  color: #ffb4b4;
  border-color: rgba(232, 93, 93, 0.45);
  background: rgba(232, 93, 93, 0.12);
}
.compose-queue-polish-panel {
  padding: 1rem 1.25rem 1.15rem;
  max-height: 90vh;
  overflow: auto;
}
.compose-queue-polish-tpl-picker {
  max-height: 28vh;
  overflow: auto;
  margin-bottom: 0.55rem;
}
.compose-queue-polish-image-fields {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.5rem 0.65rem 0.55rem;
  margin: 0 0 0.55rem;
}
.compose-queue-polish-image-legend {
  padding: 0 0.25rem;
  margin-bottom: 0.15rem;
}
.compose-queue-polish-image-hint {
  margin: 0 0 0.4rem;
  line-height: 1.4;
}
.compose-queue-polish-image-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.85rem;
}
.compose-queue-polish-image-checks label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.92rem;
  cursor: pointer;
  user-select: none;
}
.compose-queue-polish-image-checks label.is-empty-hint {
  cursor: default;
  opacity: 0.75;
}
.compose-queue-polish-rules {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  padding: 0.45rem 0.55rem;
  font: inherit;
  line-height: 1.45;
  margin-bottom: 0.45rem;
  resize: vertical;
}
.compose-queue-polish-status {
  min-height: 1.2rem;
  margin: 0.25rem 0 0.5rem;
}
.compose-queue-head {
  padding-right: 2.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.compose-queue-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}
.compose-queue-title {
  margin-bottom: 0;
}
.compose-queue-desc {
  margin: 0.35rem 0 0;
}
.compose-queue-count-pill,
.compose-queue-view-pill,
.compose-queue-row-slot-count,
.compose-queue-expand-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.45rem;
  padding: 0 0.55rem;
  border: 1px solid rgba(125, 147, 180, 0.18);
  border-radius: 999px;
  background: rgba(215, 247, 42, 0.1);
  color: #d7e2f4;
  font-size: 0.76rem;
  line-height: 1;
  white-space: nowrap;
}
.compose-queue-view-pill {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
}
.compose-queue-empty {
  margin: 0.7rem 0 1rem;
}
.compose-queue-list-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  max-height: calc(92vh - 7.5rem);
  padding: 0.15rem 0.35rem 0.3rem 0;
  scrollbar-width: thin;
}
.compose-queue-list-scroll::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.compose-queue-list-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.42);
  border-radius: 999px;
}
.compose-queue-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.compose-queue-row {
  display: grid;
  grid-template-columns: 8.4rem minmax(0, 1fr) 5.8rem 6.8rem;
  gap: 0.95rem;
  align-items: start;
  padding: 0.82rem 0.8rem;
  border: 1px solid rgba(125, 147, 180, 0.16);
  border-radius: 8px;
  background: rgba(7, 13, 22, 0.64);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.16);
}
.compose-queue-row:hover {
  border-color: rgba(215, 247, 42, 0.32);
  background: rgba(11, 17, 27, 0.72);
}
.compose-queue-row-meta {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.35rem;
  min-width: 0;
  padding-right: 0.65rem;
  border-right: 1px solid rgba(125, 147, 180, 0.12);
}
.compose-queue-row-no {
  color: #eef4ff;
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}
.compose-queue-row-time {
  color: #aeb9ca;
  font-size: 0.78rem;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}
.compose-queue-row-slot-count {
  align-self: flex-start;
  min-height: 1.35rem;
  background: rgba(34, 197, 94, 0.08);
  color: #b8e3c6;
}
.compose-queue-row-main {
  min-width: 0;
}
.compose-queue-table .col-idx { width: 2.5rem; }
.compose-queue-table .col-time { width: 9.5rem; white-space: nowrap; }
.compose-queue-table .col-slots { width: auto; min-width: 16rem; }
.compose-queue-table .col-action { width: 7.5rem; white-space: nowrap; vertical-align: middle; }
.compose-queue-slots {
  display: grid;
  grid-template-columns: repeat(auto-fill, 6.55rem);
  gap: 0.65rem;
  align-items: start;
}
.compose-queue-slot {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  align-items: stretch;
}
.compose-queue-slot-tag {
  display: block;
  min-height: 1.05rem;
  overflow: hidden;
  color: #aeb9ca;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-left: 0.05rem;
}
.compose-queue-slot-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(125, 147, 180, 0.18);
  background: #0b1018;
}
.compose-queue-slot-del {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.88;
}
.compose-queue-slot-del:hover {
  background: rgba(220, 70, 70, 0.92);
  opacity: 1;
}
.compose-queue-slot--add .compose-queue-slot-thumb--empty {
  border-style: dashed;
  border-color: rgba(125, 147, 180, 0.35);
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
  justify-content: center;
}
.compose-queue-slot-thumb--missing {
  border-style: dashed;
  border-color: rgba(220, 120, 80, 0.45);
  background: rgba(220, 80, 60, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}
.compose-queue-slot-missing-hint {
  font-size: 0.72rem;
  color: #c98a72;
  user-select: none;
}
.compose-queue-slot-add-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid rgba(125, 147, 180, 0.28);
  border-radius: 999px;
  background: rgba(13, 19, 29, 0.75);
  color: #aeb9ca;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}
.compose-queue-slot-add-btn:hover {
  color: #fff;
  border-color: rgba(215, 247, 42, 0.55);
  background: rgba(215, 247, 42, 0.22);
}
.compose-queue-slot-thumb > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  font-size: 0;
  color: transparent;
  border: none;
  border-radius: 0;
}
.compose-queue-slot-tools {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  overflow: hidden;
  border: 1px solid rgba(125, 147, 180, 0.16);
  border-radius: 0 0 6px 6px;
  background: rgba(125, 147, 180, 0.16);
}
.compose-queue-slot-tool {
  min-width: 0;
  height: 1.3rem;
  padding: 0;
  border: 0;
  background: rgba(13, 19, 29, 0.92);
  color: #aeb9ca;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
}
.compose-queue-slot-tool:hover {
  color: #ffffff;
  background: rgba(215, 247, 42, 0.28);
}
.compose-queue-slot-tool:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.compose-queue-expand-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.48rem;
  min-height: 1.6rem;
}
.compose-queue-expand-chip--extra {
  border-style: dashed;
  opacity: 0.92;
}
.compose-queue-expand-empty {
  line-height: 1.35;
}
.compose-queue-expand-chip {
  min-width: 0;
  max-width: 7rem;
  height: 1.55rem;
  padding: 0 0.55rem;
  border: 1px solid rgba(125, 147, 180, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: #d7e2f4;
  font-size: 0.74rem;
  line-height: 1;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compose-queue-expand-chip:hover {
  border-color: rgba(215, 247, 42, 0.45);
  background: rgba(215, 247, 42, 0.14);
}
.compose-queue-actions {
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  align-items: stretch;
}
.compose-queue-action-btn {
  width: 100%;
  min-height: 1.65rem;
}
#composeQueueImageModal.modal {
  z-index: 57;
}
.compose-queue-image-panel {
  max-width: min(96vw, 920px);
  width: min(96vw, 920px);
  padding: 1rem 1.2rem;
  text-align: center;
}
.compose-queue-image-preview {
  display: block;
  max-width: 100%;
  max-height: min(78vh, 720px);
  margin: 0.5rem auto;
  border-radius: 8px;
  object-fit: contain;
  background: var(--bg);
}
.compose-queue-image-meta {
  margin: 0.35rem 0 0;
}
.compose-queue-tabs {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}
.compose-queue-tab {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.82rem;
  cursor: pointer;
}
.compose-queue-tab--active {
  color: var(--text);
  border-color: rgba(215, 247, 42, 0.5);
  background: rgba(215, 247, 42, 0.14);
}
.compose-queue-toolbar--gen {
  margin-top: 0.25rem;
  margin-bottom: 0.35rem;
}
.compose-queue-gen-lbl {
  margin: 0;
  font-size: 0.82rem;
}
.compose-queue-gen-select {
  min-width: 8rem;
  max-width: 14rem;
}
.compose-queue-gen-select-sm {
  min-width: 4.2rem;
  max-width: 5.5rem;
}
.compose-queue-panel-gallery,
.compose-queue-panel-queue {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.compose-gallery-scroll {
  flex: 1;
  overflow: auto;
  min-height: 12rem;
  padding-right: 0.15rem;
}
.compose-gallery-day {
  margin-bottom: 1rem;
}
.compose-gallery-day-title {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.45rem;
  font-weight: 600;
}
.compose-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.45rem;
}
.compose-gallery-item {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
  background: var(--bg);
}
.compose-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.compose-gallery-item-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.15rem 0.3rem;
  font-size: 0.62rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
  color: #e8ecf1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compose-queue-row-outputs-col {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  min-width: 0;
  padding: 0 0.35rem;
  border-left: 1px solid rgba(125, 147, 180, 0.12);
  border-right: 1px solid rgba(125, 147, 180, 0.12);
}
.compose-queue-row-outputs-label {
  font-size: 0.68rem;
  color: #7a8799;
  letter-spacing: 0.04em;
}
.compose-queue-row-outputs {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0.35rem;
  margin-top: 0;
  align-items: stretch;
  flex: 1;
}
.compose-queue-output-thumb {
  position: relative;
  width: 100%;
  max-width: 72px;
  height: auto;
  aspect-ratio: 1;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
}
.compose-queue-gen-hint {
  margin-left: 0.35rem;
  white-space: nowrap;
}
.compose-queue-gen-modal-hint {
  margin: 0.35rem 0 0.65rem;
  line-height: 1.45;
}
.compose-queue-output-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.compose-queue-output-thumb--fav {
  border-color: #c9a227;
  box-shadow: 0 0 0 1px rgba(245, 200, 66, 0.45);
}
.compose-queue-output-thumb--fav::after {
  content: "�?;
  position: absolute;
  top: 0.12rem;
  right: 0.14rem;
  z-index: 2;
  font-size: 0.62rem;
  line-height: 1;
  color: #f5c842;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}
.compose-queue-gen-status {
  font-size: 0.72rem;
  color: var(--muted);
}
#composeGalleryLightbox.modal {
  z-index: 59;
  padding: 1vh 1vw;
}
.compose-gallery-lightbox-panel {
  max-width: min(98vw, 1320px);
  width: min(98vw, 1320px);
  max-height: 96vh;
  padding: 0.85rem 2.75rem;
  text-align: center;
  position: relative;
}
.compose-gallery-lightbox-img {
  max-width: 100%;
  max-height: min(86vh, 920px);
  object-fit: contain;
  border-radius: 8px;
  background: var(--bg);
}
.compose-gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 2.2rem;
  height: 2.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.compose-gallery-nav--prev {
  left: 0.35rem;
}
.compose-gallery-nav--next {
  right: 0.35rem;
}
.compose-gallery-lightbox-meta {
  margin: 0.5rem 0;
}
.compose-queue-slot-id {
  font-variant-numeric: tabular-nums;
  text-align: center;
  line-height: 1.2;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.compose-queue-table .col-action .btn {
  display: block;
  width: 100%;
  margin-bottom: 0.22rem;
}
.compose-queue-table .col-action .btn:last-child {
  margin-bottom: 0;
}
@media (max-width: 980px) {
  .compose-queue-row {
    grid-template-columns: 1fr;
  }
  .compose-queue-row-meta {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    border-right: 0;
    border-bottom: 1px solid rgba(125, 147, 180, 0.12);
    padding: 0 0 0.55rem;
  }
  .compose-queue-row-outputs-col {
    border-left: 0;
    border-right: 0;
    border-top: 1px solid rgba(125, 147, 180, 0.12);
    padding: 0.55rem 0 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .compose-queue-row-outputs {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .compose-queue-actions {
    flex-direction: row;
  }
  .compose-queue-slots {
    grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
  }
}
.btn-tiny {
  padding: 0.15rem 0.35rem;
  font-size: 0.72rem;
}
.compose-queue-pick-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--accent);
  background: rgba(20, 24, 32, 0.96);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
}
.compose-queue-pick-bar.hidden {
  display: none !important;
}
.compose-queue-pick-hint {
  flex: 1;
  min-width: 12rem;
  font-size: 0.9rem;
}
.compose-queue-pick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
body.compose-queue-pick-active .main-grid-scroll .card {
  cursor: pointer;
}
body.compose-queue-pick-active .grid.grid-marquee {
  cursor: crosshair;
}
body.compose-queue-pick-active .card.expand-pick-selected {
  border-color: #ef4444;
  box-shadow:
    0 0 0 3px #ef4444,
    0 6px 20px rgba(239, 68, 68, 0.55);
}
body.compose-queue-pick-active .card.expand-pick-selected::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(220, 38, 38, 0.48);
  pointer-events: none;
  z-index: 1;
}
body.compose-queue-pick-active .card.expand-pick-selected img,
body.compose-queue-pick-active .card.expand-pick-selected video,
body.compose-queue-pick-active .card.expand-pick-selected .card-media img,
body.compose-queue-pick-active .card.expand-pick-selected .card-media video {
  filter: saturate(0.75) brightness(0.88);
}

.bulk-progress-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 10, 14, 0.72);
  backdrop-filter: blur(4px);
}
.bulk-progress-overlay.hidden {
  display: none !important;
}
.bulk-progress-card {
  width: min(420px, 100%);
  padding: 22px 24px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}
.bulk-progress-title {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 600;
}
.bulk-progress-text {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}
.bulk-progress-shell {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #11161f;
}
.bulk-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  transition: width 0.18s ease;
}
.bulk-progress-detail {
  margin: 12px 0 0;
  min-height: 1.2em;
}

.compose-queue-slot-tools--5 {
  grid-template-columns: repeat(5, 1fr);
}
.compose-queue-slot-tool--complement {
  color: #ffb89a;
  font-weight: 600;
}
.compose-queue-slot-tool--complement:hover:not(:disabled) {
  color: #fff;
  background: rgba(255, 120, 90, 0.35);
}

/* 预览模态框裁切 */
.modal-crop {
  z-index: 62;
}
.modal-crop .modal-crop-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}
.modal-crop .modal-crop-panel {
  position: relative;
  margin: 0;
  flex-shrink: 0;
  width: min(96vw, 960px);
  max-height: 94vh;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.modal-crop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-crop-close {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.modal-crop-hint {
  margin: 0;
  padding: 8px 16px 0;
}
.modal-crop-stage {
  margin: 12px 16px;
  height: min(62vh, 640px);
  min-height: 280px;
  background: #111;
  overflow: hidden;
}
.modal-crop-stage img {
  display: block;
  max-width: 100%;
}
.modal-crop-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border);
}
.modal-crop-ratio-lbl {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}
.modal-crop-ratio {
  min-width: 96px;
}
.modal-crop-actions {
  display: flex;
  gap: 8px;
}
