.address-add-button {
  width: auto;
  min-height: 44px;
  min-width: 132px;
  padding-right: 20px;
  padding-left: 20px;
  cursor: pointer;
}

.address-add-button[hidden] {
  display: none;
}

.address-add-button.is-form-mode {
  border-color: #95a98b;
  background: #fffdfa;
  color: #4e5d50;
}

.address-add-button.is-form-mode:hover {
  background: #f5f3ed;
}

.account-status.auth-required button {
  cursor: pointer;
}

.address-message {
  margin: 0 0 14px;
  color: #315c2e;
  font-weight: 700;
}

.address-message.error {
  color: #8a3324;
}

.address-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.address-filter[hidden] {
  display: none;
}

.address-filter-button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffdfa;
  color: #4e5d50;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.address-filter-button:hover,
.address-filter-button.is-active {
  border-color: #95a98b;
  background: #edf3e8;
  color: #315c2e;
}

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

.addresses-list[hidden] {
  display: none;
}

.address-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.address-card.is-recently-updated {
  border-color: #95a98b;
  background: #f3f8ee;
  box-shadow: 0 0 0 3px rgba(127, 150, 120, 0.18);
}

.address-card h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}

.address-lines {
  display: grid;
  gap: 3px;
  color: var(--text);
  line-height: 1.45;
}

.address-lines .muted {
  color: var(--muted);
}

.address-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.address-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #edf3e8;
  color: #46603d;
  font-size: 0.82rem;
  font-weight: 700;
}

.address-badge.is-default {
  background: #e7f0e1;
  color: #315c2e;
}

.address-card-actions {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.address-card-actions button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #95a98b;
  border-radius: 999px;
  background: #fff;
  color: #4e5d50;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.address-card-actions button:hover {
  background: #f5f3ed;
}

.address-card-actions .danger {
  border-color: #ebc7bd;
  color: #8a3324;
}

.addresses-empty-state {
  display: grid;
  gap: 8px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.addresses-empty-state h2,
.addresses-empty-state p {
  margin: 0;
}

.addresses-empty-state p {
  color: var(--muted);
  line-height: 1.45;
}

.address-form {
  display: grid;
  gap: 16px;
  margin-top: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.address-form[hidden] {
  display: none;
}

.address-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.address-form-head h2 {
  margin: 0;
  font-size: 1.16rem;
}

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

.address-field {
  display: grid;
  gap: 7px;
}

.address-field label {
  color: #4e5d50;
  font-weight: 700;
}

.address-field input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.address-field.is-invalid input {
  border-color: #c65d49;
  background: #fff8f6;
}

.field-error {
  margin: 0;
  color: #8a3324;
  font-size: 0.92rem;
  line-height: 1.4;
}

.address-flags {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  padding: 14px;
  border: 1px solid #edf0e8;
  border-radius: 8px;
  background: #fbf8f1;
}

.address-flags label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #4e5d50;
  font-weight: 700;
}

.address-flags input {
  width: 18px;
  height: 18px;
  accent-color: #5f7f53;
}

.address-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.address-actions .summary-button {
  width: auto;
  min-width: 130px;
  padding-right: 20px;
  padding-left: 20px;
  cursor: pointer;
}

.address-actions .summary-button:disabled,
.address-add-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.address-actions .summary-button:not(:disabled) {
  cursor: pointer;
}

.address-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(35, 45, 37, 0.34);
}

.address-modal[hidden] {
  display: none;
}

.address-modal-panel {
  width: min(100%, 480px);
  display: grid;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  box-shadow: 0 18px 42px rgba(35, 45, 37, 0.18);
}

.address-modal-panel h2 {
  margin: 0;
  font-size: 1.22rem;
}

.address-modal-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.address-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.address-modal-actions .summary-button {
  width: auto;
  min-width: 150px;
  padding-right: 18px;
  padding-left: 18px;
  cursor: pointer;
}

.address-modal-actions .danger-modal-button {
  border-color: #8a3324;
  background: #8a3324;
}

@media (max-width: 760px) {
  .address-card,
  .address-fields,
  .address-flags {
    grid-template-columns: 1fr;
  }

  .address-card-actions,
  .address-actions {
    display: grid;
  }

  .address-card-actions button,
  .address-actions .summary-button {
    width: 100%;
  }

  .address-add-button {
    min-width: 88px;
    min-height: 40px;
    padding-right: 14px;
    padding-left: 14px;
    white-space: nowrap;
  }

  .address-modal-actions {
    flex-wrap: wrap;
  }

  .address-modal-actions .summary-button {
    flex: 1 1 0;
    min-width: 0;
  }
}

