/* 尊享模式 — 深色主题；布局复用 /style.css 的 .layout / .config-panel / .gallery-area */

:root {
  --premium-bg: #0f1117;
  --premium-surface: #1a1d26;
  --premium-surface2: #232733;
  --premium-border: #2e3444;
  --premium-accent: #c9a227;
  --premium-accent-hover: #e0b83d;
  --premium-text: #e8eaed;
  --premium-muted: #9aa0a6;
  --premium-success: #34a853;
  --premium-error: #ea4335;
  --premium-radius: 10px;

  /* 映射到标准表单变量，使 ratio-grid / ref-zone 等可读 */
  --bg: var(--premium-bg);
  --surface: var(--premium-surface);
  --surface2: var(--premium-surface2);
  --border: var(--premium-border);
  --text: var(--premium-text);
  --muted: var(--premium-muted);
  --accent: var(--premium-accent);
  --accent-h: var(--premium-accent-hover);
  --radius: var(--premium-radius);
}

/* 与标准版一致：整页纵向滚动（配置区 + 右侧任务/预览区一起滚） */
body.premium-mode {
  background: var(--premium-bg);
  color: var(--premium-text);
  overflow-x: hidden;
  overflow-y: auto;
}

body.premium-mode #premium-app.layout {
  flex: none;
  min-height: auto;
  overflow: visible;
  align-items: flex-start;
}

body.premium-mode .config-panel {
  overflow: visible;
  max-height: none;
  flex-shrink: 0;
  background: var(--premium-surface);
  border-right-color: var(--premium-border);
}

body.premium-mode .gallery-area {
  overflow: visible;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 60vh;
  background: var(--premium-bg);
}

body.premium-mode .gallery,
body.premium-mode .premium-gallery {
  overflow: visible;
  flex: none;
  min-height: 0;
}

.premium-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--premium-border);
  background: var(--premium-surface);
  flex-wrap: wrap;
  flex-shrink: 0;
}

.link-back-standard {
  color: var(--premium-muted);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}
.link-back-standard:hover { color: var(--premium-accent-hover); }

.premium-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  justify-content: center;
  min-width: 0;
}
.premium-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--premium-accent);
  color: #1a1200;
}
.logo span { color: var(--premium-accent); }
.logo-sub { font-size: 0.85rem; color: var(--premium-muted); }

.premium-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.balance-pill {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--premium-surface2);
  border: 1px solid var(--premium-border);
}
.balance-label { font-size: 0.75rem; color: var(--premium-muted); }
.balance-pill strong { color: var(--premium-accent); }

.premium-header .header-link-btn,
.premium-header .toolbar-btn {
  color: var(--premium-text);
  border: 1px solid var(--premium-border);
  background: var(--premium-surface2);
  border-radius: 8px;
  padding: 6px 12px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  font-size: 0.88rem;
}
.premium-header .toolbar-btn:hover,
.premium-header .header-link-btn:hover {
  border-color: var(--premium-accent);
  color: var(--premium-accent-hover);
}

/* 区域 1：顶栏登录触发按钮 */
.premium-header .premium-auth-trigger {
  min-width: 64px;
  font-weight: 600;
  transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
}
.premium-header .premium-auth-trigger:hover {
  background: rgba(201, 162, 39, 0.08);
  color: var(--premium-accent-hover);
}
.premium-header .premium-auth-trigger.is-open {
  border-color: var(--premium-accent);
  color: var(--premium-accent-hover);
  background: rgba(201, 162, 39, 0.12);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.25);
}

.auth-wrap { position: relative; }
.auth-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  background: var(--premium-surface);
  border: 1px solid var(--premium-border);
  border-radius: var(--premium-radius);
  padding: 8px;
  z-index: 50;
}
.auth-dropdown-name {
  font-size: 0.8rem;
  color: var(--premium-muted);
  padding: 4px 8px 8px;
  word-break: break-all;
}
.auth-dropdown-link,
.auth-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--premium-text);
  font: inherit;
  cursor: pointer;
  border-radius: 6px;
  text-decoration: none;
}
.auth-dropdown-link:hover,
.auth-dropdown button:hover { background: var(--premium-surface2); }

