:root {
  --blush: #5aafff;
  --lavender: #baddff;
  --surface: #fafcff;
  --surface-strong: #ffffff;
  --ink: #2c3e50;
  --muted: #5a7a9b;
  --soft: #f0f7ff;
  --line: #d6e6f5;
  --brand: #1e4f80;
  --brand-dark: #1e4f80;
  --accent: #3b94e6;
  --success: #26795f;
  --danger: #b4233b;
  --warning: #a86808;
  --shadow: 0 18px 45px rgba(31, 41, 51, 0.11);
  --sky-50: #f0f7ff;
  --sky-100: #e0efff;
  --sky-200: #baddff;
  --sky-300: #8ec8ff;
  --sky-400: #5aafff;
  --sky-500: #3b94e6;
  --sky-600: #2a6db3;
  --sky-700: #1e4f80;
  --cream: #fafcff;
  --text-dark: #2c3e50;
  --text-mid: #5a7a9b;
  --text-light: #8bacc8;
  --border: #d6e6f5;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Jost', Arial, sans-serif;
  color: var(--ink);
  background: var(--surface);
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

.top-stripe {
  height: 6px;
  background: linear-gradient(90deg, #356c8f, #67a0a7, #c54965);
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 32px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: var(--ink);
}

h1 {
  font-size: 34px;
  line-height: 1;
}

.header-copy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

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

.save-state {
  min-width: 120px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.save-state.dirty {
  color: var(--warning);
}

.save-state.saved {
  color: var(--success);
}

.save-state.error {
  color: var(--danger);
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.danger-btn {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 700;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}

.primary-btn {
  background: var(--brand);
  color: #ffffff;
}

.primary-btn:hover:not(:disabled) {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

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

.save-btn {
  box-shadow: 0 10px 24px rgba(53, 108, 143, 0.25);
}

.secondary-btn {
  background: var(--ink);
  color: #ffffff;
}

.secondary-btn:hover {
  background: #111820;
}

.ghost-btn {
  background: #ffffff;
  color: var(--ink);
  border-color: var(--line);
}

.ghost-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.danger-btn {
  background: #ffffff;
  color: var(--danger);
  border-color: rgba(180, 35, 59, 0.28);
}

.danger-btn:hover {
  background: #fff1f3;
  border-color: var(--danger);
}

.admin-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 24px 32px 48px;
}

.admin-tools {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(160px, 0.7fr) minmax(170px, 0.7fr) auto auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.tool-group,
.card-fields label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
}

textarea {
  min-height: 78px;
  resize: vertical;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(53, 108, 143, 0.12);
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 14px;
}

.summary-row strong {
  margin-right: 10px;
  color: var(--ink);
}

.draft-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #f2c46d;
  border-radius: 8px;
  background: #fff8e8;
  color: #674100;
}

.draft-notice button {
  border: none;
  background: transparent;
  color: var(--brand);
  font-weight: 700;
}

.products-loading,
.products-error,
.empty-state {
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 280px;
  text-align: center;
  color: var(--muted);
}

.products-error[hidden],
.empty-state[hidden],
.draft-notice[hidden] {
  display: none;
}

.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.admin-card {
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  box-shadow: 0 10px 28px rgba(31, 41, 51, 0.07);
}

.admin-card.changed {
  border-color: rgba(53, 108, 143, 0.7);
  box-shadow: 0 12px 32px rgba(53, 108, 143, 0.14);
}

.card-preview {
  background: #ffffff;
}

.product-img {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--soft);
  cursor: pointer;
}

.img-upload-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(31, 41, 51, 0.48);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  opacity: 0;
  transition: opacity 0.18s;
  pointer-events: none;
}

.product-img:hover .img-upload-overlay {
  opacity: 1;
}

.product-img.drag-over-img .img-upload-overlay {
  opacity: 1;
  background: rgba(53, 108, 143, 0.6);
}

.product-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-img.uploading::after {
  content: 'Lista para subir';
  position: absolute;
  right: 12px;
  bottom: 12px;
  border-radius: 8px;
  padding: 5px 9px;
  color: #ffffff;
  background: rgba(31, 41, 51, 0.78);
  font-size: 11px;
  font-weight: 700;
}

.product-img img[src=""],
.product-img img:not([src]) {
  display: none;
}

.placeholder-icon {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.badge {
  position: absolute;
  top: 12px;
  left: 12px;
  display: none;
  max-width: calc(100% - 24px);
  overflow: hidden;
  border-radius: 8px;
  padding: 5px 10px;
  color: #ffffff;
  background: var(--accent);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge.visible {
  display: block;
}

.product-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  text-align: center;
}

.wysiwyg-input,
.wysiwyg-textarea {
  border: 1px dashed var(--line);
  background: rgba(238, 242, 246, 0.45);
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.wysiwyg-input:hover,
.wysiwyg-textarea:hover {
  border-color: var(--muted);
  background: #ffffff;
}

.preview-name {
  min-height: 38px;
  padding: 6px 8px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
}

.preview-description {
  min-height: 64px;
  padding: 6px 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.price-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preview-price,
.preview-offer {
  min-height: 36px;
  color: var(--brand);
  font-size: 16px;
  font-weight: 800;
}

.preview-offer {
  color: var(--accent);
}

.chip-preview {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  min-height: 18px;
}

.color-dot {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(31, 41, 51, 0.18);
  border-radius: 50%;
  flex: 0 0 auto;
}

.sizes {
  min-height: 17px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.card-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}

.upload-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.image-dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 138px;
  padding: 18px;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.image-dropzone.compact {
  min-height: 52px;
  padding: 10px 18px;
}

.image-dropzone strong {
  color: var(--ink);
  font-size: 14px;
}

.image-dropzone span {
  font-size: 12px;
}

.upload-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.plus-btn {
  color: var(--brand);
}

.image-dropzone.drag-over {
  border-color: var(--brand);
  background: #f0f7fb;
  color: var(--brand);
}

.extra-images-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.extra-thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.extra-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.extra-thumb.pending::after {
  content: 'Subir';
  position: absolute;
  left: 6px;
  bottom: 6px;
  border-radius: 8px;
  padding: 3px 6px;
  color: #ffffff;
  background: rgba(31, 41, 51, 0.76);
  font-size: 10px;
  font-weight: 700;
}

.remove-image {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  min-height: 24px;
  padding: 0;
  border: none;
  border-radius: 8px;
  color: #ffffff;
  background: rgba(31, 41, 51, 0.75);
  font-size: 16px;
  line-height: 1;
}

.extra-add-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border: 1.5px dashed var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 0;
  transition: border-color 0.18s, background 0.18s;
}

.extra-add-cell:hover {
  border-color: var(--brand);
  background: #f0f7fb;
}

.extra-add-icon {
  color: var(--muted);
  font-size: 22px;
  font-weight: 300;
  line-height: 1;
  pointer-events: none;
}

.extra-add-cell:hover .extra-add-icon {
  color: var(--brand);
}

.extra-images-list.drag-over {
  outline: 2px dashed var(--brand);
  outline-offset: 3px;
  border-radius: 8px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.color-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.selected-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 34px;
}

.selected-color-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 7px 5px 9px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.remove-color {
  width: 22px;
  min-height: 22px;
  padding: 0;
  border: none;
  border-radius: 8px;
  color: var(--muted);
  background: var(--soft);
  font-size: 14px;
  line-height: 1;
}

.remove-color:hover {
  color: #ffffff;
  background: var(--danger);
}

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

.custom-color-row {
  grid-template-columns: minmax(0, 1fr) 52px auto;
}

.custom-color-hex {
  min-width: 52px;
  padding: 6px;
}

/* ── Sizes editor ── */
.sizes-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sizes-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.size-chip {
  min-height: 30px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.size-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.size-chip.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.size-chip.active:hover {
  background: var(--brand-dark, var(--brand));
  border-color: var(--brand-dark, var(--brand));
}

.size-chip.custom {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-color: var(--muted);
  background: var(--soft);
  color: var(--ink);
}

.size-chip.custom:hover {
  border-color: var(--danger);
  background: #fff1f3;
  color: var(--danger);
}

.size-remove {
  font-size: 14px;
  line-height: 1;
  pointer-events: none;
}

.size-custom-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.check-row {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  color: var(--ink) !important;
  font-size: 13px !important;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.app-dialog {
  width: min(420px, calc(100vw - 32px));
  border: none;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

.app-dialog::backdrop {
  background: rgba(31, 41, 51, 0.45);
}

.app-dialog form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
}

.app-dialog p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.help-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border: none;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.help-dialog::backdrop {
  background: rgba(31, 41, 51, 0.5);
}

.help-dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
}

.help-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 12px;
  border-bottom: 1px solid var(--line);
}

.help-dialog-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.help-dialog-body {
  overflow-y: auto;
  padding: 14px 22px;
}

.help-dialog-body p {
  margin: 0 0 12px;
  color: var(--ink);
  line-height: 1.45;
  font-size: 14px;
}

.help-dialog-body p:last-child {
  margin-bottom: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 15px;
}

@media (max-width: 1180px) {
  .admin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .admin-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  h1 {
    font-size: 28px;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .save-state {
    width: 100%;
    min-width: 0;
    text-align: left;
  }

  .admin-shell {
    padding: 18px 16px 40px;
  }

  .admin-tools,
  .admin-grid,
  .field-grid,
  .color-row,
  .custom-color-row {
    grid-template-columns: 1fr;
  }

  .summary-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .draft-notice {
    align-items: flex-start;
    flex-wrap: wrap;
  }
}

@media (max-width: 520px) {
  .admin-header {
    position: static;
  }

  .primary-btn,
  .secondary-btn,
  .ghost-btn,
  .danger-btn {
    width: 100%;
  }

  .card-footer,
  .dialog-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .extra-images-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* ── Card top bar ── */
.card-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 0;
  min-height: 32px;
}

.card-checkbox-wrap {
  display: flex;
  align-items: center;
  cursor: pointer;
}

.card-checkbox {
  width: 16px;
  min-height: 16px;
  cursor: pointer;
}

.drag-handle {
  color: var(--line);
  font-size: 18px;
  line-height: 1;
  cursor: grab;
  padding: 2px 4px;
  border-radius: 4px;
  user-select: none;
  transition: color 0.15s;
}

.drag-handle:hover {
  color: var(--muted);
}

.drag-handle:active {
  cursor: grabbing;
}

/* ── Drag states ── */
.admin-card.dragging {
  opacity: 0.45;
  outline: 2px dashed var(--brand);
  outline-offset: -2px;
}

.admin-card.drop-target {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
  box-shadow: 0 0 0 4px rgba(53, 108, 143, 0.15);
}

@keyframes highlight-flash {
  0%   { box-shadow: 0 0 0 4px rgba(53, 108, 143, 0.55); }
  100% { box-shadow: 0 10px 28px rgba(31, 41, 51, 0.07); }
}

.admin-card.highlight-flash {
  animation: highlight-flash 1.2s ease-out forwards;
}

/* ── Card footer actions ── */
.card-footer-actions {
  display: flex;
  gap: 8px;
}

/* ── Bulk toolbar ── */
.bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 10px 14px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  background: #f0f7fb;
}

.bulk-toolbar[hidden] {
  display: none;
}

.bulk-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand);
  white-space: nowrap;
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.bulk-actions select {
  min-height: 36px;
  font-size: 13px;
  width: auto;
}

.bulk-actions .ghost-btn,
.bulk-actions .danger-btn {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 13px;
  white-space: nowrap;
}

/* ── Publish dialog ── */
.publish-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  border: none;
  border-radius: 12px;
  padding: 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.publish-dialog::backdrop {
  background: rgba(31, 41, 51, 0.5);
}

.publish-dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
}

.publish-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

.publish-summary-lead {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
  flex: 0 0 auto;
  transition: border-color 0.15s, color 0.15s;
}

.icon-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.publish-sections {
  overflow-y: auto;
  flex: 1 1 auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.publish-dialog .dialog-actions {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
  margin-top: 0;
}

.publish-section-title {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
}

.publish-section-added .publish-section-title { color: var(--success); }
.publish-section-deleted .publish-section-title { color: var(--danger); }
.publish-section-modified .publish-section-title { color: var(--warning); }

.publish-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.publish-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.publish-item-img-wrap {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--soft);
  flex: 0 0 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.publish-item-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.publish-item-no-img {
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  text-align: center;
}

.publish-item-info {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.publish-item-info strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.publish-item-detail {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.publish-item-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}

.publish-item-actions .ghost-btn,
.publish-item-actions .danger-btn {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 12px;
  white-space: nowrap;
}

/* ── Toast ── */
.toast-stack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  max-width: 340px;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  background: var(--ink);
  box-shadow: 0 8px 24px rgba(31, 41, 51, 0.22);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-warning { background: var(--warning); }

/* ── Image hover popover ── */
.image-popover {
  position: fixed;
  z-index: 8888;
  width: 220px;
  height: 220px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(31, 41, 51, 0.22);
  pointer-events: none;
  border: 1px solid var(--line);
  background: var(--soft);
}

.image-popover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Maintenance admin button ── */

.maintenance-toggle-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  position: relative;
}

.maintenance-toggle-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.maintenance-toggle-btn.maintenance-active {
  border-color: var(--warning);
  color: var(--warning);
  background: #fffbf0;
}

.maintenance-btn-icon {
  font-size: 15px;
  line-height: 1;
}

.maintenance-status-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--warning);
  border: 2px solid var(--surface-strong);
}

