/*
 * Customer pages of the standard frame (ADR 0017): sign-in by code (issue #847), then the
 * order page and the account. Fields, buttons and messages are the frame's own
 * (standard.css); only the frame's `--sp-*` tokens here, so light and dark follow the
 * shop's background on their own.
 */

.sp--customers-login .sp-header__inner {
  justify-content: center;
}

.acc-login {
  flex: 1;
  padding-block: 24px 40px;
}

.acc-card {
  max-width: 400px;
  margin-inline: auto;
}

@media (min-width: 560px) {
  .acc-login {
    padding-block: 56px 72px;
  }

  .acc-card {
    padding: 36px 32px 28px;
    border: 1px solid var(--sp-border);
    border-radius: min(calc(var(--sp-radius) * 1.5), 20px);
  }
}

.acc-title {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.acc-intro {
  margin: 0 0 24px;
  color: var(--sp-muted);
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.acc-form {
  margin: 0;
}

.acc-code input {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3em;
}

.acc-invalid input {
  border-color: var(--sp-danger);
}

.acc-message {
  margin-top: 8px;
}

.acc-message p {
  margin: 0;
}

.acc-submit {
  width: 100%;
  margin-top: 16px;
}

[data-submitting] .acc-submit {
  opacity: 0.6;
  cursor: progress;
}

/* Stacked: the countdown of "Send a new code" never pushes the other link around. */
.acc-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 8px;
}

.acc-actions form {
  margin: 0;
}

.acc-action {
  min-height: 44px;
  font-size: 0.875rem;
}

.acc-action:disabled {
  color: var(--sp-muted);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  cursor: default;
}

.acc-note {
  margin: 20px 0 0;
  color: var(--sp-muted);
  font-size: 0.8125rem;
  text-align: center;
}
/* ----- Account pages (issue #850): Orders, an order, Profile ----- */

.acc-page {
  flex: 1;
  padding-block: 28px 56px;
}

/* Profile: a readable column, on the same left edge as the header and the Orders tab. */
.acc-page--narrow > * {
  max-width: 720px;
}

@media (min-width: 760px) {
  .acc-page {
    padding-block: 44px 80px;
  }
}

.acc-page__title {
  margin: 0 0 20px;
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.acc-muted {
  margin: 0;
  color: var(--sp-muted);
}

.acc-strong {
  margin: 0;
  font-weight: 600;
}

.acc-hint {
  margin: 0;
  color: var(--sp-muted);
  font-size: 0.8125rem;
}

/* Notices of the last form */

.acc-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 20px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--sp-fg) 14%, transparent);
  border-radius: var(--sp-radius-box);
  background: var(--sp-summary);
  font-size: 0.9375rem;
}

.acc-notice svg {
  flex: none;
  margin-top: 2px;
}

.acc-notice--error {
  border-color: color-mix(in srgb, var(--sp-danger) 45%, transparent);
  color: var(--sp-danger);
}

/* Badges: a tone, never a color of their own (the shop's text and accent). */

.acc-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--sp-fg) 7%, transparent);
  color: var(--sp-fg);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

.acc-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}

.acc-badge--success::before,
.acc-badge--progress::before {
  background: var(--sp-accent);
  opacity: 1;
}

.acc-badge--progress {
  background: color-mix(in srgb, var(--sp-accent) 12%, transparent);
}

.acc-badge--muted {
  color: var(--sp-muted);
}

/* Order list: cards on a phone, a light table from 760px. */

.acc-orders {
  display: block;
  width: 100%;
  border-collapse: collapse;
}

.acc-orders thead {
  display: none;
}

.acc-orders tbody {
  display: grid;
  gap: 12px;
}

.acc-order {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "main main"
    "date date"
    "state total";
  gap: 8px 12px;
  padding: 16px;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-box);
  transition: border-color 0.15s;
}

.acc-order:hover {
  border-color: color-mix(in srgb, var(--sp-fg) 40%, transparent);
}

.acc-order:has(.acc-order__link:focus-visible) {
  outline: 2px solid var(--sp-focus);
  outline-offset: 2px;
}

.acc-order > * {
  padding: 0;
  text-align: left;
  font-weight: inherit;
}

