/* ==========================================================================
   Kaidora — account.css
   Customer sign-in, registration, account overview, order history and saved
   addresses. Built on the tokens and primitives in site.css, so the day skin
   and the dark canvas both work without duplicating the palette.
   ========================================================================== */

.account-page {
  --account-sidebar: 13.5rem;
}

/* --------------------------------------------------------------------------
   Auth: sign in and register
   -------------------------------------------------------------------------- */

.auth-shell {
  display: grid;
  gap: var(--s-md);
  width: 100%;
  max-width: 66rem;
  margin-inline: auto;
}

.auth-card {
  padding: clamp(1.25rem, 2.5vw + 0.6rem, 2.6rem);
  border: 1px solid var(--line-2);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--sh-3);
  min-width: 0;
}

.auth-card h1 {
  margin-bottom: 0.4rem;
  font-size: var(--fs-h2);
}

.auth-card__intro {
  max-width: 46ch;
  margin-bottom: var(--s-md);
}

.auth-card .form-error {
  margin-bottom: var(--s-xs);
}

.auth-card .form-actions {
  margin-top: var(--s-xs);
}

.auth-card .btn {
  min-width: 10rem;
}

.auth-card__alt {
  margin-top: var(--s-md);
  padding-top: var(--s-sm);
  border-top: 1px solid var(--line);
  color: var(--text-2);
}

.auth-card__alt a {
  font-weight: 600;
}

.auth-card__note {
  margin-top: 0.5rem;
  font-size: var(--fs-small);
  line-height: 1.6;
}

.auth-aside {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.25rem, 2.5vw + 0.6rem, 2.4rem);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(217, 84, 47, 0.16), transparent 58%),
    radial-gradient(100% 100% at 0% 100%, rgba(127, 168, 139, 0.12), transparent 62%),
    linear-gradient(155deg, rgba(37, 75, 89, 0.62), rgba(15, 34, 45, 0.22));
  min-width: 0;
}

.auth-aside h2 {
  font-size: var(--fs-h3);
  max-width: 24ch;
}

.auth-aside .eyebrow {
  color: var(--c-blush);
}

:root[data-theme="day"] .auth-aside {
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(217, 84, 47, 0.12), transparent 58%),
    radial-gradient(100% 100% at 0% 100%, rgba(127, 168, 139, 0.16), transparent 62%),
    linear-gradient(155deg, rgba(255, 253, 246, 0.9), rgba(232, 226, 211, 0.72));
}

:root[data-theme="day"] .auth-aside .eyebrow {
  color: var(--accent-text);
}

.auth-list {
  display: grid;
  gap: 0.7rem;
  margin-top: var(--s-xs);
  color: var(--text-2);
  font-size: 0.95rem;
}

.auth-list li {
  position: relative;
  padding-left: 1.15rem;
  line-height: 1.55;
}

.auth-list li::before {
  content: "";
  position: absolute;
  inset-block-start: 0.62em;
  inset-inline-start: 0;
  inline-size: 0.4rem;
  block-size: 0.4rem;
  border-radius: 50%;
  background: var(--accent-2);
}

.auth-aside__note {
  margin-top: var(--s-md);
  padding-top: var(--s-sm);
  border-top: 1px solid var(--line-2);
  color: var(--text-2);
  font-size: var(--fs-small);
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   Account page shell
   -------------------------------------------------------------------------- */

.account-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-xs) var(--s-sm);
  margin-bottom: var(--s-md);
}

.account-head > div {
  min-width: 0;
}

.account-head h1 {
  margin-bottom: 0.25rem;
  overflow-wrap: anywhere;
}

.account-head p {
  margin-bottom: 0;
}

.account-head .eyebrow a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--line-2);
}

.account-head .eyebrow a:hover {
  color: var(--accent-text);
  border-bottom-color: currentColor;
}

.account-head .btn {
  flex: 0 0 auto;
}

.account-layout {
  display: grid;
  gap: var(--s-md);
  align-items: start;
}

.account-main {
  display: grid;
  gap: var(--s-sm);
  min-width: 0;
}

.account-sidebar {
  display: grid;
  gap: var(--s-sm);
  min-width: 0;
}

.account-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
}

.account-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.5rem 0.9rem;
  border-radius: var(--r-pill);
  color: var(--text-2);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition:
    color var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}