/* 厂商轨：复用 .vendor-rail，略宽以容纳中文厂商名 */
body.premium-mode .premium-vendor-rail {
  width: 168px;
  padding: 12px 8px 16px;
  background: var(--premium-surface);
  border-right-color: var(--premium-border);
}
body.premium-mode .premium-vendor-rail .sidebar-title {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--premium-muted);
  margin: 0 4px 10px;
  padding: 0 4px;
}
body.premium-mode .premium-vendor-rail .vendor-btn {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--premium-text);
  font-size: 0.82rem;
}
body.premium-mode .premium-vendor-rail .vendor-btn:hover {
  background: var(--premium-surface2);
  border-color: var(--premium-border);
}
body.premium-mode .premium-vendor-rail .vendor-btn.active {
  background: rgba(201, 162, 39, 0.12);
  border-color: rgba(201, 162, 39, 0.35);
  color: var(--premium-accent-hover);
}

body.premium-mode .config-panel .section-title {
  color: var(--premium-muted);
  font-size: 0.78rem;
}
body.premium-mode .config-panel label {
  color: var(--premium-muted);
  font-size: 0.82rem;
}
body.premium-mode .config-panel textarea,
body.premium-mode .config-panel select,
body.premium-mode .config-panel input[type="text"],
body.premium-mode .config-panel input[type="number"] {
  background: var(--premium-bg);
  border-color: var(--premium-border);
  color: var(--premium-text);
}
body.premium-mode .config-panel .ref-zone {
  background: var(--premium-bg);
  border-color: var(--premium-border);
}
body.premium-mode .config-panel .ratio-btn {
  background: var(--premium-bg);
  border-color: var(--premium-border);
  color: var(--premium-text);
}
body.premium-mode .config-panel .ratio-btn.active {
  border-color: var(--premium-accent);
  background: rgba(201, 162, 39, 0.12);
  color: var(--premium-accent-hover);
}
body.premium-mode .config-panel .btn-gen {
  background: linear-gradient(180deg, var(--premium-accent-hover), var(--premium-accent));
  color: #1a1200;
  border: none;
}
body.premium-mode .config-panel .btn-gen:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
body.premium-mode .config-panel .btn-sub {
  color: rgba(26, 18, 0, 0.65);
}
body.premium-mode .config-panel .more-settings.is-open .more-settings-chevron {
  transform: rotate(180deg);
}
body.premium-mode .config-panel .more-settings-body:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 4px;
}

.model-price-hint {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--premium-accent);
}
.form-note,
.form-note-inline {
  font-size: 0.78rem;
  color: var(--premium-muted);
  margin-top: 8px;
  line-height: 1.4;
}

body.premium-mode .config-panel select.quality-locked {
  opacity: 0.85;
  cursor: not-allowed;
}
body.premium-mode .config-panel .ref-zone p {
  font-size: 0.72rem;
  margin-top: 2px;
}
.form-note-inline { margin-top: 4px; }
.login-hint {
  font-size: 0.8rem;
  color: var(--premium-muted);
  margin-top: 8px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.12s;
  display: inline-block;
}
.login-hint:hover {
  color: var(--premium-accent-hover);
}
.login-hint[hidden] { display: none; }

.param-section { display: none; }
.param-section.show { display: block; }

