:root {
  --bg: #0a090c;
  --bg-soft: #0f0d11;
  --surface: #151218;
  --surface-2: #1b171e;
  --surface-3: #211b23;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.15);
  --text: #f6f0f3;
  --muted: #a59ba3;
  --muted-2: #766e75;
  --pink: #d88ca7;
  --rose: #f2b2c8;
  --rose-soft: rgba(216, 140, 167, 0.12);
  --green: #9bd8b5;
  --red: #ff9b9b;
  --shadow-sm: 0 10px 30px rgba(0, 0, 0, 0.18);
  --shadow-lg: 0 28px 80px rgba(0, 0, 0, 0.42);
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 20px;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 72% -12%, rgba(216, 140, 167, 0.09), transparent 30%),
    linear-gradient(180deg, #0d0b0f 0%, var(--bg) 52%);
  color: var(--text);
  font-family: Inter, "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.settings-open {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0 15px;
  cursor: pointer;
  font-weight: 650;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, opacity 160ms ease, transform 160ms ease;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid rgba(242, 178, 200, 0.8);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

button.primary {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, #efb0c6, #cf7898);
  color: #24131a;
  box-shadow: 0 12px 28px rgba(207, 120, 152, 0.2);
}

button.primary:not(:disabled):hover {
  transform: translateY(-1px);
  background: linear-gradient(135deg, #ffd1df, #df8eab);
  box-shadow: 0 16px 34px rgba(207, 120, 152, 0.28);
}

button.secondary {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
}

button.secondary:not(:disabled):hover {
  border-color: rgba(216, 140, 167, 0.5);
  background: var(--rose-soft);
}

button.text-button {
  min-height: 28px;
  padding: 0 4px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

button.text-button:not(:disabled):hover {
  color: var(--rose);
}

button.danger {
  border: 1px solid rgba(255, 155, 155, 0.22);
  background: rgba(255, 107, 107, 0.08);
  color: #ffaaaa;
}

button.danger:not(:disabled):hover {
  border-color: rgba(255, 155, 155, 0.48);
  background: rgba(255, 107, 107, 0.14);
}

button.small {
  min-height: 36px;
  padding-inline: 12px;
  white-space: nowrap;
}

button.full {
  width: 100%;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  min-width: 38px;
  padding: 0;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(7, 6, 9, 0.62);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

input:hover,
textarea:hover,
select:hover {
  border-color: var(--line-strong);
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(216, 140, 167, 0.62);
  background-color: rgba(9, 7, 10, 0.88);
  box-shadow: 0 0 0 3px rgba(216, 140, 167, 0.09);
}

textarea {
  resize: vertical;
  line-height: 1.58;
}

select {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 36px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 50%,
    calc(100% - 11px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1,
.page-heading h2,
.editor-heading h2 {
  font-family: Georgia, "Songti SC", serif;
  font-weight: 500;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 10;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: rgba(10, 9, 12, 0.92);
  padding: 20px 18px;
  backdrop-filter: blur(22px);
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 48px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 42px;
  height: 46px;
  display: block;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
  flex: 1;
}

.brand-copy h1 {
  font-size: 21px;
  letter-spacing: -0.02em;
}

.brand-copy p {
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 10px;
  white-space: nowrap;
}

.ai-button {
  min-width: 40px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(242, 178, 200, 0.54);
  border-radius: 999px;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.34), transparent 28%),
    linear-gradient(135deg, #efafc5, #bd6688);
  color: #25141b;
  box-shadow: 0 10px 25px rgba(189, 102, 136, 0.2);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.ai-button:hover,
.ai-button[aria-expanded="true"] {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(189, 102, 136, 0.3);
}

.settings-popover {
  position: absolute;
  top: 56px;
  left: 0;
  right: 0;
  z-index: 30;
  display: grid;
  width: auto;
  max-width: 100%;
  gap: 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(23, 19, 25, 0.98);
  padding: 17px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
}

.popover-heading,
.section-heading,
.editor-heading,
.form-section-heading,
.dialog-heading,
.jobs-panel-heading,
.poster-title-row,
.job-head,
.job-actions,
.label-line,
.title-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.popover-heading h2,
.section-heading h2 {
  margin-top: 2px;
  font-size: 15px;
}

.connection-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(155, 216, 181, 0.08);
}

.eyebrow {
  color: var(--pink);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.16em;
}

.grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.queue-setting {
  display: grid;
  grid-template-columns: auto auto minmax(220px, 1fr);
  align-items: end;
  gap: 8px;
}

.queue-setting .small {
  min-height: 38px;
  white-space: nowrap;
  padding-inline: 12px;
}

.queue-concurrency-combo {
  display: grid;
  grid-template-columns: auto 72px;
  align-items: stretch;
  min-height: 38px;
}

.queue-setting .local-tooling-actions {
  width: 186px;
}

.queue-concurrency-combo .queue-concurrency-label {
  border-radius: 14px 0 0 14px;
  border-right: 0;
  pointer-events: none;
}

.queue-concurrency-combo select {
  min-height: 38px;
  border-radius: 0 14px 14px 0;
  padding: 0 34px 0 12px;
  text-align: center;
}

.sidebar-block {
  margin-bottom: 14px;
}

.section-heading.compact {
  margin-bottom: 13px;
}

.count-pill,
.selection-count,
.button-badge,
.tab-badge,
.field-tag,
.required-mark,
.status-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 10px;
}

.count-pill {
  min-width: 28px;
  padding: 4px 8px;
  text-align: center;
}

.search-field {
  position: relative;
  display: block;
}

.search-field input {
  height: 42px;
  padding-left: 36px;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  z-index: 1;
  color: var(--muted-2);
  font-size: 17px;
  transform: translateY(-50%);
}

.search-mode-badge {
  position: absolute;
  top: 50%;
  right: 10px;
  z-index: 1;
  border: 1px solid rgba(216, 140, 167, 0.35);
  border-radius: 6px;
  background: rgba(216, 140, 167, 0.12);
  color: var(--rose);
  padding: 2px 5px;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  transform: translateY(-50%);
}

.search-field input {
  padding-right: 48px;
}

.semantic-search-toggle {
  display: none;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 9px;
}

.metadata-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.metadata-filter-grid select {
  padding: 10px 36px 10px 8px;
  font-size: 11px;
}

.metadata-filter-grid #aspectFilter {
  grid-column: 1 / -1;
}

.filter-grid select {
  padding: 10px 36px 10px 9px;
  font-size: 12px;
}

.import-disclosure {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.025);
}

.import-disclosure > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 13px;
  cursor: pointer;
  list-style: none;
}

.import-disclosure > summary::-webkit-details-marker,
.generation-settings > summary::-webkit-details-marker {
  display: none;
}

.import-disclosure > summary:hover {
  background: var(--rose-soft);
}

.summary-icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 9px;
  background: var(--rose-soft);
  color: var(--rose);
  font-size: 19px;
}

.import-disclosure summary strong,
.import-disclosure summary small {
  display: block;
}

.import-disclosure summary strong {
  color: var(--text);
  font-size: 13px;
}

.import-disclosure summary small {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 10px;
}

.chevron {
  color: var(--muted);
  transition: transform 180ms ease;
}

.import-disclosure[open] .chevron {
  transform: rotate(180deg);
}

.import-form {
  display: grid;
  gap: 11px;
  border-top: 1px solid var(--line);
  padding: 13px;
}

.drop {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 118px;
  border: 1px dashed rgba(216, 140, 167, 0.34);
  border-radius: 12px;
  background: rgba(216, 140, 167, 0.035);
  padding: 16px;
  text-align: center;
  cursor: pointer;
}