.account-nav__link:hover {
  color: var(--text);
  background: var(--surface-2);
}

.account-nav__link[aria-current="page"] {
  color: var(--text);
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line-2);
}

.account-nav__signout {
  margin-left: auto;
  padding-inline: 0.65rem;
}

.account-nav__signout .link-button {
  font-size: 0.82rem;
  text-decoration: none;
  letter-spacing: 0.03em;
}

.account-nav__signout .link-button:hover {
  text-decoration: underline;
}

.account-sidebar__note {
  display: grid;
  gap: 0.35rem;
  padding: var(--s-sm);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface);
}

.account-sidebar__note p {
  margin: 0;
  font-size: var(--fs-small);
}

.account-sidebar__note .micro {
  color: var(--text-3);
}

.account-sidebar__note .link-arrow {
  font-size: var(--fs-small);
}

/* Panels ------------------------------------------------------------------ */

.account-panel {
  min-width: 0;
  padding: clamp(1rem, 2.5vw + 0.35rem, 1.6rem);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.account-panel h2 {
  font-size: var(--fs-h3);
}

.account-panel__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem var(--s-sm);
  margin-bottom: var(--s-sm);
}

.account-panel__head h2 {
  margin: 0;
}

.account-panel__head .micro {
  font-size: 0.7rem;
}

.account-panel__head .link-arrow {
  font-size: var(--fs-small);
}

.account-panel .form-grid {
  margin-top: var(--s-xs);
}

/* --------------------------------------------------------------------------
   Orders
   -------------------------------------------------------------------------- */

.order-list {
  display: grid;
  gap: 0.55rem;
}

.order-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "identity status"
    "total open";
  align-items: center;
  gap: 0.45rem 0.75rem;
  padding: 0.9rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  min-width: 0;
}

.order-row__identity {
  grid-area: identity;
  min-width: 0;
}

.order-row__number {
  display: inline-block;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.25;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.order-row__number:hover {
  color: var(--accent-text);
}

.order-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin: 0.15rem 0 0;
  color: var(--text-3);
  font-size: 0.8rem;
  line-height: 1.45;
}

.order-row .status {
  grid-area: status;
  justify-self: end;
}