.premium-showcase {
  padding: 4px 0 20px;
}
.premium-showcase-head {
  margin-bottom: 16px;
}
.premium-showcase-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--premium-text);
}
.premium-showcase-sub {
  margin: 0;
  font-size: 0.82rem;
  color: var(--premium-muted);
  line-height: 1.45;
}
.premium-showcase-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.premium-showcase-card {
  background: var(--premium-surface2);
  border: 1px solid var(--premium-border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}
.premium-showcase-card:hover {
  border-color: rgba(201, 162, 39, 0.45);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.premium-showcase-cover {
  position: relative;
  aspect-ratio: 1;
  background: #fff;
  overflow: hidden;
}
.premium-showcase-cover img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.premium-showcase-cover--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--premium-surface) 0%, var(--premium-bg) 100%);
}
.premium-showcase-cover-ph {
  font-size: 1.6rem;
  font-weight: 700;
  color: rgba(201, 162, 39, 0.35);
  letter-spacing: 0.08em;
}
.premium-showcase-tag {
  position: absolute;
  left: 8px;
  top: 8px;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(12, 14, 20, 0.78);
  color: var(--premium-accent-hover);
  border: 1px solid rgba(201, 162, 39, 0.4);
}
.premium-showcase-multi-badge {
  position: absolute;
  right: 8px;
  top: 8px;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(12, 14, 20, 0.82);
  color: var(--premium-accent-hover);
  border: 1px solid rgba(201, 162, 39, 0.45);
}
.premium-showcase-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.premium-showcase-card-title {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--premium-text);
  line-height: 1.35;
}
.premium-showcase-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}
.premium-showcase-btn {
  flex: 1;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--premium-border);
  background: var(--premium-bg);
  color: var(--premium-text);
  font-size: 0.76rem;
  font-family: var(--font);
  cursor: pointer;
}
.premium-showcase-btn--primary {
  border: none;
  background: linear-gradient(180deg, var(--premium-accent-hover), var(--premium-accent));
  color: #1a1200;
  font-weight: 600;
}
.premium-showcase-btn--primary:hover {
  filter: brightness(1.06);
}

.premium-jobs-title {
  grid-column: 1 / -1;
  font-size: 1rem;
  font-weight: 600;
  color: var(--premium-muted);
  margin: 0 0 4px;
  width: 100%;
}
body.premium-mode .premium-gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-content: start;
}
.jobs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.premium-job-card {
  background: var(--premium-surface);
  border: 1px solid var(--premium-border);
  border-radius: 12px;
  padding: 12px 14px;
}
.premium-job-card.is-unread {
  border-color: rgba(201, 162, 39, 0.65);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.2);
}
.premium-job-unread-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  color: #1a1406;
  background: linear-gradient(165deg, var(--premium-accent-hover), var(--premium-accent));
  letter-spacing: 0.04em;
}
.premium-job-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.82rem;
}
.premium-job-status {
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--premium-surface2);
}
.premium-job-status.status-succeeded { color: var(--premium-success); }
.premium-job-status.status-failed { color: var(--premium-error); }
.premium-job-status.status-running { color: var(--premium-accent-hover); }
.premium-job-meta { color: var(--premium-muted); }
.premium-job-logo-badge {
  color: var(--premium-accent-hover);
  font-weight: 600;
}
.premium-job-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-top: 2px;
}
.premium-job-body--single {
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
}
.premium-job-body--single .premium-job-prompt-wrap {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
}
.premium-job-media {
  flex-shrink: 0;
  width: 100%;
}
.premium-job-body--single .premium-job-media {
  flex: 0 0 72px;
  width: 72px;
  max-width: 72px;
  overflow: hidden;
}
.premium-job-imgs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.premium-job-imgs--multi .premium-job-img-btn {
  width: 72px;
  flex: 0 0 72px;
}
.premium-job-imgs--multi .premium-job-img-btn img {
  width: 72px;
  height: 72px;
  object-fit: cover;
}
.premium-job-thumb-placeholder {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1;
  min-height: 72px;
  border-radius: 10px;
  border: 1px dashed var(--premium-border);
  background: var(--premium-surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.premium-job-body--single .premium-job-thumb-placeholder {
  width: 72px;
  height: 72px;
  min-height: 72px;
  aspect-ratio: auto;
}
.premium-job-body--single .premium-job-img-btn {
  width: 72px;
  flex: 0 0 72px;
}
.premium-job-body--single .premium-job-img-btn img {
  width: 72px;
  height: 72px;
  object-fit: cover;
}
.premium-job-thumb-placeholder--empty {
  min-height: 48px;
  height: 48px;
}
.premium-job-body--single .premium-job-thumb-placeholder--empty {
  width: 72px;
  height: 48px;
  min-height: 48px;
}
.premium-job-spin {
  width: 22px;
  height: 22px;
  border: 2px solid var(--premium-border);
  border-top-color: var(--premium-accent);
  border-radius: 50%;
  animation: premium-job-spin 0.7s linear infinite;
}
@keyframes premium-job-spin {
  to { transform: rotate(360deg); }
}
.premium-job-prompt-wrap {
  width: 100%;
  min-width: 0;
}
.premium-job-prompt {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.4;
  color: var(--premium-muted);
  word-break: break-word;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.premium-job-body--multi .premium-job-prompt {
  -webkit-line-clamp: 2;
}
.premium-job-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.premium-job-action-btn {
  padding: 4px 10px;
  font-size: 0.72rem;
  border-radius: 6px;
  border: 1px solid var(--premium-border);
  background: var(--premium-surface2);
  color: var(--premium-text);
  cursor: pointer;
  font-family: var(--font);
}
.premium-job-action-btn:hover {
  border-color: var(--premium-accent);
  color: var(--premium-accent-hover);
}
.premium-progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0 4px;
}
.premium-progress-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--premium-surface2);
  overflow: hidden;
}
.premium-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--premium-accent), var(--premium-accent-hover));
  transition: width 0.35s ease;
}
.premium-progress-label {
  font-size: 0.75rem;
  color: var(--premium-muted);
  min-width: 2.5rem;
  text-align: right;
}

