/* Order list and account navigation share the storefront content grid. */
.orders-layout { display: grid; gap: 2rem; }
.orders-heading { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.orders-heading h1 { margin-top: .5rem; }
.orders-gate { display: grid; justify-items: start; gap: 1.5rem; padding: 1.5rem; border: 1px solid var(--line-strong); border-radius: var(--r-m); background: var(--bg-raised); }
.orders-page #orders { display: grid; gap: 1.5rem; }
.account-actions { margin-top: 1.5rem; }
.account-link { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; min-height: 88px; padding: 1.5rem; border: 1px solid var(--line-strong); border-radius: var(--r-m); background: var(--bg-raised); text-decoration: none; }
.account-link > span:first-child { display: grid; gap: .25rem; }
.account-link strong { font-size: 1.125rem; }
.account-link > span > span { color: var(--fg-dim); font-size: .875rem; }
.account-link:hover { border-color: var(--accent); }
.account-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
[dir="rtl"] .account-link > span:last-child { transform: scaleX(-1); }
#orders {
  grid-template-columns: minmax(0, 1fr);
}
.order-history {
  display: block;
  min-width: 0;
  color: var(--sage-900);
  text-decoration: none;
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-m);
  overflow: hidden;
  transition: border-color 160ms ease;
}
.order-history:hover { border-color: var(--accent); }
.order-history:focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; }
.order-history__header {
  display: grid;
  grid-template-columns: 1fr 1fr 1.3fr 1.3fr;
  gap: 1rem;
  margin: 0;
  padding: 1.5rem;
  background: var(--sage-100, #eaf0e5);
  border-bottom: 1px solid var(--sage-300);
}
.order-history__field { min-width: 0; }
.order-history__field dt { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; opacity: .72; }
.order-history__field dd { margin: .2rem 0 0; font-size: .9rem; font-weight: 700; overflow-wrap: anywhere; }
.order-history__field dd > span { display: block; }
.order-history__field .order-history__city { font-size: .78rem; font-weight: 500; }
.order-history__number { text-align: end; }
.order-history__number dd > .status { display: table; margin-top: .35rem; margin-inline-start: auto; max-width: 100%; overflow-wrap: anywhere; }
.order-history__body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(180px, 230px); gap: 1.5rem; padding: 1.5rem; }
.order-history__items { display: grid; gap: .8rem; margin: 0; padding: 0; list-style: none; }
.order-history__item { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.order-history__photo { display: grid; place-items: center; flex: 0 0 72px; width: 72px; height: 72px; overflow: hidden; background: var(--bg); border: 1px solid var(--sage-200); border-radius: var(--r-s); }
.order-history__photo img { width: 100%; height: 100%; object-fit: contain; }
.order-history__photo > span { font-family: var(--font-display); font-size: .95rem; opacity: .45; }
.order-history__product { display: grid; gap: .25rem; min-width: 0; }
.order-history__name { font-weight: 700; font-size: .95rem; line-height: 1.5; overflow-wrap: anywhere; }
.order-history__quantity { font-size: .8rem; opacity: .75; }
.order-history__action { display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; text-align: end; }
.order-history__action .status { max-width: 100%; overflow-wrap: anywhere; }
.order-history__payment { font-size: .78rem; font-weight: 600; }
.order-history__payment[data-payment="failed"] { color: #8b3024; }
.order-history__tracking { font-size: .75rem; opacity: .7; overflow-wrap: anywhere; }
.order-history__details { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; margin-top: auto; padding: .65rem 1rem; border: 1.5px solid var(--sage-900); border-radius: 999px; background: var(--sage-900); color: var(--bg-raised); font-size: .83rem; font-weight: 700; }
.order-history:hover .order-history__details { background: var(--accent); border-color: var(--accent); }
[dir="rtl"] .order-history__details > span { transform: scaleX(-1); }
@media (max-width: 640px) {
  .orders-layout { gap: 1.5rem; }
  .orders-gate,.account-link { padding: 1rem; }
  .order-history__header { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: .9rem 1rem; gap: .8rem 1rem; }
  .order-history__number { text-align: start; }
  .order-history__number dd > .status { margin-inline-start: 0; }
  .order-history__field dt { font-size: .65rem; }
  .order-history__field dd { font-size: .82rem; }
  .order-history__body { grid-template-columns: minmax(0, 1fr); gap: 1rem; padding: 1rem; }
  .order-history__photo { flex-basis: 60px; width: 60px; height: 60px; }
  .order-history__item { gap: .8rem; }
  .order-history__action { align-items: flex-start; text-align: start; border-top: 1px solid var(--sage-200); padding-top: 1rem; }
  .order-history__details { margin-top: .25rem; width: 100%; min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .order-history { transition: none; }
}
