/* ==========================================================================
   Catalog presentation: uniform product cards, brand artwork tiles,
   auto-laid-out descriptions and warranty fine print.
   Loaded last so desktop grid sizing wins over the earlier fixed 4-up grid.
   ========================================================================== */

/* ---------- Uniform, responsive product grid ---------- */
.products-grid,
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 16px;
  align-items: stretch;
}

.product {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  overflow: hidden;
}

.product-media {
  position: relative;
  flex-shrink: 0;
}

.product-art {
  width: 100%;
  height: 122px;
  display: grid;
  place-items: center;
  padding: 0;
}

.product-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  padding: 13px 15px 15px;
}

.product-category {
  margin: 0;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-title {
  margin: 5px 0 0;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 650;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
  overflow-wrap: anywhere;
}

.product-desc {
  margin-top: 7px;
  max-height: 3.1em;
  overflow: hidden;
  font-size: 10px;
  line-height: 1.5;
  color: #a9a2bb;
}

.product-availability {
  margin: 9px 0 0;
  font-size: 9px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-bottom {
  margin-top: auto;
  padding-top: 11px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
}

.product-price {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.product-price strong {
  font-size: 16px;
  line-height: 1.15;
  white-space: nowrap;
}

/* Warranty is fine print now, never a badge. */
.product-warranty-note {
  font-size: 9px;
  line-height: 1.35;
  color: #7f7691;
  letter-spacing: 0.01em;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.product-warranty-note.detail {
  margin: 10px 0 0;
  white-space: normal;
  font-size: 10px;
  color: var(--muted);
}

/* Order history and support lists use the same quiet fine print. */
.warranty-note-line {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.35;
  color: #7f7691;
  letter-spacing: 0.01em;
}

.warranty-note-line.is-expired {
  color: #8b8398;
}

[data-theme='white'] .warranty-note-line {
  color: #7b8794;
}

.product-actions-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.product.is-sold-out .product-art,
.product.is-sold-out .product-title {
  opacity: 0.62;
}

.product-stock-flag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(240, 180, 41, 0.16);
  border: 1px solid rgba(240, 180, 41, 0.42);
  color: #f2c869;
  pointer-events: none;
}

/* ---------- Brand artwork tiles ---------- */
.brand-tile {
  position: relative;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 19px;
  background:
    radial-gradient(115% 115% at 28% 12%, var(--brand-soft), rgba(255, 255, 255, 0) 68%),
    linear-gradient(155deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--brand-line);
  box-shadow:
    0 12px 26px -12px var(--brand-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.brand-tile:before {
  content: '';
  position: absolute;
  inset: -40% -40% auto auto;
  width: 120%;
  height: 120%;
  background: radial-gradient(circle at 70% 25%, var(--brand-soft), rgba(255, 255, 255, 0) 60%);
  pointer-events: none;
}

.brand-tile .brand-svg {
  width: 32px;
  height: 32px;
  position: relative;
  filter: drop-shadow(0 3px 8px var(--brand-glow));
}

.brand-svg[data-contrast='light'] {
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.55));
}

.brand-svg[data-contrast='light-stroke'] {
  stroke: #e9ddfb;
}

/* ---------- Photo artwork ---------- */
.product-image-mark {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 19px;
  overflow: hidden;
  border: 1px solid rgba(171, 155, 250, 0.28);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 12px 26px -12px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.product-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.product-art .product-image-mark,
.product-art .brand-tile {
  width: 62px;
  height: 62px;
}

.product-art .custom-product-svg {
  width: 58px;
  height: 58px;
}

.product-art .generic-product-mark {
  width: 62px;
  height: 62px;
}

/* Smaller artwork inside rows, modals and previews */
.line-item .brand-tile,
.line-item .product-image-mark,
.history-order-art .brand-tile,
.history-order-art .product-image-mark,
.reorder-product-card .brand-tile,
.reorder-product-card .product-image-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
}

.line-item .brand-tile .brand-svg,
.history-order-art .brand-tile .brand-svg {
  width: 22px;
  height: 22px;
}

.history-order-art .generic-product-mark,
.line-item .generic-product-mark {
  width: 44px;
  height: 44px;
}

/* ---------- Auto-laid-out description ---------- */
.product-detail-desc,
.product-desc {
  min-width: 0;
}

.desc-heading {
  margin: 12px 0 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #b49ae0;
}

.desc-heading:first-child {
  margin-top: 0;
}

.desc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 3px;
}

.desc-item {
  position: relative;
  padding-left: 12px;
  font-size: 11px;
  line-height: 1.5;
  color: #b7aecb;
  overflow-wrap: anywhere;
}

.desc-item:before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.52em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #8b78ff;
}

.desc-item.tone-yes:before {
  background: #4ade80;
}

.desc-item.tone-no:before {
  background: #fb7185;
}

.desc-item.tone-warn:before {
  background: #fbbf24;
}

.desc-text {
  margin: 5px 0;
  font-size: 11px;
  line-height: 1.62;
  color: #a89fbd;
  overflow-wrap: anywhere;
}

.desc-more {
  margin: 5px 0 0;
  font-size: 9px;
  letter-spacing: 0.04em;
  color: #8d84a5;
}

.product-detail-desc {
  margin: 12px 0 0;
  max-height: 46vh;
  overflow: auto;
}

.product-detail-meta {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.product-detail-instructions {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: #a89fbd;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.product-detail-art {
  height: 150px;
  border-radius: 14px;
  border: 1px solid var(--line);
}

.product-detail-art .brand-tile,
.product-detail-art .product-image-mark {
  width: 84px;
  height: 84px;
  border-radius: 24px;
}

.product-detail-art .brand-tile .brand-svg {
  width: 42px;
  height: 42px;
}

/* Compact variant used inside the card keeps two tidy lines */
.product-desc .desc-list {
  gap: 1px;
}

.product-desc .desc-item {
  font-size: 10px;
  padding-left: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-desc .desc-text {
  margin: 2px 0;
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Admin: artwork editor, image upload, brand defaults ---------- */
.artwork-editor-kinds {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 0;
}

.artwork-editor-kinds .btn {
  font-size: 10px;
}

.artwork-image-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(165, 112, 203, 0.18);
  display: grid;
  gap: 12px;
}

.artwork-image-drop {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 18px;
  border: 1px dashed rgba(165, 112, 203, 0.42);
  border-radius: 14px;
  background: rgba(151, 94, 219, 0.06);
  text-align: center;
  font-size: 11px;
  color: #b8a4cf;
}

.artwork-image-drop.dragover {
  border-color: #c084fc;
  background: rgba(168, 85, 247, 0.14);
}

.artwork-image-drop input[type='file'] {
  display: block;
  width: 100%;
  font-size: 10px;
  min-height: 38px;
  padding: 8px;
}

.artwork-image-current {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(165, 112, 203, 0.22);
  border-radius: 14px;
  background: rgba(20, 12, 34, 0.7);
}

.artwork-image-current img {
  width: 66px;
  height: 66px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid rgba(171, 155, 250, 0.3);
  flex-shrink: 0;
}

.artwork-image-current > div {
  min-width: 0;
  flex: 1;
}

.artwork-image-current strong {
  display: block;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.artwork-image-current small {
  display: block;
  font-size: 9px;
  color: #9c8cb0;
  margin-top: 3px;
}

.artwork-brand-default {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(165, 112, 203, 0.24);
  border-radius: 13px;
  background: rgba(151, 94, 219, 0.07);
  font-size: 10px;
  line-height: 1.6;
  color: #c1aada;
}

.artwork-brand-default input {
  width: auto;
  margin: 0;
  flex-shrink: 0;
}

.brand-artwork-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.brand-artwork-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 13px;
  border: 1px solid rgba(165, 112, 203, 0.2);
  border-radius: 15px;
  background: rgba(19, 12, 32, 0.7);
  min-width: 0;
}

.brand-artwork-card.is-set {
  border-color: rgba(168, 85, 247, 0.5);
  background: rgba(88, 42, 138, 0.16);
}

.brand-artwork-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-artwork-head .brand-artwork-thumb {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}

.brand-artwork-head .brand-artwork-thumb .brand-tile,
.brand-artwork-head .brand-artwork-thumb .product-image-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
}

.brand-artwork-head .brand-artwork-thumb .brand-svg,
.brand-artwork-head .brand-artwork-thumb svg {
  width: 21px;
  height: 21px;
}

.brand-artwork-head strong {
  font-size: 11px;
  overflow-wrap: anywhere;
  min-width: 0;
}

.brand-artwork-head small {
  display: block;
  font-size: 8.5px;
  color: #9a89b0;
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.brand-artwork-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.brand-artwork-actions .btn {
  font-size: 9px;
  padding: 7px 9px;
  flex: 1 1 auto;
}

.brand-artwork-search {
  max-width: 380px;
  margin: 0 0 18px;
}

/* Team / administrator management */
.team-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 6px;
}

.team-admin-card {
  padding: 16px;
  border: 1px solid rgba(165, 112, 203, 0.22);
  border-radius: 15px;
  background: rgba(19, 12, 32, 0.7);
  min-width: 0;
}

.team-admin-card.is-you {
  border-color: rgba(96, 165, 250, 0.45);
}

.team-admin-card strong {
  display: block;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.team-admin-card p {
  margin: 5px 0 10px;
  font-size: 10px;
  color: #a795bb;
  overflow-wrap: anywhere;
}

.team-admin-card .inline-actions {
  margin-top: 10px;
}

.hidden-stock-note {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 16px;
  padding: 12px 15px;
  border-radius: 12px;
  font-size: 11px;
  background: rgba(240, 180, 41, 0.09);
  border: 1px solid rgba(240, 180, 41, 0.3);
  color: #e8c98a;
}

/* ---------- Light theme ---------- */
[data-theme='white'] .product-desc,
[data-theme='white'] .desc-text {
  color: #64748b;
}

[data-theme='white'] .desc-heading {
  color: #7c3aed;
}

[data-theme='white'] .desc-item {
  color: #475569;
}

[data-theme='white'] .product-category,
[data-theme='white'] .product-availability,
[data-theme='white'] .product-warranty-note {
  color: #7b8794;
}

[data-theme='white'] .brand-tile,
[data-theme='white'] .product-image-mark {
  background: #f6f4ff;
  border-color: rgba(99, 102, 241, 0.28);
  box-shadow: 0 8px 18px -10px rgba(99, 102, 241, 0.35);
}

[data-theme='white'] .product-stock-flag {
  background: rgba(240, 180, 41, 0.16);
  border-color: rgba(202, 138, 4, 0.4);
  color: #a16207;
}

[data-theme='white'] .brand-artwork-card,
[data-theme='white'] .team-admin-card,
[data-theme='white'] .artwork-image-current {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #0f172a;
}

[data-theme='white'] .artwork-image-drop {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569;
}

[data-theme='white'] .hidden-stock-note {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
}

/* ---------- Narrow screens ---------- */
@media (max-width: 760px) {
  .products-grid,
  .featured-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 11px;
  }

  .product-art {
    height: 104px;
  }

  .product-body {
    padding: 11px 12px 13px;
  }

  .product-art .brand-tile,
  .product-art .product-image-mark {
    width: 50px;
    height: 50px;
    border-radius: 15px;
  }

  .product-art .brand-tile .brand-svg {
    width: 26px;
    height: 26px;
  }

  .product-bottom {
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
  }

  .product-actions-wrap {
    width: 100%;
  }

  .product-actions-wrap .btn {
    flex: 1 1 0;
  }

  .product-title {
    font-size: 12px;
  }
}

@media (min-width: 1500px) {
  .products-grid,
  .featured-grid {
    grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
    gap: 18px;
  }
}

@media (min-width: 1920px) {
  .products-grid,
  .featured-grid {
    grid-template-columns: repeat(auto-fill, minmax(244px, 1fr));
    gap: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product {
    transition: none;
  }
}

/* ---------- Administrator recovery key ---------- */
.recovery-key-card {
  background: rgba(16, 185, 129, 0.07);
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: 14px;
  padding: 16px;
}

.recovery-key-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.recovery-key-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.recovery-key-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px !important;
  padding: 9px 12px;
  border-radius: 10px;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.24);
  color: #b6adc6 !important;
  font-size: 12px !important;
}

.recovery-key-status.is-set {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(52, 211, 153, 0.35);
  color: #6ee7b7 !important;
}

.recovery-key-status .color-icon {
  width: 15px;
  height: 15px;
  flex: none;
}

.recovery-key-reveal p:first-child {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 16px;
  letter-spacing: 0.06em;
  word-break: break-all;
  padding: 14px;
  border-radius: 12px;
  background: rgba(124, 58, 237, 0.12);
  border: 1px dashed rgba(167, 139, 250, 0.5);
  text-align: center;
}

.auth-recovery-link {
  text-align: center;
  margin-top: 14px;
}

.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--purple);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

[data-theme='white'] .recovery-key-status {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #475569 !important;
}

[data-theme='white'] .recovery-key-status.is-set {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46 !important;
}

/* ---------- Official brand mark sync ---------- */
.brand-marks-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(139, 124, 250, 0.08);
  border: 1px solid rgba(139, 124, 250, 0.24);
}

.brand-marks-toolbar strong {
  display: block;
  font-size: 13px;
  margin-bottom: 3px;
}

.brand-marks-toolbar small {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

/* Settings: per-section save bars */
.section-save-bar{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:12px 0 4px;padding-top:12px;border-top:1px dashed #ffffff1f}
.section-save-bar .btn{min-width:150px}
.section-save-msg{font-size:12px;color:#aa9cbd}
.section-save-msg.ok{color:#58d9ac}
.section-save-msg.err{color:#ff8a8a;font-weight:600}
.rules-heading{margin:10px 0 0;font-size:15px}