.premium-job-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.premium-export-btn {
  padding: 6px 12px;
  font-size: 0.78rem;
  border-radius: 8px;
  border: 1px solid var(--premium-border);
  background: var(--premium-surface2);
  color: var(--premium-text);
  cursor: pointer;
  font-family: var(--font);
}
.premium-export-btn:hover {
  border-color: var(--premium-accent);
  color: var(--premium-accent-hover);
}

.premium-job-img-link {
  display: block;
  border-radius: 8px;
  overflow: hidden;
}
.premium-job-imgs img {
  width: 100%;
  border-radius: 8px;
  display: block;
  background: var(--premium-bg);
}

.premium-toast-backdrop {
  position: fixed;
  inset: 0;
  z-index: 240;
  background: rgba(0, 0, 0, 0.55);
  pointer-events: none;
}
.premium-toast-backdrop[hidden] {
  display: none !important;
}

.premium-toast {
  position: fixed;
  top: 44%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 12px 20px;
  border-radius: 8px;
  background: var(--premium-surface);
  border: 1px solid var(--premium-accent);
  color: var(--premium-text);
  z-index: 520;
  max-width: 90vw;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.premium-load-more-wrap,
.hist-load-more-wrap.premium-hist-drawer .hist-load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 12px 0 4px;
}
.premium-load-more-btn,
body.premium-mode .hist-load-more-btn {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid var(--premium-border);
  background: var(--premium-surface2);
  color: var(--premium-text);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.82rem;
}
.premium-load-more-btn:hover:not(:disabled),
body.premium-mode .hist-load-more-btn:hover:not(:disabled) {
  border-color: var(--premium-accent);
  color: var(--premium-accent-hover);
}
.premium-load-more-btn:disabled,
body.premium-mode .hist-load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