.acc-order__main {
  grid-area: main;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.acc-order__id {
  display: grid;
  min-width: 0;
}

.acc-order__link {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
  outline: 0;
}

/* The whole card opens the order. */
.acc-order__link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.acc-order__items,
.acc-order__date {
  color: var(--sp-muted);
  font-size: 0.875rem;
}

.acc-order__state {
  grid-area: state;
  align-self: center;
}

.acc-order__total {
  grid-area: total;
  align-self: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.acc-order__date {
  grid-area: date;
}

.acc-order__go {
  display: none;
}

.acc-thumbs {
  display: flex;
  flex: none;
}

.acc-thumb {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  overflow: hidden;
  border: 2px solid var(--sp-bg);
  border-radius: min(var(--sp-radius-box), 10px);
  background: var(--sp-summary);
  color: var(--sp-muted);
}

.acc-thumb + .acc-thumb {
  margin-left: -12px;
}

.acc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.acc-thumb--more {
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 760px) {
  .acc-orders {
    display: table;
  }

  .acc-orders thead {
    display: table-header-group;
  }

  .acc-orders tbody {
    display: table-row-group;
  }

  .acc-orders th,
  .acc-orders td {
    padding: 14px 16px 14px 0;
    border-bottom: 1px solid var(--sp-border);
    text-align: left;
    vertical-align: middle;
  }

  .acc-orders thead th {
    padding-block: 0 10px;
    color: var(--sp-muted);
    font-size: 0.8125rem;
    font-weight: 500;
  }

  .acc-orders .acc-orders__num {
    text-align: right;
  }

  .acc-order {
    display: table-row;
    border: 0;
  }

  .acc-order:hover {
    background: color-mix(in srgb, var(--sp-fg) 3%, transparent);
  }

  .acc-order:has(.acc-order__link:focus-visible) {
    outline: 0;
  }

  .acc-order__link::after {
    display: none;
  }

  .acc-order__link:focus-visible {
    outline: 2px solid var(--sp-focus);
    outline-offset: 2px;
    border-radius: 2px;
  }

  .acc-order__link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
  }

  .acc-order__main {
    display: table-cell;
  }

  .acc-order__main > * {
    vertical-align: middle;
  }

  /* Room for three thumbnails and "+N": the order numbers line up. */
  .acc-order__main .acc-thumbs {
    display: inline-flex;
    width: 156px;
    margin-right: 14px;
  }

  .acc-order__id {
    display: inline-grid;
  }

  .acc-order__go {
    display: table-cell;
    width: 12px;
    padding-right: 0;
    color: var(--sp-muted);
  }

  .acc-order__date {
    font-size: 0.9375rem;
    white-space: nowrap;
  }
}

/* Pages of the list */

.acc-pages {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.acc-pages__link {
  min-height: 44px;
  padding-inline: 18px;
}

.acc-pages__current {
  color: var(--sp-muted);
  font-size: 0.875rem;
}

/* Empty state */

.acc-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 48px 20px;
  border: 1px dashed var(--sp-border);
  border-radius: var(--sp-radius-box);
  text-align: center;
}

.acc-empty__icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--sp-summary);
  color: var(--sp-muted);
}

.acc-empty__title {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.acc-empty__text {
  margin: 0 0 12px;
  color: var(--sp-muted);
}

/* Sections (Profile, subscriptions) */

.acc-section {
  margin-top: 36px;
  outline: 0;
  scroll-margin-top: 16px;
}

.acc-page__title + .acc-section,
.acc-notice + .acc-section {
  margin-top: 0;
}

.acc-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.acc-section__title {
  margin: 0 0 12px;
  font-size: 1.0625rem;
  font-weight: 600;
}

.acc-section__empty {
  margin-bottom: 12px;
}

.acc-card-box {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 20px;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-box);
}

.acc-card-box p {
  margin: 0;
}

@media (max-width: 479px) {
  .acc-card-box,
  .acc-new-address .acc-address__panel {
    padding: 16px;
  }
}

.acc-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.acc-form-actions .sp-button {
  min-height: 48px;
}

.acc-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  padding-top: 10px;
  cursor: pointer;
  font-size: 0.9375rem;
}

.acc-check input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--sp-accent);
}

.acc-check input:focus-visible {
  outline: 2px solid var(--sp-focus);
  outline-offset: 2px;
}

.acc-list {
  display: grid;
  margin: 0;
  padding: 0;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-box);
  list-style: none;
}

.acc-card-box .acc-list {
  margin-top: 6px;
}

.acc-list__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 16px;
  padding: 14px 16px;
}

.acc-list__item + .acc-list__item {
  border-top: 1px solid var(--sp-border);
}

.acc-list__main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.acc-list__main .acc-muted {
  font-size: 0.875rem;
}

.acc-list__side {
  font-variant-numeric: tabular-nums;
}

.acc-progress {
  width: 100%;
  height: 8px;
  accent-color: var(--sp-accent);
}

.acc-referral {
  overflow-wrap: anywhere;
}

/* Address book */

.acc-addresses {
  display: grid;
  gap: 12px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .acc-addresses {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* An address being edited takes the whole row. */
  .acc-address:has(.acc-address__edit[open]) {
    grid-column: 1 / -1;
  }
}

.acc-address {
  display: grid;
  align-content: space-between;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-box);
  scroll-margin-top: 16px;
}

.acc-address:target {
  border-color: var(--sp-focus);
}

.acc-address__badge {
  margin-bottom: 8px;
}

