:root {
  --bg: #0b0c0f;
  --bg-soft: #111319;
  --panel: rgba(18, 20, 27, 0.94);
  --panel-2: rgba(13, 15, 20, 0.98);
  --panel-3: rgba(22, 25, 33, 0.96);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(82, 124, 255, 0.46);
  --text: #f6f7fb;
  --muted: #9096a8;
  --accent: #2e6bff;
  --accent-2: #7a5cff;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  font-family: "Manrope", "Noto Sans SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(43, 78, 170, 0.18), transparent 24%),
    radial-gradient(circle at top right, rgba(121, 74, 247, 0.14), transparent 26%),
    linear-gradient(180deg, #141519 0%, #0e0f13 45%, #090a0d 100%);
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 85%);
  opacity: 0.2;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.panel {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(21, 24, 31, 0.98), rgba(13, 15, 20, 0.98));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  height: 100vh;
  padding: 18px;
  overflow: hidden;
}

.sidebar {
  height: calc(100vh - 36px);
  min-height: 0;
  border-radius: 30px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  position: relative;
  background:
    radial-gradient(circle at 38% 35%, rgba(96, 132, 255, 0.48), transparent 24%),
    radial-gradient(circle at 70% 62%, rgba(123, 89, 255, 0.28), transparent 30%),
    linear-gradient(180deg, #23345f, #121928);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 18px 30px rgba(0, 0, 0, 0.3);
}

.brand-mark::before,
.brand-mark::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark::before {
  inset: 10px;
}

.brand-mark::after {
  inset: 18px 8px 8px 18px;
}

.eyebrow,
.profile-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brand h1,
.detail-content h2 {
  margin: 0;
}

.brand h1 {
  font-size: 1.18rem;
}

.profile-subtext {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.sidebar-library {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head.compact {
  margin-bottom: 12px;
}

.section-head span:first-child {
  font-weight: 700;
}

.section-meta,
.muted {
  color: var(--muted);
}

.profile-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-info {
  min-width: 0;
}

.profile-label {
  margin: 0 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.profile-subtext {
  margin: 8px 0 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--muted);
}

.profile-card-v2 {
  display: grid;
  gap: 14px;
  align-items: start;
  padding: 14px;
}

.profile-card-v2 #endpointLabel {
  display: block;
  font-size: 1.05rem;
  line-height: 1.25;
}

.profile-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.profile-actions-v2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.profile-action-button {
  min-height: 44px;
  justify-content: center;
  padding: 10px 12px;
}

#openFeishuButton {
  grid-column: 1 / -1;
}

.sync-now-button {
  min-width: 92px;
}

.ghost-button:disabled,
.primary-button:disabled {
  cursor: default;
  opacity: 0.62;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  transform: none;
}

.sync-badge {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.sync-badge.live {
  border-color: rgba(68, 211, 145, 0.38);
  background: rgba(52, 161, 113, 0.14);
  color: #b7f2d2;
}

.sync-badge.error {
  border-color: rgba(255, 130, 130, 0.35);
  background: rgba(166, 52, 64, 0.16);
  color: #ffc7cf;
}

.sync-badge.idle {
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.ghost-button,
.primary-button,
.filter-chip,
.stepper-btn,
.display-mode-option,
.icon-button {
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  transition: 180ms ease;
}

.ghost-button,
.icon-button {
  border-radius: 14px;
  padding: 10px 12px;
}

.ghost-button:hover,
.icon-button:hover,
.filter-chip:hover,
.display-mode-option:hover,
.stepper-btn:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.05);
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  min-height: 0;
  height: calc(100vh - 36px);
  overflow: auto;
  padding-right: 4px;
}

.toolbar {
  border-radius: 28px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  position: sticky;
  top: 12px;
  z-index: 20;
}

.searchbar {
  flex: 1;
  min-width: 0;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
}

.searchbar input {
  width: 100%;
  border: 0;
  outline: none;
  color: var(--text);
  background: transparent;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
}

.filter-chip {
  height: 58px;
  padding: 0 18px;
  border-radius: 16px;
}

.filter-chip.active {
  background: linear-gradient(180deg, rgba(41, 74, 159, 0.98), rgba(31, 58, 122, 0.98));
  border-color: var(--border-strong);
}

.workbench {
  min-width: 0;
}

.workbench-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.95fr) minmax(340px, 1.15fr) minmax(280px, 0.95fr) 180px;
  grid-template-areas:
    "source control prompt action"
    "detail detail example example";
  gap: 16px;
}