.drop:hover,
.drop.dragging {
  border-color: var(--pink);
  background: var(--rose-soft);
}

.drop input {
  display: none;
}

.drop-main {
  display: grid;
  width: 100%;
  min-height: 84px;
  place-items: center;
  gap: 6px;
  background: transparent;
  color: inherit;
  padding: 8px 42px;
}

.drop-main:hover {
  background: transparent;
}

.drop-icon {
  color: var(--rose);
  font-size: 23px;
}

.drop strong {
  color: var(--text);
  font-size: 12px;
}

.drop small {
  color: var(--muted-2);
  font-size: 10px;
}

.clear-import-files {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(216, 140, 167, 0.32);
  border-radius: 8px;
  background: rgba(216, 140, 167, 0.1);
  color: var(--rose);
  padding: 5px 9px;
  font-size: 10px;
  line-height: 1;
}

.clear-import-files:hover:not(:disabled) {
  border-color: rgba(216, 140, 167, 0.62);
  background: rgba(216, 140, 167, 0.2);
}

.clear-import-files:disabled {
  cursor: default;
  opacity: 0.36;
}

.import-preview {
  display: none;
  grid-template-columns: repeat(3, minmax(0, 52px));
  justify-content: center;
  gap: 6px;
  margin-top: 4px;
  max-width: 100%;
}

.drop.has-preview {
  min-height: 146px;
}

.drop.has-preview .drop-icon {
  display: none;
}

.drop.has-preview .drop-main {
  min-height: 112px;
}

.drop.has-preview .import-preview {
  display: grid;
}

.import-preview.single {
  grid-template-columns: minmax(0, 76px);
}

.import-preview-item {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.28);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.import-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.import-preview-more {
  display: grid;
  place-items: center;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  padding: 10px;
  cursor: pointer;
}

.toggle-row:hover {
  border-color: rgba(216, 140, 167, 0.4);
  background: var(--rose-soft);
}

.folder-icon-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: grid;
  width: 34px;
  min-width: 34px;
  min-height: 34px;
  place-items: center;
  border: 1px solid rgba(216, 140, 167, 0.25);
  border-radius: 9px;
  background: var(--rose-soft);
  color: var(--rose);
  padding: 0;
  font-size: 15px;
}

.folder-icon-button:hover {
  border-color: rgba(216, 140, 167, 0.55);
  background: rgba(216, 140, 167, 0.18);
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row strong {
  color: var(--text);
  font-size: 11px;
}

.toggle-row small {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.4;
}

.toggle-row input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: var(--pink);
}

.portable-path {
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.45;
}

.portable-path span:first-child {
  color: var(--pink);
}

.crop-setting {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  padding: 10px;
}

.import-settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.crop-setting > p {
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.45;
}

.custom-crop-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: end;
  gap: 7px;
}

.custom-crop-fields > span {
  padding-bottom: 10px;
  color: var(--muted);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 18px;
  color: var(--muted-2);
}

.sidebar-footer p {
  font-size: 10px;
  line-height: 1.45;
}

.shortcut-key {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 4px 7px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 10px;
}

.main-content {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 9, 12, 0.82);
  padding: 13px 24px;
  backdrop-filter: blur(22px);
}

.topbar > .brand {
  flex: 0 0 auto;
  min-width: 184px;
  min-height: 42px;
  margin: 0;
  border-right: 1px solid var(--line);
  padding-right: 16px;
}

.topbar > .brand .brand-mark {
  width: 36px;
  height: 40px;
}

.topbar > .brand .brand-copy h1 {
  font-size: 20px;
}

.topbar > .brand .brand-copy p {
  margin-top: 2px;
}

.topbar > .page-heading {
  display: none;
}

.page-heading h2 {
  font-size: 23px;
  letter-spacing: -0.02em;
}

.title-line {
  justify-content: flex-start;
  margin-top: 2px;
}

.selection-count {
  padding: 3px 8px;
}

.status-line {
  min-height: 16px;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 11px;
}

.status-line.error {
  color: var(--red);
}

.status-line.success {
  color: var(--green);
}

.top-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.topbar > .import-disclosure {
  position: relative;
  overflow: visible;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.035);
}

.topbar > .import-disclosure > summary {
  min-height: 38px;
  grid-template-columns: auto auto auto;
  gap: 8px;
  padding: 3px 10px 3px 6px;
}

.topbar > .import-disclosure > summary:hover {
  background: var(--rose-soft);
}

.topbar > .import-disclosure .summary-icon {
  width: 30px;
  height: 30px;
  font-size: 16px;
}

.topbar > .import-disclosure summary strong {
  font-size: 12px;
  white-space: nowrap;
}

.topbar > .import-disclosure summary small {
  display: none;
}

.topbar > .import-disclosure .chevron {
  font-size: 11px;
}

.topbar > .import-disclosure .import-form {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  z-index: 40;
  width: min(410px, calc(100vw - 32px));
  max-height: calc(100vh - 112px);
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(21, 18, 24, 0.98);
  padding: 16px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
}

.task-shortcut {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.settings-button {
  font-size: 15px;
}

.local-model-status {
  order: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  min-width: 16px;
  height: 38px;
  min-height: 38px;
  padding: 0 !important;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.settings-button {
  order: 5;
}

.local-model-status:hover {
  color: var(--text);
}

.local-model-status:focus-visible {
  outline: 2px solid var(--line-strong);
  outline-offset: 3px;
}

.local-model-status-label {
  display: none !important;
}

.local-model-status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 100, 120, 0.12), 0 0 10px rgba(255, 100, 120, 0.7);
  animation: localModelStatusBreath 1.8s ease-in-out infinite;
}

@keyframes localModelStatusBreath {
  0%,
  100% {
    opacity: 0.58;
    transform: scale(0.82);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.local-model-status.status-running .local-model-status-dot {
  background: #56d889;
  box-shadow: 0 0 0 3px rgba(86, 216, 137, 0.12), 0 0 10px rgba(86, 216, 137, 0.7);
}

.local-model-status.status-busy .local-model-status-dot {
  background: #e3b34d;
  box-shadow: 0 0 0 3px rgba(227, 179, 77, 0.12), 0 0 10px rgba(227, 179, 77, 0.7);
}

.local-model-status.status-error .local-model-status-dot {
  background: #ff637c;
  box-shadow: 0 0 0 3px rgba(255, 99, 124, 0.12), 0 0 10px rgba(255, 99, 124, 0.7);
}

.local-model-status.status-not-installed .local-model-status-dot {
  background: #8b94a8;
  box-shadow: 0 0 0 3px rgba(139, 148, 168, 0.12), 0 0 10px rgba(139, 148, 168, 0.45);
}

.settings-launcher {
  position: fixed;
  top: 72px;
  right: 22px;
  z-index: 50;
  width: min(360px, calc(100vw - 28px));
}

.settings-launcher-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(21, 18, 24, 0.98);
  padding: 16px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(24px);
}

.settings-launcher-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.032);
  color: var(--text);
  padding: 13px;
  text-align: left;
}

.settings-launcher-option:hover {
  border-color: rgba(216, 140, 167, 0.48);
  background: rgba(216, 140, 167, 0.08);
  transform: translateY(-1px);
}

.settings-launcher-option > span {
  grid-row: span 2;
  color: var(--pink);
  font-family: ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
}

.settings-launcher-option strong {
  font-size: 13px;
}

.settings-launcher-option small {
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.45;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 49;
  background: rgba(4, 3, 5, 0.58);
  backdrop-filter: blur(5px);
}

.settings-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  display: flex;
  width: min(460px, 100vw);
  height: 100vh;
  flex-direction: column;
  border-left: 1px solid var(--line-strong);
  background: rgba(18, 15, 20, 0.98);
  box-shadow: -28px 0 80px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(24px);
}

