.account-body {
  --brown: var(--sage-dark, #6f4328);
  --cream: var(--paper, #fbf6ef);
}

.account-body {
  min-height: 100vh;
  background: var(--cream);
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

.account-loading .account-main {
  visibility: hidden;
}

.account-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px clamp(18px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(251, 246, 239, 0.96);
  backdrop-filter: blur(12px);
}

.account-topnav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-topnav a,
.account-topnav button,
.link-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--brown);
  font: inherit;
  font-weight: 900;
  padding: 10px 14px;
  text-decoration: none;
}

.account-main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: clamp(28px, 5vw, 58px) 0 58px;
}

.account-hero {
  display: grid;
  justify-items: center;
  margin-bottom: 22px;
  text-align: center;
}

.account-hero h1 {
  max-width: 13ch;
  margin: 0;
  font-size: clamp(2.15rem, 6vw, 4.2rem);
  line-height: 1.02;
}

.account-hero p:not(.eyebrow) {
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.account-message {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--sage-dark);
  font-weight: 900;
  padding: 14px 16px;
}

.account-message.is-error {
  color: #8d2d24;
}

.account-grid,
.account-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.auth-flow {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
}

.auth-page {
  display: grid;
  justify-items: center;
}

.account-layout {
  grid-template-columns: 230px minmax(0, 1fr);
  align-items: start;
}

.account-panel,
.account-sidebar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  padding: 22px;
}

.account-panel.narrow {
  width: min(100%, 620px);
  margin-right: auto;
  margin-left: auto;
}

.auth-card {
  width: min(100%, 640px);
}

.account-panel h2,
.account-panel h3 {
  margin-top: 0;
}

.account-panel h2 {
  font-size: clamp(1.7rem, 4vw, 2.35rem);
}

.account-panel form,
.account-panel,
.account-form-grid,
.password-form {
  display: grid;
  gap: 12px;
}

.account-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 900;
}

.account-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 11px 12px;
}

.account-panel textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  padding: 11px 12px;
}

.auth-switch {
  margin: 0;
  color: var(--muted);
  text-align: center;
}

.auth-switch button {
  border: 0;
  background: transparent;
  color: var(--brown);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.account-form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.account-form-wide {
  grid-column: 1 / -1;
}

.account-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.account-cards article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.account-cards span,
.muted {
  color: var(--muted);
}

.account-cards strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
}

.account-sidebar {
  display: grid;
  gap: 8px;
}

.account-sidebar a {
  border-radius: 8px;
  color: var(--brown);
  font-weight: 900;
  padding: 11px 12px;
  text-decoration: none;
}

.account-sidebar a:hover,
.account-sidebar a:focus,
.account-sidebar a:focus-visible,
.account-sidebar a:active {
  background: var(--soft);
  color: var(--brown);
  outline: 2px solid rgba(111, 67, 40, 0.35);
  outline-offset: 2px;
}

.account-sidebar a.is-active,
.account-sidebar a[aria-current="page"],
.account-sidebar a.current,
.account-sidebar a.selected,
.account-sidebar a.active {
  background: var(--brown);
  color: #fff;
  outline-color: transparent;
}

.overview-stack {
  display: grid;
  gap: 12px;
}

.overview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.order-list {
  display: grid;
  gap: 12px;
}

.account-order-card,
.account-detail-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.account-order-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.account-order-card strong,
.account-order-card span {
  overflow-wrap: anywhere;
}

.status-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.status-badges span {
  border-radius: 999px;
  background: var(--soft);
  color: var(--brown);
  font-size: 0.82rem;
  font-weight: 900;
  padding: 6px 10px;
}

.account-lines {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.account-order-hero,
.account-section-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.account-order-hero {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.account-order-hero h2,
.account-section-card h3 {
  margin: 0;
}

.account-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.account-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0;
}

.account-actions-row {
  margin-top: 14px;
}

.account-line {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.account-line img {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
}

.account-line-image-link {
  display: inline-flex;
  width: 54px;
  height: 54px;
  border-radius: 8px;
}

.account-line-image-link:focus-visible,
.account-line-product-link:focus-visible {
  outline: 2px solid var(--brown);
  outline-offset: 3px;
}

.account-line-product-link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(111, 67, 40, 0.28);
  text-underline-offset: 3px;
}

.account-line-product-link:hover {
  color: var(--brown);
  text-decoration-color: currentColor;
}

.account-line-placeholder {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 8px;
  background: var(--soft);
  color: var(--brown);
  font-size: 0.64rem;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
}

.payment-box {
  border-radius: 8px;
  background: #fff6ed;
  border: 1px solid var(--line);
  padding: 16px;
  margin-top: 14px;
}

.detail-list {
  display: grid;
  gap: 8px;
}

.detail-list div {
  display: grid;
  grid-template-columns: minmax(120px, 0.4fr) minmax(0, 1fr);
  gap: 12px;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 900;
}

.detail-list dd {
  margin: 0;
}

@media (max-width: 760px) {
  .account-header,
  .account-topnav {
    align-items: stretch;
    flex-direction: column;
  }

  .account-grid,
  .account-layout,
  .account-form-grid,
  .account-cards,
  .account-detail-grid {
    grid-template-columns: 1fr;
  }

  .account-main {
    width: min(100% - 24px, 680px);
    padding-top: 24px;
  }

  .account-hero h1 {
    max-width: 100%;
  }

  .account-panel,
  .account-sidebar {
    padding: 18px;
  }

  .account-order-card,
  .account-line,
  .detail-list div {
    grid-template-columns: 1fr;
  }

  .account-section-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