body.premium-mode .premium-hist-backdrop {
  background: rgba(0, 0, 0, 0.55);
  z-index: 220;
}
body.premium-mode .premium-hist-drawer {
  z-index: 230;
  width: min(440px, 100vw);
  background: var(--premium-surface);
  border-left: 1px solid var(--premium-border);
  color: var(--premium-text);
}
body.premium-mode .premium-hist-drawer .hist-drawer-close:hover {
  border-color: var(--premium-error);
  color: var(--premium-error);
}
body.premium-mode .premium-hist-drawer .hist-drawer-top {
  background: var(--premium-surface2);
  border-bottom-color: var(--premium-border);
}
body.premium-mode .premium-hist-drawer .hist-drawer-top h2 {
  color: var(--premium-text);
}
body.premium-mode .premium-hist-drawer .hist-drawer-close {
  background: var(--premium-bg);
  border-color: var(--premium-border);
  color: var(--premium-muted);
}
body.premium-mode .premium-hist-drawer .hist-list {
  padding: 12px 14px 16px;
  gap: 14px;
}
body.premium-mode .hist-entry {
  border-color: var(--premium-border);
  background: var(--premium-surface2);
}
body.premium-mode .hist-entry-header {
  border-bottom-color: var(--premium-border);
  background: rgba(0, 0, 0, 0.15);
}
body.premium-mode .hist-ts,
body.premium-mode .hist-model {
  color: var(--premium-muted);
}
body.premium-mode .hist-model {
  color: var(--premium-text);
}
body.premium-mode .premium-hist-pub-row {
  color: var(--premium-muted);
}
body.premium-mode .premium-hist-pub-row input {
  accent-color: var(--premium-accent);
}
body.premium-mode .hist-tag {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(201, 162, 39, 0.45);
  color: var(--premium-accent-hover);
  background: rgba(201, 162, 39, 0.1);
}
body.premium-mode .hist-tag--logo {
  letter-spacing: 0.02em;
}
body.premium-mode .hist-prompt-expand:not(.hist-prompt-expand--compact) {
  border-bottom-color: var(--premium-border);
}
body.premium-mode .hist-prompt-inner {
  color: var(--premium-muted);
}
body.premium-mode .hist-prompt-expand-btn {
  border-color: var(--premium-border);
  background: var(--premium-bg);
  color: var(--premium-accent-hover);
}
body.premium-mode .hist-prompt-expand-btn:hover {
  border-color: var(--premium-accent);
  background: rgba(201, 162, 39, 0.12);
}
body.premium-mode .hist-entry--compact .hist-main-row {
  border-bottom-color: var(--premium-border);
}
body.premium-mode .hist-row-prompt {
  color: var(--premium-muted);
}
body.premium-mode .premium-hist-drawer .hist-images {
  padding: 10px 12px;
  gap: 8px;
}
body.premium-mode .premium-hist-drawer .hist-images--extra {
  border-bottom: 1px solid var(--premium-border);
  padding: 8px 12px 10px;
}
body.premium-mode .premium-hist-drawer .hist-img-item img {
  border-color: var(--premium-border);
  background: #fff;
  cursor: pointer;
  object-fit: contain;
}
body.premium-mode .premium-hist-drawer .hist-img-item--inline {
  position: relative;
}
body.premium-mode .premium-hist-drawer .hist-img-item--inline img {
  width: 88px;
  height: 88px;
}
body.premium-mode .hist-multi-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px 2px 5px;
  border-radius: 5px;
  font-size: 0.62rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--premium-accent-hover);
  background: rgba(12, 14, 20, 0.82);
  border: 1px solid rgba(201, 162, 39, 0.45);
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}
body.premium-mode .hist-multi-badge-icon {
  display: inline-flex;
  opacity: 0.95;
}
body.premium-mode .hist-multi-badge-text {
  letter-spacing: 0.04em;
}
body.premium-mode .premium-hist-drawer .hist-images:not(.hist-images--extra) .hist-img-item img {
  width: calc(50% - 4px);
  max-width: 120px;
  height: auto;
  aspect-ratio: 1;
}
body.premium-mode .premium-hist-drawer .hist-images:not(.hist-images--extra) {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
body.premium-mode .premium-hist-drawer .hist-images:not(.hist-images--extra) .hist-img-item {
  width: 100%;
}
body.premium-mode .premium-hist-drawer .hist-images:not(.hist-images--extra) .hist-img-item img {
  width: 100%;
  max-width: none;
  height: auto;
  aspect-ratio: 1;
}
body.premium-mode .premium-hist-actions {
  margin-top: 0;
  padding: 10px 12px 12px;
  border-top: 1px solid var(--premium-border);
  gap: 8px;
}
body.premium-mode .premium-hist-actions button {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  border-color: var(--premium-border);
  background: var(--premium-bg);
  color: var(--premium-text);
  font-size: 0.74rem;
  padding: 7px 10px;
}
body.premium-mode .premium-hist-actions button:hover {
  border-color: var(--premium-accent);
  color: var(--premium-accent-hover);
  background: rgba(201, 162, 39, 0.08);
}
body.premium-mode .hist-status {
  border-bottom-color: var(--premium-border);
  color: var(--premium-muted);
}
body.premium-mode .hist-status-fail {
  color: var(--premium-error);
}
body.premium-mode .hist-similar-btn {
  border-color: var(--premium-border);
  background: var(--premium-bg);
  color: var(--premium-accent-hover);
}
body.premium-mode .hist-similar-btn:hover {
  border-color: var(--premium-accent);
}

.premium-modal-backdrop,
body.premium-mode .tpl-library-backdrop,
body.premium-mode .premium-job-detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
body.premium-mode .tpl-library-backdrop[hidden],
body.premium-mode .premium-job-detail-backdrop[hidden],
body.premium-mode #template-preview-modal[hidden] {
  display: none !important;
}
body.premium-mode .premium-modal-panel {
  background: var(--premium-surface);
  border-color: var(--premium-border);
  color: var(--premium-text);
}
body.premium-mode .tpl-preview-prompt-box,
body.premium-mode .tpl-preview-refs {
  background: var(--premium-bg);
  border-color: var(--premium-border);
}
body.premium-mode .tpl-preview-apply,
body.premium-mode .premium-login-panel .primary {
  background: linear-gradient(180deg, var(--premium-accent-hover), var(--premium-accent));
  color: #1a1200;
  border: none;
}