.settings-dialog {
  width: min(720px, calc(100vw - 28px));
  max-height: calc(100vh - 32px);
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
}

.settings-dialog::backdrop {
  background: rgba(3, 2, 4, 0.75);
  backdrop-filter: blur(8px);
}

.settings-dialog-card {
  display: flex;
  max-height: calc(100vh - 32px);
  flex-direction: column;
}

.settings-dialog-body {
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
}

.settings-dialog .settings-section {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.avoid-words-dialog {
  width: min(860px, calc(100vw - 28px));
}

.avoid-words-dialog-body {
  display: grid;
  gap: 14px;
}

.generation-rules-dialog {
  width: min(680px, calc(100vw - 28px));
}

.generation-rules-dialog-body {
  display: grid;
  gap: 14px;
}

.settings-password-dialog {
  width: min(420px, calc(100vw - 28px));
}

.settings-password-card {
  width: 100%;
}

.settings-password-error {
  margin: 0;
  color: #ff9aaf;
  font-size: 12px;
}

.generation-rules-identity-note {
  border: 1px solid rgba(216, 140, 167, 0.24);
  border-radius: 10px;
  background: rgba(216, 140, 167, 0.07);
  color: #f0c5d3;
  font-size: 11px;
  line-height: 1.6;
  padding: 9px 11px;
}

.dialog-heading .generation-rules-identity-note {
  max-width: 100%;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: #f0c5d3;
  font-size: 10px;
  line-height: 1.45;
  padding: 0;
  margin: 5px 0 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generation-rules-dialog .dialog-heading {
  position: relative;
}

.generation-rules-dialog .dialog-heading > div {
  width: 100%;
}

.generation-rules-dialog .dialog-heading > .dialog-close {
  position: absolute;
  top: 17px;
  right: 18px;
}

.generation-rule-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  gap: 10px;
}

.generation-rule-group-heading {
  grid-column: 1 / -1;
  color: var(--pink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1;
  padding: 6px 2px 0;
}

.generation-rule {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  padding: 11px 12px 10px;
}

.generation-rule-title {
  min-width: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.generation-rule-value {
  color: var(--pink);
  font-family: ui-monospace, monospace;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.generation-rule input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  min-width: 0;
  height: 20px;
  margin: 0;
  padding: 0;
  grid-column: 1 / -1;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--pink) 0%,
    var(--pink) var(--range-progress, 0%),
    rgba(255, 255, 255, 0.16) var(--range-progress, 0%),
    rgba(255, 255, 255, 0.16) 100%
  );
  box-shadow: inset 0 0 0 1px rgba(239, 164, 190, 0.55);
  cursor: pointer;
}

.generation-rule input[type="range"]::-webkit-slider-runnable-track {
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
}

.generation-rule input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -6px;
  border: 0;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 0 2px rgba(255, 226, 237, 0.42), 0 2px 7px rgba(0, 0, 0, 0.35);
}

.generation-rule input[type="range"]::-moz-range-track {
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.generation-rule input[type="range"]::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--pink);
}

.generation-rule input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: var(--pink);
  box-shadow: 0 0 0 2px rgba(255, 226, 237, 0.42), 0 2px 7px rgba(0, 0, 0, 0.35);
}

.generation-rule-scale {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  grid-column: 1 / -1;
  color: var(--muted-2);
  font-size: 10px;
}

.generation-rule-scale > span:last-child {
  text-align: right;
}

