:root {
  --bg: #0f1114;
  --surface: #1a1d23;
  --surface2: #242830;
  --border: #2e3440;
  --text: #e8eaed;
  --text-muted: #9aa0a8;
  --accent: #c9a962;
  --accent-hover: #dfc07a;
  --accent-dim: rgba(201, 169, 98, 0.15);
  --card-fill: #e85222;
  --card-fill-hover: #f06a3d;
  --card-on-fill: #ffffff;
  --card-on-fill-muted: rgba(255, 255, 255, 0.88);
  --danger: #e57373;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --header-offset: 68px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: radial-gradient(circle at top right, #1a2230 0%, var(--bg) 40%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

body.sidebar-open {
  overflow: hidden;
}

/* Header */
.header {
  background: rgba(26, 29, 35, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 120;
  transition: transform 0.22s ease;
}

.header.header-hidden {
  transform: translateY(calc(-1 * var(--header-offset)));
}

.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0.65rem 1rem;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.user-session-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-logout {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  width: 100%;
  justify-content: center;
}

.btn-logout:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--surface2);
}

.brand h1 {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.brand-catalog-links {
  display: flex;
  gap: 0.65rem;
}

.brand-catalog-link {
  font-size: 0.72rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.brand-catalog-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex: 1;
  max-width: none;
  justify-content: flex-end;
}

.auth-area {
  position: relative;
}

.auth-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  min-width: 220px;
  padding: 0.55rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 200;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.auth-form input {
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  width: 100%;
}

.search-box {
  flex: 1;
  min-width: 180px;
}

.search-box input {
  width: 100%;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 0.95rem;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

/* Layout */
.layout {
  max-width: 1600px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  min-height: calc(100vh - var(--header-offset));
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem 0;
  position: sticky;
  top: calc(var(--header-offset) + 0.4rem);
  height: fit-content;
  max-height: calc(100vh - var(--header-offset) - 0.4rem);
  overflow-y: auto;
}

.sidebar-toggle {
  display: none;
  flex-shrink: 0;
}

.sidebar-backdrop {
  display: none;
}

.sidebar h2 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 1.25rem;
  margin-bottom: 0.75rem;
}

.section-filter {
  width: calc(100% - 2.5rem);
  margin: 0 1.25rem 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
}

.section-filter:focus {
  outline: none;
  border-color: var(--accent);
}

.sidebar-hint {
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.toolbar-left {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.breadcrumb {
  font-size: 1.1rem;
  font-weight: 600;
}

.group-nav {
  display: flex;
  flex-direction: column;
}

.group-link-wrap {
  display: flex;
  align-items: stretch;
  position: relative;
}

.group-link-wrap.active .group-link {
  background: var(--accent-dim);
  border-left-color: var(--accent);
  color: var(--accent-hover);
}

.group-link-wrap .group-link {
  flex: 1;
  min-width: 0;
}

.group-link__rename {
  flex-shrink: 0;
  align-self: center;
  margin-right: 0.5rem;
  padding: 0.2rem 0.45rem;
  font-size: 0.75rem;
  line-height: 1;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.group-link-wrap:hover .group-link__rename,
.group-link__rename:focus-visible {
  opacity: 1;
}

.group-link__rename:hover {
  color: var(--accent-hover);
  background: var(--surface2);
  border-color: var(--border);
}

.group-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 1.25rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.group-link:hover {
  background: var(--surface2);
}

.group-link.active {
  background: var(--accent-dim);
  border-left-color: var(--accent);
  color: var(--accent-hover);
}

.group-link.no-image-category {
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.group-link--service {
  border-left-color: var(--text-muted);
}

.group-link--service.active {
  border-left-color: #c9a227;
  color: #c9a227;
}

.group-service-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface2);
  border-radius: 4px;
  vertical-align: middle;
}

.group-link--service.active .group-service-tag {
  color: #8a7018;
  background: rgba(201, 162, 39, 0.15);
}

.group-link--editing {
  border-left-color: #d97706;
}

.group-link--editing.active {
  border-left-color: #f59e0b;
  color: #f59e0b;
}

.group-editing-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.35rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #f59e0b;
  background: rgba(245, 158, 11, 0.12);
  border-radius: 4px;
  vertical-align: middle;
}

.group-link--editing.active .group-editing-tag {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.22);
}

.detail-rename-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.folder-num-prefix {
  flex: 0 0 auto;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
}

.detail-rename-row input[type="text"] {
  flex: 1 1 12rem;
  min-width: 8rem;
}

#moveCategorySelect option.option-editing {
  background: #3d2a14;
  color: #f59e0b;
  font-weight: 600;
}

