/* Spec §99–103: mobile-first responsive design.
   Spec §40: site-wide storefront CSS.
   Test breakpoints: 375 / 390 / 768 / 1024 / 1280 / 1440 / 1920 px.
   No horizontal scroll on mobile (spec §101). */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               Arial, sans-serif;
  color: #1f2937;
  background: #ffffff;
  line-height: 1.6;
  overflow-x: hidden;          /* spec §101: no horizontal scroll */
  -webkit-text-size-adjust: 100%;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.75rem; margin: 0 0 1rem; }
h2 { font-size: 1.25rem; margin: 1.25rem 0 0.5rem; }
p  { margin: 0.5rem 0; }
img { max-width: 100%; height: auto; display: block; }
code, pre {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  word-break: break-word;
}

/* Layout shell */
.store-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.store-main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
}

/* Header */
.store-header {
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.store-header__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  flex-wrap: wrap;
}
.store-header__brand {
  font-weight: 700;
  font-size: 1.0625rem;
  color: #1f2937;
  text-decoration: none;
  margin-right: 0.5rem;
}
.store-header__brand:hover { color: #2563eb; }

.store-header__nav {
  display: flex;
  gap: 0.5rem;
  flex: 1;
}
.store-header__nav-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #1f2937;
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background .12s, border-color .12s, color .12s;
}
.store-header__nav-btn:hover {
  background: #f9fafb;
  border-color: #2563eb;
  color: #2563eb;
  text-decoration: none;
}

.store-header__user {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.store-header__inline-form { display: inline; margin: 0; }
.store-header__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
  color: #4b5563;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s, border-color .12s, color .12s;
}
.store-header__icon-btn:hover {
  background: #f9fafb;
  border-color: #2563eb;
  color: #2563eb;
  text-decoration: none;
}
.store-header__icon-btn--account {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}
.store-header__icon-btn--account:hover {
  background: #dbeafe;
  border-color: #2563eb;
  color: #1d4ed8;
}

.store-header__lang { display: flex; gap: 0.25rem; margin-left: 0.25rem; }
.store-header__lang a {
  padding: 0.4rem 0.55rem;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #4b5563;
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1;
}
.store-header__lang a:hover {
  border-color: #2563eb;
  color: #2563eb;
  text-decoration: none;
}
.store-header__lang a.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #fff;
}

.link-btn {
  background: none; border: 0; color: #2563eb; cursor: pointer; font: inherit;
  padding: 0;
}

@media (max-width: 600px) {
  .store-header__inner { gap: 0.5rem; padding: 0.5rem 0.75rem; }
  .store-header__nav-btn { padding: 0.35rem 0.6rem; font-size: 0.875rem; }
  .store-header__lang a { padding: 0.35rem 0.45rem; font-size: 0.75rem; }
  .store-header__icon-btn { width: 32px; height: 32px; }
}

/* Footer */
.store-footer {
  border-top: 1px solid #e5e7eb;
  padding: 1rem;
  text-align: center;
  color: #6b7280;
  background: #f9fafb;
}

/* Breadcrumb */
.breadcrumb ol {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: #6b7280;
}
.breadcrumb .sep { margin: 0 0.25rem; }