.tpl-library-panel {
  width: min(920px, 96vw);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  border: 1px solid var(--premium-border);
  overflow: hidden;
}
.tpl-library-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--premium-border);
}
.tpl-library-header h2 {
  margin: 0;
  font-size: 1rem;
}
.tpl-library-close,
.premium-login-close,
.premium-image-close {
  border: none;
  background: transparent;
  color: var(--premium-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}
.tpl-library-scroll {
  overflow-y: auto;
  padding: 12px 18px 20px;
}
.tpl-library-section {
  margin-bottom: 20px;
}
.tpl-library-section-title {
  margin: 0 0 4px;
  font-size: 0.9rem;
}
.tpl-library-section-hint {
  margin: 0 0 10px;
  font-size: 0.75rem;
  color: var(--premium-muted);
}
.tpl-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.tpl-library-grid .template-card {
  cursor: pointer;
}
.tpl-library-empty {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  color: var(--premium-muted);
  padding: 12px 0;
}

.premium-image-panel {
  position: relative;
  max-width: min(92vw, 960px);
  max-height: 90vh;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--premium-border);
  background: var(--premium-surface);
}
.premium-image-preview {
  display: block;
  max-width: 100%;
  max-height: calc(90vh - 80px);
  margin: 0 auto;
  border-radius: 8px;
}
.premium-image-actions {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}
.premium-image-download {
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--premium-accent);
  color: #1a1200;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
}
.premium-job-img-btn {
  display: block;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  border-radius: 8px;
  overflow: hidden;
  width: 100%;
}
.premium-job-img-btn img {
  width: 100%;
  display: block;
  border-radius: 8px;
}

.premium-auth-wrap {
  position: relative;
}
.premium-login-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(300px, calc(100vw - 24px));
  padding: 16px 16px 14px;
  background: var(--premium-surface);
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 12px;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(201, 162, 39, 0.08);
  z-index: 250;
}
.premium-login-popover::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 28px;
  width: 10px;
  height: 10px;
  background: var(--premium-surface);
  border-left: 1px solid rgba(201, 162, 39, 0.35);
  border-top: 1px solid rgba(201, 162, 39, 0.35);
  transform: rotate(45deg);
}
.premium-login-popover[hidden] {
  display: none !important;
}
.premium-login-popover-close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--premium-muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.premium-login-popover-close:hover {
  background: var(--premium-surface2);
  color: var(--premium-text);
}
.premium-login-popover-title {
  margin: 0 28px 12px 0;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--premium-text);
  letter-spacing: 0.02em;
}
.premium-login-popover-tip {
  margin: -6px 0 12px 0;
  padding: 8px 10px;
  font-size: 0.76rem;
  color: var(--premium-accent);
  background: rgba(201, 162, 39, 0.1);
  border-radius: 6px;
  border-left: 3px solid var(--premium-accent);
  line-height: 1.4;
}
.premium-login-popover-tip[hidden] {
  display: none;
}

