:root {
  --shop-bg: #faf7f2;
  --shop-card: #ffffff;
  --shop-text: #222;
  --shop-muted: #6b5f55;
  --shop-border: #e8dfd3;
  --shop-orange: #f1641e;
  --shop-green: #1f8a4c;
  --shop-yellow: #b7791f;
  --shop-red: #c0392b;
  --shop-blue: #2563eb;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--shop-bg);
  color: var(--shop-text);
  font-family: "Segoe UI", system-ui, sans-serif;
  margin: 0;
}

a {
  color: inherit;
}

.shop-shell {
  margin: 0 auto;
  max-width: 1280px;
  padding: 20px;
}

.shop-header {
  align-items: center;
  border-bottom: 1px solid var(--shop-border);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
}

.shop-logo {
  color: var(--shop-orange);
  font-size: 1.8rem;
  font-weight: 700;
  text-decoration: none;
}

.shop-tagline {
  color: var(--shop-muted);
  margin: 4px 0 0;
}

.shop-header-meta {
  align-items: end;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shop-stats {
  color: var(--shop-muted);
  font-size: 0.92rem;
}

.shop-panel-link {
  background: #fff;
  border: 1px solid var(--shop-border);
  border-radius: 999px;
  color: var(--shop-text);
  font-size: 0.9rem;
  padding: 8px 14px;
  text-decoration: none;
}

.shop-notice {
  background: #fff8e6;
  border: 1px solid #e6c84b;
  border-radius: 14px;
  margin-bottom: 16px;
  padding: 12px 14px;
}

.shop-notice.hidden,
.hidden {
  display: none !important;
}

.shop-toolbar {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 220px;
  margin-bottom: 18px;
}

.shop-toolbar input,
.shop-toolbar select {
  background: #fff;
  border: 1px solid var(--shop-border);
  border-radius: 12px;
  font: inherit;
  padding: 12px 14px;
}

.shop-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.shop-card {
  background: var(--shop-card);
  border: 1px solid var(--shop-border);
  border-radius: 18px;
  cursor: pointer;
  display: grid;
  gap: 10px;
  overflow: hidden;
  padding: 0 0 14px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.shop-card:hover {
  box-shadow: 0 10px 24px rgba(34, 34, 34, 0.08);
  transform: translateY(-2px);
}

.shop-card-image {
  align-items: center;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #f6efe7, #efe4d7);
  color: var(--shop-muted);
  display: flex;
  font-size: 2.4rem;
  font-weight: 700;
  justify-content: center;
  overflow: hidden;
}

.shop-card-image img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.shop-card-body {
  display: grid;
  gap: 8px;
  padding: 0 14px;
}

.shop-card-title {
  -webkit-box-orient: vertical;
  display: -webkit-box;
  font-size: 0.98rem;
  -webkit-line-clamp: 2;
  line-height: 1.35;
  margin: 0;
  overflow: hidden;
}

.shop-card-meta,
.shop-card-stock {
  color: var(--shop-muted);
  font-size: 0.86rem;
}

.shop-card-mapping-note {
  color: var(--shop-muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.shop-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.shop-badge {
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
}

.badge-etsy {
  background: #fff1ea;
  color: var(--shop-orange);
}

.badge-simulation {
  background: #eef4ff;
  color: var(--shop-blue);
}

.badge-connected {
  background: #e8f7ee;
  color: var(--shop-green);
}

.badge-partial {
  background: #fff6df;
  color: var(--shop-yellow);
}

.badge-disconnected {
  background: #fdeeee;
  color: var(--shop-red);
}

.shop-mapping-legend {
  align-items: center;
  background: #fff;
  border: 1px solid var(--shop-border);
  border-radius: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-bottom: 16px;
  padding: 12px 14px;
}

.legend-item {
  align-items: center;
  color: var(--shop-muted);
  display: inline-flex;
  font-size: 0.86rem;
  gap: 8px;
}

.shop-mapping-stats {
  color: var(--shop-muted);
  font-size: 0.86rem;
  margin-left: auto;
}

.shop-card.status-connected {
  border-color: #9fd4b3;
  box-shadow: inset 0 0 0 1px #d8f1e2;
}

.shop-card.status-partial {
  border-color: #e6c76d;
  box-shadow: inset 0 0 0 1px #fff1c9;
}

.shop-card.status-disconnected {
  border-color: #e7a7a7;
  box-shadow: inset 0 0 0 1px #fde0e0;
}

.mapping-banner {
  border-radius: 14px;
  line-height: 1.45;
  padding: 12px 14px;
}

.mapping-banner.connected {
  background: #e8f7ee;
  border: 1px solid #9fd4b3;
  color: #17663a;
}

.mapping-banner.partial {
  background: #fff6df;
  border: 1px solid #e6c76d;
  color: #7a5712;
}

.mapping-banner.disconnected {
  background: #fdeeee;
  border: 1px solid #e7a7a7;
  color: #8f2323;
}

.mapping-banner strong {
  display: block;
  margin-bottom: 4px;
}

.shop-variant-table tr.sku-row-mapped {
  background: #f4fbf7;
}

.shop-variant-table tr.sku-row-unmapped {
  background: #fff7f7;
}

.sku-mapping-pill {
  border-radius: 999px;
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 8px;
}

.sku-mapping-pill.mapped {
  background: #e8f7ee;
  color: var(--shop-green);
}

.sku-mapping-pill.unmapped {
  background: #fdeeee;
  color: var(--shop-red);
}

.shop-empty {
  color: var(--shop-muted);
  grid-column: 1 / -1;
  padding: 40px 0;
  text-align: center;
}

.shop-detail-view {
  display: grid;
  gap: 18px;
}

.shop-back-btn {
  background: #fff;
  border: 1px solid var(--shop-border);
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  justify-self: start;
  padding: 10px 14px;
}

.shop-detail-content {
  background: #fff;
  border: 1px solid var(--shop-border);
  border-radius: 20px;
  display: grid;
  gap: 20px;
  padding: 20px;
}

.shop-detail-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(260px, 360px) 1fr;
}

.shop-detail-media,
.shop-detail-image {
  align-items: center;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #f6efe7, #efe4d7);
  border-radius: 16px;
  color: var(--shop-muted);
  display: flex;
  font-size: 3rem;
  font-weight: 700;
  justify-content: center;
  overflow: hidden;
}

.shop-gallery {
  display: grid;
  gap: 12px;
  width: 100%;
}

.shop-gallery-main {
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #f6efe7, #efe4d7);
  border-radius: 16px;
  overflow: hidden;
}

.shop-gallery-main img,
.shop-detail-image img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.shop-gallery-thumbs {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
}

.shop-gallery-thumb {
  aspect-ratio: 1 / 1;
  background: #fff;
  border: 2px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
}

.shop-gallery-thumb.active {
  border-color: var(--shop-orange);
}

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

.shop-gallery-empty {
  align-items: center;
  color: var(--shop-muted);
  display: flex;
  font-size: 1rem;
  height: 100%;
  justify-content: center;
  min-height: 260px;
}

.shop-properties-section h3 {
  margin: 0 0 10px;
}

.shop-properties-accordion {
  border: 1px solid var(--shop-border);
  border-radius: 14px;
  padding: 12px 14px;
}

.shop-properties-accordion summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-weight: 600;
  gap: 12px;
  justify-content: space-between;
  list-style: none;
}

.shop-properties-accordion summary::-webkit-details-marker {
  display: none;
}

.shop-properties-summary-meta {
  color: var(--shop-muted);
  font-size: 0.86rem;
  font-weight: 500;
}

.shop-taxonomy-meta,
.shop-properties-empty,
.shop-variant-meta {
  color: var(--shop-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  margin: 10px 0 0;
}

.shop-properties-table-wrap {
  margin-top: 12px;
  overflow: auto;
}

.shop-properties-table {
  border-collapse: collapse;
  min-width: 100%;
}

.shop-properties-table th,
.shop-properties-table td {
  border-bottom: 1px solid var(--shop-border);
  padding: 10px 12px;
  text-align: left;
}

.shop-properties-table th {
  background: #fbf8f4;
  color: var(--shop-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.shop-properties-table tr.property-empty td:last-child {
  color: #9a8f84;
  font-style: italic;
}

.shop-detail-title {
  font-size: 1.5rem;
  line-height: 1.3;
  margin: 0 0 8px;
}

.shop-detail-price {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 12px;
}

.shop-detail-description {
  color: var(--shop-muted);
  line-height: 1.55;
  white-space: pre-wrap;
}

.shop-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shop-tag {
  background: #f6f1ea;
  border-radius: 999px;
  font-size: 0.82rem;
  padding: 6px 10px;
}

.shop-variant-table-wrap {
  overflow: auto;
}

.shop-variant-table {
  border-collapse: collapse;
  min-width: 100%;
}

.shop-variant-table th,
.shop-variant-table td {
  border-bottom: 1px solid var(--shop-border);
  padding: 10px 12px;
  text-align: left;
}

.shop-variant-table th {
  background: #fbf8f4;
  color: var(--shop-muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.shop-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.shop-detail-actions a,
.shop-detail-actions button {
  background: #fff;
  border: 1px solid var(--shop-border);
  border-radius: 12px;
  color: inherit;
  cursor: pointer;
  font: inherit;
  padding: 10px 14px;
  text-decoration: none;
}

.shop-detail-actions a.primary {
  background: var(--shop-orange);
  border-color: var(--shop-orange);
  color: #fff;
}

.shop-ai-section {
  background: #fffaf5;
  border: 1px solid #f0dcc8;
  border-radius: 16px;
  display: grid;
  gap: 12px;
  padding: 16px;
}

.shop-ai-header {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.shop-ai-header h3 {
  margin: 0 0 6px;
}

.shop-ai-gap-summary,
.shop-ai-disclaimer,
.shop-ai-addressed {
  color: var(--shop-muted);
  font-size: 0.9rem;
  line-height: 1.45;
  margin: 0;
}

.shop-ai-btn {
  background: var(--shop-orange);
  border: none;
  border-radius: 12px;
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 10px 14px;
  white-space: nowrap;
}

.shop-ai-btn:disabled {
  cursor: wait;
  opacity: 0.7;
}

.shop-ai-notes-label {
  color: var(--shop-muted);
  font-size: 0.86rem;
}

.shop-ai-notes {
  background: #fff;
  border: 1px solid var(--shop-border);
  border-radius: 12px;
  font: inherit;
  padding: 10px 12px;
  resize: vertical;
  width: 100%;
}

.shop-ai-status {
  border-radius: 12px;
  font-size: 0.9rem;
  padding: 10px 12px;
}

.shop-ai-status.error {
  background: #fdeeee;
  border: 1px solid #e7a7a7;
  color: #8f2323;
}

.shop-ai-status.success {
  background: #e8f7ee;
  border: 1px solid #9fd4b3;
  color: #17663a;
}

.shop-ai-result-card {
  background: #fff;
  border: 1px solid var(--shop-border);
  border-radius: 14px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.shop-ai-result-head {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shop-ai-confidence,
.shop-ai-feed-badge {
  background: #f6f1ea;
  border-radius: 999px;
  font-size: 0.78rem;
  padding: 4px 8px;
}

.shop-ai-description {
  color: var(--shop-muted);
  line-height: 1.55;
  white-space: pre-wrap;
}

.shop-ai-notes-list {
  color: var(--shop-muted);
  margin: 0;
  padding-left: 18px;
}

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

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