.group-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.main {
  padding: 1.25rem 1.5rem 2rem;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.result-count {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.view-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.selection-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.selection-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.selection-move-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.selection-move-label select {
  padding: 0.35rem 0.5rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  max-width: 12rem;
}

.view-controls select {
  margin-left: 0.35rem;
  padding: 0.35rem 0.5rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
}

/* Grid — узкие вытянутые карточки под портретные превью моделей */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  transition: opacity 0.15s ease;
}

.grid.is-loading {
  opacity: 0.55;
  pointer-events: none;
}

.card {
  background: var(--card-fill);
  border: 1px solid #c7431a;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--card-fill-hover);
  background: var(--card-fill-hover);
}

.card-image {
  position: relative;
  overflow: hidden;
  background: var(--card-fill);
  width: 100%;
  aspect-ratio: 3 / 4;
  min-height: 280px;
}

.card-image img,
.card-image .no-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.card-image img {
  object-fit: fill;
  object-position: center center;
  display: block;
}

.card-image .no-image {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1rem;
  text-align: center;
}

.card-badges {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  z-index: 1;
}

.badge {
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
}

.badge-accent {
  background: var(--accent);
  color: #1a1d23;
  font-weight: 600;
}

.card-body {
  padding: 0.85rem 1rem 1rem;
}

.card-tag {
  display: inline-block;
  margin-bottom: 0.45rem;
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
}

.card-select-wrap {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 4px;
  cursor: pointer;
}

.card-select {
  width: 0.95rem;
  height: 0.95rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.card--selected {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.grid--select-mode .card {
  cursor: pointer;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--card-on-fill);
}

.card-meta {
  font-size: 0.78rem;
  color: var(--card-on-fill-muted);
}

.card-caption {
  font-size: 0.78rem;
  color: var(--card-on-fill-muted);
  line-height: 1.35;
  margin: 0;
  white-space: pre-line;
}

.detail-caption-row textarea {
  width: 100%;
  min-height: 4.5rem;
  margin: 0.35rem 0 0.5rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  resize: vertical;
}

.detail-caption-row textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, opacity 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #1a1d23;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-accent {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn-accent:hover {
  background: rgba(201, 169, 98, 0.25);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-icon {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  padding: 0;
  justify-content: center;
}

.btn-icon span {
  font-size: 0.95rem;
  line-height: 1;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.auth-hint {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: var(--accent-dim);
  color: var(--accent-hover);
  font-size: 0.9rem;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1d23;
  font-weight: 600;
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* Modal */
.modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: min(1100px, 96vw);
  width: 100%;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 92vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--surface2);
  color: var(--text);
  font-size: 1.5rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
}

.modal-close:hover {
  background: var(--border);
}

.detail-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.detail-header h2 {
  font-size: 1.35rem;
  padding-right: 2.5rem;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.tag {
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  background: var(--accent-dim);
  color: var(--accent-hover);
  border-radius: 6px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.detail-gallery {
  padding: 1rem 1.5rem;
}

.detail-gallery h3,
.detail-section h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.gallery-item {
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
  aspect-ratio: 1;
  background: var(--surface2);
  position: relative;
}

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

.gallery-item:hover {
  border-color: var(--accent);
}

.lightbox-img {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  background: #000;
  border-radius: 8px;
}

.detail-section {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

.variant-block {
  background: var(--surface2);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.variant-block h4 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.file-list {
  list-style: none;
}

.file-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  gap: 0.5rem;
}

.file-list li:last-child {
  border-bottom: none;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.file-size {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 200;
  animation: fadeIn 0.3s;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.card.loading-skeleton .card-image {
  background: linear-gradient(90deg, var(--surface2) 25%, var(--border) 50%, var(--surface2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ——— Мобильная версия ——— */
@media (max-width: 768px) {
  .header-inner {
    padding: 0.5rem 0.75rem;
    gap: 0.5rem;
  }

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

  .header-actions {
    gap: 0.5rem;
  }

  .auth-popover {
    right: 0;
    left: auto;
    min-width: min(260px, 88vw);
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  .search-box {
    min-width: 0;
  }

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

  .sidebar {
    display: block;
    position: fixed;
    top: var(--header-offset);
    left: 0;
    bottom: 0;
    width: min(320px, 84vw);
    max-height: none;
    height: calc(100dvh - var(--header-offset));
    overflow-y: auto;
    border-right: 1px solid var(--border);
    border-bottom: none;
    padding: 0.75rem 0 1rem;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    z-index: 190;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    position: fixed;
    inset: var(--header-offset) 0 0 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 185;
    display: block;
  }

  .sidebar-backdrop.hidden {
    display: none;
  }

  .main {
    padding: 1rem;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .card-image {
    aspect-ratio: 3 / 4;
    min-height: 220px;
  }

  .card-body {
    padding: 0.65rem 0.75rem 0.75rem;
  }

  .card-title {
    font-size: 0.85rem;
    -webkit-line-clamp: 3;
  }

  .card-meta {
    font-size: 0.72rem;
  }

  .card:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border);
  }

  .card:active {
    border-color: var(--accent);
    opacity: 0.95;
  }

  .modal {
    max-width: 100%;
    width: 100%;
    height: 100%;
    max-height: 100%;
    margin: 0;
  }

  .modal-content {
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    min-height: 100%;
  }

  .modal-close {
    top: max(0.5rem, env(safe-area-inset-top));
    right: 0.5rem;
    width: 44px;
    height: 44px;
  }

  .detail-header {
    padding: 1rem 1rem 0.75rem;
    padding-top: max(1rem, env(safe-area-inset-top));
  }

  .detail-gallery,
  .detail-section {
    padding-left: 1rem;
    padding-right: 1rem;
  }

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

  .lightbox-img {
    max-height: 50vh;
    max-height: 50dvh;
  }

  .file-list li {
    flex-wrap: wrap;
  }

  .toast {
    left: 1rem;
    right: 1rem;
    bottom: max(1rem, env(safe-area-inset-bottom));
  }
}

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

  .card-image {
    aspect-ratio: 3 / 4;
    min-height: 320px;
  }
}

/* Display editor */
.display-editor-modal .modal-content {
  max-width: min(960px, 96vw);
  width: 100%;
}

.display-editor-title {
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.display-editor-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 1.25rem;
  align-items: start;
}

.display-editor-workspace {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
}

#displayEditorCanvas {
  max-width: 100%;
  height: auto;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  cursor: grab;
  touch-action: none;
  background: var(--surface2);
}

#displayEditorCanvas:active {
  cursor: grabbing;
}

.display-editor-controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.display-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.display-field input[type="range"] {
  width: 100%;
}

.display-editor-controls .card-image.display-preview-frame {
  width: 180px;
  height: 240px;
  min-height: 0;
  max-width: 180px;
  aspect-ratio: auto;
}

.display-preview-frame canvas,
.display-preview-frame img {
  width: 180px;
  height: 240px;
  display: block;
  object-fit: contain;
}

.display-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.detail-edit-block {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
}

.detail-edit-block h3 {
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.detail-edit-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.detail-edit-row input,
.detail-edit-row select {
  flex: 1;
  min-width: 140px;
  padding: 0.45rem 0.6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.detail-upload-row {
  flex-direction: column;
  align-items: stretch;
}

.upload-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  border: 2px dashed var(--border);
  border-radius: 10px;
  background: var(--surface);
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.upload-dropzone--over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.upload-dropzone--busy {
  opacity: 0.65;
  pointer-events: none;
}

.upload-dropzone__hint {
  margin: 0;
  font-size: 0.9rem;
}

.upload-dropzone__meta {
  margin: 0;
}

.upload-dropzone__input {
  display: none;
}

.gallery-item {
  position: relative;
}

.gallery-delete-btn {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  z-index: 2;
  padding: 0.2rem 0.45rem;
  font-size: 0.72rem;
  border-radius: 6px;
  border: none;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  cursor: pointer;
}

@media (max-width: 768px) {
  .display-editor-layout {
    grid-template-columns: 1fr;
  }
}