/* ── Maintenance dialog ── */

.maintenance-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  box-shadow: var(--shadow);
  width: min(540px, 96vw);
  max-height: 88vh;
  overflow: hidden;
}

.maintenance-dialog::backdrop {
  background: rgba(31, 41, 51, 0.45);
  backdrop-filter: blur(3px);
}

.maintenance-dialog-inner {
  display: flex;
  flex-direction: column;
  max-height: 88vh;
  overflow: hidden;
}

.maintenance-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.maintenance-dialog-lead {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.maintenance-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 24px;
  color: var(--muted);
  font-size: 14px;
}

.maintenance-loading[hidden],
.maintenance-body[hidden],
.maintenance-actions[hidden] {
  display: none;
}

.maintenance-body {
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.maintenance-toggle-row {
  padding: 14px 16px;
  background: var(--soft);
  border-radius: 10px;
}

.maintenance-toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  cursor: default;
}

.maintenance-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.maintenance-toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.maintenance-toggle-track {
  position: relative;
  width: 40px;
  height: 22px;
  border-radius: 11px;
  background: var(--line);
  transition: background 0.2s;
  flex-shrink: 0;
}

.maintenance-toggle-wrap.active .maintenance-toggle-track {
  background: var(--warning);
}

.maintenance-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: left 0.2s;
}