@media (max-width: 360px) {
  .address-modal-actions {
    display: grid;
  }

  .address-modal-actions .summary-button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .address-content .account-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .address-content .account-head h1 {
    font-size: 1.95rem;
  }

  .address-add-button {
    font-size: 0.9rem;
  }
}

.account-page {
  background: linear-gradient(180deg, #edf4e9 0%, #f8f5ed 42%, #fbf9f2 100%);
}

.address-card,
.address-form,
.address-modal-panel,
.address-flags {
  border-color: var(--storefront-border);
  border-radius: var(--storefront-radius-lg);
  background: rgba(255, 253, 250, 0.92);
  box-shadow: var(--storefront-shadow-sm);
}

.address-field input,
.address-field select,
.address-field textarea {
  border-color: var(--storefront-border);
  border-radius: var(--storefront-radius-md);
  background: var(--storefront-surface-raised);
}

.address-card-actions button,
.address-actions .summary-button,
.address-modal-actions .summary-button {
  border-radius: var(--storefront-radius-md);
}

body:has(#addressesList) .account-content {
  --address-card-width: 292px;
  --address-grid-gap: 16px;
  --address-grid-max-width: calc((var(--address-card-width) * 3) + (var(--address-grid-gap) * 2));
  padding: 26px;
}

body:has(#addressesList) .account-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  width: min(100%, var(--address-grid-max-width));
  margin-bottom: 18px;
  margin-right: auto;
  margin-left: auto;
}

body:has(#addressesList) .address-add-button {
  max-width: 100%;
  min-width: 140px;
  min-height: 44px;
  padding-right: 18px;
  padding-left: 18px;
  border-radius: var(--storefront-radius-md);
  white-space: nowrap;
}

body:has(#addressesList) .address-add-button.is-form-mode {
  border-color: var(--storefront-accent);
  background: var(--storefront-surface-raised);
  color: var(--storefront-accent-dark);
}

body:has(#addressesList) .address-message {
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid #d7e5cf;
  border-radius: var(--storefront-radius-md);
  background: #f1f8ed;
  color: #315c2e;
}

body:has(#addressesList) .address-message[hidden] {
  display: none;
}

body:has(#addressesList) .address-message.error {
  border-color: #ebc7bd;
  background: #fff7f4;
  color: var(--storefront-danger);
}

body:has(#addressesList) .address-filter {
  gap: 10px;
  margin-bottom: 18px;
}

body:has(#addressesList) .address-filter-button {
  min-height: 40px;
  padding-right: 16px;
  padding-left: 16px;
  border-color: var(--storefront-border);
  border-radius: var(--storefront-radius-md);
  background: var(--storefront-surface-raised);
  color: var(--storefront-text-soft);
  box-shadow: none;
}

body:has(#addressesList) .address-filter-button:hover,
body:has(#addressesList) .address-filter-button.is-active {
  border-color: var(--storefront-accent);
  background: var(--storefront-accent-soft);
  color: var(--storefront-accent-dark);
}

body:has(#addressesList) .account-status {
  padding: 22px;
  border-color: var(--storefront-border);
  border-radius: var(--storefront-radius-lg);
  background: rgba(255, 253, 250, 0.92);
  box-shadow: var(--storefront-shadow-sm);
}

body:has(#addressesList) .account-status.auth-required {
  max-width: 680px;
}

body:has(#addressesList) .addresses-list {
  width: min(100%, var(--address-grid-max-width));
  grid-template-columns: repeat(auto-fill, minmax(var(--address-card-width), var(--address-card-width)));
  gap: var(--address-grid-gap);
  align-items: stretch;
  justify-content: center;
  margin-right: auto;
  margin-left: auto;
}

body:has(#addressesList) .address-card {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 20px;
  border-color: var(--storefront-border);
  border-radius: var(--storefront-radius-lg);
  background: rgba(255, 253, 250, 0.92);
  box-shadow: var(--storefront-shadow-sm);
  height: 100%;
  min-width: 0;
}

body:has(#addressesList) .address-card-main {
  display: grid;
  gap: 10px;
  align-content: start;
  min-width: 0;
}

body:has(#addressesList) .address-card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: start;
  justify-content: space-between;
  min-width: 0;
}

body:has(#addressesList) .address-card-head h2 {
  flex: 1 1 0;
  min-width: 0;
}

body:has(#addressesList) .address-card h2,
body:has(#addressesList) .address-form-head h2,
body:has(#addressesList) .address-modal-panel h2 {
  color: var(--storefront-text);
  font-family: var(--storefront-heading-font-family);
  font-weight: 600;
  line-height: 1.16;
}

body:has(#addressesList) .address-lines {
  gap: 4px;
  color: var(--storefront-text);
}

body:has(#addressesList) .address-badges {
  gap: 8px;
  margin-top: -2px;
}

body:has(#addressesList) .address-default-badges {
  flex: 0 0 auto;
  justify-content: flex-end;
  margin-left: auto;
  margin-top: 0;
  max-width: min(100%, 190px);
}

body:has(#addressesList) .address-type-badges {
  justify-content: flex-start;
}

body:has(#addressesList) .address-badge {
  justify-content: center;
  border: 1px solid #d8e4d2;
  background: #edf3e8;
  color: #46603d;
  white-space: nowrap;
}

body:has(#addressesList) .address-badge.is-default {
  border-color: #d6c38a;
  background: #fff4c7;
  color: #6f5312;
}

body:has(#addressesList) .address-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-self: end;
}

body:has(#addressesList) .address-card-actions button {
  width: 100%;
  min-height: 40px;
  padding-right: 16px;
  padding-left: 16px;
  border-color: var(--storefront-accent);
  background: var(--storefront-surface-raised);
  color: var(--storefront-accent-dark);
}

body:has(#addressesList) .address-card-actions button:hover {
  background: var(--storefront-accent-soft);
  color: var(--storefront-text);
}

body:has(#addressesList) .address-card-actions .danger {
  border-color: #ebc7bd;
  color: var(--storefront-danger);
}

body:has(#addressesList) .address-card-actions .danger:hover {
  background: #fff7f4;
  color: #8a3324;
}

body:has(#addressesList) .addresses-empty-state {
  grid-column: 1 / -1;
  gap: 10px;
  padding: 22px;
  border-color: var(--storefront-border);
  border-radius: var(--storefront-radius-lg);
  background: rgba(255, 253, 250, 0.92);
  box-shadow: var(--storefront-shadow-sm);
}

body:has(#addressesList) .addresses-empty-state h2 {
  color: var(--storefront-text);
  font-family: var(--storefront-heading-font-family);
  font-size: 1.16rem;
  font-weight: 600;
  line-height: 1.16;
}

body:has(#addressesList) .addresses-empty-state p {
  color: var(--storefront-text-soft);
}

body:has(#addressesList) .address-form {
  gap: 18px;
  padding: 20px;
  border-color: var(--storefront-border);
  border-radius: var(--storefront-radius-lg);
  background: rgba(255, 253, 250, 0.92);
  box-shadow: var(--storefront-shadow-sm);
}

body:has(#addressesList) .address-fields {
  gap: 16px;
}

body:has(#addressesList) .address-field {
  gap: 8px;
}

body:has(#addressesList) .address-field label,
body:has(#addressesList) .address-flags label {
  color: var(--storefront-text-soft);
  font-family: var(--storefront-heading-font-family);
  font-size: 0.94rem;
  line-height: 1.2;
}

body:has(#addressesList) .address-field input,
body:has(#addressesList) .address-field select,
body:has(#addressesList) .address-field textarea {
  min-height: 50px;
  padding-right: 15px;
  padding-left: 15px;
  border-color: var(--storefront-border);
  border-radius: var(--storefront-radius-md);
  background: var(--storefront-surface-raised);
  color: var(--storefront-text);
  box-shadow: none;
}

body:has(#addressesList) .address-field input:focus,
body:has(#addressesList) .address-field select:focus,
body:has(#addressesList) .address-field textarea:focus {
  border-color: var(--storefront-accent);
  box-shadow: var(--storefront-focus);
  outline: 0;
}

body:has(#addressesList) .address-autocomplete-root {
  position: relative;
}

body:has(#addressesList) .address-autocomplete-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  display: grid;
  gap: 4px;
  max-height: min(280px, 58vh);
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--storefront-border);
  border-radius: var(--storefront-radius-md);
  background: var(--storefront-surface-raised);
  box-shadow: var(--storefront-shadow-md);
}

body:has(#addressesList) .address-autocomplete-panel[hidden] {
  display: none;
}

body:has(#addressesList) .address-autocomplete-hint,
body:has(#addressesList) .address-autocomplete-state {
  padding: 8px 10px;
  color: var(--storefront-text-soft);
  font-size: 0.86rem;
}

body:has(#addressesList) .address-autocomplete-option {
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--storefront-text);
  font: inherit;
  font-size: 0.94rem;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

body:has(#addressesList) .address-autocomplete-option:hover,
body:has(#addressesList) .address-autocomplete-option.is-active {
  background: rgba(111, 128, 96, 0.1);
}

body:has(#addressesList) .address-field.is-invalid input,
body:has(#addressesList) .address-field.is-invalid select,
body:has(#addressesList) .address-field.is-invalid textarea {
  border-color: #c45a4a;
  background: #fffafa;
  box-shadow: 0 0 0 3px rgba(196, 90, 74, 0.1);
}

body:has(#addressesList) .field-error {
  color: var(--storefront-danger);
  font-size: 0.9rem;
  font-weight: 700;
}

body:has(#addressesList) .address-flags {
  gap: 12px 16px;
  padding: 14px;
  border-color: #e8e5da;
  border-radius: var(--storefront-radius-md);
  background: rgba(255, 255, 255, 0.58);
  box-shadow: none;
}

body:has(#addressesList) .address-actions {
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid #e8e5da;
}

body:has(#addressesList) .address-actions .summary-button {
  min-width: 150px;
  min-height: 48px;
}

body:has(#addressesList) .address-modal {
  z-index: 2000;
  background: rgba(35, 45, 37, 0.34);
}

body:has(#addressesList) .address-modal-panel {
  gap: 14px;
  padding: 24px;
  border-color: var(--storefront-border);
  border-radius: var(--storefront-radius-lg);
  background: rgba(255, 253, 250, 0.98);
  box-shadow: 0 18px 42px rgba(35, 45, 37, 0.18);
}

body:has(#addressesList) .address-modal-actions {
  gap: 10px;
}

body:has(#addressesList) .address-modal-actions .summary-button {
  min-height: 44px;
  border-radius: var(--storefront-radius-md);
}

body:has(#addressesList) .address-modal-actions .danger-modal-button {
  border-color: #8a3324;
  background: #8a3324;
  color: #ffffff;
}

@media (max-width: 860px) {
  body:has(#addressesList) .account-content {
    --address-grid-max-width: calc((var(--address-card-width) * 2) + var(--address-grid-gap));
    padding: 20px;
  }

  body:has(#addressesList) .account-head {
    margin-bottom: 16px;
  }

  body:has(#addressesList) .address-card,
  body:has(#addressesList) .address-form {
    padding: 18px;
  }
}

@media (max-width: 760px) {
  body:has(#addressesList) .addresses-list {
    grid-template-columns: repeat(auto-fill, minmax(var(--address-card-width), var(--address-card-width)));
  }

  body:has(#addressesList) .address-card {
    gap: 14px;
  }

  body:has(#addressesList) .address-card-actions {
    grid-template-columns: 1fr 1fr;
  }

  body:has(#addressesList) .address-modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  body:has(#addressesList) .address-modal-actions .summary-button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  body:has(#addressesList) .account-content {
    --address-grid-max-width: 100%;
    padding: 18px;
  }

  body:has(#addressesList) .address-content .account-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  body:has(#addressesList) .address-add-button {
    min-width: 0;
    max-width: 128px;
    padding-right: 12px;
    padding-left: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body:has(#addressesList) .address-filter {
    display: grid;
    grid-template-columns: 1fr;
  }

  body:has(#addressesList) .address-filter-button {
    width: 100%;
  }

  body:has(#addressesList) .addresses-list {
    grid-template-columns: 1fr;
  }

  body:has(#addressesList) .address-card,
  body:has(#addressesList) .address-form {
    padding: 16px;
  }

  body:has(#addressesList) .address-card-actions {
    grid-template-columns: 1fr;
  }

  body:has(#addressesList) .address-actions {
    display: grid;
  }

  body:has(#addressesList) .address-actions .summary-button {
    width: 100%;
  }
}

/* Phase A: account address cards and form rhythm. */
body:has(#addressesList) .address-card {
  gap: 20px;
}

body:has(#addressesList) .address-card-main {
  gap: 12px;
}

body:has(#addressesList) .address-lines {
  line-height: 1.4;
}

body:has(#addressesList) .address-form {
  gap: 20px;
}

body:has(#addressesList) .address-fields {
  gap: 16px 18px;
}

body:has(#addressesList) .address-card-actions .danger {
  background: #fffdfa;
  box-shadow: none;
}