@media (max-width: 620px) {
  .generation-rule-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

.avoid-words-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.avoid-words-grid label {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.avoid-words-grid label > span {
  color: var(--pink);
  font-family: ui-monospace, monospace;
  font-size: 10px;
  font-weight: 800;
}

.avoid-words-grid textarea {
  width: 100%;
  min-width: 0;
  min-height: 320px;
  resize: vertical;
  line-height: 1.8;
}

@media (max-width: 680px) {
  .avoid-words-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .avoid-words-grid textarea {
    min-height: 150px;
  }
}

.settings-drawer-heading {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 20px;
}

.settings-drawer-heading h2 {
  margin: 3px 0 0;
  font-family: Georgia, "Songti SC", serif;
  font-size: 24px;
  font-weight: 500;
}

.settings-drawer-body {
  display: grid;
  min-height: 0;
  flex: 1 1 auto;
  gap: 14px;
  overflow-y: auto;
  padding: 16px 18px 28px;
}

.settings-section {
  display: grid;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
  padding: 15px;
}

.settings-section-heading,
.settings-section-heading > div,
.settings-actions,
.copy-field {
  display: flex;
  align-items: center;
  gap: 9px;
}

.settings-section-heading {
  justify-content: space-between;
}

.settings-section-heading h3 {
  margin: 0;
  font-size: 14px;
}

.settings-index {
  color: var(--pink);
  font-family: ui-monospace, monospace;
  font-size: 9px;
}

.settings-description {
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.55;
}

.provider-settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.semantic-search-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  margin: 6px 0 8px;
}
.semantic-search-toggle input { accent-color: var(--rose); }

.embedding-provider-card {
  border-color: rgba(130, 192, 255, 0.2);
}

.local-tooling-panel {
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.local-tooling-status-row,
.local-tooling-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.local-tooling-status-row strong {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.local-tooling-activity {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.local-tooling-activity.status-running { color: #e3b34d; }
.local-tooling-activity.status-success { color: #56d889; }
.local-tooling-activity.status-error { color: #ff637c; }

.local-tooling-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #8b94a8;
}

.local-tooling-dot.status-running { background: #56d889; box-shadow: 0 0 8px rgba(86, 216, 137, 0.65); }
.local-tooling-dot.status-busy,
.local-tooling-dot.status-installing { background: #e3b34d; box-shadow: 0 0 8px rgba(227, 179, 77, 0.65); animation: localModelStatusBreath 1.5s ease-in-out infinite; }
.local-tooling-dot.status-error { background: #ff637c; box-shadow: 0 0 8px rgba(255, 99, 124, 0.65); }

.local-tooling-actions {
  flex-wrap: nowrap;
}

.local-tooling-actions .small {
  min-width: 0;
  flex: 1 1 0;
  padding-inline: 8px;
  white-space: nowrap;
}

.local-tooling-output {
  max-height: 108px;
  margin: 0;
  padding: 8px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.16);
  color: var(--muted);
  font: 11px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.provider-card {
  display: grid;
  min-width: 0;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.025);
  margin: 0;
  padding: 12px;
}

.provider-card legend {
  color: var(--rose);
  font-size: 11px;
  font-weight: 750;
  padding: 0 6px;
}

.provider-card .field-hint {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.model-inline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.model-inline-row .small {
  min-height: 38px;
  white-space: nowrap;
  padding-inline: 12px;
}

.model-picker {
  width: 100%;
  margin-top: 8px;
}

.settings-section label small {
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.4;
}

.settings-actions {
  justify-content: flex-end;
}

.settings-actions button {
  flex: 1 1 0;
  font-size: 11px;
}

.settings-notice {
  margin: -2px 0 0;
  border: 1px solid rgba(89, 209, 140, 0.35);
  border-radius: 14px;
  background: rgba(89, 209, 140, 0.1);
  color: #b9ffd3;
  font-size: 10px;
  line-height: 1.45;
  padding: 9px 11px;
}

.settings-notice.error {
  border-color: rgba(255, 121, 142, 0.38);
  background: rgba(255, 121, 142, 0.1);
  color: #ffb1bc;
}

.compact-toggle {
  display: inline-flex;
  cursor: pointer;
}

.compact-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.compact-toggle span {
  position: relative;
  display: block;
  width: 38px;
  height: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  transition: background 160ms ease, border-color 160ms ease;
}

.compact-toggle span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
  transition: transform 160ms ease, background 160ms ease;
}

.compact-toggle input:checked + span {
  border-color: rgba(216, 140, 167, 0.5);
  background: rgba(216, 140, 167, 0.18);
}

.compact-toggle input:checked + span::after {
  background: var(--rose);
  transform: translateX(16px);
}

.api-status {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  padding: 9px 10px;
  font-size: 10px;
  line-height: 1.45;
}

.api-status.ready {
  border-color: rgba(155, 216, 181, 0.25);
  color: var(--green);
}

.api-status.warning {
  border-color: rgba(215, 188, 134, 0.25);
  color: #d7bc86;
}

.copy-field {
  align-items: stretch;
}

.copy-field input {
  min-width: 0;
  font-family: ui-monospace, monospace;
  font-size: 9px;
}

.copy-field button {
  flex: 0 0 auto;
  min-height: auto;
  font-size: 10px;
}

.api-docs {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.api-docs > summary {
  padding: 11px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.api-docs-content {
  display: grid;
  gap: 9px;
  border-top: 1px solid var(--line);
  padding: 11px;
}

.api-docs-content p {
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.5;
}

.api-docs-content pre {
  overflow: auto;
  max-height: 280px;
  margin: 0;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.25);
  padding: 10px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 9px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.button-badge,
.tab-badge {
  min-width: 20px;
  padding: 2px 6px;
  text-align: center;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(410px, 470px);
  align-items: start;
  gap: 20px;
  padding: 22px 24px 36px;
}

.library-canvas {
  min-width: 0;
}

.library-toolbar {
  position: sticky;
  top: 79px;
  z-index: 7;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin: -8px -10px 13px;
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 14px;
  background: rgba(10, 9, 12, 0.88);
  padding: 8px 10px;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(22px);
}

.library-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.library-toolbar .library-tools {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(6, minmax(68px, 0.76fr)) minmax(150px, 1.5fr) auto;
  align-items: center;
  gap: 7px;
  margin: 0;
}

.library-toolbar .library-tools .section-heading.compact {
  grid-column: 8;
  grid-row: 1;
  margin: 0;
}

.library-toolbar .library-tools .section-heading.compact > div {
  display: none;
}

.library-toolbar .search-field {
  grid-column: 7;
  grid-row: 1;
}

.library-toolbar .search-field input {
  height: 38px;
}

.library-toolbar .filter-grid,
.library-toolbar .metadata-filter-grid {
  display: contents;
}

.library-toolbar #categoryFilter {
  grid-column: 1;
}

.library-toolbar #tagFilter {
  grid-column: 2;
}

.library-toolbar #peopleFilter {
  grid-column: 3;
}

.library-toolbar #genderFilter {
  grid-column: 4;
}

.library-toolbar #textPresenceFilter {
  grid-column: 5;
}

.library-toolbar #aspectFilter {
  grid-column: 2;
}

.library-toolbar .library-tools select {
  min-width: 0;
  height: 38px;
  padding: 0 34px 0 7px;
  font-size: 11px;
}

.view-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  padding: 3px;
}

.view-button {
  display: grid;
  width: 34px;
  min-width: 34px;
  min-height: 32px;
  place-items: center;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.view-button:hover,
.view-button.active {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.manage-button {
  min-height: 34px;
  font-size: 11px;
}

.bulk-toolbar {
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 12px;
  margin-bottom: 13px;
  border: 1px solid rgba(216, 140, 167, 0.25);
  border-radius: 12px;
  background: rgba(216, 140, 167, 0.065);
  padding: 8px 10px;
}

.select-all-control {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  color: var(--text);
  cursor: pointer;
}

.select-all-control input {
  width: 15px;
  height: 15px;
  accent-color: var(--pink);
}

.bulk-count {
  flex: 1 1 auto;
  color: var(--muted);
  font-size: 11px;
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.bulk-actions button {
  min-height: 32px;
  padding-inline: 10px;
  font-size: 10px;
}

.gallery {
  display: block;
  column-gap: 15px;
  column-width: 218px;
}

.gallery-empty,
.jobs-empty {
  display: grid;
  min-height: 260px;
  place-items: center;
  width: 100%;
  column-span: all;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  color: var(--muted);
  padding: 30px;
  text-align: center;
}

.empty-illustration {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  margin: 0 auto 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--rose-soft);
  color: var(--rose);
  font-size: 22px;
}

.gallery-empty h3,
.jobs-empty h3 {
  margin: 0 0 5px;
  color: var(--text);
  font-size: 14px;
}

.gallery-empty p,
.jobs-empty p {
  color: var(--muted-2);
  font-size: 11px;
}

.poster-card {
  position: relative;
  display: inline-block;
  overflow: hidden;
  width: 100%;
  margin: 0 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(27, 23, 30, 0.94), rgba(19, 16, 21, 0.94));
  box-shadow: var(--shadow-sm);
  break-inside: avoid;
  page-break-inside: avoid;
  transition: border-color 170ms ease, transform 170ms ease, box-shadow 170ms ease;
}

.manage-select {
  position: absolute;
  top: 11px;
  left: 11px;
  z-index: 4;
  display: none;
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(10, 9, 12, 0.72);
  color: transparent;
  padding: 0;
  backdrop-filter: blur(12px);
}

.gallery.manage-mode .manage-select {
  display: grid;
}

.poster-card.manage-selected .manage-select {
  border-color: var(--rose);
  background: var(--rose);
  color: #24131a;
}

.poster-card.manage-selected {
  border-color: rgba(242, 178, 200, 0.72);
  box-shadow: 0 0 0 3px rgba(216, 140, 167, 0.09), var(--shadow-sm);
}

.gallery.manage-mode .selection-indicator,
.gallery.manage-mode .select-label {
  display: none;
}

.poster-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 17px 38px rgba(0, 0, 0, 0.28);
}

.poster-card.selected {
  border-color: rgba(242, 178, 200, 0.76);
  box-shadow: 0 0 0 3px rgba(216, 140, 167, 0.1), 0 18px 42px rgba(0, 0, 0, 0.28);
}

.poster-card.locked {
  border-color: rgba(255, 255, 255, 0.08);
}

.poster-card.locked:not(.manage-selected):hover {
  border-color: rgba(255, 255, 255, 0.13);
  transform: none;
}

.poster-preview {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  min-height: 0;
  border-radius: 0;
  background: #080709;
  padding: 0;
  text-align: left;
}

.poster-card.portrait .poster-preview {
  aspect-ratio: 3 / 4;
}

.poster-card.landscape .poster-preview {
  aspect-ratio: 4 / 3;
}

.poster-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  transition: filter 180ms ease, transform 260ms ease;
}

.poster-card:hover .poster-preview img {
  transform: scale(1.018);
}

.poster-card.selected .poster-preview img {
  filter: saturate(0.92) brightness(0.86);
}

.poster-card.locked .poster-preview img {
  filter: grayscale(0.72) brightness(0.34) saturate(0.55);
  transform: none;
}

.poster-card.locked .poster-preview:disabled {
  cursor: not-allowed;
  opacity: 1;
}

.poster-lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  gap: 7px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.58), rgba(0, 0, 0, 0.82));
  color: #fff;
  padding: 16px;
  pointer-events: none;
  text-align: center;
}

.poster-lock-icon {
  display: inline-grid;
  min-width: 34px;
  height: 34px;
  place-items: center;
  justify-self: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--rose);
  font-size: 12px;
  font-weight: 750;
}

.poster-lock-overlay strong {
  font-size: 13px;
  letter-spacing: 0.03em;
}