.maintenance-toggle-wrap.active .maintenance-toggle-thumb {
  left: 21px;
}

.maintenance-toggle-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  min-width: 52px;
}

.maintenance-toggle-wrap.active .maintenance-toggle-text {
  color: var(--warning);
}

.maintenance-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.maintenance-presets {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.maintenance-presets-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.maintenance-presets-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.maintenance-presets-row {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px;
  align-items: end;
}

.maintenance-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.maintenance-texts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.maintenance-section label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.maintenance-section label input[type="text"],
.maintenance-section label input[type="url"],
.maintenance-section label input[type="tel"],
.maintenance-section label select,
.maintenance-section label input[type="datetime-local"] {
  padding: 8px 10px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  background: var(--surface-strong);
  color: var(--ink);
  transition: border-color 0.15s;
}

.maintenance-section label input:focus {
  outline: none;
  border-color: var(--brand);
}

.maintenance-section label select:focus {
  outline: none;
  border-color: var(--brand);
}

@media (max-width: 640px) {
  .maintenance-presets-header,
  .maintenance-presets-row,
  .maintenance-dates {
    grid-template-columns: 1fr;
  }

  .maintenance-presets-header {
    display: grid;
  }
}

/* ── Store-side maintenance (existing) ── */

html.maintenance-active,
html.maintenance-active body {
  overflow: hidden;
}

.maintenance-screen {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--surface);
  color: var(--ink);
}

