/* 数据表、API Key、工作流列表等面板 */
.data-table {
  font-size: 14px;
  line-height: 1.6;
}

.data-table .row {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.data-table .row:last-child {
  border-bottom: none;
}

.key-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.key-card h3 {
  font-size: 16px;
  margin-bottom: 12px;
}

.platform-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 16px;
}

.platform-card pre {
  background: var(--bg);
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  overflow-x: auto;
  margin-top: 8px;
}

.section-header {
  margin: 40px 0 20px;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.user-comfyui-card {
  margin-bottom: 16px;
}

.user-comfyui-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
}

.comfyui-queue-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.comfyui-queue-toolbar .field-hint {
  flex: 1;
  margin: 0;
}

.queue-status-badge {
  flex-shrink: 0;
  min-width: 140px;
  max-width: 220px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.35;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.queue-status-badge.is-ok {
  background: rgba(52, 199, 89, 0.1);
  border-color: rgba(52, 199, 89, 0.35);
  color: #1a7f37;
}

.queue-status-badge.is-warn {
  background: rgba(255, 149, 0, 0.12);
  border-color: rgba(255, 149, 0, 0.35);
  color: #b25000;
}

.queue-status-badge.is-busy {
  background: rgba(255, 59, 48, 0.1);
  border-color: rgba(255, 59, 48, 0.35);
  color: #c41e16;
}

.queue-status-badge.is-offline {
  background: rgba(142, 142, 147, 0.12);
  border-color: rgba(142, 142, 147, 0.35);
  color: #636366;
}

.queue-status-badge.is-unknown {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text-secondary);
}

.api-key-status {
  margin-bottom: 16px;
}

.api-key-masked code,
.api-key-plain {
  display: block;
  margin-top: 8px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius-md);
  font-size: 13px;
  word-break: break-all;
}

.api-key-once {
  margin-top: 16px;
  padding: 14px;
  background: rgba(0, 113, 227, 0.06);
  border: 1px solid rgba(0, 113, 227, 0.2);
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
}

.api-key-actions {
  margin-top: 8px;
}

.api-key-actions .btn-primary {
  width: 100%;
}

#platform-api-key-card code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.api-key-list {
  margin-bottom: 16px;
}

.api-key-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.api-key-row:last-child {
  border-bottom: none;
}

.api-key-row-main {
  flex: 1;
  min-width: 0;
}

.api-key-row-main code {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-md);
  font-size: 13px;
  word-break: break-all;
  margin-bottom: 0;
}

.api-key-value-wrap {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 6px;
}

.api-key-row-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.btn-copy-api-key {
  height: auto;
  min-height: 40px;
  padding: 0 14px;
  flex-shrink: 0;
}

.api-key-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.btn-delete-api-key {
  height: 40px;
  padding: 0 16px;
}

.btn-danger {
  background: var(--danger) !important;
}

.btn-danger:hover:not(:disabled) {
  background: #ff453a !important;
}

.textarea-input {
  resize: vertical;
  min-height: 80px;
  font-family: var(--font);
  line-height: 1.5;
}

.code-input {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
}

.select-input {
  min-width: 140px;
  cursor: pointer;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.field-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.workflow-filters {
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.workflow-search-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 12px;
}

.workflow-search-input {
  flex: 1 1 220px;
  min-width: 0;
  max-width: 480px;
}

.workflow-search-hint {
  margin: 0;
  font-size: 13px;
  white-space: nowrap;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
}

.pagination-actions {
  display: flex;
  gap: 8px;
}

.workflow-fields-table-scroll {
  max-height: min(560px, 65vh);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.workflow-fields-table {
  min-width: 780px;
}

.workflow-fields-table .row {
  display: grid;
  grid-template-columns: 52px 0.9fr 0.9fr 56px 56px 44px 44px 44px 44px 44px 96px 1fr;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  padding: 8px 10px;
}

.workflow-fields-table .row:not(.workflow-fields-table-header) {
  border-bottom: 1px solid var(--border);
}

.workflow-fields-table .row:not(.workflow-fields-table-header):last-child {
  border-bottom: none;
}

.workflow-fields-table-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  color: var(--text-secondary);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.workflow-fields-table-header span {
  white-space: nowrap;
}

.aspect-ratio-admin-table .row {
  display: grid;
  grid-template-columns: 0.8fr 64px 64px 1fr 72px 56px 140px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  margin-bottom: 8px;
}

.aspect-ratio-admin-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.aspect-ratio-admin-add-row .input {
  max-width: 120px;
}

.wf-wizard-dimension-wrap {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.aspect-ratio-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.aspect-ratio-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 72px;
  padding: 10px 12px 8px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, box-shadow 0.15s;
}

.aspect-ratio-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
}

.aspect-ratio-preview-box {
  display: block;
  border: 2px solid currentColor;
  border-radius: 4px;
  background: rgba(26, 115, 232, 0.06);
  box-sizing: border-box;
  transition: background 0.15s, border-color 0.15s;
}

.aspect-ratio-chip-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.2;
}

.aspect-ratio-chip-key {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.aspect-ratio-chip-label {
  font-size: 11px;
  color: var(--text-secondary);
}

.aspect-ratio-chip:hover:not(.is-readonly) {
  border-color: #1a73e8;
  color: #1a73e8;
}

.aspect-ratio-chip:hover:not(.is-readonly) .aspect-ratio-chip-key {
  color: #1a73e8;
}

.aspect-ratio-chip.is-selected {
  border-color: #1a73e8;
  background: #e8f0fe;
  color: #174ea6;
  box-shadow: 0 0 0 1px rgba(26, 115, 232, 0.15);
}

.aspect-ratio-chip.is-selected .aspect-ratio-preview-box {
  background: rgba(26, 115, 232, 0.18);
  border-color: #174ea6;
}

.aspect-ratio-chip.is-selected .aspect-ratio-chip-key {
  color: #174ea6;
}

.aspect-ratio-chip.is-selected .aspect-ratio-chip-label {
  color: #174ea6;
}

.aspect-ratio-chip.is-readonly {
  cursor: default;
  pointer-events: none;
}

[data-image-lightbox] {
  cursor: zoom-in;
}

.workflow-row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-sm {
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.trash-readonly pre {
  background: rgba(0, 0, 0, 0.04);
  padding: 12px;
  border-radius: var(--radius-md);
  font-size: 12px;
  overflow: auto;
  max-height: 240px;
}

/* 图片灯箱（风格预览、生成结果等） */
/* 灯箱是最顶层浮层：z-index 必须高于其它 .page-modal（默认 200）与浮窗，
   否则在弹窗（如会话记录详情）内点开大图会被弹窗盖在底层。 */
.admin-image-lightbox.page-modal {
  z-index: 1300;
}
.admin-image-lightbox .page-modal-backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.admin-image-lightbox-body {
  position: relative;
  max-width: min(96vw, 1200px);
  max-height: 92vh;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-image-lightbox-body img {
  max-width: 100%;
  max-height: 92vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.admin-image-lightbox-close {
  position: absolute;
  top: -36px;
  right: 0;
  border: none;
  background: transparent;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
