/* Shopmart app-specific styles — built on tokens from styles.css. */

/* ----- auth/account button ----- */
.btn-login.btn-greet {
  width: auto;
  background: transparent;
  color: #fff;
  font-weight: 600;
  padding: 0 12px;
  text-transform: capitalize;
}
.dropdown-sep { height: 1px; background: var(--line); margin: 4px 0; }

.cart-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-left: 4px;
  border-radius: 9px;
  background: var(--gold);
  color: #212121;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

/* ----- common button variants ----- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 2px;
  background: #ff9f00; color: #fff;
  font-size: 15px; font-weight: 600;
  padding: 12px 22px;
  text-transform: uppercase;
  letter-spacing: .3px;
  cursor: pointer;
}
.btn-primary:hover { background: #e68a00; }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 2px;
  background: #fb641b; color: #fff;
  font-size: 15px; font-weight: 600;
  padding: 12px 22px;
  text-transform: uppercase;
  letter-spacing: .3px;
  cursor: pointer;
}
.btn-secondary:hover { background: #e0550f; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 2px;
  background: #fff; color: var(--text);
  font-size: 14px; font-weight: 500;
  padding: 9px 18px;
  cursor: pointer;
}
.btn-ghost:hover { background: #f5faff; color: var(--blue); }

.btn-link {
  background: none; border: 0; padding: 0;
  color: var(--blue); cursor: pointer;
  font-size: 14px; font-weight: 500;
}
.btn-link:hover { text-decoration: underline; }

.btn-danger { color: #c62828; }
.btn-danger:hover { background: #fff5f5; }

/* ----- toast ----- */
.toast-host {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  background: #212121; color: #fff;
  font-size: 14px; padding: 10px 16px;
  border-radius: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s;
  max-width: 360px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { background: #c62828; }
.toast-success { background: #2e7d32; }

/* ----- forms ----- */
.form-card {
  max-width: 760px;
  margin: 24px auto;
  background: #fff;
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.form-card .form-info {
  background: var(--blue);
  color: #fff;
  padding: 28px 28px;
}
.form-card .form-info h1 { margin: 0 0 6px; font-size: 24px; font-weight: 500; }
.form-card .form-info p  { margin: 0; opacity: .92; line-height: 1.5; }
.form-card .form-body   { padding: 28px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}
.form-grid .field-full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 13px; color: var(--muted);
  font-weight: 500;
}
.field input, .field select, .field textarea {
  border: 1px solid #d0d4da;
  background: #fff;
  border-radius: 2px;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}
.field .help { font-size: 12px; color: var(--muted); }
.field .err  { font-size: 12px; color: #c62828; min-height: 14px; }
.form-actions {
  display: flex; align-items: center; gap: 16px;
  margin-top: 22px;
  flex-wrap: wrap;
}
.form-actions .form-error { color: #c62828; font-size: 13px; }
.form-foot {
  padding: 18px 28px;
  background: #f7f8fa;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.form-foot a { color: var(--blue); }

@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ----- page container ----- */
.page {
  max-width: var(--container);
  margin: 8px auto 0;
  padding: 0 8px;
}
.page-card {
  background: #fff;
  box-shadow: var(--shadow-1);
  padding: 20px 24px;
}
.page-title { margin: 0 0 4px; font-size: 22px; font-weight: 500; }
.page-sub   { margin: 0 0 18px; color: var(--muted); }
.crumbs {
  display: flex; flex-wrap: wrap; gap: 6px;
  font-size: 13px; color: var(--muted);
  margin: 8px 0 12px;
}
.crumbs a { color: var(--blue); }
.crumbs .sep { color: #b0b0b0; }

/* ----- product list ----- */
.list-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 8px;
  align-items: start;
}
.filter-rail {
  background: #fff;
  box-shadow: var(--shadow-1);
  padding: 14px 16px;
  position: sticky; top: 72px;
}
.filter-rail h3 { margin: 0 0 8px; font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .3px; }
.filter-rail ul { display: flex; flex-direction: column; gap: 4px; }
.filter-rail a {
  display: flex; justify-content: space-between;
  padding: 6px 8px; font-size: 14px;
  border-radius: 2px;
}
.filter-rail a:hover, .filter-rail a.is-active { background: #f5faff; color: var(--blue); }
.filter-rail a .n { color: var(--muted); font-size: 12px; }

.list-main { display: flex; flex-direction: column; gap: 0; }
.list-toolbar {
  background: #fff;
  box-shadow: var(--shadow-1);
  padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  margin-bottom: 8px;
}
.list-toolbar .count { font-size: 14px; color: var(--muted); }
.list-toolbar select {
  border: 1px solid #d0d4da;
  background: #fff;
  padding: 6px 10px;
  font: inherit;
  border-radius: 2px;
}
.list-grid {
  background: #fff;
  box-shadow: var(--shadow-1);
  padding: 8px 12px 22px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
@media (max-width: 1100px) { .list-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 820px) {
  .list-layout { grid-template-columns: 1fr; }
  .list-grid { grid-template-columns: repeat(2, 1fr); }
  .filter-rail { position: static; }
}

.empty, .list-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
  background: #fff;
  box-shadow: var(--shadow-1);
}

.pager {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 12px 0 0; padding: 12px;
}
.pager button {
  border: 1px solid #d0d4da; background: #fff; color: var(--text);
  padding: 6px 12px; font-size: 13px; border-radius: 2px;
  cursor: pointer;
}
.pager button:disabled { opacity: .45; cursor: not-allowed; }
.pager .page-info { color: var(--muted); font-size: 13px; }

/* ----- product detail (PDP) ----- */
.pdp {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  max-width: var(--container);
  margin: 8px auto 0;
}
.pdp-media {
  background: #fff;
  box-shadow: var(--shadow-1);
  padding: 20px;
  display: flex; align-items: flex-start; gap: 16px;
  position: sticky; top: 72px;
}
.pdp-main {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  display: flex; align-items: center; justify-content: center;
  min-height: 320px;
}
.pdp-media img#pdpImage { max-width: 100%; max-height: 560px; display: block; }

/* Vertical thumbnail rail on the LEFT, like Taobao / JD. Up/down arrows
   scroll the thumb list when more than ~5 images are loaded. The active
   thumb has a colored outline. */
.pdp-thumbs-rail {
  flex: 0 0 auto;
  display: flex; flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 64px;
}
.pdp-thumb-arrow {
  background: #f5f7fa;
  border: 1px solid #e0e3e8;
  border-radius: 4px;
  width: 56px;
  height: 22px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #555;
  font-size: 11px;
  line-height: 1;
  padding: 0;
}
.pdp-thumb-arrow:hover:not(:disabled) { background: #e6f4ff; color: #1677ff; border-color: #bae0ff; }
.pdp-thumb-arrow:disabled { opacity: .35; cursor: not-allowed; }
.pdp-thumbs-track {
  display: flex; flex-direction: column;
  gap: 6px;
  max-height: 380px;
  overflow: hidden;
  scroll-behavior: smooth;
}
.pdp-thumbs-track button {
  background: transparent;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  width: 56px; height: 56px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
  flex: 0 0 auto;
}
.pdp-thumbs-track button:hover { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .22); }
.pdp-thumbs-track button.is-active {
  border-color: #ff9f00;
  box-shadow: 0 0 0 1px #ff9f00;
}
.pdp-thumbs-track img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}

/* Prev / next arrows overlaid on the main image. Click swaps to the
   previous or next image in the gallery, syncs the thumbnail highlight. */
.pdp-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px; height: 56px;
  background: rgba(0, 0, 0, .35);
  color: #fff;
  border: 0;
  border-radius: 4px;
  font-size: 22px;
  line-height: 56px;
  text-align: center;
  cursor: pointer;
  padding: 0;
  z-index: 2;
  opacity: 0;
  transition: opacity .15s;
}
.pdp-main:hover .pdp-arrow { opacity: 1; }
.pdp-arrow:hover { background: rgba(0, 0, 0, .6); }
.pdp-arrow:disabled { display: none; }
.pdp-arrow.prev { left: 6px; }
.pdp-arrow.next { right: 6px; }

/* Image counter (e.g. 1 / 4) shown over the top-right of the main image. */
.pdp-counter {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  z-index: 2;
  pointer-events: none;
}

/* Mobile / narrow viewport: collapse the left rail into a horizontal
   scrollable row above the main image. Swipe-friendly. */
@media (max-width: 640px) {
  .pdp-media { flex-direction: column-reverse; padding: 12px; gap: 10px; }
  .pdp-thumbs-rail {
    width: 100%;
    flex-direction: row;
  }
  .pdp-thumb-arrow {
    width: 28px; height: 48px;
    transform: rotate(0deg);
  }
  .pdp-thumb-arrow.up { transform: rotate(-90deg); }
  .pdp-thumb-arrow.down { transform: rotate(90deg); }
  .pdp-thumbs-track {
    flex-direction: row;
    max-height: none;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px;
  }
  .pdp-thumbs-track button { width: 48px; height: 48px; }
  .pdp-media img#pdpImage { max-height: 360px; }
}
.pdp-info {
  background: #fff;
  box-shadow: var(--shadow-1);
  padding: 20px 24px;
}
.pdp-info .breadcrumb-line { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.pdp-info h1 { margin: 0 0 6px; font-size: 22px; font-weight: 500; }
.pdp-info .brand-line { color: var(--muted); font-size: 14px; margin-bottom: 12px; }
.pdp-rating {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--green); color: #fff;
  font-size: 13px; font-weight: 600;
  padding: 3px 8px; border-radius: 3px;
}
.pdp-rating .n { color: #d8d8d8; font-weight: 500; }
.price-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 14px 0 6px; }
.price-now { font-size: 26px; font-weight: 600; color: #212121; }
.price-strike { color: var(--muted); text-decoration: line-through; font-size: 15px; }
.price-off   { color: var(--green); font-weight: 600; font-size: 14px; }
.pdp-info .desc { color: #444; line-height: 1.5; margin: 10px 0 16px; }
.pdp-stock { font-size: 14px; margin-bottom: 14px; }
.pdp-stock.in  { color: var(--green); font-weight: 600; }
.pdp-stock.out { color: #c62828; font-weight: 600; }
.qty-stepper {
  display: inline-flex; align-items: center;
  border: 1px solid #d0d4da; border-radius: 2px;
  overflow: hidden;
}
.qty-stepper button {
  width: 32px; height: 36px;
  border: 0; background: #fff; font-size: 18px; color: #212121;
  cursor: pointer;
}
.qty-stepper button:hover { background: #f5faff; color: var(--blue); }
.qty-stepper button:disabled { opacity: .4; cursor: not-allowed; }
.qty-stepper input {
  width: 44px; height: 36px;
  border: 0; border-left: 1px solid #d0d4da; border-right: 1px solid #d0d4da;
  text-align: center; font-size: 14px;
  -moz-appearance: textfield;
}
.qty-stepper input::-webkit-outer-spin-button,
.qty-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.pdp-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 18px 0 8px; }

.related-row {
  max-width: var(--container);
  margin: 8px auto 0;
  background: #fff;
  box-shadow: var(--shadow-1);
  padding: 18px 12px 22px;
}
.related-row h2 { margin: 0 12px 10px; font-size: 18px; font-weight: 500; }
.related-row .tile-row {
  padding: 0;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  overflow: visible;
}
@media (max-width: 1100px) { .related-row .tile-row { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 820px)  { .related-row .tile-row { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 820px) {
  .pdp { grid-template-columns: 1fr; }
  .pdp-media { position: static; }
}

/* ----- cart page ----- */
.cart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 8px;
  align-items: start;
  max-width: var(--container);
  margin: 8px auto 0;
}
.cart-list { background: #fff; box-shadow: var(--shadow-1); }
.cart-row {
  display: grid;
  grid-template-columns: 100px 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.cart-row:last-child { border-bottom: 0; }
.cart-row .img-box { width: 100px; height: 100px; background: #f7f8fa; display: flex; align-items: center; justify-content: center; }
.cart-row .img-box img { max-width: 100%; max-height: 100%; }
.cart-row .meta h3 { margin: 0 0 4px; font-size: 15px; font-weight: 500; }
.cart-row .meta .brand { color: var(--muted); font-size: 13px; }
.cart-row .meta .price { color: #212121; font-weight: 500; margin-top: 6px; }
.cart-row .line-total { font-weight: 600; min-width: 100px; text-align: right; }
.cart-row .remove { background: none; border: 0; color: var(--blue); cursor: pointer; font-size: 13px; }

.price-card {
  background: #fff; box-shadow: var(--shadow-1);
  padding: 16px 20px;
  position: sticky; top: 72px;
}
.price-card h3 { margin: 0 0 12px; font-size: 12px; color: var(--muted); font-weight: 500; text-transform: uppercase; }
.price-line { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.price-line.total { border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 12px; font-weight: 600; font-size: 16px; }
.price-line .muted { color: var(--muted); }
.price-line .green { color: var(--green); font-weight: 500; }
.price-card .btn-primary { width: 100%; margin-top: 12px; }

@media (max-width: 820px) {
  .cart-layout { grid-template-columns: 1fr; }
  .cart-row { grid-template-columns: 80px 1fr; gap: 12px; }
  .cart-row .qty-stepper, .cart-row .line-total, .cart-row .remove {
    grid-column: 1 / -1; justify-self: start;
  }
  .price-card { position: static; }
}

/* ----- checkout ----- */
.checkout { max-width: var(--container); margin: 8px auto 0; display: grid; grid-template-columns: minmax(0,1fr) 320px; gap: 8px; align-items: start; }
.step { background: #fff; box-shadow: var(--shadow-1); margin-bottom: 8px; }
.step h2 { margin: 0; font-size: 16px; font-weight: 500; padding: 14px 20px; display: flex; align-items: center; gap: 10px; background: #f7f8fa; border-bottom: 1px solid var(--line); }
.step h2 .num { width: 22px; height: 22px; background: var(--blue); color: #fff; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.step .body { padding: 16px 20px; }
.addr-card {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 12px 14px;
  display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: start;
  cursor: pointer;
}
.addr-card.is-active { border-color: var(--blue); background: #f5faff; }
.addr-card .radio { width: 16px; height: 16px; border: 2px solid #b0b0b0; border-radius: 50%; margin-top: 3px; }
.addr-card.is-active .radio { border-color: var(--blue); box-shadow: inset 0 0 0 4px var(--blue); }
.addr-card .actions { display: flex; flex-direction: column; gap: 4px; }
.addr-card .actions button { background: none; border: 0; color: var(--blue); cursor: pointer; font-size: 13px; padding: 0; text-align: right; }
.pay-grid { display: grid; gap: 10px; }
.pay-card {
  border: 1px solid var(--line); border-radius: 2px; padding: 12px 14px;
  display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.pay-card.is-active { border-color: var(--blue); background: #f5faff; }
.pay-card.is-unavailable {
  opacity: 0.78;
  background: #fafafa;
  cursor: not-allowed;
}
.pay-card.is-unavailable:hover { background: #f5f5f5; }
.pay-card.is-unavailable.is-active {
  /* Never visually select an unavailable option — keep it greyed out. */
  border-color: var(--line);
  background: #fafafa;
}
.pay-card.is-unavailable .radio {
  border-color: #d0d0d0;
  background: repeating-linear-gradient(
    -45deg, #d0d0d0 0 4px, transparent 4px 8px
  );
}
.pay-card .radio { width: 16px; height: 16px; border: 2px solid #b0b0b0; border-radius: 50%; margin-top: 3px; }
.pay-card.is-active .radio { border-color: var(--blue); box-shadow: inset 0 0 0 4px var(--blue); }
.pay-card .muted { color: var(--muted); font-size: 12px; }
.pay-card-body { min-width: 0; }
.pay-card-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.pay-card-label {
  font-weight: 500; color: var(--text);
  flex: 1 1 auto; min-width: 0;
}
.pay-card-note { margin-top: 4px; }
.pay-unavailable-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #c62828;
  background: #ffebee;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.pay-unavailable-banner {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px;
  padding: 10px 14px;
  background: #fff4e5;
  border: 1px solid #ffe0b2;
  border-left: 4px solid #e65100;
  border-radius: 2px;
  color: #5d2c00;
  font-size: 13px;
}
.pay-unavailable-banner[hidden] { display: none; }
.pay-unavailable-icon {
  display: inline-flex; align-items: center; justify-content: center;
  color: #e65100; flex-shrink: 0;
}
.pay-unavailable-text { line-height: 1.4; }

.summary-items { display: flex; flex-direction: column; }
.summary-row {
  display: grid; grid-template-columns: 56px 1fr auto; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center;
}
.summary-row:last-child { border-bottom: 0; }
.summary-row img { width: 56px; height: 56px; object-fit: contain; background: #f7f8fa; }
.summary-row .qty { color: var(--muted); font-size: 12px; }
.summary-row .amt { font-weight: 500; }

@media (max-width: 820px) {
  .checkout { grid-template-columns: 1fr; }
  .price-card { position: static; }
}

/* ----- user center ----- */
.account {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 8px;
  max-width: var(--container);
  margin: 8px auto 0;
}
.account-nav {
  background: #fff; box-shadow: var(--shadow-1);
  padding: 8px 0;
}
.account-nav a {
  display: block; padding: 10px 16px;
  font-size: 14px;
}
.account-nav a:hover, .account-nav a.is-active { background: #f5faff; color: var(--blue); }
.account-pane { background: #fff; box-shadow: var(--shadow-1); padding: 20px 24px; }
.account-pane h2 { margin: 0 0 14px; font-size: 18px; font-weight: 500; }
.order-card {
  border: 1px solid var(--line); border-radius: 2px;
  padding: 12px 14px; margin-bottom: 10px;
  display: grid; grid-template-columns: 1fr auto; gap: 12px;
  align-items: center;
}
.order-card .meta { font-size: 13px; color: var(--muted); }
.order-card .total { font-weight: 600; }

/* ----- wallet tab ----- */
.wallet-hero {
  background: linear-gradient(135deg, #2874f0 0%, #1a5fd0 100%);
  color: #fff;
  padding: 28px 32px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-1);
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}
.wallet-hero::after {
  content: '';
  position: absolute;
  right: -40px; top: -40px;
  width: 200px; height: 200px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
}
.wallet-hero::before {
  content: '';
  position: absolute;
  right: 60px; bottom: -60px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
}
.wallet-hero-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  opacity: .9;
}
.wallet-hero-value {
  font-size: 36px;
  font-weight: 600;
  margin-top: 6px;
  line-height: 1.1;
}
.wallet-hero-sub {
  font-size: 13px;
  opacity: .85;
  margin-top: 4px;
}

.wallet-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.wallet-stats .admin-stat-card { margin: 0; }

.wallet-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.wallet-cols:last-child { margin-bottom: 0; }
@media (max-width: 820px) {
  .wallet-stats { grid-template-columns: 1fr; }
  .wallet-cols  { grid-template-columns: 1fr; }
}

.wallet-card { margin: 0; }
.wallet-card-head {
  border-bottom: 1px solid var(--line);
  padding: 0 0 12px;
  margin-bottom: 14px;
}
.wallet-card-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.wallet-card-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.wallet-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.wallet-form .form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.wallet-form .form-actions .form-error {
  margin-left: auto;
  color: #c62828;
  font-size: 13px;
}
.wallet-amount-wrap {
  position: relative;
}
.wallet-amount-wrap input {
  padding-left: 30px;
  font-size: 18px;
  font-weight: 600;
}
.wallet-amount-prefix {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-weight: 600;
  font-size: 16px;
  pointer-events: none;
}
.wallet-amount-hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.wallet-warn {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fff8e1;
  border-left: 3px solid #f6a623;
  border-radius: 2px;
  font-size: 13px;
  color: #6b4d00;
}
.wallet-steps, .wallet-tips {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  color: #444;
  line-height: 1.7;
}
.wallet-tips { padding-left: 18px; list-style: disc; }
.wallet-tips li, .wallet-steps li { margin-bottom: 4px; }

.wallet-card-info { background: #f7faff; }

.status-chip {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 2px 8px; border-radius: 10px;
  background: #fff8e1; color: #b26a00; text-transform: capitalize;
}
.status-chip.paid        { background: #e8f5e9; color: #2e7d32; }
.status-chip.cancelled   { background: #ffebee; color: #c62828; }
.status-chip.pending_payment { background: #fff8e1; color: #b26a00; }

@media (max-width: 820px) {
  .account { grid-template-columns: 1fr; }
}

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.kv dd.kv-total { font-weight: 600; font-size: 16px; }

/* ----- order-detail page ----- */
.order-detail-page { max-width: var(--container); margin: 18px auto 40px; }
.order-detail-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: #fff; box-shadow: var(--shadow-1);
  padding: 18px 22px;
  margin-bottom: 10px;
  border-radius: 2px;
}
.order-detail-header-main { min-width: 0; flex: 1 1 auto; }
.order-detail-title-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 4px;
}
.order-detail-title-row .page-title { margin: 0; }
.order-detail-actions-top { margin-top: 4px; }
.order-detail-actions-top .btn-ghost { padding: 6px 12px; font-size: 13px; }

.order-timeline {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0;
  background: #fff; box-shadow: var(--shadow-1);
  padding: 16px 24px;
  margin-bottom: 10px;
  border-radius: 2px;
  position: relative;
}
.order-timeline.is-cancelled .timeline-step.is-done .timeline-dot { background: var(--muted); }
.order-timeline.is-cancelled .timeline-step.is-done .timeline-label { color: var(--muted); }
.timeline-step {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  flex: 0 0 auto;
  min-width: 88px;
}
.timeline-dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: #e0e0e0;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px #d0d4dc;
  transition: background .2s, box-shadow .2s;
}
.timeline-step.is-done .timeline-dot {
  background: var(--green);
  box-shadow: 0 0 0 2px #c8e6c9;
}
.timeline-step.is-cancelled.is-done .timeline-dot,
.order-timeline.is-cancelled .timeline-step.is-done .timeline-dot {
  background: var(--muted);
  box-shadow: 0 0 0 2px #e0e0e0;
}
.timeline-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.timeline-step.is-done .timeline-label { color: var(--text); }
.timeline-rail {
  flex: 1 1 auto; height: 3px;
  background: #e0e0e0;
  position: relative;
  margin: 0 -8px;
  align-self: flex-start;
  margin-top: 9px;
}
.timeline-rail.is-done { background: var(--green); }

/* The order-detail-grid is two-column on desktop. */
.order-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 10px;
  align-items: start;
}
.order-detail-left { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.order-detail-right { display: flex; flex-direction: column; gap: 10px; }
.order-detail-section {
  background: #fff; box-shadow: var(--shadow-1);
  border-radius: 2px;
  padding: 16px 20px;
}
.order-detail-section .section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.order-detail-section h2 {
  margin: 0; font-size: 16px; font-weight: 500;
}
.section-count {
  font-size: 12px; color: var(--muted);
  background: #f1f3f6; border-radius: 999px;
  padding: 2px 10px;
}

/* Items section */
.order-detail-items .empty { color: var(--muted); margin: 0; }
.order-item-row {
  display: grid;
  grid-template-columns: 72px minmax(0,1fr) auto;
  gap: 14px; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.order-item-row:last-child { border-bottom: 0; padding-bottom: 4px; }
.order-item-row:first-child { padding-top: 4px; }
.order-item-img {
  width: 72px; height: 72px;
  background: #f7f8fa; border-radius: 4px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.order-item-img img { width: 100%; height: 100%; object-fit: contain; }
.order-item-meta { min-width: 0; }
.order-item-title {
  font-size: 14px; font-weight: 500;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 4px;
}
.order-item-sub {
  display: flex; gap: 14px; align-items: center;
  font-size: 12px; color: var(--muted);
  flex-wrap: wrap;
}
.order-item-unit { color: var(--muted); }
.order-item-qty {
  background: #f1f3f6; border-radius: 999px;
  padding: 1px 10px;
}
.order-item-amt { font-weight: 600; font-size: 15px; min-width: 90px; text-align: right; }

/* Address block */
.address-block {
  border: 1px solid var(--line); border-radius: 2px;
  padding: 12px 14px;
  background: #fafbfc;
}
.address-block .addr-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.address-block .addr-phone { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.address-block .addr-line { font-size: 13px; line-height: 1.5; color: var(--text); }

/* Payment block */
.payment-block { display: flex; flex-direction: column; gap: 14px; }
.payment-method-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: #fafbfc; border: 1px solid var(--line); border-radius: 4px;
}
.payment-method-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #e3f2fd; color: var(--blue);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.payment-method-name { font-weight: 600; font-size: 14px; }
.payment-method-note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.payment-breakdown { display: flex; flex-direction: column; gap: 6px; }
.payment-row {
  display: flex; justify-content: space-between;
  font-size: 14px;
}
.payment-row .muted { color: var(--muted); }
.payment-row.total {
  border-top: 1px dashed var(--line);
  margin-top: 6px; padding-top: 10px;
  font-weight: 600; font-size: 16px;
}
.payment-row.wallet .value { color: var(--green); font-weight: 600; }

/* Status pill on header */
.status-pill {
  display: inline-flex; align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: #e0e0e0; color: #555;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.status-pill.pending_payment { background: #fff3e0; color: #e65100; }
.status-pill.paid, .status-pill.shipped { background: #e3f2fd; color: #1565c0; }
.status-pill.delivered, .status-pill.bought_back { background: #e8f5e9; color: var(--green); }
.status-pill.cancelled { background: #ffebee; color: #c62828; }

/* Order summary card */
.order-summary-card .kv {
  grid-template-columns: 110px 1fr;
  row-gap: 10px;
}

@media (max-width: 820px) {
  .order-detail-grid { grid-template-columns: 1fr; }
  .order-timeline { padding: 12px 12px; gap: 0; }
  .timeline-step { min-width: 64px; }
  .timeline-label { font-size: 11px; }
  .timeline-rail { margin: 0 -4px; }
  .order-detail-header { padding: 14px 16px; }
  .order-detail-section { padding: 14px 16px; }
  .order-item-row { grid-template-columns: 56px minmax(0,1fr) auto; gap: 10px; }
  .order-item-img { width: 56px; height: 56px; }
  .order-summary-card .kv { grid-template-columns: 100px 1fr; }
}

/* ----- success / empty pages ----- */
.success-card {
  background: #fff; box-shadow: var(--shadow-1);
  max-width: 560px; margin: 40px auto; padding: 32px 28px;
  text-align: center;
}
.success-card .check {
  width: 64px; height: 64px; margin: 0 auto 12px;
  background: var(--green); color: #fff;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 32px;
}
.success-card h1 { margin: 0 0 8px; font-size: 22px; }
.success-card .order-id { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.success-card .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- in-app messages (inbox v2 — accordion) ---------- */
.msg-stack {
  display: flex; flex-direction: column; gap: 12px;
}
.msg-card {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid #e5e9f0;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  font: inherit;
  color: inherit;
  padding: 0;
  transition: border-color .12s, box-shadow .12s;
}
.msg-card:hover { border-color: #c4d4ee; }
.msg-card.is-unread {
  border-color: #2874f0;
  box-shadow: 0 0 0 1px rgba(40, 116, 240, 0.12);
}
.msg-card.is-expanded { border-color: #2874f0; }
.msg-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}
.msg-card-mail {
  position: relative;
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.msg-card-mail.is-unread { background: #e6f0ff; }
.msg-card-mail.is-read   { background: #f1f3f6; }
.msg-card-mail-dot {
  position: absolute;
  top: -2px; right: -2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #e53935;
  box-shadow: 0 0 0 2px #fff;
  display: none;
}
.msg-card-mail.is-unread .msg-card-mail-dot { display: block; }
.msg-card-mail-glyph {
  width: 20px; height: 20px;
  display: block;
}
.msg-card-mail.is-unread .msg-card-mail-glyph { color: #2874f0; }
.msg-card-mail.is-read   .msg-card-mail-glyph { color: #878787; }
.msg-card-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1a2238;
}
.msg-card.is-unread .msg-card-title { font-weight: 600; }
.msg-card.is-read   .msg-card-title { font-weight: 400; }
.msg-card-time {
  flex-shrink: 0;
  font-size: 12px;
  color: #878787;
  white-space: nowrap;
}
.msg-card-expand {
  display: none;
  border-top: 1px solid #eef0f4;
  padding: 18px 20px;
  background: #fafbfc;
}
.msg-card-expand.is-open { display: block; }
.msg-card-expand-title {
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #1a2238;
  margin-bottom: 12px;
  word-break: break-word;
}
.msg-card-expand-body {
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.7;
  color: #2a3344;
  word-break: break-word;
}
.msg-card-expand-footer {
  text-align: right;
  font-size: 13px;
  color: #878787;
  margin-top: 14px;
}
.msg-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 16px;
  color: #888;
  background: #fff;
  border: 1px solid #e5e9f0;
  border-radius: 10px;
}
.msg-empty .msg-card-mail-glyph { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.4; }

/* header / nav unread badge (unchanged — still used) */
.badge.msg-badge {
  background: var(--blue, #2874f0); color: #fff;
  font-size: 11px; padding: 2px 7px; border-radius: 10px;
  margin-left: 6px; vertical-align: middle; font-weight: 600;
}
.dropdown-item .msg-badge { margin-left: auto; }

/* ---------- badge palette (shared) ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.4;
}
.badge.badge-blue   { background: #e6f4ff; color: #1677ff; }
.badge.badge-teal   { background: #e6fffb; color: #08979c; }
.badge.badge-green  { background: #f6ffed; color: #389e0d; }
.badge.badge-red    { background: #fff1f0; color: #cf1322; }
.badge.badge-orange { background: #fff7e6; color: #d46b08; }
.badge.badge-gray   { background: #f5f5f5; color: #666; }
.badge.badge-purple { background: #f9f0ff; color: #531dab; }

/* Wallet — withdrawal accounts tab + method picker. */
.wallet-tabs { display: flex; gap: 4px; border-bottom: 1px solid #e0e0e0; margin-bottom: 14px; }
.wallet-tab {
  background: transparent; border: 0; padding: 10px 18px; cursor: pointer;
  font: 600 14px sans-serif; color: #666; border-bottom: 2px solid transparent;
  margin-bottom: -1px; display: flex; align-items: center; gap: 8px;
}
.wallet-tab:hover { color: #1565c0; }
.wallet-tab.is-active { color: #1565c0; border-bottom-color: #1565c0; }
.wallet-tab-badge {
  font: 600 11px sans-serif; padding: 2px 8px; border-radius: 10px;
  white-space: nowrap;
}
.wallet-tab-badge.is-saved  { background: #f6ffed; color: #389e0d; }
.wallet-tab-badge.is-empty  { background: #f5f5f5; color: #888; }

.wallet-method-pill {
  display: inline-block; background: #1565c0; color: #fff;
  font: 700 11px sans-serif; padding: 2px 8px; border-radius: 10px;
  letter-spacing: .5px; margin-right: 6px; vertical-align: middle;
}
.wallet-method-picker { display: flex; flex-direction: column; gap: 8px; }
.wallet-method-option {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid #e0e0e0; border-radius: 6px; cursor: pointer;
  background: #fafbfc;
}
.wallet-method-option:hover { background: #f0f6ff; border-color: #b3d4fc; }
.wallet-method-option input[type=radio] { margin: 0; }
.wallet-method-option code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px; color: #333; flex: 1; word-break: break-all;
}
.wallet-saved-account {
  padding: 10px 12px; background: #fafbfc; border: 1px solid #e0e0e0;
  border-radius: 6px; font-size: 14px;
}

/* ----- Wallet management card (sits below the orders list) ----- */
.wallet-management-body { padding: 4px 0 0; }
.wallet-management-summary {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 14px; background: #fafbfc; border: 1px solid #e0e0e0;
  border-radius: 6px; margin-bottom: 8px;
}
.wallet-management-summary-row {
  display: flex; gap: 12px; align-items: baseline;
}
.wallet-management-label {
  flex: 0 0 110px; font-size: 13px; color: #666; font-weight: 500;
}
.wallet-management-value {
  flex: 1; font-size: 14px; color: #222; word-break: break-all;
}
.wallet-management-value.is-empty { color: #888; font-style: italic; }

/* ----- Wallet management modal ----- */
.wm-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.wm-modal {
  background: #fff; border-radius: 8px; width: 100%; max-width: 540px;
  max-height: calc(100vh - 40px); overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
.wm-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; border-bottom: 1px solid #e0e0e0;
}
.wm-modal-title { font-size: 16px; font-weight: 600; color: #222; }
.wm-modal-close {
  background: transparent; border: 0; cursor: pointer; font-size: 22px;
  color: #888; line-height: 1; padding: 4px 8px; border-radius: 4px;
}
.wm-modal-close:hover { background: #f0f2f5; color: #222; }
.wm-modal-body {
  padding: 18px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px;
}
.wm-modal-hint { margin: 0 0 4px; font-size: 13px; color: #666; }
.wm-section {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 14px; background: #fafbfc; border: 1px solid #e0e0e0;
  border-radius: 6px;
}
.wm-section-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 4px;
}
.wm-method-pill {
  display: inline-block; padding: 2px 10px; border-radius: 4px;
  background: #e3f2fd; color: #1565c0; font-size: 12px; font-weight: 600;
}
.wm-section-note { font-size: 12px; color: #888; }
.wm-modal-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 18px; border-top: 1px solid #e0e0e0;
  background: #fafbfc;
}