/* 区域 2：登录 / 注册 Tab */
.premium-login-popover .premium-auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  padding: 3px;
  border-radius: 10px;
  background: var(--premium-bg);
  border: 1px solid var(--premium-border);
}
.premium-login-popover .premium-auth-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--premium-muted);
  font-size: 0.84rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}
.premium-login-popover .premium-auth-tab:hover:not(.active) {
  color: var(--premium-text);
  background: rgba(255, 255, 255, 0.04);
}
.premium-login-popover .premium-auth-tab.active {
  background: linear-gradient(180deg, rgba(224, 184, 61, 0.22), rgba(201, 162, 39, 0.12));
  color: var(--premium-accent-hover);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.premium-login-popover .account-field {
  margin-bottom: 10px;
}
.premium-login-popover .account-field label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.78rem;
  color: var(--premium-muted);
}
.premium-login-popover .account-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: var(--font);
  background: var(--premium-bg);
  border: 1px solid var(--premium-border);
  color: var(--premium-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.premium-login-popover .account-field input:focus {
  outline: none;
  border-color: rgba(201, 162, 39, 0.55);
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.15);
}
.premium-login-popover .auth-form-error {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  background: rgba(234, 67, 53, 0.12);
  color: #f28b82;
  border: 1px solid rgba(234, 67, 53, 0.35);
}
.premium-login-popover .auth-form-error[hidden] {
  display: none !important;
}

/* 区域 3：底部提交按钮 */
.premium-login-popover .premium-auth-submit {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  color: #1a1200;
  background: linear-gradient(180deg, #e0b83d 0%, #c9a227 100%);
  box-shadow: 0 2px 8px rgba(201, 162, 39, 0.35);
  transition: filter 0.15s, transform 0.1s, box-shadow 0.15s;
}
.premium-login-popover .premium-auth-submit:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 4px 14px rgba(201, 162, 39, 0.45);
}
.premium-login-popover .premium-auth-submit:active:not(:disabled) {
  transform: translateY(1px);
  box-shadow: 0 1px 4px rgba(201, 162, 39, 0.3);
}
.premium-login-popover .premium-auth-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.premium-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 0 4px;
  font-size: 0.78rem;
}
.premium-pagination[hidden] {
  display: none !important;
}
.premium-pagination--drawer {
  padding: 8px 12px 16px;
}
.premium-page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--premium-border);
  background: var(--premium-surface2);
  color: var(--premium-text);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.78rem;
}
.premium-page-btn:hover:not(:disabled) {
  border-color: var(--premium-accent);
  color: var(--premium-accent-hover);
}
.premium-page-btn.active {
  border-color: var(--premium-accent);
  background: rgba(201, 162, 39, 0.15);
  color: var(--premium-accent-hover);
  font-weight: 600;
}
.premium-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.premium-page-jump {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 4px;
}
.premium-page-jump input {
  width: 44px;
  height: 32px;
  padding: 0 6px;
  border-radius: 8px;
  border: 1px solid var(--premium-border);
  background: var(--premium-bg);
  color: var(--premium-text);
  font-size: 0.78rem;
  text-align: center;
}