.work-card {
  border-radius: 28px;
  padding: 16px;
  min-width: 0;
}

.source-card {
  grid-area: source;
  min-height: 320px;
}

.control-card {
  grid-area: control;
  min-height: 320px;
}

.prompt-card {
  grid-area: prompt;
  min-height: 320px;
}

.action-card {
  grid-area: action;
  min-height: 320px;
}

.detail-card {
  grid-area: detail;
  min-height: 248px;
}

.detail-edit-button {
  margin-left: auto;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.82rem;
}

.example-card {
  grid-area: example;
  min-height: 248px;
}

.workflow-grid {
  display: grid;
  gap: 10px;
}

.workflow-card {
  padding: 12px 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.014));
  transition: 180ms ease;
  cursor: pointer;
  min-height: 96px;
}

.workflow-card:hover,
.workflow-card.selected {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow:
    0 18px 36px rgba(0, 0, 0, 0.28),
    inset 0 0 0 1px rgba(82, 124, 255, 0.16);
}

.workflow-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.workflow-head h3,
.workflow-main p {
  margin: 0;
}

.workflow-main h3 {
  font-size: 0.92rem;
  line-height: 1.2;
}

.workflow-main p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag-row,
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-pill,
.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  color: #d7def2;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.workflow-main.simple {
  gap: 8px;
}

.dropzone {
  height: calc(100% - 34px);
  min-height: 254px;
  border-radius: 24px;
  border: 1px dashed rgba(150, 171, 218, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.012));
  transition: 180ms ease;
  overflow: hidden;
}

.dropzone:focus-visible,
.editor-preview:focus-visible {
  outline: 1px solid rgba(110, 138, 255, 0.78);
  outline-offset: 2px;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: rgba(110, 138, 255, 0.62);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.032), rgba(255, 255, 255, 0.016));
}

.dropzone-empty,
.image-preview-wrap {
  height: 100%;
}

.dropzone-empty {
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  gap: 10px;
  padding: 20px;
}

.dropzone-art {
  width: 74px;
  height: 74px;
  border-radius: 22px;
  position: relative;
  background:
    radial-gradient(circle at 50% 35%, rgba(98, 128, 255, 0.18), transparent 28%),
    rgba(255, 255, 255, 0.03);
}

.dropzone-art::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 18px;
  border: 1px solid rgba(220, 231, 255, 0.24);
}

.drop-title {
  margin: 0;
  font-weight: 700;
}

.image-preview-wrap {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
}

.image-preview-wrap img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  border-radius: 20px;
  background: #0d1017;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.image-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.workflow-form {
  height: calc(100% - 30px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.console-block {
  height: 100%;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(255, 255, 255, 0.01));
}

.field {
  display: grid;
  gap: 10px;
}

.field > span {
  font-weight: 600;
}

.params-block {
  display: grid;
  align-content: start;
  gap: 14px;
}

.note-block {
  display: grid;
}

.prompt-toggle-block {
  padding: 12px 14px;
}

.toggle-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}

.toggle-copy {
  display: grid;
  gap: 6px;
}

.toggle-copy p {
  margin: 0;
}

.toggle-hint {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

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

.switch-ui {
  position: relative;
  width: 54px;
  height: 32px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: 180ms ease;
}

.switch-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f4f7ff;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  transition: 180ms ease;
}

.toggle-row input:checked + .switch-ui {
  background: linear-gradient(180deg, rgba(41, 74, 159, 0.98), rgba(31, 58, 122, 0.98));
  border-color: var(--border-strong);
}

.toggle-row input:checked + .switch-ui::after {
  transform: translateX(22px);
}

.field input[type="number"],
.field input[type="url"],
.field select,
.field textarea {
  width: 100%;
  color: var(--text);
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px 16px;
  outline: none;
}

.field input[type="number"] {
  text-align: center;
  appearance: textfield;
}

.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
  appearance: none;
  margin: 0;
}