.acc-address__text {
  font-size: 0.9375rem;
  font-style: normal;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.acc-address__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 16px;
}

.acc-address__actions form {
  margin: 0;
}

/* "Edit" sits among the actions; its form opens on a row of its own below them. */
.acc-address__edit {
  display: contents;
}

.acc-address__edit > summary {
  order: -1;
  list-style: none;
}

.acc-address__edit > summary::-webkit-details-marker {
  display: none;
}

.acc-address__edit > .acc-address__panel {
  order: 10;
  flex-basis: 100%;
}

.acc-action {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 0.875rem;
  cursor: pointer;
}

.acc-action--danger {
  color: var(--sp-danger);
}

.acc-address__panel {
  margin-top: 8px;
}

.acc-panel__title {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
}

.acc-address-form {
  margin: 0;
}

.acc-new-address > summary {
  list-style: none;
}

.acc-new-address > summary::-webkit-details-marker {
  display: none;
}

.acc-new-address__toggle {
  min-height: 48px;
}

.acc-new-address[open] > summary {
  display: none;
}

.acc-new-address .acc-address__panel {
  margin-top: 0;
  padding: 20px;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-box);
}

.acc-new-address .acc-hint {
  margin-top: 12px;
}

.acc-signout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 24px;
  border-top: 1px solid var(--sp-border);
}

.acc-signout form {
  margin: 0;
}
/* The order's page in the account: back link, invoice, returns (issue #850). */

.os-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  margin: -8px 0 4px;
  color: var(--sp-muted);
  font-size: 0.875rem;
  text-decoration: none;
}

.os-back:hover {
  color: var(--sp-fg);
}

.os-back:focus-visible {
  outline: 2px solid var(--sp-focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.acc-invoice {
  margin: 0;
}

.acc-invoice__link {
  width: 100%;
  min-height: 48px;
  justify-content: flex-start;
}

.acc-invoice__link .acc-hint {
  margin-left: auto;
  font-weight: 400;
}

.acc-returns {
  outline: 0;
  scroll-margin-top: 16px;
}

.acc-returns .acc-notice {
  margin-bottom: 12px;
}

.acc-return-list {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.acc-return {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-box);
}

.acc-return__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.acc-return__lines {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
}

.acc-return__note {
  padding: 10px 12px;
  border-radius: calc(var(--sp-radius-box) - 2px);
  background: var(--sp-summary);
  font-size: 0.875rem;
}

.acc-return__note h3 {
  margin: 0 0 2px;
  font-size: 0.8125rem;
  font-weight: 600;
}

.acc-return__note p {
  margin: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.acc-return-request > summary {
  list-style: none;
}

.acc-return-request > summary::-webkit-details-marker {
  display: none;
}

.acc-return-request__toggle {
  width: 100%;
  min-height: 48px;
}

.acc-return-request[open] > summary {
  display: none;
}

.acc-return-form {
  display: grid;
  gap: 12px;
  margin: 0;
}

.acc-return-form > p {
  margin: 0;
}

.acc-return-form__items {
  margin: 0;
  padding: 0;
  border: 1px solid var(--sp-border);
  border-radius: var(--sp-radius-box);
}

.acc-return-form__legend {
  padding: 0 6px;
  margin-left: 10px;
  color: var(--sp-muted);
  font-size: 0.8125rem;
}

.acc-return-form__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
}

.acc-return-form__item + .acc-return-form__item {
  border-top: 1px solid var(--sp-border);
}

.acc-return-form__label {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: 0.9375rem;
  overflow-wrap: anywhere;
}

.acc-qty {
  flex: none;
  width: 76px;
  height: 44px;
  padding: 0 10px;
  border: 1px solid var(--sp-field-border);
  border-radius: min(var(--sp-radius), 12px);
  background: var(--sp-field);
  color: var(--sp-fg);
  font: inherit;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.acc-qty:focus,
.acc-textarea textarea:focus {
  outline: 0;
  border-color: var(--sp-focus);
  box-shadow: 0 0 0 1px var(--sp-focus);
}

.acc-textarea {
  display: grid;
  gap: 6px;
}

.acc-textarea label {
  color: var(--sp-muted);
  font-size: 0.875rem;
}

.acc-textarea textarea {
  width: 100%;
  min-height: 96px;
  padding: 12px var(--sp-pad);
  border: 1px solid var(--sp-field-border);
  border-radius: var(--sp-radius-box);
  background: var(--sp-field);
  color: var(--sp-fg);
  font: inherit;
  font-size: 16px;
  resize: vertical;
}

.acc-policy {
  font-size: 0.875rem;
}

.acc-policy summary {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  cursor: pointer;
}

.acc-policy p {
  margin: 0;
  color: var(--sp-muted);
  white-space: pre-line;
}

/* "Track my order" (issue #1263): the number's hint stays close to its field. */

.ol-field {
  display: grid;
  gap: 6px;
}
