﻿#theme-engine.section.active {
  display: block;
  min-height: 0;
  padding: 0;
}

.theme-engine-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: max(480px, calc(100vh - 150px));
  color: var(--admin-panel-text-strong);
}

.theme-engine-toolbar,
.theme-engine-card {
  background: var(--wb-theme-surface-bg);
  border: 1px solid var(--wb-theme-surface-border);
  border-radius: 8px;
  box-shadow: var(--admin-panel-shadow-soft);
}

.theme-engine-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
}

.theme-engine-toolbar-copy {
  min-width: 0;
}

.theme-engine-eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--wb-theme-accent-text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

.theme-engine-toolbar h3,
.theme-engine-card h4 {
  margin: 0;
  color: var(--admin-panel-text-strong);
  font-weight: 600;
}

.theme-engine-toolbar h3 {
  font-size: 20px;
}

.theme-engine-toolbar p {
  margin: 6px 0 0;
  color: var(--admin-panel-text-muted);
  font-size: 13px;
}

.theme-engine-toolbar-actions,
.theme-engine-form-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.theme-engine-active-summary {
  color: var(--admin-panel-text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.theme-engine-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.78fr) minmax(360px, 1.22fr);
  align-items: stretch;
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
}

.theme-engine-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.theme-engine-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--wb-theme-modal-divider);
  background: var(--wb-theme-modal-shell-muted);
}

.theme-engine-card-header h4 {
  font-size: 15px;
}

.theme-engine-card-meta {
  display: block;
  margin-top: 4px;
  color: var(--admin-panel-text-muted);
  font-size: 12px;
}

.theme-engine-theme-list {
  display: grid;
  gap: 8px;
  align-content: start;
  overflow: auto;
  padding: 14px;
}

.theme-engine-theme-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 9px 11px;
  border: 1px solid var(--wb-theme-surface-border);
  border-radius: 8px;
  background: var(--wb-theme-button-soft);
  color: var(--admin-panel-text-strong);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.theme-engine-theme-item:hover {
  border-color: var(--wb-theme-button-border);
  background: var(--wb-theme-button-soft-hover);
}

.theme-engine-theme-item:focus-visible {
  outline: 2px solid var(--wb-theme-accent-text);
  outline-offset: 2px;
}

.theme-engine-theme-item.is-selected {
  border-color: var(--wb-theme-button-border);
  box-shadow: 0 0 0 1px var(--wb-theme-button-border);
}

.theme-engine-theme-item.is-active .theme-engine-theme-copy strong {
  color: var(--wb-theme-accent-text);
}

.theme-engine-theme-swatch {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--theme-engine-primary), var(--theme-engine-accent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--admin-panel-text-strong) 16%, transparent);
}

.theme-engine-theme-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.theme-engine-theme-copy strong {
  overflow: hidden;
  color: var(--admin-panel-text-strong);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-engine-theme-copy small {
  overflow: hidden;
  color: var(--admin-panel-text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-engine-theme-status {
  margin-left: auto;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--wb-theme-info-soft);
  color: var(--wb-theme-info-text);
  font-size: 11px;
  white-space: nowrap;
}

.theme-engine-editor-preview {
  width: 54px;
  height: 34px;
  flex: 0 0 54px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--theme-engine-preview-primary), var(--theme-engine-preview-accent));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--admin-panel-text-strong) 16%, transparent);
}

.theme-engine-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-height: 0;
  padding: 18px;
}

.theme-engine-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.theme-engine-field {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--admin-panel-text-muted);
  font-size: 12px;
}

.theme-engine-field--wide {
  grid-column: 1 / -1;
}

.theme-engine-field input[type="text"],
.theme-engine-field select {
  width: 100%;
  min-height: 38px;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--wb-theme-modal-field-border);
  border-radius: 7px;
  background: var(--wb-theme-modal-field-bg);
  color: var(--admin-panel-text-strong);
  font: inherit;
}

.theme-engine-field input[type="text"]:focus-visible,
.theme-engine-field select:focus-visible,
.theme-engine-color-control input[type="color"]:focus-visible {
  outline: 0;
  border-color: var(--wb-theme-accent-text);
  box-shadow: 0 0 0 3px var(--wb-theme-accent-soft);
}

.theme-engine-color-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 5px 9px;
  border: 1px solid var(--wb-theme-modal-field-border);
  border-radius: 7px;
  background: var(--wb-theme-modal-field-bg);
}

.theme-engine-color-control input[type="color"] {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.theme-engine-color-control output {
  color: var(--admin-panel-text-strong);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.theme-engine-editor-error {
  padding: 9px 10px;
  border: 1px solid var(--wb-theme-danger-border);
  border-radius: 7px;
  background: var(--wb-theme-danger-soft);
  color: var(--wb-theme-danger-text);
  font-size: 12px;
}

.theme-engine-form-actions {
  margin-top: auto;
  padding-top: 4px;
}

.theme-engine-form-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

@media (max-width: 900px) {
  .theme-engine-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .theme-engine-toolbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .theme-engine-layout {
    grid-template-columns: 1fr;
  }

  .theme-engine-registry {
    max-height: 420px;
  }
}

@media (max-width: 560px) {
  .theme-engine-form-grid {
    grid-template-columns: 1fr;
  }

  .theme-engine-field--wide {
    grid-column: auto;
  }
}


/* ===== 主题分类 Tab ===== */
.theme-engine-tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 4px;
}


.theme-engine-kind-tabs {
  width: 100%;
  display: flex;
}
.theme-engine-tabs-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .theme-engine-tabs-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .theme-engine-kind-tabs {
  width: 100%;
  display: flex;
}
.theme-engine-tabs-actions {
    justify-content: space-between;
  }
}