.field textarea {
  resize: none;
  min-height: 148px;
}

.stepper {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  gap: 8px;
}

.stepper-btn {
  border-radius: 16px;
  font-size: 1.4rem;
}

input[type="range"] {
  width: 100%;
  accent-color: #896eff;
}

.range-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.prompt-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.prompt-reset-button {
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.8rem;
}

.prompt-editor {
  margin: 0;
  height: calc(100% - 30px);
  min-height: 254px;
  overflow: auto;
  padding: 14px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  color: #dbe4ff;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
  width: 100%;
  resize: none;
  outline: none;
}

.prompt-editor:focus {
  border-color: rgba(110, 138, 255, 0.56);
  box-shadow: inset 0 0 0 1px rgba(110, 138, 255, 0.18);
}

.action-stack {
  height: calc(100% - 30px);
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
}

.action-stat {
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 8px;
}

.action-stat span {
  font-size: 0.82rem;
  color: var(--muted);
}

.action-stat strong {
  font-size: 1rem;
}

.primary-button {
  min-height: 58px;
  border-radius: 18px;
  padding: 14px 18px;
  border-color: rgba(125, 156, 255, 0.3);
  background: linear-gradient(180deg, rgba(43, 76, 160, 1), rgba(32, 58, 120, 1));
  box-shadow: 0 16px 34px rgba(17, 41, 93, 0.34);
}

.primary-button.half {
  width: 100%;
}

.status-box {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  align-self: end;
}

.status-box.success {
  color: #9ef0c6;
  border-color: rgba(158, 240, 198, 0.22);
}

.status-box.error {
  color: #ff9db9;
  border-color: rgba(255, 157, 185, 0.22);
}

.detail-content {
  display: grid;
  gap: 14px;
}

.detail-heading {
  display: flex;
  align-items: center;
  gap: 14px;
}

.detail-badge {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(50, 84, 171, 0.9), rgba(111, 84, 255, 0.78));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.detail-description {
  margin: 0;
  color: #cfd5e7;
  line-height: 1.65;
}

.example-gallery {
  display: grid;
  gap: 10px;
}

.empty-state {
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  color: var(--muted);
}

.gallery-layout {
  display: grid;
  gap: 10px;
}

.gallery-layout.stack-vertical {
  grid-template-columns: 1fr;
}

.gallery-layout.stack-horizontal {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.gallery-layout.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gallery-layout.grid-4,
.gallery-layout.free-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.gallery-tile {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.gallery-tile img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.gallery-layout.stack-vertical .gallery-tile,
.gallery-layout.stack-horizontal .gallery-tile {
  aspect-ratio: 16 / 9;
}

.gallery-layout.grid-3 .gallery-tile,
.gallery-layout.grid-4 .gallery-tile,
.gallery-layout.free-grid .gallery-tile {
  aspect-ratio: 1.05 / 1;
}

.gallery-tile::after {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--text);
  background: rgba(10, 10, 14, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.gallery-tile.source::after {
  content: "原图";
}

.gallery-tile.result::after {
  content: "效果";
}

.compare-wrap {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.compare-stage {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.compare-stage img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.compare-after-mask {
  position: absolute;
  inset: 0;
  width: 50%;
  overflow: hidden;
}

.compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.82);
}

.compare-handle {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: rgba(18, 18, 22, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.compare-handle::before,
.compare-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 8px;
  height: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.78);
  border-right: 1px solid rgba(255, 255, 255, 0.78);
}

.compare-handle::before {
  left: 10px;
  transform: translateY(-50%) rotate(-135deg);
}

.compare-handle::after {
  right: 10px;
  transform: translateY(-50%) rotate(45deg);
}

.compare-slider {
  width: 100%;
  accent-color: #4d84ff;
}

.settings-dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

.settings-dialog::backdrop {
  background: rgba(0, 0, 0, 0.76);
}

.settings-panel {
  width: min(620px, calc(100vw - 32px));
  padding: 22px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(77, 110, 213, 0.12), transparent 26%),
    linear-gradient(180deg, rgba(25, 28, 36, 0.99), rgba(14, 16, 22, 0.99));
}

.workflow-editor {
  width: min(860px, calc(100vw - 32px));
}

.workflow-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 18px;
}

.editor-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at top right, rgba(77, 110, 213, 0.08), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0.016));
}

