/* Customer private area: one coherent, task-focused shell for profile, orders and addresses. */

.customer-area,
.customer-auth-entry {
  --customer-ink: #10284d;
  --customer-text: #34445a;
  --customer-muted: #55657a;
  --customer-border: #d6e1ef;
  --customer-border-strong: #b6cae3;
  --customer-surface: #ffffff;
  --customer-surface-soft: #f5f8fc;
  --customer-primary: #2057d4;
  --customer-primary-dark: #1746b0;
  --customer-focus: #ffca28;
  --customer-danger: #a12f35;
  --customer-danger-soft: #fff5f5;
  --customer-success: #17663c;
  --customer-success-soft: #edf9f2;
  --customer-warning: #81580b;
  --customer-warning-soft: #fff8e7;
}

.customer-area {
  display: grid;
  grid-template-columns: minmax(220px, 256px) minmax(0, 1fr);
  align-items: start;
  gap: clamp(20px, 3vw, 36px);
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  color: var(--customer-text);
}

/* Keep sticky account navigation inside the active task; later discovery rails
   belong to the page flow and must never slide underneath it. */
.customer-area--with-discovery {
  grid-template-columns: minmax(0, 1fr);
  max-width: none;
}

.customer-area--with-discovery .customer-area__task-layout {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
}

.customer-area__task-layout {
  display: grid;
  grid-template-columns: minmax(220px, 256px) minmax(0, 1fr);
  align-items: start;
  gap: clamp(20px, 3vw, 36px);
}

.customer-area *,
.customer-auth-entry * {
  min-width: 0;
}

.customer-area [hidden],
.customer-auth-entry [hidden] {
  display: none !important;
}

.customer-area :where(a, button, input, select, summary):focus-visible,
.customer-auth-entry :where(a, button, input, select):focus-visible {
  outline: 3px solid #0f2a52;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--customer-focus);
}

/* Stable first-paint controls: the global public bundle is deliberately non-blocking. */
.customer-area .button-group,
.customer-auth-entry .button-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.customer-area .button,
.customer-auth-entry .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 16px;
  border: 0;
  border-radius: 9px;
  background: var(--customer-primary);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
}

.customer-area .button:hover,
.customer-auth-entry .button:hover {
  background: var(--customer-primary-dark);
  text-decoration: none;
}

.customer-area .button:disabled,
.customer-auth-entry .button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.customer-area .button--secondary,
.customer-auth-entry .button--secondary {
  background: var(--customer-ink);
}

.customer-area .button--ghost,
.customer-auth-entry .button--ghost {
  background: #eef2f7;
  color: var(--customer-ink);
}

.customer-area .button--outline,
.customer-auth-entry .button--outline {
  border: 1px solid var(--customer-border-strong);
  background: #ffffff;
  color: var(--customer-ink);
}

.customer-area .button--danger,
.customer-auth-entry .button--danger {
  background: var(--customer-danger);
}

.customer-area a.button:not(.button--outline):not(.button--ghost),
.customer-auth-entry a.button:not(.button--outline):not(.button--ghost) {
  color: #ffffff;
}

.customer-area a.button--outline,
.customer-area a.button--ghost,
.customer-auth-entry a.button--outline,
.customer-auth-entry a.button--ghost {
  color: var(--customer-ink);
}

.customer-area__navigation {
  position: sticky;
  top: calc(var(--site-header-height, 80px) + 16px);
  align-self: start;
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 1px solid var(--customer-border);
  border-radius: 18px;
  background: var(--customer-surface);
  box-shadow: 0 12px 30px rgba(15, 35, 67, 0.06);
}

.customer-area__context-brand {
  position: absolute;
  bottom: calc(100% + 16px);
  left: 0;
  display: flex;
  align-items: center;
  width: 100%;
  height: calc(var(--site-header-height, 80px) - 16px);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  pointer-events: none;
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    visibility 0s linear 180ms;
}

body.has-site-header-hidden .customer-area__context-brand {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition-delay: 100ms, 100ms, 0s;
}