.poster-lock-overlay small {
  display: -webkit-box;
  overflow: hidden;
  max-width: 180px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.poster-card.locked-error .poster-lock-icon {
  color: var(--red);
}

.selection-indicator {
  position: absolute;
  top: 11px;
  right: 11px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(10, 9, 12, 0.62);
  color: transparent;
  font-size: 12px;
  backdrop-filter: blur(12px);
}

.poster-card.selected .selection-indicator {
  border-color: var(--rose);
  background: var(--rose);
  color: #24131a;
}

.select-label {
  position: absolute;
  right: 11px;
  bottom: 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(10, 9, 12, 0.7);
  color: rgba(255, 255, 255, 0.86);
  padding: 5px 9px;
  font-size: 10px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
  backdrop-filter: blur(12px);
}

.poster-card:hover .select-label,
.poster-card.selected .select-label {
  opacity: 1;
  transform: translateY(0);
}

.poster-meta {
  display: grid;
  gap: 8px;
  padding: 12px 13px 13px;
}

.poster-title-row {
  min-width: 0;
}

.poster-name {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-poster {
  width: 28px;
  min-width: 28px;
  min-height: 28px;
  background: transparent;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.edit-poster:hover {
  background: var(--rose-soft);
  color: var(--rose);
}

.chips {
  display: flex;
  overflow: hidden;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 48px;
}

.chip {
  overflow: hidden;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  padding: 3px 7px;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-state {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  color: var(--muted-2);
  font-size: 10px;
}

.prompt-state-icon {
  display: block;
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.prompt-state.ready {
  color: var(--green);
}

.poster-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.fact-chip {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  gap: 4px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 3px 6px;
  font-size: 9px;
}

.color-swatches {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.color-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.prompt-state.queued,
.prompt-state.analyzing {
  color: var(--rose);
}

.prompt-state.analyzing::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--rose);
  box-shadow: 0 0 0 4px rgba(216, 140, 167, 0.09);
  content: "";
  animation: promptPulse 1.4s ease-in-out infinite;
}

.prompt-state.paused {
  color: #d7bc86;
}

.prompt-state.error {
  color: var(--red);
}

.chips .prompt-state,
.chips .prompt-state.ready,
.chips .prompt-state.queued,
.chips .prompt-state.analyzing,
.chips .prompt-state.paused,
.chips .prompt-state.error {
  flex: 0 0 auto;
  margin-left: 1px;
  color: #fff;
}

.chips .prompt-state.analyzing::before {
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1);
}

@keyframes promptPulse {
  50% {
    opacity: 0.35;
    transform: scale(0.8);
  }
}

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

.poster-date {
  display: none;
  color: var(--muted-2);
  font-size: 9px;
  white-space: nowrap;
}

.gallery.list-view {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: 0;
  column-width: auto;
  gap: 9px;
}

.gallery.list-view .poster-card {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  min-height: 96px;
  margin: 0;
}

.gallery.list-view .poster-preview {
  height: 100%;
  aspect-ratio: auto;
}

.gallery.list-view .poster-preview img {
  height: 100%;
  min-height: 104px;
}

.gallery.list-view .poster-meta {
  align-content: center;
  grid-template-columns: minmax(180px, 0.9fr) minmax(220px, 1.4fr) minmax(160px, 0.8fr);
  column-gap: 18px;
  padding: 13px 16px;
}

.gallery.list-view .poster-title-row {
  grid-column: 1;
  grid-row: 1 / span 2;
  align-content: center;
}

.gallery.list-view .chips {
  grid-column: 2;
  grid-row: 1;
  align-content: center;
  max-height: none;
}

.gallery.list-view .poster-facts {
  grid-column: 2;
  grid-row: 2;
  align-content: center;
}

.gallery.list-view .poster-footline {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-items: flex-end;
  flex-direction: column;
  justify-content: center;
}

.gallery.list-view .poster-date {
  display: block;
}

.gallery.list-view .select-label {
  opacity: 1;
  transform: none;
}

.editor-shell {
  position: sticky;
  top: 102px;
  display: flex;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: calc(100vh - 124px);
  min-height: 570px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(21, 18, 24, 0.9);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(22px);
}

.workspace-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
  padding: 7px;
}

.workspace-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.workspace-tab:hover {
  color: var(--text);
}

.workspace-tab.active {
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line);
}

.workspace-tab.active .tab-badge {
  border-color: rgba(216, 140, 167, 0.4);
  color: var(--rose);
}

.editor-panel {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 18px;
}

.editor-heading {
  align-items: flex-start;
  margin-bottom: 15px;
  min-width: 0;
}

.creation-heading {
  align-items: stretch;
  gap: 16px;
}

.creation-heading > div:first-child {
  min-width: 0;
}

.editor-heading h2 {
  margin-top: 3px;
  font-size: 23px;
}

.heading-selection {
  display: grid;
  width: min(230px, 48%);
  min-width: 0;
  flex: 0 0 auto;
  align-content: start;
  justify-items: end;
  gap: 6px;
}

.selection-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  min-width: 0;
  max-width: 100%;
  width: 100%;
  overflow: hidden;
  padding: 10px;
}

.selection-card-label,
.form-section-heading > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.selection-card-label {
  color: var(--muted);
  font-size: 11px;
  justify-content: space-between;
}

.selection-card-label > span {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.step-number {
  color: var(--pink);
  font-family: ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
}

.selected-info {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 11px;
}

.selected-info.empty {
  align-items: center;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0 10px;
}

.selected-token {
  display: inline-flex;
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  padding: 5px 9px 5px 5px;
  color: var(--text);
}

.selected-token img {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  object-fit: cover;
}

.selected-token span {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-section {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.form-section + .form-section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.prompt-fusion-section {
  margin-top: -2px;
}

.form-section-heading h3 {
  font-size: 13px;
  font-weight: 650;
}

.change-heading {
  align-items: flex-start;
}

.prompt-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.prompt-grid label {
  min-width: 0;
}

.prompt-grid textarea {
  min-height: 156px;
}

.form-section.emphasized {
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(216, 140, 167, 0.075), rgba(216, 140, 167, 0.015));
  margin-inline: -7px;
  padding: 16px 7px 0;
}

.form-section.emphasized textarea {
  min-height: 72px;
}

.sr-only {
  position: absolute !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  border: 0 !important;
  margin: -1px !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

.modifier-field {
  display: grid;
  gap: 6px;
  margin-top: -15px;
}

.modifier-editor {
  min-height: 72px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(7, 6, 9, 0.66);
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  outline: none;
  padding: 12px 14px;
  white-space: pre-wrap;
  cursor: text;
}

.modifier-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--muted-2);
  pointer-events: none;
}

.modifier-editor:focus {
  border-color: rgba(216, 140, 167, 0.5);
  box-shadow: 0 0 0 3px rgba(216, 140, 167, 0.08);
}

.inline-image-token {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 128px;
  margin: 0 2px;
  border: 1px solid rgba(216, 140, 167, 0.38);
  border-radius: 999px;
  background: rgba(216, 140, 167, 0.13);
  color: #ffd9e5;
  font-size: 11px;
  padding: 2px 7px 2px 3px;
  vertical-align: middle;
  user-select: none;
}

.inline-image-token img {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  object-fit: cover;
}

.image-mention-menu button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(216, 140, 167, 0.28);
  border-radius: 999px;
  background: rgba(216, 140, 167, 0.11);
  color: #ffd9e5;
  font-size: 10px;
  line-height: 1;
  padding: 7px 9px;
}

.image-mention-menu button:hover {
  border-color: rgba(216, 140, 167, 0.62);
  background: rgba(216, 140, 167, 0.2);
}

.image-mention-menu img {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  object-fit: cover;
}

