/* Image workspace final override: Flow gallery + bottom prompt dock + right parameter drawer */
.gallery-layout.flow-workbench {
  position: relative;
  min-height: calc(100vh - 128px);
  padding-bottom: 232px;
}

.gallery-layout .flow-topbar {
  position: sticky;
  top: 78px;
  z-index: 18;
  padding: 10px 0 14px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(248, 250, 252, 0.72));
  backdrop-filter: blur(12px);
}

.gallery-layout .flow-masonry {
  display: block;
  min-height: 64vh;
  padding: 12px 0 28px;
  column-count: 4;
  column-gap: 22px;
}

.gallery-empty {
  min-height: 64vh;
  border: 1px dashed var(--line);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.56);
}

.gallery-layout .floating-composer {
  position: fixed !important;
  left: var(--sidebar-width) !important;
  right: 0 !important;
  bottom: 24px !important;
  z-index: 60;
  width: min(980px, calc(100vw - var(--sidebar-width) - 68px)) !important;
  max-width: none !important;
  margin: 0 auto !important;
  padding: 12px;
  border: 1px solid rgba(229, 231, 235, 0.92);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 20px 70px rgba(15, 23, 42, 0.13);
  backdrop-filter: blur(20px);
  transform: none !important;
}

.gallery-layout .capsule-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
  align-items: end;
  gap: 10px;
}

.gallery-layout .capsule-prompt {
  min-height: 56px;
  max-height: 128px;
  padding: 15px 16px;
  border: 0;
  border-radius: 22px;
  background: #f8fafc;
  font-size: 15px;
  line-height: 1.55;
}

.gallery-layout .capsule-row .function-credit-hint {
  align-self: center;
}

.gallery-layout .capsule-icon-button {
  width: 50px;
  height: 50px;
  min-height: 50px;
  padding: 0;
  border-radius: 18px;
  flex: 0 0 50px;
}

.gallery-layout .capsule-submit-button {
  width: 58px;
  height: 50px;
  border-radius: 18px;
  background: #111827;
}

.gallery-layout .composer-thumbnail-zone {
  justify-content: flex-start;
  padding: 10px 8px 0;
}

.gallery-layout .composer-drop-zone {
  display: none;
}

.gallery-layout .composer-options {
  position: fixed !important;
  top: 86px !important;
  right: 24px !important;
  bottom: 24px !important;
  left: auto !important;
  z-index: 90;
  display: grid;
  align-content: start;
  grid-template-columns: 1fr;
  width: min(360px, calc(100vw - var(--sidebar-width) - 42px)) !important;
  margin-top: 0 !important;
  padding: 18px;
  border: 1px solid rgba(229, 231, 235, 0.92);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(18px);
  overflow: auto;
}

.gallery-layout .composer-options.hidden {
  display: none !important;
}

.drawer-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.drawer-panel-head > div {
  display: grid;
  gap: 4px;
}

.drawer-panel-head strong {
  font-size: 16px;
}

.drawer-panel-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.drawer-panel-head .icon-button {
  width: 36px;
  height: 36px;
  background: #f8fafc;
  color: #475569;
}

.gallery-layout .composer-options .field {
  margin-top: 14px;
}

.gallery-layout .media-card {
  display: inline-block;
  width: 100%;
  margin: 0 0 22px;
  break-inside: avoid;
  border: 0;
  border-radius: 24px;
  background: transparent;
  box-shadow: none;
}

.gallery-layout .media-surface {
  position: relative;
  overflow: hidden;
  min-height: auto;
  border: 0;
  border-radius: 24px;
  background: transparent;
  box-shadow: none;
}

.gallery-layout .media-card.image .media-surface,
.gallery-layout .media-card.video .media-surface {
  aspect-ratio: auto;
}

.gallery-layout .media-thumb,
.gallery-layout .media-card.image img.media-thumb,
.gallery-layout .media-card.video .media-thumb {
  display: block;
  width: 100%;
  height: auto;
  min-height: 260px;
  max-height: none;
  object-fit: cover;
  border-radius: 24px;
  background: #f1f5f9;
}

.gallery-layout .media-overlay {
  position: absolute;
  inset: auto 0 0;
  display: grid;
  gap: 8px;
  padding: 56px 16px 14px;
  color: #fff;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0), rgba(15, 23, 42, 0.72));
}

.gallery-layout .media-prompt {
  margin: 0;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.55;
}

.gallery-layout .media-meta {
  color: rgba(255, 255, 255, 0.86);
}

.gallery-layout .media-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.gallery-layout .media-card:hover .media-actions {
  opacity: 1;
  transform: translateY(0);
}

.gallery-layout .media-actions .icon-button {
  width: 38px;
  height: 38px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
}

@media (max-width: 900px) {
  .gallery-layout.flow-workbench {
    padding-bottom: 230px;
  }

  .gallery-layout .flow-topbar {
    top: 64px;
  }

  .gallery-layout .floating-composer {
    left: 14px !important;
    right: 14px !important;
    bottom: 14px !important;
    width: auto !important;
  }

  .gallery-layout .composer-options {
    position: fixed !important;
    top: 84px !important;
    right: 14px !important;
    left: 14px !important;
    bottom: 108px !important;
    width: auto !important;
    margin-top: 0 !important;
  }

  .gallery-layout .flow-masonry {
    column-count: 2;
  }
}

@media (max-width: 560px) {
  .gallery-layout .capsule-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .gallery-layout .capsule-row > .capsule-prompt {
    grid-column: 1 / -1;
  }

  .gallery-layout .capsule-row .function-credit-hint {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-left: 6px;
  }

  .gallery-layout .flow-masonry {
    column-count: 1;
  }
}