.customer-area__context-brand img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(72px, calc(var(--site-header-height, 80px) - 32px));
  object-fit: contain;
}

.customer-area__navigation-summary {
  display: none;
}

.customer-area__navigation-summary:focus-visible {
  outline: 3px solid #0f2a52;
  outline-offset: -4px;
  box-shadow: inset 0 0 0 7px var(--customer-focus);
}

.customer-area__navigation-content,
details.customer-area__navigation:not([open]) > .customer-area__navigation-content {
  display: grid;
  overflow: clip;
  border-radius: inherit;
}

.customer-area__identity {
  display: grid;
  gap: 4px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--customer-border);
  overflow-wrap: anywhere;
}

.customer-area__identity-label {
  color: var(--customer-muted);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.customer-area__identity strong {
  color: var(--customer-ink);
  font-size: 1.04rem;
  line-height: 1.3;
}

.customer-area__identity-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.customer-area__identity-edit {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
  margin-block: -8px;
  padding: 8px 5px;
  border-radius: 8px;
  color: var(--customer-primary-dark);
  font-size: 0.8rem;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
}

.customer-area__identity-edit:hover {
  background: var(--customer-surface-soft);
  color: var(--customer-primary-dark);
  text-decoration: none;
}

.customer-area__identity-edit svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.customer-area__identity-name + span {
  overflow: hidden;
  color: var(--customer-muted);
  font-size: 0.84rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-profile-dialog {
  width: min(620px, calc(100vw - 32px));
  max-height: min(760px, calc(100dvh - 32px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--customer-border);
  border-radius: 18px;
  background: var(--customer-surface);
  color: var(--customer-text);
  box-shadow: 0 24px 70px rgba(15, 35, 67, 0.28);
}

.customer-profile-dialog::backdrop {
  background: rgba(9, 24, 47, 0.58);
}

.customer-profile-dialog__surface {
  display: grid;
  gap: 22px;
  max-height: min(760px, calc(100dvh - 32px));
  padding: clamp(20px, 4vw, 30px);
  overflow-y: auto;
}

.customer-profile-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.customer-profile-dialog__header .eyebrow {
  margin-bottom: 5px;
}

.customer-profile-dialog__header h2 {
  margin: 0;
  color: var(--customer-ink);
  font-size: clamp(1.45rem, 4vw, 1.9rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.customer-profile-dialog__close {
  display: inline-grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  margin: -8px -8px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--customer-surface-soft);
  color: var(--customer-ink);
  cursor: pointer;
}

.customer-profile-dialog__close:hover {
  background: #e8eef7;
}

.customer-profile-dialog__close svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.customer-area__navigation-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 10px;
  list-style: none;
}

.customer-area__navigation-link {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  min-height: 48px;
  padding: 10px 12px;
  border-radius: 11px;
  color: var(--customer-ink);
  font-weight: 750;
  line-height: 1.25;
  text-decoration: none;
}

.customer-area__navigation-link svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.customer-area__navigation-link:hover {
  background: var(--customer-surface-soft);
  color: var(--customer-ink);
  text-decoration: none;
}

.customer-area__navigation-link.is-current {
  background: #eaf1ff;
  color: var(--customer-primary-dark);
}

.customer-area__logout {
  margin: 0;
  padding: 10px;
  border-top: 1px solid var(--customer-border);
}

.customer-area__logout button {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--customer-muted);
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  text-align: left;
}

.customer-area__logout button:hover {
  background: var(--customer-surface-soft);
  color: var(--customer-ink);
}

.customer-area__content {
  display: grid;
  gap: 18px;
  width: 100%;
}

.customer-area__page-header {
  display: grid;
  gap: 7px;
  padding: 4px 2px 10px;
}

.customer-area__page-header--with-action {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 20px;
}

.customer-area__page-header h1 {
  margin: 0;
  color: var(--customer-ink);
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.customer-area__page-header p:not(.eyebrow) {
  max-width: 680px;
  margin: 0;
  color: var(--customer-muted);
  line-height: 1.55;
}

.customer-area__page-header .button {
  min-height: 46px;
  white-space: nowrap;
}

.customer-area__panel {
  margin: 0;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--customer-border);
  border-radius: 18px;
  background: var(--customer-surface);
  box-shadow: 0 12px 30px rgba(15, 35, 67, 0.055);
}

.customer-area__section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.customer-area__section-heading h2,
.customer-area__verification h2,
.customer-area__error-summary h2,
.customer-area__empty-state h3 {
  margin: 0;
  color: var(--customer-ink);
  letter-spacing: -0.02em;
}

.customer-area__section-heading h2,
.customer-area__verification h2,
.customer-area__error-summary h2 {
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  line-height: 1.2;
}

.customer-area__section-heading p,
.customer-area__verification p,
.customer-area__error-summary p,
.customer-area__empty-state p {
  margin: 6px 0 0;
  color: var(--customer-muted);
  line-height: 1.55;
}

.customer-area__feedback,
.customer-area__verification,
.customer-area__error-summary {
  margin: 0;
  padding: 15px 17px;
  border: 1px solid var(--customer-border);
  border-radius: 14px;
  box-shadow: none;
}

.customer-area__feedback.alert--success {
  border-color: #b7dfc8;
  background: var(--customer-success-soft);
  color: var(--customer-success);
}

.customer-area__feedback.alert--warning,
.customer-area__verification,
.customer-area__error-summary {
  border-color: #ead49c;
  background: var(--customer-warning-soft);
  color: #654509;
}

.customer-area__verification {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.customer-area__verification form {
  flex: 0 0 auto;
  margin: 0;
}

.customer-area__verification .button {
  min-height: 44px;
}

.customer-area__form {
  display: grid;
  gap: 20px;
  max-width: 700px;
}

.customer-area__fieldset {
  display: grid;
  gap: 18px;
  min-width: 0;
  margin: 0;
  padding: 0 0 24px;
  border: 0;
  border-bottom: 1px solid var(--customer-border);
}

.customer-area__fieldset + .customer-area__fieldset {
  padding-top: 4px;
}

.customer-area__fieldset legend {
  margin-bottom: 18px;
  padding: 0;
  color: var(--customer-ink);
  font-size: 1.13rem;
  font-weight: 800;
  line-height: 1.25;
}

.customer-area__form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.customer-area__form-row--location {
  grid-template-columns: minmax(130px, 0.65fr) minmax(220px, 1.35fr);
}

.customer-area__field {
  display: grid;
  gap: 7px;
}

.customer-area__field--compact {
  max-width: 280px;
}

.customer-area__field--medium {
  max-width: 390px;
}

.customer-area__field--country {
  max-width: 180px;
}

.customer-area__field label,
.customer-area__field-label {
  color: var(--customer-ink);
  font-size: 0.94rem;
  font-weight: 750;
  line-height: 1.35;
}

.customer-area__field input,
.customer-area__field select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #7187a1;
  border-radius: 10px;
  background: #ffffff;
  color: #172335;
  font: inherit;
  line-height: 1.35;
}

.customer-area__field input:hover,
.customer-area__field select:hover {
  border-color: #8098b6;
}

.customer-area__field input:focus,
.customer-area__field select:focus {
  border-color: var(--customer-primary);
  box-shadow: 0 0 0 1px var(--customer-primary);
}

.customer-area__field.has-error input,
.customer-area__field.has-error select {
  border-color: var(--customer-danger);
  box-shadow: 0 0 0 1px var(--customer-danger);
}

.customer-area__field-error {
  margin: 0;
  color: var(--customer-danger);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.4;
}

.customer-area__readonly-value {
  min-height: 48px;
  margin: 0;
  padding: 12px 13px;
  overflow-wrap: anywhere;
  border: 1px solid var(--customer-border);
  border-radius: 10px;
  background: var(--customer-surface-soft);
  color: var(--customer-text);
  line-height: 1.4;
}

.customer-area__checkbox {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: fit-content;
  max-width: 100%;
  color: var(--customer-ink);
  cursor: pointer;
  font-weight: 700;
  line-height: 1.45;
}

.customer-area__checkbox input {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  margin: 1px 0 0;
  accent-color: var(--customer-primary);
}

.customer-area__form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.customer-area__form-actions .button {
  min-height: 44px;
}

.customer-area__visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.customer-area__empty-state {
  padding: clamp(20px, 4vw, 32px);
  border: 1px dashed var(--customer-border-strong);
  border-radius: 14px;
  background: var(--customer-surface-soft);
}

.customer-area__empty-state h3 {
  font-size: 1.16rem;
  line-height: 1.3;
}

.customer-area__empty-state .button {
  min-height: 44px;
  margin-top: 18px;
}

.customer-auth-entry {
  display: grid;
  gap: 12px;
  max-width: 680px;
  margin: 32px auto;
  padding: clamp(24px, 4vw, 38px);
  border: 1px solid var(--customer-border);
  border-radius: 18px;
  background: var(--customer-surface);
}

.customer-auth-entry h1 {
  margin: 0;
  color: var(--customer-ink);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.customer-auth-entry > p:not(.eyebrow) {
  margin: 0;
  color: var(--customer-muted);
  line-height: 1.55;
}

.customer-auth-entry__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.customer-auth-entry__actions .button {
  min-height: 46px;
}

@media (max-width: 860px) {
  .customer-area,
  .customer-area__task-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .customer-area__navigation {
    position: static;
    width: 100%;
  }

  .customer-area__context-brand {
    display: none;
  }

  .customer-area__navigation-summary {
    display: grid;
    grid-template-columns: minmax(0, auto) minmax(0, 1fr) 22px;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 10px 15px;
    color: var(--customer-ink);
    cursor: pointer;
    list-style: none;
  }

  .customer-area__navigation-summary::-webkit-details-marker {
    display: none;
  }

  .customer-area__navigation-summary > span {
    color: var(--customer-muted);
    font-size: 0.84rem;
    font-weight: 700;
  }

  .customer-area__navigation-summary > strong {
    overflow: hidden;
    font-size: 0.95rem;
    text-align: right;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .customer-area__navigation-summary svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: transform 160ms ease;
  }

  .customer-area__navigation[open] .customer-area__navigation-summary svg {
    transform: rotate(180deg);
  }

  details.customer-area__navigation:not([open]) > .customer-area__navigation-content {
    display: none;
  }

  .customer-area__navigation-content {
    border-top: 1px solid var(--customer-border);
  }

  .customer-area__identity {
    padding-block: 17px;
  }
}

@media (max-width: 640px) {
  .customer-area__page-header--with-action,
  .customer-area__form-row,
  .customer-area__form-row--location {
    grid-template-columns: minmax(0, 1fr);
  }

  .customer-area__page-header--with-action {
    align-items: start;
  }

  .customer-area__page-header--with-action .button {
    justify-self: start;
  }

  .customer-area__verification {
    display: grid;
  }

  .customer-area__field--compact,
  .customer-area__field--medium,
  .customer-area__field--country {
    max-width: none;
  }

}

@media (max-width: 420px) {
  .customer-area__navigation-summary {
    grid-template-columns: minmax(0, 1fr) 22px;
  }

  .customer-area__navigation-summary > span {
    display: none;
  }

  .customer-area__navigation-summary > strong {
    text-align: left;
  }

  .customer-area__panel {
    padding: 17px;
  }

  .customer-profile-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  .customer-profile-dialog__surface {
    max-height: calc(100dvh - 20px);
    padding: 18px;
  }

  .customer-area__form-actions,
  .customer-auth-entry__actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .customer-area__form-actions .button,
  .customer-auth-entry__actions .button,
  .customer-area__page-header--with-action .button {
    width: 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .customer-area__context-brand {
    transition: none;
    transform: none;
  }

  .customer-area__navigation-summary svg {
    transition: none;
  }
}