.image-mention-menu {
  display: flex;
  width: fit-content;
  max-width: 100%;
  gap: 6px;
  margin: -5px 0 6px 4px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(13, 10, 15, 0.96);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.36);
  padding: 6px;
  z-index: 5;
}

.task-image-grid {
  display: grid;
  grid-template-columns: repeat(2, 42px);
  gap: 8px;
}

.task-image-field {
  position: relative;
  display: block;
  min-width: 0;
  width: 42px;
  height: 42px;
  cursor: pointer;
}

.task-image-field input {
  position: absolute;
  inset: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.task-image-placeholder {
  position: relative;
  display: grid;
  overflow: hidden;
  width: 100%;
  height: 100%;
  place-items: center;
  border: 1px dashed rgba(216, 140, 167, 0.42);
  border-radius: 12px;
  background: rgba(7, 6, 9, 0.62);
  color: var(--rose);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.task-image-field:hover .task-image-placeholder {
  border-color: rgba(216, 140, 167, 0.72);
  background: var(--rose-soft);
  transform: translateY(-1px);
}

.task-image-plus {
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
}

.task-image-placeholder img {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.task-image-field.has-image .task-image-placeholder {
  border-style: solid;
  border-color: rgba(216, 140, 167, 0.56);
}

.task-image-field.has-image .task-image-plus {
  display: none;
}

.task-image-field.has-image img {
  display: block;
}

.task-image-field.has-image::after {
  content: "+";
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  border: 1px solid rgba(216, 140, 167, 0.55);
  border-radius: 999px;
  background: rgba(23, 19, 25, 0.96);
  color: var(--rose);
  font-size: 12px;
  line-height: 1;
}

.task-image-field:focus-within .task-image-placeholder {
  border-color: rgba(216, 140, 167, 0.78);
  box-shadow: 0 0 0 3px rgba(216, 140, 167, 0.1);
}

.task-image-field small {
  overflow: hidden;
  color: var(--muted-2);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.replacement-text-panel {
  display: grid;
  gap: 8px;
}

.replacement-text-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.replacement-text-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.replacement-list {
  display: grid;
  gap: 7px;
  max-height: 156px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 6, 9, 0.45);
  padding: 8px;
}

.replacement-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.92fr) auto minmax(160px, 1.08fr);
  align-items: center;
  gap: 8px;
}

.replacement-source {
  display: -webkit-box;
  overflow: hidden;
  color: #fff4f7;
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  word-break: break-word;
}

.replacement-equals {
  color: var(--pink);
  font-size: 12px;
  font-weight: 700;
}

.replacement-input {
  min-height: 30px;
  padding: 6px 8px;
  font-size: 11px;
}

.replacement-empty {
  display: grid;
  min-height: 72px;
  place-items: center;
  color: var(--muted-2);
  font-size: 10px;
}

.label-line {
  justify-content: flex-start;
}

.replacement-heading {
  justify-content: space-between;
}

.add-custom-text-button {
  display: grid;
  width: 42px;
  min-width: 42px;
  height: 42px;
  min-height: 42px;
  flex: 0 0 42px;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid rgba(216, 140, 167, 0.35);
  border-radius: 8px;
  background: rgba(216, 140, 167, 0.1);
  color: #ffd4e4;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.add-custom-text-button:hover {
  border-color: rgba(255, 190, 216, 0.72);
  background: rgba(216, 140, 167, 0.2);
}

.custom-text-list {
  display: grid;
  gap: 7px;
}

.custom-text-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 7px;
  align-items: center;
}

.custom-text-input {
  min-width: 0;
  min-height: 34px;
  padding: 7px 9px;
  font-size: 11px;
}

.remove-custom-text-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-2);
  padding: 0;
  font-size: 15px;
}

.remove-custom-text-button:hover {
  border-color: rgba(255, 145, 165, 0.55);
  color: #ffadbd;
}

.field-tag,
.required-mark {
  padding: 2px 6px;
}

.field-tag {
  color: var(--pink);
}

.required-mark {
  border-color: rgba(216, 140, 167, 0.35);
  color: var(--rose);
}

.required-field small {
  color: var(--muted-2);
  line-height: 1.45;
}

.required-field.invalid textarea {
  border-color: rgba(255, 155, 155, 0.55);
}

.generation-settings {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.generation-settings > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  list-style: none;
}

.generation-settings > summary:hover {
  color: var(--text);
}

.generation-settings > summary span:last-child {
  color: var(--muted-2);
  font-family: ui-monospace, monospace;
  font-size: 10px;
}

.settings-grid {
  border-top: 1px solid var(--line);
  padding: 12px;
}

.generate-dock {
  position: sticky;
  bottom: -18px;
  z-index: 3;
  display: grid;
  gap: 8px;
  margin: 18px -18px -18px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(21, 18, 24, 0.92), rgba(21, 18, 24, 0.99) 24%);
  padding: 13px 18px 18px;
  backdrop-filter: blur(16px);
}

.generate-dock p {
  min-height: 15px;
  color: var(--muted-2);
  font-size: 10px;
  text-align: center;
}

.generate-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  align-items: stretch;
}