.editor-section-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.editor-section-head strong {
  font-size: 1rem;
  color: #eef2ff;
}

.editor-section-head span {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #9da9c5;
}

.settings-panel .section-head {
  margin-bottom: 18px;
}

.settings-panel .field > span {
  color: #dfe5f7;
}

.settings-panel .muted,
.settings-tip p {
  color: #b7c1d8;
}

.settings-tip {
  margin-top: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(120, 146, 210, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.032), rgba(255, 255, 255, 0.016));
}

.settings-tip strong {
  display: block;
  margin-bottom: 8px;
  color: #eef2ff;
}

.settings-tip p {
  margin: 0;
  line-height: 1.65;
}

.settings-tip p + p {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.workflow-editor .field > span {
  font-size: 0.9rem;
  font-weight: 600;
  color: #eef2ff;
}

.workflow-editor input[type="text"],
.workflow-editor input[type="url"],
.workflow-editor textarea,
.workflow-editor select {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(12, 15, 22, 0.78);
  color: #f3f6ff;
  padding: 14px 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.workflow-editor textarea {
  resize: vertical;
}

.editor-section-main textarea {
  min-height: 220px;
}

.editor-upload-grid,
.editor-preview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.upload-field {
  padding: 14px;
  border-radius: 20px;
  border: 1px dashed rgba(120, 146, 210, 0.22);
  background: rgba(255, 255, 255, 0.02);
}

.upload-field input[type="file"] {
  margin-top: 10px;
  width: 100%;
}

.editor-preview {
  min-height: 132px;
  padding: 10px;
  border-radius: 20px;
  border: 1px dashed rgba(255, 255, 255, 0.11);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.028), rgba(255, 255, 255, 0.012)),
    rgba(255, 255, 255, 0.01);
}

.preview-tip {
  margin: 8px 2px 0;
  font-size: 0.8rem;
  color: #95a1bd;
}

.editor-preview.single img,
.editor-preview.multi img {
  width: 100%;
  border-radius: 12px;
  object-fit: cover;
}

.editor-preview.single img {
  aspect-ratio: 16 / 9;
}

.editor-preview.multi {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.editor-preview.multi img {
  aspect-ratio: 1 / 1;
}

.display-mode-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.display-mode-option {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 12px 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.018);
}

.display-mode-option.active {
  border-color: rgba(93, 126, 255, 0.8);
  background:
    linear-gradient(180deg, rgba(82, 109, 214, 0.16), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.03);
  box-shadow: 0 0 0 1px rgba(93, 126, 255, 0.16) inset;
}

.mode-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #edf2ff;
}

.mode-preview {
  width: 100%;
  height: 52px;
  display: grid;
  gap: 5px;
  padding: 5px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mode-preview span {
  display: block;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
}

.mode-preview.compare,
.mode-preview.stack-horizontal {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mode-preview.stack-vertical {
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.mode-preview.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.mode-preview.grid-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.mode-preview.free-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.mode-preview.free-grid span:nth-child(1),
.mode-preview.free-grid span:nth-child(3) {
  grid-column: span 2;
}

@media (max-width: 1500px) {
  .workbench-grid {
    grid-template-columns: minmax(240px, 0.95fr) minmax(320px, 1.1fr) minmax(260px, 0.9fr);
    grid-template-areas:
      "source control action"
      "prompt prompt prompt"
      "detail detail example";
  }
}

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

  .sidebar {
    min-height: 0;
  }

  .workbench-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "source control"
      "prompt action"
      "detail detail"
      "example example";
  }

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

  .workflow-editor-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
    gap: 12px;
  }

  .toolbar {
    flex-direction: column;
  }

  .toolbar-actions {
    width: 100%;
    overflow: auto;
  }

  .workbench-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "source"
      "control"
      "prompt"
      "action"
      "detail"
      "example";
  }

  .display-mode-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .gallery-layout.stack-horizontal,
  .gallery-layout.grid-3,
  .gallery-layout.grid-4,
  .gallery-layout.free-grid {
    grid-template-columns: 1fr;
  }
}