.order-row__total {
  grid-area: total;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.order-row__open {
  grid-area: open;
  justify-self: end;
  font-size: 0.82rem;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  padding: 0.28rem 0.62rem;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.69rem;
  letter-spacing: 0.09em;
  line-height: 1.4;
  text-transform: uppercase;
  white-space: nowrap;
}

.status::before {
  content: "";
  inline-size: 0.4rem;
  block-size: 0.4rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.85;
}

.status--new,
.status--payment-unpaid {
  border-color: rgba(217, 84, 47, 0.4);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.status--processing {
  border-color: var(--line-strong);
  background: var(--surface-3);
  color: var(--text);
}

.status--shipped,
.status--completed,
.status--payment-paid {
  border-color: rgba(127, 168, 139, 0.42);
  background: var(--ok-soft);
  color: var(--ok-text);
}

.status--cancelled,
.status--payment-refunded {
  border-color: var(--line);
  background: transparent;
  color: var(--text-3);
}

.order-statuses {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.order-proof {
  margin: var(--s-sm) 0 0;
  font-size: var(--fs-small);
  overflow-wrap: anywhere;
}

.order-items {
  display: grid;
  gap: 0;
  margin-bottom: var(--s-sm);
}

.order-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-sm);
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.order-item:first-child {
  padding-top: 0;
}

.order-item:last-child {
  border-bottom: 0;
  padding-bottom: 0.35rem;
}

.order-item__body {
  min-width: 0;
}

.order-item__name {
  margin: 0;
  color: var(--text);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.order-item__meta,
.order-item__options {
  margin: 0.15rem 0 0;
  color: var(--text-3);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.order-item__total {
  flex: 0 0 auto;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.order-totals {
  max-width: 26rem;
  margin-left: auto;
  padding-top: var(--s-xs);
  border-top: 1px solid var(--line-2);
}

.order-totals .cart-total__row {
  padding-block: 0.28rem;
}

/* --------------------------------------------------------------------------
   Addresses
   -------------------------------------------------------------------------- */

.account-address-grid,
.address-grid {
  display: grid;
  gap: var(--s-sm);
  grid-template-columns: minmax(0, 1fr);
}

.address-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
}

.address-card {
  display: flex;
  flex-direction: column;
  gap: var(--s-xs);
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.address-card--default {
  border-color: rgba(217, 84, 47, 0.42);
  background:
    linear-gradient(160deg, rgba(217, 84, 47, 0.08), transparent 55%),
    var(--surface-2);
}

:root[data-theme="day"] .address-card--default {
  border-color: rgba(180, 33, 1, 0.32);
  background:
    linear-gradient(160deg, rgba(180, 33, 1, 0.06), transparent 55%),
    var(--surface-2);
}

.address-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.address-card__head h3 {
  margin: 0;
  font-size: 1.02rem;
  overflow-wrap: anywhere;
}

.address-card .badge {
  flex: 0 0 auto;
  font-size: 0.64rem;
}

.account-address {
  min-width: 0;
  color: var(--text-2);
  font-style: normal;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.account-address strong {
  color: var(--text);
  font-weight: 600;
}

.address-card .account-address {
  font-size: 0.92rem;
}

.address-card__actions {
  margin-top: auto;
  padding-top: var(--s-xs);
  border-top: 1px solid var(--line);
}

.link-button--danger {
  color: var(--text-3);
  font-size: var(--fs-small);
  text-decoration: none;
}

.link-button--danger:hover {
  color: var(--danger-text);
  text-decoration: underline;
}

/* Empty and footer notes -------------------------------------------------- */

.account-empty {
  display: grid;
  justify-items: start;
  gap: var(--s-xs);
  padding: var(--s-md);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
  color: var(--text-2);
}

.account-empty p {
  max-width: 52ch;
  margin: 0;
}

.account-empty--inline {
  padding: var(--s-sm);
}

.account-footnote {
  margin-top: var(--s-xs);
  font-size: var(--fs-small);
  line-height: 1.6;
}

/* --------------------------------------------------------------------------
   Larger screens
   -------------------------------------------------------------------------- */

@media (min-width: 860px) {
  .auth-shell {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    align-items: stretch;
    gap: var(--s-lg);
  }
}

@media (min-width: 900px) {
  .account-layout {
    grid-template-columns: var(--account-sidebar) minmax(0, 1fr);
    gap: var(--s-lg);
  }

  .account-sidebar {
    position: sticky;
    top: calc(var(--header-h-sm) + 1rem);
  }

  .account-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    padding: 0.45rem;
    border-radius: var(--r-lg);
  }

  .account-nav__link {
    display: block;
    padding: 0.65rem 0.8rem;
    border-radius: var(--r-sm);
    font-size: 0.88rem;
  }

  .account-nav__link[aria-current="page"] {
    background: var(--surface-2);
    box-shadow: inset 3px 0 0 var(--accent-2);
  }

  .account-nav__signout {
    margin-left: 0;
    margin-top: 0.3rem;
    padding: 0.7rem 0.8rem 0.25rem;
    border-top: 1px solid var(--line);
  }

  .account-nav__signout .link-button {
    font-size: 0.85rem;
  }

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

  .order-row {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    grid-template-areas: "identity status total open";
    gap: var(--s-sm);
    padding: 1rem 1.1rem;
  }
}

/* --------------------------------------------------------------------------
   Small phones
   -------------------------------------------------------------------------- */

@media (max-width: 430px) {
  .auth-card,
  .auth-aside {
    border-radius: var(--r-lg);
  }

  .auth-card .btn {
    width: 100%;
  }

  .account-head {
    align-items: flex-start;
  }

  .account-head .btn {
    width: 100%;
  }

  .account-nav {
    border-radius: var(--r-lg);
  }

  .account-nav__link {
    flex: 1 1 auto;
    justify-content: center;
    padding-inline: 0.55rem;
  }

  .account-nav__signout {
    flex: 1 1 100%;
    margin-left: 0;
    padding: 0.15rem 0.55rem 0.3rem;
    text-align: center;
  }

  .account-panel {
    padding: 0.95rem;
    border-radius: var(--r-md);
  }

  .order-row {
    padding: 0.85rem;
  }

  .order-totals {
    max-width: none;
  }
}

/* Personal welcome code */
.welcome-code__value {
  margin: 0.6rem 0;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 1.1rem + 1vw, 2rem);
  letter-spacing: 0.08em;
  color: var(--accent-text);
}
.welcome-code__value code { background: none; }

/* Newsletter intent on registration */
.newsletter-intent-note {
  grid-column: 1 / -1;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.newsletter-intent-note p { margin: 0.35rem 0 0; color: var(--text-muted); }
.checkbox--highlight {
  padding: 0.9rem 1rem 0.9rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Customer invoice */
.invoice-page { max-width: 980px; }
.invoice-actions { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.invoice-sheet {
  background: #fffdf6;
  color: #0f222d;
  border: 1px solid rgba(15, 34, 45, 0.18);
  border-radius: var(--r-sm);
  padding: clamp(1.4rem, 4vw, 3rem);
  box-shadow: 0 18px 50px rgba(15, 34, 45, 0.08);
}
.invoice-head { display: flex; justify-content: space-between; gap: 2rem; border-bottom: 1px solid rgba(15, 34, 45, 0.18); padding-bottom: 1.5rem; }
.invoice-head h1 { margin: 0.2rem 0; color: #0f222d; }
.invoice-meta { min-width: 15rem; font-size: 0.9rem; }
.invoice-meta p { display: flex; justify-content: space-between; gap: 1rem; margin: 0.35rem 0; }
.invoice-meta span { color: #5f7075; }
.invoice-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; padding: 1.5rem 0; }
.invoice-parties h2 { font-family: var(--font-body); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: #5f7075; margin: 0 0 0.6rem; }
.invoice-parties address { font-style: normal; color: #33474f; line-height: 1.6; }
.invoice-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.invoice-table th { text-align: left; font-family: var(--font-body); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: #5f7075; border-bottom: 1px solid rgba(15, 34, 45, 0.2); padding: 0.6rem 0.45rem; }
.invoice-table td { padding: 0.75rem 0.45rem; border-bottom: 1px solid rgba(15, 34, 45, 0.1); vertical-align: top; }
.invoice-table .num { text-align: right; white-space: nowrap; }
.invoice-totals { width: min(100%, 22rem); margin: 1.25rem 0 0 auto; }
.invoice-totals > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0.45rem; }
.invoice-totals__grand { border-top: 1px solid rgba(15, 34, 45, 0.25); margin-top: 0.4rem; padding-top: 0.7rem !important; font-weight: 700; font-size: 1.08rem; }
.invoice-foot { border-top: 1px solid rgba(15, 34, 45, 0.18); margin-top: 2rem; padding-top: 1rem; font-size: 0.8rem; color: #5f7075; }
.invoice-foot p { margin: 0.3rem 0; }
@media (max-width: 620px) {
  .invoice-head { flex-direction: column; }
  .invoice-parties { grid-template-columns: 1fr; gap: 1rem; }
}
@media print {
  .site-header, .site-footer, .invoice-actions { display: none !important; }
  body { background: #fff !important; }
  .invoice-page { max-width: none; padding: 0; }
  .invoice-sheet { border: 0; box-shadow: none; border-radius: 0; padding: 0; }
}

/* Refund position on customer invoice */
.invoice-refund {
  margin-top: 2rem;
  padding-top: 1.4rem;
  border-top: 2px solid rgba(180, 33, 1, 0.35);
}
.invoice-refund__head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.invoice-refund h2 { margin: 0.2rem 0 0; color: #0f222d; font-size: 1.35rem; }
.invoice-refund__net { color: #b42101; font-family: var(--font-body); font-size: 1.1rem; white-space: nowrap; }
.invoice-refund__table { margin-top: 1rem; }
.invoice-refund__totals { width: min(100%, 22rem); margin: 1rem 0 0 auto; }
.invoice-refund__totals > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0.45rem; }
.invoice-refund__net-line { border-top: 1px solid rgba(15, 34, 45, 0.25); margin-top: 0.35rem; padding-top: 0.65rem; font-weight: 700; }
.invoice-refund__note { margin: 0.8rem 0 0; color: #b42101; font-size: 0.85rem; }
@media print { .invoice-refund { break-inside: avoid; } }

/* Customer invoice list */
.invoice-list { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.invoice-list th { text-align: left; font-family: var(--font-body); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--line-strong); padding: 0.6rem 0.5rem; }
.invoice-list td { padding: 0.75rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.invoice-list .num { text-align: right; white-space: nowrap; }
.invoice-list .badge { margin-right: 0.45rem; }