/* Product grid */
.product-grid {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}
@media (max-width: 1199px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.product-card {
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  padding: 0.5rem;
  transition: box-shadow .15s;
}
.product-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.product-card a {
  display: block;
  color: #1f2937;
  text-decoration: none;
}
.product-card h2 {
  font-size: 1rem;
  margin: 0.5rem 0;
}
.product-card__price { font-size: 0.875rem; }
.product-card__packing { font-size: 0.75rem; color: #6b7280; }
.product-card__price-unit {
  display: inline-block;
  margin-left: 0.25rem;
  color: #6b7280;
  font-size: 0.75rem;
  font-weight: 400;
}
.fav-card__price-unit {
  display: inline-block;
  margin-left: 0.25rem;
  color: #6b7280;
  font-size: 0.7rem;
}
.cart-table__price-unit {
  display: block;
  margin-top: 0.125rem;
  color: #6b7280;
  font-size: 0.75rem;
}

/* Product detail */
.product-detail__layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
@media (max-width: 767px) {
  .product-detail__layout { grid-template-columns: 1fr; }
}
.product-detail__images {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.product-detail__images img { max-width: 100%; max-height: 100%; object-fit: contain; }

.product-detail__info h1 { font-size: 1.5rem; }

.product-detail__specs {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1rem;
  margin: 1rem 0;
}
.product-detail__specs dt { color: #6b7280; }
.product-detail__sold-by-carton {
  font-style: italic;
  color: #b91c1c;
  padding: 0.5rem;
  background: #fef2f2;
  border-radius: 4px;
}

.product-detail__actions {
  display: flex;
  gap: 0.75rem;
  margin: 1rem 0;
  flex-wrap: wrap;
}
.btn-favorite, .btn-cart {
  padding: 0.5rem 1rem;
  border: 1px solid #2563eb;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  font: inherit;
}
.btn-favorite[aria-pressed="true"], .btn-cart {
  background: #2563eb;
}

/* Generic primary / secondary buttons */
.btn-primary {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  background: #2563eb;
  color: #fff !important;
  border-radius: 6px;
  text-decoration: none !important;
  border: 0;
  font: inherit;
  cursor: pointer;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  background: transparent;
  color: #2563eb !important;
  border: 1px solid #2563eb;
  border-radius: 6px;
  text-decoration: none !important;
  cursor: pointer;
  font: inherit;
}

/* Pagination */
.pagination {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  padding: 1rem 0;
}

/* Forms */
label {
  display: block;
  margin: 0.5rem 0;
}
input, textarea, select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  font: inherit;
}
button[type="submit"] {
  padding: 0.5rem 1rem;
  background: #2563eb;
  color: #fff;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}
th, td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

/* ─── Auth pages (login / register / forgot / reset / verify) ───────── */

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
}
.auth-page__inner {
  width: 100%;
  max-width: 420px;
  padding: 2rem 1.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.auth-page__title { margin: 0 0 0.25rem; font-size: 1.5rem; }
.auth-page__subtitle {
  color: #6b7280;
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
}
.auth-form__label {
  font-size: 0.875rem;
  color: #374151;
  margin: 1rem 0 0.25rem;
}
.auth-form__input {
  width: 100%;
  padding: 0.625rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font: inherit;
}
.auth-form__input:focus {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
}
.auth-form__hint {
  font-size: 0.8rem;
  color: #6b7280;
  margin: 0.25rem 0 0;
}
.auth-form__error {
  color: #b91c1c;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  margin: 1rem 0 0;
  font-size: 0.875rem;
}
.auth-form__success {
  color: #065f46;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  margin: 1rem 0 0;
  font-size: 0.875rem;
}
.auth-form__submit {
  margin: 1.25rem 0 1rem;
  width: 100%;
  padding: 0.75rem;
  background: #2563eb;
  color: #fff;
  border: 0;
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
}
.auth-form__alt {
  text-align: center;
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0.5rem 0 0;
}
.auth-form__alt a { color: #2563eb; }
.auth-page__body { color: #6b7280; }
.auth-page__success {
  color: #065f46;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin: 1rem 0;
}

/* ─── Error pages (404 / 403) ────────────────────────────────────────── */

.error-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
}
.error-page__inner {
  text-align: center;
  max-width: 480px;
  padding: 2rem;
}
.error-page__code {
  font-size: 4rem;
  font-weight: 800;
  color: #2563eb;
  margin: 0;
  line-height: 1;
}
.error-page__title { margin: 1rem 0 0.5rem; }
.error-page__body { color: #6b7280; }
.error-page__path {
  margin: 1rem 0;
  color: #6b7280;
  font-size: 0.875rem;
}
.error-page__path code {
  background: #f3f4f6;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}
.error-page__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin: 1.5rem 0 0;
  flex-wrap: wrap;
}

/* ─── Cart ──────────────────────────────────────────────────────────── */

.cart-table {
  width: 100%;
  margin: 1rem 0;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
}
.cart-table th {
  background: #f9fafb;
  font-weight: 600;
}
.cart-table td {
  vertical-align: middle;
}
.cart-table__col-img { width: 56px; }

.cart-product {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.25rem 0;
}
.cart-product__image {
  flex-shrink: 0;
  display: block;
  width: 48px; height: 48px;
  border-radius: 4px;
  overflow: hidden;
  background: #f3f4f6;
}
.cart-product__image img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.cart-product__placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #9ca3af;
}
.cart-product__info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}
.cart-product__name {
  font-weight: 500;
  color: #1f2937;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cart-product__name:hover { color: #2563eb; }
.cart-product__code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: #6b7280;
  font-size: 0.75rem;
}
.cart-stepper {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.cart-stepper__btn {
  width: 2rem;
  height: 2rem;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
}
.cart-stepper__input {
  width: 4rem;
  text-align: center;
}
.cart-stepper__moq {
  display: block;
  color: #6b7280;
  font-size: 0.75rem;
  margin-top: 0.25rem;
}
.cart-remove {
  background: transparent;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font: inherit;
}
.cart-totals__label { font-weight: 600; text-align: right; color: #6b7280; }
.cart-totals__val { font-weight: 600; }
.cart-totals__label--grand { font-size: 1.1rem; }
.cart-totals__val--grand { font-size: 1.25rem; color: #2563eb; }
.cart-actions {
  display: flex;
  justify-content: flex-end;
  margin: 1.5rem 0;
}
.cart-disclaimer {
  font-size: 0.875rem;
  color: #6b7280;
  text-align: center;
  font-style: italic;
}
.cart-empty {
  padding: 2rem;
  text-align: center;
  color: #6b7280;
  background: #f9fafb;
  border-radius: 6px;
}

/* ─── Favorites ─────────────────────────────────────────────────────── */

.fav-page .page-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 1rem;
}
.fav-page .fav-count {
  color: #6b7280;
  font-size: 0.9375rem;
}

.fav-grid {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}
@media (max-width: 1199px) { .fav-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767px)  { .fav-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.fav-card {
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  transition: box-shadow .15s, transform .15s;
  display: flex;
  flex-direction: column;
}
.fav-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
.fav-card__link {
  display: block;
  padding: 0.5rem 0.5rem 0.75rem;
  color: #1f2937;
  text-decoration: none;
  flex: 1;
}
.fav-card__image {
  position: relative;
  aspect-ratio: 1/1;
  background: #f3f4f6;
  border-radius: 4px;
  overflow: hidden;
}
.fav-card__image img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.fav-card__placeholder {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: #9ca3af; font-size: 0.875rem;
}
.fav-card__name {
  display: block;
  margin: 0.625rem 0 0.25rem;
  font-weight: 600;
  font-size: 0.9375rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fav-card__price {
  display: flex;
  gap: 0.25rem;
  align-items: baseline;
  font-size: 0.875rem;
  color: #2563eb;
  font-weight: 500;
}
.fav-card__price small { color: #6b7280; font-weight: 400; }
.fav-card__badge {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.125rem 0.5rem;
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 999px;
  font-size: 0.75rem;
}
.fav-card__remove {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 0;
  border-top: 1px solid #e5e7eb;
  padding: 0.625rem;
  background: #f9fafb;
  color: #6b7280;
  cursor: pointer;
  font: inherit;
  font-size: 0.875rem;
  transition: background .12s, color .12s;
}
.fav-card__remove svg { display: block; }
.fav-card__remove:hover,
.fav-card__remove:focus-visible {
  background: #fef2f2;
  color: #b91c1c;
  outline: none;
}
.fav-card__remove:focus-visible {
  box-shadow: inset 0 0 0 2px #fca5a5;
}

.empty-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 3rem 1.5rem;
  text-align: center;
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 12px;
  color: #4b5563;
}
.empty-card svg { color: #9ca3af; }
.empty-card p { margin: 0; }

/* ─── Modal ─────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn .12s ease;
}
/* Belt-and-suspenders: the `hidden` HTML attribute can be overridden
   by a `display: flex` rule in the same rule-set (browsers have been
   known to do this when transitions are present). Force the modal to
   stay hidden until JS sets backdrop.hidden = false. */
.modal-backdrop[hidden] { display: none !important; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  width: min(420px, 92vw);
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  animation: pop .14s ease;
}
@keyframes pop {
  from { transform: scale(.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal h3 { margin: 0 0 0.5rem; font-size: 1.125rem; }
.modal__lead { color: #4b5563; margin: 0 0 1rem; font-size: 0.9rem; }
.modal p { color: #4b5563; margin: 0 0 1.25rem; }
.modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.btn-secondary {
  padding: 0.5rem 1rem;
  background: #fff;
  color: #1f2937;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}
.btn-secondary:hover { background: #f9fafb; }
.btn-danger {
  padding: 0.5rem 1rem;
  background: #dc2626;
  color: #fff;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}
.btn-danger:hover { background: #b91c1c; }
.btn-danger:disabled { background: #fca5a5; cursor: progress; }

/* ─── Purchase intentions ────────────────────────────────────────────── */

.purchase-table {
  width: 100%;
  margin: 1rem 0;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
}
.purchase-table th { background: #f9fafb; }
.purchase-status {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #f3f4f6;
  color: #374151;
}
.purchase-status--10 { background: #fef3c7; color: #92400e; }  /* PENDING */
.purchase-status--20 { background: #dbeafe; color: #1e40af; }  /* FOLLOWING */
.purchase-status--30 { background: #dcfce7; color: #166534; }  /* QUOTED */
.purchase-status--40 { background: #ede9fe; color: #5b21b6; }  /* NEGOTIATING */
.purchase-status--50 { background: #bbf7d0; color: #14532d; }  /* COMPLETED */
.purchase-status--90 { background: #f3f4f6; color: #6b7280; }  /* CANCELLED */
.purchase-empty {
  padding: 2rem;
  text-align: center;
  color: #6b7280;
  background: #f9fafb;
  border-radius: 6px;
}
.purchase-detail__back {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  color: #6b7280;
}

/* ─── Purchase detail page ──────────────────────────────────────── */
.purchase-detail__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.5rem 0 1.5rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.purchase-detail__head h1 {
  margin: 0;
  font-size: 1.25rem;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.purchase-detail__submitted {
  margin: 0.25rem 0 0;
  color: #6b7280;
  font-size: 0.875rem;
}
.purchase-detail__head .purchase-status {
  font-size: 0.9375rem;
  padding: 0.3rem 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.purchase-section__title {
  margin: 1.5rem 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  color: #4b5563;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.5rem;
}

.purchase-contact .contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem 1.25rem;
  background: #f9fafb;
  padding: 1rem 1.25rem;
  border-radius: 8px;
}
.purchase-contact .contact-item { display: flex; flex-direction: column; gap: 0.25rem; }
.purchase-contact .contact-item--wide { grid-column: 1 / -1; }
.purchase-contact .contact-item__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}
.purchase-contact .contact-item__value {
  font-weight: 500;
  color: #1f2937;
  word-break: break-word;
}
.purchase-contact a.contact-item__value { color: #2563eb; text-decoration: none; }
.purchase-contact a.contact-item__value:hover { text-decoration: underline; }

/* Spec §73: item snapshot — name / image / qty / price frozen. */
.purchase-items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.purchase-item {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  transition: box-shadow .12s;
}
.purchase-item:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.purchase-item__image {
  width: 80px; height: 80px;
  border-radius: 6px;
  background: #f3f4f6;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.purchase-item__image img { width: 100%; height: 100%; object-fit: cover; }
.purchase-item__placeholder {
  font-size: 0.75rem;
  color: #9ca3af;
}
.purchase-item__info { min-width: 0; }
.purchase-item__name {
  font-weight: 500;
  font-size: 0.9375rem;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.purchase-item__code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: #6b7280;
  font-size: 0.8125rem;
  margin-top: 0.125rem;
}
.purchase-item__specs {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
  font-size: 0.8125rem;
}
.purchase-item__label {
  display: block;
  color: #6b7280;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.125rem;
}
.purchase-item__value {
  font-weight: 600;
  color: #1f2937;
  font-size: 0.9375rem;
}
.purchase-item__value--total { color: #2563eb; font-size: 1.05rem; }
.purchase-item__suffix {
  color: #6b7280;
  font-weight: 400;
  font-size: 0.8125rem;
  margin-left: 0.125rem;
}
.purchase-item small {
  display: block;
  color: #9ca3af;
  font-size: 0.75rem;
  margin-top: 0.125rem;
}

.purchase-item__subtotal {
  text-align: right;
  border-left: 1px solid #e5e7eb;
  padding-left: 1rem;
}
@media (max-width: 767px) {
  .purchase-item {
    grid-template-columns: 64px 1fr;
    grid-template-areas:
      "img info"
      "img specs"
      "sub subtotal";
  }
  .purchase-item__image { grid-area: img; width: 64px; height: 64px; }
  .purchase-item__info { grid-area: info; }
  .purchase-item__specs { grid-area: specs; }
  .purchase-item__subtotal {
    grid-area: subtotal;
    text-align: left;
    border-left: 0;
    padding-left: 0;
    border-top: 1px dashed #e5e7eb;
    padding-top: 0.5rem;
  }
}

/* Timeline (follow history) */
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 0; bottom: 0;
  width: 2px;
  background: #e5e7eb;
}
.timeline__item {
  position: relative;
  padding: 0 0 1rem 1.75rem;
}
.timeline__dot {
  position: absolute;
  left: 2px; top: 0.4rem;
  width: 12px; height: 12px;
  background: #2563eb;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #e5e7eb;
}
.timeline__meta {
  font-size: 0.75rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}
.timeline__content {
  white-space: pre-wrap;
  color: #1f2937;
  font-size: 0.9375rem;
}
.timeline__next {
  margin-top: 0.25rem;
  font-size: 0.8125rem;
  color: #6b7280;
}

/* ─── Account ───────────────────────────────────────────────────────── */

.account-page {
  max-width: 760px;
  margin: 0 auto;
}

.account-hero {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: #fff;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  box-shadow: 0 4px 12px rgba(37,99,235,0.15);
}
.account-hero__avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
  font-weight: 700;
  flex-shrink: 0;
}
.account-hero__body { flex: 1; min-width: 0; }
.account-hero__body h1 {
  margin: 0;
  font-size: 1.5rem;
  word-break: break-all;
}
.account-hero__email {
  margin: 0.25rem 0 0.5rem;
  opacity: 0.85;
  font-size: 0.9375rem;
  word-break: break-all;
}
.account-hero .account-badge { margin-left: 0; }

.account-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.account-section__title {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
}
.account-section--signout {
  text-align: right;
  background: transparent;
  border: 0;
  padding: 0;
}

.account-fields {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1rem;
}
.account-fields dt { color: #6b7280; }
.account-fields dd {
  margin: 0;
  font-weight: 500;
  word-break: break-word;
}
.account-fields .muted { color: #9ca3af; font-style: italic; font-weight: 400; }
.account-fields .locale-pill {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  background: #2563eb;
  color: #fff;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
@media (max-width: 767px) {
  .account-fields { grid-template-columns: 1fr; }
  .account-fields dt { margin-top: 0.75rem; }
  .account-fields dt:first-child { margin-top: 0; }
  .account-hero { padding: 1rem; gap: 0.75rem; }
  .account-hero__avatar { width: 48px; height: 48px; font-size: 1.25rem; }
}

.account-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}
.account-action {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  text-decoration: none;
  color: #1f2937;
  background: #fff;
  transition: box-shadow .12s, border-color .12s, transform .12s;
}
.account-action:hover {
  border-color: #2563eb;
  box-shadow: 0 2px 8px rgba(37,99,235,0.1);
  transform: translateY(-1px);
  text-decoration: none;
}
.account-action__icon { font-size: 1.5rem; }
.account-action__title { font-weight: 600; }
.account-action__hint {
  font-size: 0.8125rem;
  color: #6b7280;
}

.account-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
}
.account-badge--ok { background: #dcfce7; color: #166534; }
.account-badge--warn { background: #fef3c7; color: #92400e; }

/* ─── Hint utility ──────────────────────────────────────────────────── */

.hint { color: #6b7280; font-size: 0.875rem; font-style: italic; }

/* ─── Catalog page (search bar + tree + grid) ──────────────────────── */
.catalog-page .breadcrumb ol {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: #4b5563;
}
.catalog-page .breadcrumb li[aria-current="page"] {
  font-weight: 600;
  color: #111827;
}
.catalog-page .breadcrumb .sep { color: #9ca3af; margin: 0 0.25rem; }

.catalog-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.5rem 0 1.25rem;
}
.catalog-header h1 { margin: 0; font-size: 1.5rem; }
.catalog-header__count {
  color: #6b7280;
  font-size: 0.9375rem;
  margin: 0;
}

.catalog-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 1.5rem;
  align-items: start;
}
@media (max-width: 767px) {
  .catalog-layout { grid-template-columns: 1fr; gap: 1rem; }
}

/* Mobile-only "show sidebar" toggle. Hidden on desktop, full-width
   button above the product grid on phones/tablets. The button stays
   visible even when the sidebar is open so visitors can collapse it
   again. */
.catalog-sidebar-toggle {
  display: none;
}
@media (max-width: 767px) {
  .catalog-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0 0 0.5rem;
    padding: 0.625rem 1rem;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
    cursor: pointer;
  }
  .catalog-sidebar-toggle::after {
    content: '▾';
    margin-left: 0.5rem;
    transition: transform 0.18s ease;
  }
  .catalog-layout.is-sidebar-open .catalog-sidebar-toggle::after {
    transform: rotate(-180deg);
  }
  /* Collapsed state on mobile: hide the sidebar entirely. Toggled by
     the inline script at the bottom of the template. */
  .catalog-sidebar {
    display: none;
  }
  .catalog-layout.is-sidebar-open .catalog-sidebar {
    display: flex;
  }
}

.catalog-sidebar {
  position: sticky;
  top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding-right: 0.25rem;
}
@media (max-width: 767px) {
  .catalog-sidebar { position: static; max-height: none; }
}

.catalog-search {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.catalog-search label.auth-form__label { margin-top: 0.25rem; }
.catalog-search__row { display: flex; }
.catalog-search__price {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.4rem;
}
.catalog-search__price span {
  text-align: center;
  color: #9ca3af;
  font-size: 0.875rem;
}
.catalog-search__sort {
  display: grid;
  grid-template-columns: 1fr 90px;
  gap: 0.4rem;
}
.catalog-search__actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.catalog-search__actions .btn-primary { flex: 1; }

.catalog-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.catalog-chips__label {
  color: #6b7280;
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 0.25rem;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  background: #eef2ff;
  color: #1e40af;
  border-radius: 999px;
  font-size: 0.8125rem;
}
.chip--clear {
  background: transparent;
  color: #2563eb;
  text-decoration: none;
}
.chip--clear:hover { text-decoration: underline; }

.catalog-products h1 { margin: 0 0 1rem; font-size: 1.25rem; }
.catalog-products .product-card { transition: box-shadow .12s, transform .12s; }
.catalog-products .product-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.category-page .breadcrumb ol {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: #4b5563;
}
.category-page .breadcrumb li[aria-current="page"] {
  font-weight: 600;
  color: #111827;
}
.category-page .breadcrumb .sep {
  color: #9ca3af;
  margin: 0 0.25rem;
}

.category-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 2rem;
  margin-top: 1rem;
  align-items: start;
}
@media (max-width: 767px) {
  .category-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.category-tree-aside {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}
@media (max-width: 767px) {
  .category-tree-aside {
    position: static;
    max-height: none;
  }
}
.category-tree-aside__title {
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin: 0 0 0.75rem;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 0.5rem;
}

/* Collapsible tree (native <details>, no JS). */
.category-tree--collapsible {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.9375rem;
}
.category-tree--collapsible ul {
  list-style: none;
  padding-left: 0.75rem;
  margin: 0.25rem 0;
  border-left: 1px dashed #e5e7eb;
}
.category-tree--collapsible details > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style-position: outside;
}
.category-tree--collapsible details > summary::-webkit-details-marker { display: none; }
.category-tree--collapsible details > summary::before {
  content: "▸";
  font-size: 0.75rem;
  color: #9ca3af;
  width: 0.9em;
  display: inline-block;
  transition: transform .15s ease;
  flex-shrink: 0;
}
.category-tree--collapsible details[open] > summary::before {
  transform: rotate(90deg);
}
.category-tree--collapsible details > summary:hover {
  background: #f3f4f6;
}
.category-tree--collapsible summary.is-current {
  background: #2563eb;
  color: #fff;
  font-weight: 600;
}
.category-tree--collapsible summary.is-current a {
  color: #fff;
}
.category-tree--collapsible summary a {
  flex: 1;
  color: #1f2937;
  text-decoration: none;
}
.category-tree--collapsible summary a:hover { text-decoration: underline; }
.category-tree__leaf > a {
  display: block;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  color: #4b5563;
  text-decoration: none;
}
.category-tree__leaf > a:hover {
  background: #f3f4f6;
  color: #1f2937;
}
.category-tree__leaf > a.is-current {
  background: #2563eb;
  color: #fff;
  font-weight: 600;
}

.category-products h1 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
}
.category-products .product-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
@media (max-width: 767px) {
  .category-tree--collapsible summary {
    padding: 0.4rem 0.5rem;
    font-size: 0.9375rem;
  }
  .category-tree--collapsible ul {
    padding-left: 0.6rem;
  }
}