body.premium-mode .premium-job-detail-panel {
  background: var(--premium-surface);
  border-color: var(--premium-border);
  color: var(--premium-text);
  max-width: min(980px, 100%);
  height: min(720px, calc(100vh - 32px));
  overflow: hidden;
}
body.premium-mode .premium-job-detail-panel .job-detail-prompt,
body.premium-mode .premium-job-detail-panel .job-detail-dl {
  color: var(--premium-text);
}
body.premium-mode .premium-job-detail-panel .job-detail-label,
body.premium-mode .premium-job-detail-panel .job-detail-sec-title {
  color: var(--premium-muted);
}
body.premium-mode .premium-detail-downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
body.premium-mode .premium-detail-dl-btn {
  padding: 6px 12px;
  font-size: 0.78rem;
  border-radius: 8px;
  border: 1px solid var(--premium-border);
  background: var(--premium-surface2);
  color: var(--premium-text);
  cursor: pointer;
  font-family: var(--font);
}
body.premium-mode .premium-detail-dl-btn:hover {
  border-color: var(--premium-accent);
  color: var(--premium-accent-hover);
}
body.premium-mode .premium-job-detail-panel .job-detail-grid {
  height: 100%;
  align-items: stretch;
}
body.premium-mode .premium-job-detail-panel .premium-job-detail-left {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 12px;
  min-height: 0;
  align-self: stretch;
}
body.premium-mode .premium-job-detail-panel .premium-job-detail-left--single {
  justify-content: center;
  align-items: center;
}
body.premium-mode .premium-job-detail-panel .premium-job-detail-left--single .job-detail-img-wrap {
  align-self: center;
}
body.premium-mode .premium-job-detail-panel .job-detail-img-wrap {
  align-self: center;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
  position: relative;
  cursor: zoom-in;
}
@media (hover: hover) {
  body.premium-mode .premium-job-detail-panel .job-detail-img-wrap:hover .tpl-preview-zoom-ico {
    opacity: 1;
  }
}
@media (hover: none) {
  body.premium-mode .premium-job-detail-panel .job-detail-img-wrap .tpl-preview-zoom-ico {
    opacity: 0.88;
  }
}
body.premium-mode .premium-job-detail-panel .job-detail-img {
  width: auto;
  height: auto;
  max-height: 100%;
  margin: 0 auto;
}
body.premium-mode .premium-job-detail-panel .job-detail-right {
  min-height: 0;
  overflow-y: auto;
}
.premium-detail-thumb-carousel {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 100%;
}
.premium-detail-thumbs-viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.premium-detail-thumbs {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
}
.premium-detail-thumb {
  flex: 0 0 72px;
  width: 72px;
  height: 72px;
  padding: 0;
  border: 2px solid var(--premium-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.premium-detail-thumb:hover {
  border-color: rgba(201, 162, 39, 0.55);
}
.premium-detail-thumb.active {
  border-color: var(--premium-accent);
  box-shadow: 0 0 0 1px rgba(201, 162, 39, 0.35);
}
.premium-detail-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.premium-detail-thumb-nav {
  flex-shrink: 0;
  width: 32px;
  height: 72px;
  padding: 0;
  border: 1px solid var(--premium-border);
  border-radius: 8px;
  background: var(--premium-surface2);
  color: var(--premium-text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  font-family: var(--font);
}
.premium-detail-thumb-nav:hover:not(:disabled) {
  border-color: var(--premium-accent);
  color: var(--premium-accent-hover);
  background: rgba(201, 162, 39, 0.1);
}
.premium-detail-thumb-nav:disabled {
  opacity: 0.35;
  cursor: default;
}
body.premium-mode .premium-job-detail-panel .job-detail-footer .primary {
  background: linear-gradient(180deg, var(--premium-accent-hover), var(--premium-accent));
  color: #1a1200;
  border: none;
}

@media (max-width: 720px) {
  body.premium-mode .premium-job-detail-panel {
    height: auto;
    max-height: calc(100vh - 32px);
    overflow: auto;
  }
  body.premium-mode .premium-job-detail-panel .job-detail-grid {
    height: auto;
  }
  body.premium-mode .premium-job-detail-panel .premium-job-detail-left {
    min-height: min(52vh, 420px);
  }
  body.premium-mode .premium-job-detail-panel .job-detail-right {
    overflow: visible;
  }
}

@media (max-width: 640px) {
  body.premium-mode .layout {
    flex-direction: column;
  }
  body.premium-mode .premium-vendor-rail {
    width: 100%;
    max-height: none;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--premium-border);
  }
  body.premium-mode .config-panel {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--premium-border);
    max-height: none;
  }
}