.generate-undo-button {
  display: grid;
  min-width: 82px;
  min-height: 56px;
  align-content: center;
  justify-items: center;
  gap: 2px;
  border: 1px solid rgba(244, 170, 200, 0.38);
  border-radius: 14px;
  background: rgba(42, 28, 37, 0.96);
  color: #fff4f8;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}

.generate-undo-button:not(:disabled):hover {
  border-color: rgba(255, 190, 216, 0.75);
  background: rgba(68, 38, 52, 0.98);
  transform: translateY(-1px);
}

.generate-undo-button span {
  font-size: 13px;
  font-weight: 800;
}

.generate-undo-button strong {
  color: #f6abc8;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.generate-undo-button.is-requested {
  cursor: wait;
  opacity: 0.78;
}

.generate-button {
  position: relative;
  display: flex;
  overflow: hidden;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  border-radius: 14px;
  padding: 0 18px;
  font-size: 14px;
  box-shadow: 0 12px 30px rgba(216, 140, 167, 0.22);
}

.generate-button > span {
  position: relative;
  z-index: 2;
}

.generate-button::before {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 1;
  width: 0%;
  background: linear-gradient(90deg, #f4aac8 0%, #ff82b0 55%, #ffe0ee 100%);
  content: "";
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, width 120ms linear;
}

.generate-button::after {
  position: absolute;
  inset: auto 10px 8px 10px;
  z-index: 3;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(60, 18, 34, 0.32);
  content: "";
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.generate-button[data-cooldown="true"]::before {
  opacity: 1;
  animation: cooldownSweep var(--cooldown-duration, 5s) linear forwards;
}

.generate-button[data-cooldown="done"]::before {
  width: 100%;
  opacity: 1;
}

.generate-button[data-cooldown="true"]::after {
  opacity: 1;
  transform: translateY(0);
  background:
    linear-gradient(90deg, #fff8fb, #ff6fa6) 0 0 / var(--cooldown-progress, 0%) 100% no-repeat,
    rgba(60, 18, 34, 0.32);
}

.generate-button[data-cooldown="done"]::after {
  opacity: 1;
  transform: translateY(0);
  background:
    linear-gradient(90deg, #fff8fb, #ff6fa6) 0 0 / 100% 100% no-repeat,
    rgba(60, 18, 34, 0.32);
}

.generate-button[data-cooldown="true"],
.generate-button[data-cooldown="done"] {
  cursor: wait;
  opacity: 1;
  box-shadow: 0 16px 40px rgba(216, 140, 167, 0.34);
}

.generate-button[data-cooldown="true"] {
  background: rgba(60, 25, 43, 0.92);
  color: #fff8fb;
}

.generate-button[data-cooldown="done"] {
  cursor: default;
  background: linear-gradient(135deg, #f3b1c9, #d67f9e);
  color: #241118;
}

.generate-button-main {
  display: grid;
  gap: 2px;
  text-align: left;
}

.generate-button-main strong {
  font-size: 14px;
  line-height: 1.1;
}

.generate-button-main small {
  font-size: 10px;
  font-weight: 700;
  opacity: 0.78;
}

.generate-button-seconds {
  min-width: 42px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.28);
  padding: 5px 9px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

@keyframes cooldownSweep {
  from {
    width: 0%;
  }
  to {
    width: 100%;
  }
}

.submit-island {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 80;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  width: min(520px, calc(100vw - 32px));
  max-width: min(520px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  background: rgba(12, 9, 15, 0.94);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(216, 140, 167, 0.12) inset;
  color: #ffe4ee;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.01em;
  opacity: 0;
  padding: 13px 16px;
  pointer-events: none;
  transform: translate(-50%, 18px) scale(0.96);
  transition: opacity 180ms ease, transform 220ms ease;
  backdrop-filter: blur(18px);
}

.submit-island.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.submit-island-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: #9bd8b5;
  color: #102217;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 0 0 6px rgba(155, 216, 181, 0.12);
}

.submit-island.is-pending .submit-island-icon {
  background: #f0c66d;
  color: #2d2108;
  box-shadow: 0 0 0 6px rgba(240, 198, 109, 0.12);
  animation: submitIslandPulse 1.2s ease-in-out infinite;
}

.submit-island.is-error .submit-island-icon {
  background: #ef8290;
  color: #2b0b10;
  box-shadow: 0 0 0 6px rgba(239, 130, 144, 0.12);
}

@keyframes submitIslandPulse {
  0%, 100% {
    opacity: 0.55;
    transform: scale(0.92);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.jobs-panel-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: flex-start;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.jobs-panel-heading > div:first-child {
  min-width: 0;
}

.jobs-heading-actions {
  display: grid;
  max-width: 100%;
  justify-items: end;
  gap: 6px;
  min-width: 0;
}

.queue-summary {
  overflow-wrap: anywhere;
  max-width: 160px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  text-align: right;
}

.jobs {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  gap: 10px;
  overflow-x: hidden;
}

.job {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  gap: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.025);
  padding: 12px;
  content-visibility: auto;
  contain-intrinsic-block-size: 190px;
}

.job-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  align-items: flex-start;
}

.job-head p {
  color: var(--muted-2);
  font-size: 9px;
  line-height: 1.45;
}

.job-summary {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.status-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
}

.status-queued .status-badge {
  border-color: rgba(242, 178, 200, 0.35);
  color: var(--rose);
}

.status-retrying .status-badge {
  border-color: rgba(227, 179, 77, 0.42);
  color: #e3b34d;
  animation: taskStatusBreath 1.8s ease-in-out infinite;
}

.status-processing .status-badge,
.status-submitted .status-badge {
  position: relative;
  border-color: rgba(242, 178, 200, 0.45);
  color: var(--rose);
  animation: taskStatusBreath 1.8s ease-in-out infinite;
}

.status-retrying .status-badge::before,
.status-processing .status-badge::before,
.status-submitted .status-badge::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
  vertical-align: 1px;
  animation: taskStatusDot 1.2s ease-in-out infinite;
}

.status-done .status-badge {
  border-color: rgba(155, 216, 181, 0.35);
  color: var(--green);
}

@keyframes taskStatusBreath {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(242, 178, 200, 0);
    opacity: 0.78;
  }

  50% {
    box-shadow: 0 0 0 4px rgba(242, 178, 200, 0.1);
    opacity: 1;
  }
}

@keyframes taskStatusDot {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.72);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.status-error .status-badge,
.job-error {
  color: var(--red);
}

.job-error {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.job-title {
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.job-task-line {
  display: flex;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 9px;
}

.job code {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: var(--green);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-task-line code {
  display: block;
  flex: 0 1 auto;
}

.copy-task {
  flex: 0 0 auto;
  min-width: 0;
  min-height: 25px;
  padding: 0 7px;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
}

.job details {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.job-details {
  min-width: 0;
  max-width: 100%;
  margin-top: 2px;
}

.job details summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}

.job-details > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.job pre {
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-wrap: anywhere;
  max-height: 180px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 9px;
  color: var(--muted);
  font-family: ui-monospace, monospace;
  font-size: 9px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.job-import-summary {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.job-import-summary span,
.job-import-detail p {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  margin: 0;
  padding: 7px 8px;
}

.job-import-detail {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  gap: 7px;
}

.job-import-detail code {
  color: var(--text);
  overflow-wrap: anywhere;
  white-space: normal;
  word-break: break-word;
}

.result-row {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.result-row input {
  min-width: 0;
  font-size: 10px;
}

.result-row button,
.job-actions button {
  min-height: 32px;
  padding-inline: 10px;
  font-size: 10px;
}

.job-actions {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.job-result-image {
  display: block;
  width: 100%;
  height: 220px;
  max-height: 220px;
  border-radius: 9px;
  object-fit: contain;
}

.job-result-preview {
  display: block;
  width: 100%;
  overflow: hidden;
  border: 0;
  border-radius: 9px;
  background: #080709;
  cursor: zoom-in;
  padding: 0;
  text-align: left;
}

.job-result-preview:hover .job-result-image {
  filter: brightness(1.08);
}

.job-result-preview:focus-visible {
  outline: 2px solid rgba(126, 255, 200, 0.65);
  outline-offset: 3px;
}

.job-result-section {
  display: grid;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  gap: 7px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.job-result-label {
  color: var(--green);
  font-size: 10px;
}

.asset-dialog {
  width: min(520px, calc(100vw - 28px));
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
}

.asset-dialog::backdrop {
  background: rgba(3, 2, 4, 0.75);
  backdrop-filter: blur(8px);
}

.image-preview-dialog {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  border: 0;
  background: rgba(0, 0, 0, 0.92);
  color: var(--text);
  cursor: zoom-out;
  padding: 28px;
  user-select: none;
  -webkit-user-select: none;
}

.image-preview-dialog::backdrop {
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: none;
}

.image-preview-dialog img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
}

.dialog-card {
  box-sizing: border-box;
  max-width: calc(100vw - 28px);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: rgba(24, 20, 26, 0.98);
  box-shadow: var(--shadow-lg);
}

.dialog-heading {
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding: 17px 18px;
}

.dialog-heading > div {
  min-width: 0;
}

.dialog-heading h2 {
  overflow: hidden;
  margin-top: 2px;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-body {
  display: grid;
  gap: 13px;
  padding: 18px;
}

.dialog-body .field-hint {
  display: block;
  margin-top: 5px;
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.4;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 13px 18px;
}

.dialog-actions button {
  min-width: 0;
}

.dialog-spacer {
  flex: 1 1 auto;
}

.dialog-delete {
  margin-right: auto;
}

.dialog-hint {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  padding: 10px;
  font-size: 11px;
  overflow-wrap: anywhere;
}

.asset-technical-info {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.asset-technical-info > div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.025);
  padding: 9px;
}

.asset-technical-info > div:last-child {
  grid-column: auto;
}

.asset-technical-info span:first-child {
  color: var(--muted-2);
  font-size: 9px;
}

.asset-technical-info strong {
  color: var(--text);
  font-size: 11px;
}

.bulk-tag-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 10px;
}

.grid-import-dialog .dialog-card {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  max-height: calc(100vh - 56px);
  overflow-x: hidden;
}

.grid-import-dialog {
  width: min(640px, calc(100vw - 28px));
  max-width: none;
}

.grid-import-dialog .dialog-body {
  gap: 10px;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
}

.grid-import-list {
  display: grid;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  max-height: min(42vh, 360px);
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
}

.grid-import-summary {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(216, 140, 167, 0.2);
  border-radius: 10px;
  background: rgba(216, 140, 167, 0.07);
  color: var(--muted);
  padding: 9px 11px;
  font-size: 11px;
}

.grid-import-summary strong {
  color: var(--text);
  font-size: 12px;
}

.grid-import-group {
  display: grid;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  padding: 9px;
}

.grid-import-group header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  font-size: 12px;
}

.grid-import-group header strong {
  overflow: hidden;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-import-group header span {
  flex: 0 0 auto;
  border: 1px solid rgba(216, 140, 167, 0.25);
  border-radius: 999px;
  color: var(--rose);
  font-size: 10px;
  padding: 4px 8px;
}

.grid-import-previews {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  align-items: start;
  min-width: 0;
  overflow: hidden;
}

.grid-import-preview-item {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.18);
  width: 100%;
  aspect-ratio: 3 / 4;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.grid-import-preview-item:hover,
.grid-import-preview-item:focus-visible {
  border-color: rgba(255, 255, 255, 0.55);
  outline: none;
  transform: translateY(-1px);
}

.grid-import-preview-item:not(.selected) {
  opacity: 0.38;
  filter: grayscale(0.55);
}

.grid-import-preview-item.selected {
  border-color: var(--rose);
  box-shadow: 0 0 0 2px rgba(216, 140, 167, 0.24);
}

.grid-import-selection-mark {
  position: absolute;
  top: 6px;
  left: 6px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: var(--rose);
  color: #21151b;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 160ms ease, transform 160ms ease;
}

.grid-import-preview-item.selected .grid-import-selection-mark {
  opacity: 1;
  transform: scale(1);
}

.grid-import-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.grid-import-preview-item small {
  position: absolute;
  right: 6px;
  bottom: 6px;
  min-width: 20px;
  border-radius: 999px;
  background: rgba(12, 9, 15, 0.78);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 20px;
  text-align: center;
}

.hidden {
  display: none !important;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  background-clip: padding-box;
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 400px);
    gap: 15px;
    padding-inline: 16px;
  }

  .topbar {
    padding-inline: 16px;
  }

  .gallery {
    column-width: 190px;
  }

  .gallery.list-view .poster-meta {
    grid-template-columns: minmax(150px, 0.8fr) minmax(180px, 1fr) minmax(135px, 0.7fr);
    column-gap: 12px;
  }
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    padding-inline: 14px;
  }

  .brand-copy p,
  .sidebar-footer {
    display: none;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .editor-shell {
    position: static;
    height: auto;
    min-height: 0;
  }

  .editor-panel {
    max-height: none;
  }

  .gallery.list-view .poster-meta {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  }

  .gallery.list-view .poster-title-row {
    grid-column: 1;
    grid-row: 1;
  }

  .gallery.list-view .chips {
    grid-column: 2;
    grid-row: 1;
  }

  .gallery.list-view .poster-facts {
    grid-column: 2;
    grid-row: 2;
  }

  .gallery.list-view .poster-footline {
    grid-column: 1 / -1;
    grid-row: 3;
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    margin-bottom: 16px;
  }

  .library-tools {
    margin-bottom: 10px;
  }

  .settings-popover {
    position: fixed;
    top: 72px;
    right: 14px;
    left: 14px;
    width: auto;
    max-height: calc(100vh - 90px);
    overflow: auto;
  }

  .topbar {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: auto;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
  }

  .topbar > .brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    border-right: 0;
    padding-right: 0;
  }

  .topbar > .import-disclosure {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
  }

  .topbar > .page-heading {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .top-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: 0;
  }

  .topbar > .import-disclosure .import-form {
    position: fixed;
    top: 76px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100vh - 90px);
  }

  .top-actions #reversePrompt {
    display: none;
  }

  .top-actions #taskTabShortcut {
    display: none;
  }

  .creation-heading {
    display: grid;
  }

  .heading-selection {
    width: 100%;
    justify-items: stretch;
  }

  .heading-selection #clearSelection {
    justify-self: end;
  }

  .prompt-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-image-grid {
    grid-template-columns: repeat(2, 42px);
  }

  .replacement-text-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace {
    padding: 15px;
  }

  .library-toolbar,
  .bulk-toolbar {
    flex-wrap: wrap;
  }

  .library-toolbar {
    top: 0;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    margin: -6px -6px 13px;
    border-radius: 12px;
    padding: 7px;
  }

  .library-toolbar-actions {
    justify-content: space-between;
  }

  .library-toolbar .library-tools {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }

  .library-toolbar .search-field {
    grid-column: 1 / -1;
    grid-row: 4;
  }

  .library-toolbar #categoryFilter {
    grid-column: 1;
    grid-row: 1;
  }

  .library-toolbar #tagFilter {
    grid-column: 2;
    grid-row: 1;
  }

  .library-toolbar #peopleFilter {
    grid-column: 1;
    grid-row: 2;
  }

  .library-toolbar #genderFilter {
    grid-column: 2;
    grid-row: 2;
  }

  .library-toolbar #textPresenceFilter {
    grid-column: 1;
    grid-row: 3;
  }

  .library-toolbar #aspectFilter {
    grid-column: 2;
    grid-row: 1;
  }

  .library-toolbar .library-tools .section-heading.compact {
    grid-column: 1 / -1;
    grid-row: 5;
    justify-self: end;
  }

  .bulk-count {
    min-width: 90px;
  }

  .bulk-actions {
    width: 100%;
  }

  .gallery {
    column-gap: 10px;
    column-width: 160px;
  }

  .poster-card {
    margin-bottom: 10px;
  }

  .poster-meta {
    padding: 10px;
  }

  .gallery.list-view .poster-card {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .gallery.list-view .poster-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .gallery.list-view .poster-title-row,
  .gallery.list-view .poster-footline {
    grid-column: 1;
    grid-row: auto;
  }

  .gallery.list-view .chips {
    display: none;
  }

  .gallery.list-view .poster-footline {
    align-items: flex-start;
    flex-direction: column;
  }

  .chips {
    display: none;
  }

  .grid2,
  .filter-grid,
  .metadata-filter-grid,
  .provider-settings-grid,
  .bulk-tag-grid {
    grid-template-columns: 1fr;
  }

  .metadata-filter-grid #aspectFilter {
    grid-column: auto;
  }

  .editor-panel {
    padding: 15px;
  }

  .generate-dock {
    bottom: -15px;
    margin: 16px -15px -15px;
    padding-inline: 15px;
  }
}

@media (max-width: 430px) {
  .brand-copy p {
    display: none;
  }

  .topbar > .import-disclosure summary strong {
    display: none;
  }

  .topbar > .import-disclosure > summary {
    grid-template-columns: auto auto;
  }

  .library-toolbar .library-tools {
    grid-template-columns: minmax(0, 1fr);
  }

  .library-toolbar .search-field,
  .library-toolbar #categoryFilter,
  .library-toolbar #tagFilter,
  .library-toolbar #peopleFilter,
  .library-toolbar #genderFilter,
  .library-toolbar #textPresenceFilter,
  .library-toolbar #aspectFilter {
    grid-column: 1;
    grid-row: auto;
  }

  .library-toolbar .library-tools .section-heading.compact {
    display: none;
  }

  .gallery {
    column-count: 1;
    column-width: auto;
  }

  .page-heading h2 {
    font-size: 20px;
  }

  .task-shortcut > span:first-child {
    display: none;
  }
}