.maintenance-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--soft), var(--surface-strong), var(--surface));
  opacity: 0.9;
}

.maintenance-panel {
  position: relative;
  width: min(560px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  text-align: center;
}

.maintenance-kicker {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--brand);
  text-transform: uppercase;
}

.maintenance-panel h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.15;
  color: var(--brand-dark);
}

.maintenance-message,
.maintenance-detail,
.maintenance-eta {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.maintenance-detail,
.maintenance-eta {
  font-size: 14px;
}

.maintenance-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 22px;
  min-height: 42px;
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.maintenance-action:hover {
  background: var(--brand-dark);
}

/* Product detail dialog */

.product-detail-dialog {
  border: none;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
  width: min(980px, 96vw);
  max-height: 90vh;
  overflow: hidden;
}

.product-detail-dialog::backdrop {
  background: rgba(31, 41, 51, 0.45);
  backdrop-filter: blur(3px);
}

.product-detail-inner {
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

.product-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.product-detail-header h2 {
  margin: 4px 0 0;
  font-size: 24px;
}

.product-detail-body {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
  overflow-y: auto;
  padding: 18px 24px;
}

.product-detail-preview,
.product-detail-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.product-detail-body label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.product-detail-body input[type="text"],
.product-detail-body input[type="url"],
.product-detail-body textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.product-detail-body textarea {
  min-height: 130px;
  resize: vertical;
}

.product-detail-image {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.product-detail-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-detail-image img[hidden] {
  display: none;
}

.product-detail-image .placeholder-icon {
  color: var(--muted);
  font-size: 14px;
}

.product-detail-preview .extra-images-list {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.product-detail-preview .extra-thumb {
  border-radius: 8px;
}

.product-detail-preview-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.product-detail-preview .preview-colors {
  justify-content: flex-start;
}

.product-detail-preview .preview-sizes {
  min-height: 0;
}

.product-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.product-detail-featured {
  flex-direction: row !important;
  align-items: center;
}

/* ── View toggle ── */

.view-toggle-group {
  display: flex;
  gap: 2px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px;
}

.view-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.view-toggle-btn:hover {
  color: var(--ink);
}

.view-toggle-btn[aria-pressed="true"] {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(31, 41, 51, 0.12);
}

/* ── List view ── */

.admin-grid.list-view {
  grid-template-columns: 1fr;
  gap: 4px;
}

.admin-grid.list-view .admin-card {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  border-radius: 6px;
  cursor: pointer;
}

.admin-grid.list-view .card-preview {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex: 0 0 auto;
}

.admin-grid.list-view .card-top-bar {
  flex-direction: column;
  justify-content: center;
  padding: 0 8px;
  min-height: auto;
  gap: 4px;
}

.admin-grid.list-view .drag-handle {
  font-size: 14px;
}

.admin-grid.list-view .product-img {
  width: 64px;
  height: 64px;
  min-width: 64px;
  aspect-ratio: auto;
}

.admin-grid.list-view .product-info {
  flex-direction: row;
  align-items: center;
  padding: 8px 10px;
  gap: 8px;
  text-align: left;
  border-left: 1px solid var(--line);
}

.admin-grid.list-view .wysiwyg-input,
.admin-grid.list-view .wysiwyg-textarea {
  text-align: left;
}

.admin-grid.list-view .preview-name {
  width: 160px;
  min-width: 80px;
  min-height: 30px;
  font-size: 13px;
  padding: 4px 6px;
}

.admin-grid.list-view .preview-description,
.admin-grid.list-view .chip-preview,
.admin-grid.list-view .preview-sizes,
.admin-grid.list-view .badge {
  display: none;
}

.admin-grid.list-view .price-row {
  grid-template-columns: auto auto;
}

.admin-grid.list-view .preview-price,
.admin-grid.list-view .preview-offer {
  width: 70px;
  min-height: 30px;
  font-size: 13px;
  padding: 4px 6px;
}

.admin-grid.list-view .card-fields {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  flex: 1 1 auto;
  border-top: none;
  border-left: 1px solid var(--line);
}

.admin-grid.list-view .upload-group,
.admin-grid.list-view .color-editor,
.admin-grid.list-view .sizes-editor {
  display: none;
}

.admin-grid.list-view .field-grid {
  display: flex;
  flex-direction: row;
  gap: 8px;
  flex: 1 1 auto;
}

.admin-grid.list-view .card-fields label {
  flex-direction: row;
  align-items: center;
  gap: 4px;
  font-size: 0;
}

.admin-grid.list-view .card-fields label input {
  font-size: 13px;
  min-width: 90px;
}

.admin-grid.list-view .card-footer {
  border-top: none;
  padding: 0;
  flex-shrink: 0;
  margin-top: 0;
}

@media (max-width: 760px) {
  .product-detail-body {
    grid-template-columns: 1fr;
  }

  .product-detail-preview-actions {
    grid-template-columns: 1fr;
  }

  .product-detail-preview .extra-images-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .product-detail-grid {
    grid-template-columns: 1fr;
  }

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

  .publish-dialog-header {
    padding: 16px 16px 12px;
  }

  .publish-sections {
    padding: 12px 16px;
  }

  .publish-dialog .dialog-actions {
    padding: 12px 16px;
  }

  .card-footer-actions {
    flex-direction: column;
  }
}
