.hpw-auto-reorders,
.hpw-auto-reorders *,
.hpw-auto-reorders *::before,
.hpw-auto-reorders *::after {
  box-sizing: border-box;
}

.hpw-auto-reorders {
  --hpw-ar-brand: var(--hpw, #1478ad);
  --hpw-ar-brand-dark: #0b679b;
  --hpw-ar-ink: #202b3d;
  --hpw-ar-muted: #6b7485;
  --hpw-ar-border: #cfdae6;
  display: flex;
  width: 100%;
  max-width: 100%;
  margin: 0;
  flex-direction: column;
  gap: 1.5rem;
  color: var(--hpw-ar-ink);
}

.hpw-ar-page-header {
  margin: 0 0 0.25rem;
}
.hpw-ar-page-header h2 {
  margin: 0 0 0.55rem;
  color: var(--hpw-ar-brand);
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  font-weight: 700;
  line-height: 1.15;
}
.hpw-ar-page-header p {
  max-width: 820px;
  margin: 0;
  color: var(--hpw-ar-muted);
  font-size: 1rem;
  line-height: 1.45;
}

.hpw-ar-empty-state {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
  text-align: left;
  background: #fff;
  border: 1px solid var(--hpw-ar-border);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(20, 39, 64, 0.04);
}
.hpw-ar-empty-icon {
  display: grid;
  width: 86px;
  height: 86px;
  flex: 0 0 86px;
  place-items: center;
  color: var(--hpw-ar-brand);
  background: #edf6fc;
  border-radius: 50%;
}
.hpw-ar-empty-icon svg,
.hpw-ar-status svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hpw-ar-empty-icon svg {
  width: 42px;
  height: 42px;
  stroke-width: 1.7;
}
.hpw-ar-empty-state h3 {
  margin: 0 0 0.35rem;
  color: var(--hpw-ar-brand);
  font-size: 1.15rem;
  font-weight: 700;
}
.hpw-ar-empty-state p {
  margin: 0 0 0.7rem;
  color: var(--hpw-ar-muted);
  line-height: 1.4;
}

.hpw-auto-reorder-card {
  position: relative;
  min-width: 0;
  padding: clamp(1.25rem, 3vw, 1.75rem);
  background: #fff;
  border: 1px solid var(--hpw-ar-border);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(20, 39, 64, 0.04);
}

.hpw-ar-header {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  align-items: start;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.hpw-ar-product-image {
  display: grid;
  width: 88px;
  height: 88px;
  place-items: center;
  overflow: hidden;
  background: #f5f8fb;
  border: 1px solid #d8e2ec;
  border-radius: 12px;
}
.hpw-ar-product-image img {
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: contain;
}
.hpw-ar-header-text {
  min-width: 0;
  padding-top: 0.1rem;
}
.hpw-auto-reorders .hpw-ar-header .hpw-ar-header-text h3 {
  margin: 0 0 0.45rem !important;
  color: var(--hpw-ar-ink) !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  line-height: 1.2 !important;
  text-transform: none !important;
}
.hpw-ar-product-meta {
  display: grid;
  gap: 0.25rem;
  margin: 0.6rem 0 0;
}
.hpw-ar-product-meta > div {
  display: grid;
  grid-template-columns: minmax(120px, 175px) minmax(0, 1fr);
  gap: 0.75rem;
}
.hpw-ar-product-meta dt,
.hpw-ar-product-meta dd {
  margin: 0;
  color: #3d485b;
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.hpw-ar-product-meta dt,
.hpw-ar-product-meta dd {
  font-weight: 600;
}

.hpw-ar-status {
  display: inline-flex;
  min-width: 92px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.4rem 0.9rem;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  background: #eef1f4;
  border: 1px solid transparent;
  border-radius: 999px;
}
.hpw-ar-status svg {
  width: 15px;
  height: 15px;
  stroke-width: 2.2;
}
.hpw-ar-status--active {
  color: #07844b;
  background: #e8f8ef;
  border-color: #c6ecd8;
}
.hpw-ar-status--pending_payment {
  color: #a91e13;
  background: #fff0ee;
  border-color: #f5cdc8;
}
.hpw-ar-status--inventory_hold {
  color: #8a5300;
  background: #fff6e8;
  border-color: #f3dcae;
}
.hpw-ar-status--processing {
  color: #1a4fba;
  background: #edf2ff;
  border-color: #d0dcfb;
}
.hpw-ar-status--canceled {
  color: #5f6773;
  background: #f1f3f5;
  border-color: #dfe3e7;
}

.hpw-ar-card-divider {
  height: 1px;
  margin: 0 0 1.15rem;
  background: #d9e4ef;
}
.hpw-ar-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 0 0 1.25rem;
}
.hpw-ar-detail-row {
  position: relative;
  min-width: 0;
  min-height: 88px;
  padding: 0.9rem 1rem;
  background: #f6f8fa;
  border: 1px solid #e2e8ef;
  border-radius: 10px;
}
.hpw-ar-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0 0 0.55rem;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.25;
}
.hpw-ar-detail-head > span {
  color: var(--hpw-ar-ink);
}
.hpw-ar-detail-value {
  color: var(--hpw-ar-ink);
  font-size: 0.94rem;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.hpw-ar-actions {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1rem;
}
.hpw-ar-action-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.hpw-ar-form {
  margin: 0;
}
.hpw-ar-form--inline {
  display: inline-flex;
}

.hpw-auto-reorders .hpw-ar-btn,
.hpw-ar-cancel-modal .hpw-ar-btn {
  display: inline-flex !important;
  min-height: 44px;
  width: auto !important;
  align-items: center;
  justify-content: center;
  margin: 0 !important;
  padding: 0.65rem 1.1rem !important;
  color: var(--hpw-ar-brand, #1478ad) !important;
  font: inherit;
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  line-height: 1.2 !important;
  white-space: nowrap;
  text-align: center;
  text-decoration: none !important;
  text-transform: uppercase;
  background: #fff !important;
  border: 1px solid var(--hpw-ar-brand, #1478ad) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  cursor: pointer;
}
.hpw-auto-reorders .hpw-ar-btn:hover,
.hpw-ar-cancel-modal .hpw-ar-btn:hover {
  color: #fff !important;
  background: var(--hpw-ar-brand, #1478ad) !important;
}
.hpw-auto-reorders .hpw-ar-btn--primary,
.hpw-ar-cancel-modal .hpw-ar-btn--primary {
  color: #fff !important;
  background: var(--hpw-ar-brand, #1478ad) !important;
}
.hpw-auto-reorders .hpw-ar-btn--primary:hover,
.hpw-ar-cancel-modal .hpw-ar-btn--primary:hover {
  background: var(--hpw-ar-brand-dark, #0b679b) !important;
}
.hpw-auto-reorders .hpw-ar-btn--danger,
.hpw-ar-cancel-modal .hpw-ar-btn--danger {
  color: #b42318 !important;
  background: #fff !important;
  border-color: #e7aaa5 !important;
}
.hpw-auto-reorders .hpw-ar-btn--danger:hover,
.hpw-ar-cancel-modal .hpw-ar-btn--danger:hover {
  color: #fff !important;
  background: #b42318 !important;
  border-color: #b42318 !important;
}

.hpw-ar-tile-edit {
  position: static;
  margin: 0;
}
.hpw-ar-tile-edit > summary {
  min-height: 0;
  padding: 0 !important;
  color: var(--hpw-ar-brand) !important;
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  white-space: nowrap;
  list-style: none;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  cursor: pointer;
}
.hpw-ar-tile-edit > summary::-webkit-details-marker {
  display: none;
}
.hpw-ar-tile-edit > summary:hover {
  color: var(--hpw-ar-brand-dark) !important;
  text-decoration: underline !important;
}
.hpw-ar-action-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 0.45rem);
  right: 0;
  display: grid;
  width: min(330px, 82vw);
  gap: 0.65rem;
  padding: 1rem;
  background: #fff;
  border: 1px solid var(--hpw-ar-border);
  border-radius: 12px;
  box-shadow: 0 14px 32px rgba(20, 39, 64, 0.16);
}
.hpw-ar-action-panel select,
.hpw-ar-action-panel input[type="date"],
.hpw-ar-action-panel input[type="number"],
.hpw-ar-action-panel input[type="text"],
.hpw-ar-action-panel input[type="email"] {
  width: 100% !important;
  min-width: 0;
  margin: 0 !important;
}
.hpw-ar-tile-label {
  color: var(--hpw-ar-muted);
  font-size: 0.8rem;
  font-weight: 700;
}
.hpw-ar-tile-link {
  color: var(--hpw-ar-brand);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}
.hpw-ar-tile-link:hover {
  text-decoration: underline;
}
.hpw-ar-address-panel {
  grid-template-columns: 1fr 1fr;
}
.hpw-ar-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
}
.hpw-ar-field label {
  color: var(--hpw-ar-muted);
  font-size: 0.82rem;
  font-weight: 600;
}
.hpw-ar-address-panel .hpw-ar-btn,
.hpw-ar-address-panel .hpw-ar-field--full {
  grid-column: 1 / -1;
}

.hpw-ar-management-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin: 0 0 10px;
  color: var(--hpw-ar-muted);
  font-size: 0.84rem;
  line-height: 1.4;
}
.hpw-ar-management-note span {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  flex: 0 0 18px;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  background: #8190a3;
  border-radius: 50%;
}
.hpw-ar-management-note a {
  display: inline-flex;
  align-items: center;
  color: var(--hpw-ar-brand);
  font-weight: 700;
  line-height: inherit;
  text-decoration: none;
  margin: 0;
}
.hpw-ar-management-note a:hover {
  text-decoration: underline;
}

.hpw-auto-reorders button:focus-visible,
.hpw-auto-reorders select:focus-visible,
.hpw-auto-reorders input:focus-visible,
.hpw-auto-reorders a:focus-visible,
.hpw-auto-reorders summary:focus-visible {
  outline: 3px solid rgba(20, 120, 173, 0.25);
  outline-offset: 2px;
}

.hpw-ar-cancel-modal[hidden] {
  display: none;
}
.hpw-ar-cancel-modal {
  position: fixed;
  z-index: 99999;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.hpw-ar-cancel-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.46);
}
.hpw-ar-cancel-modal__dialog {
  position: relative;
  width: min(440px, 100%);
  padding: 1.75rem 1.5rem 1.5rem;
  background: #fff;
  border: 1px solid var(--hpw-ar-border, #cfdae6);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.28);
}
.hpw-ar-cancel-modal__close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  display: inline-flex;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0 !important;
  color: var(--hpw-ar-muted, #6b7485) !important;
  font-size: 1.45rem !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  cursor: pointer;
}
.hpw-ar-cancel-modal__close:hover {
  color: var(--hpw-ar-ink, #202b3d) !important;
  background: transparent !important;
}
.hpw-ar-cancel-modal__dialog h3 {
  margin: 0 2rem 0.65rem 0;
  color: var(--hpw-ar-ink, #202b3d);
  font-size: 1.35rem;
}
.hpw-ar-cancel-modal__dialog p {
  margin: 0 0 1.25rem;
  color: var(--hpw-ar-muted, #6b7485);
  line-height: 1.45;
}
.hpw-ar-cancel-modal__actions {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 0.9rem;
}
.hpw-ar-cancel-modal__actions .hpw-ar-btn {
  flex: 1 1 0;
  min-width: 0;
  padding-right: 0.85rem !important;
  padding-left: 0.85rem !important;
}
.hpw-ar-modal-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .hpw-ar-details {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hpw-ar-header {
    grid-template-columns: 78px minmax(0, 1fr) auto;
    gap: 1rem;
  }
  .hpw-ar-product-image {
    width: 78px;
    height: 78px;
  }
  .hpw-auto-reorders .hpw-ar-btn {
    padding-right: 0.85rem !important;
    padding-left: 0.85rem !important;
    font-size: 0.84rem !important;
  }
}

@media (max-width: 600px) {
  .hpw-auto-reorders {
    gap: 1rem;
  }
  .hpw-auto-reorder-card {
    padding: 1rem;
    border-radius: 13px;
  }
  .hpw-ar-empty-state {
    align-items: flex-start;
    padding: 1rem;
  }
  .hpw-ar-empty-icon {
    width: 60px;
    height: 60px;
    flex-basis: 60px;
  }
  .hpw-ar-empty-icon svg {
    width: 30px;
    height: 30px;
  }
  .hpw-ar-header {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 0.8rem;
  }
  .hpw-ar-product-image {
    width: 64px;
    height: 64px;
    border-radius: 10px;
  }
  .hpw-ar-status {
    grid-column: 1 / -1;
    min-width: 0;
    width: fit-content;
    min-height: 32px;
  }
  .hpw-ar-details {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }
  .hpw-ar-detail-row {
    min-height: 0;
  }
  .hpw-ar-product-meta > div {
    grid-template-columns: minmax(105px, 42%) minmax(0, 1fr);
    gap: 0.5rem;
  }
  .hpw-ar-action-panel {
    position: fixed;
    z-index: 1000;
    top: 50%;
    left: 50%;
    width: min(320px, calc(100vw - 32px));
    transform: translate(-50%, -50%);
  }
  .hpw-ar-address-panel {
    grid-template-columns: 1fr;
  }
  .hpw-ar-address-panel .hpw-ar-btn,
  .hpw-ar-address-panel .hpw-ar-field--full {
    grid-column: auto;
    width: 100% !important;
  }
  .hpw-ar-management-note {
    align-items: flex-start;
  }
  .hpw-ar-cancel-modal__actions {
    justify-content: stretch;
    gap: 0.6rem;
  }
  .hpw-ar-cancel-modal__actions .hpw-ar-btn {
    width: auto !important;
    font-size: 0.78rem !important;
  }
}
