/* FreshWay address book — independent from the checkout form. */
#addressModal.fw-address-modal {
  align-items: flex-end;
  justify-content: center;
  padding: env(safe-area-inset-top) 0 0;
  overflow: hidden;
  overscroll-behavior: contain;
}
body.fw-address-modal-open { overflow: hidden; }
.address-modal-sheet {
  width: min(560px, 100%);
  max-height: calc(100vh - env(safe-area-inset-top) - 8px);
  max-height: calc(100dvh - env(safe-area-inset-top) - 8px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border-radius: 22px 22px 0 0;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  box-sizing: border-box;
  scrollbar-gutter: stable;
}
.fw-address-modal-head {
  position: sticky;
  top: -18px;
  z-index: 5;
  background: #fff;
  margin: -18px -16px 14px;
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.fw-address-modal-head > div { min-width: 0; }
.fw-address-modal-head h2 { line-height: 1.2; }
.fw-address-subtitle {
  margin: 5px 0 0;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--muted);
}
.fw-address-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  margin: 10px 0;
  min-width: 0;
}
.fw-address-card.is-selected {
  border-color: rgba(15,122,75,.45);
  box-shadow: 0 0 0 2px rgba(15,122,75,.07);
}
.fw-address-card-heading,
.fw-address-card-heading > div {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}
.fw-address-card-heading { justify-content: space-between; }
.fw-address-card-heading strong { font-size: 15px; }
.fw-default-tag,
.fw-selected-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.fw-default-tag { color: var(--green-dark); background: var(--mint); }
.fw-selected-tag { color: #43584b; background: #f0f4f1; }
.fw-address-card-text {
  overflow-wrap: anywhere;
  margin: 10px 0 7px;
  color: #526159;
  background: #f7faf8;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px;
  font-size: 12px;
  line-height: 1.5;
}
.fw-address-card-contact {
  display: block;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
  margin: 0 0 11px;
}
.fw-address-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.fw-address-actions button,
.fw-address-editor-footer button { min-height: 44px; }
.fw-address-actions .primary-btn,
.fw-address-actions .secondary-btn { width: 100%; margin: 0; padding: 10px 8px; }
.fw-address-add { margin-bottom: 3px; min-height: 50px; }
.fw-address-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 30px 18px;
  border: 1px dashed #cad8cf;
  border-radius: 18px;
  color: var(--muted);
  margin-top: 8px;
}
.fw-address-empty > span { font-size: 30px; margin-bottom: 10px; }
.fw-address-empty strong { color: var(--ink); font-size: 15px; }
.fw-address-empty p { margin: 7px 0 0; font-size: 12px; line-height: 1.5; }
.address-editor-sheet { padding-bottom: 0; }
.fw-address-editor-body { padding-bottom: 14px; min-width: 0; }
.fw-address-editor-body label {
  display: block;
  font-size: 12px;
  font-weight: 750;
  margin: 0 0 12px;
}
.fw-address-editor-body input,
.fw-address-editor-body textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #dce5df;
  background: #fbfcfb;
  border-radius: 12px;
  padding: 12px;
  margin-top: 6px;
  outline: 0;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink);
}
.fw-address-editor-body textarea { resize: vertical; min-height: 68px; }
.fw-address-editor-body input:focus,
.fw-address-editor-body textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(15,122,75,.08);
}
.fw-address-labels { margin: 0 0 14px; }
.fw-address-labels .address-label { min-height: 42px; flex: 1 1 0; }
.fw-address-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 10px;
}
.fw-location-tools { display: grid; gap: 10px; margin: 8px 0 10px; }
.fw-location-tools > button { width: 100%; min-height: 46px; }
.fw-address-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.fw-address-search input { margin: 0; }
.fw-address-search button { min-height: 44px; margin: 0; }
.fw-address-search-results { display: grid; gap: 6px; margin: 7px 0; }
.fw-address-search-results button { white-space: normal; text-align: left; overflow-wrap: anywhere; margin: 0; }
.fw-address-search-results p,
.fw-address-search-hint { color: var(--muted); font-size: 11px; line-height: 1.45; margin: 6px 0; }
.fw-address-map { height: 230px; min-height: 190px; border-radius: 15px; overflow: hidden; border: 1px solid var(--line); background: #f0f4f1; margin: 10px 0; }
.fw-address-map .leaflet-container { font: inherit; }
.fw-map-unavailable { padding: 24px 16px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.fw-address-match {
  background: #e9f7ef;
  border: 1px solid rgba(15,122,75,.14);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.fw-address-match[hidden] { display: none !important; }
.fw-address-match > div { min-width: 0; flex: 1 1 180px; }
.fw-address-match strong,
.fw-address-match small { display: block; }
.fw-address-match strong { font-size: 12px; }
.fw-address-match small { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.fw-address-match button { margin: 0; min-height: 40px; }
.address-location-status { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.address-location-status > div { min-width: 0; }
.address-location-status strong,
.address-location-status small { display: block; }
.address-location-status small { line-height: 1.4; }
.fw-address-editor-footer {
  position: sticky;
  bottom: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  gap: 10px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.97);
  border-top: 1px solid var(--line);
}
.fw-address-editor-footer button { width: 100%; margin: 0; }
.fw-checkout-address {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.fw-checkout-address-copy { min-width: 0; flex: 1 1 auto; }
.fw-checkout-address-copy > strong { display: block; font-size: 14px; margin-top: 4px; line-height: 1.4; }
.fw-checkout-address-copy p { margin: 6px 0 5px; color: #526159; font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.fw-checkout-address-copy small { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.fw-checkout-address .fw-change-address { flex: 0 0 auto; margin: 0; min-height: 42px; }
label[hidden] { display: none !important; }
@media (max-width: 390px) {
  .address-modal-sheet { padding-left: 13px; padding-right: 13px; }
  .fw-address-modal-head { margin-left: -13px; margin-right: -13px; padding-left: 13px; padding-right: 13px; }
  .fw-address-form-grid { grid-template-columns: minmax(0, 1fr); }
  .fw-address-map { height: 205px; }
  .fw-address-card { padding: 12px; }
  .fw-checkout-address { align-items: flex-start; }
  .fw-checkout-address .fw-change-address { padding: 9px 10px; }
}

/* Clear, readable address feedback that stays above the fixed cart bar. */
#toast { width: max-content; max-width: calc(100vw - 28px); white-space: normal; overflow-wrap: anywhere; text-align: center; line-height: 1.4; z-index: 80; bottom: calc(154px + env(safe-area-inset-bottom)); }
.fw-address-incomplete { color: #805900 !important; background: #fff8e8; border: 1px solid #f1dfaa; border-radius: 10px; padding: 9px 10px; font-size: 11px; line-height: 1.45; }
.fw-address-modal-error .fw-address-subtitle { color: #9d3d2b; }
#addressModal [tabindex="-1"]:focus { outline: none; }
@media (max-width: 390px) { #toast { max-width: calc(100vw - 24px); bottom: calc(158px + env(safe-area-inset-bottom)); } }

/* Keep the address form quick to scan on mobile; optional fields stay available on demand. */
.fw-address-additional{border:1px solid var(--line);border-radius:13px;background:#fbfcfb;margin:2px 0 14px;overflow:hidden}
.fw-address-additional>summary{min-height:44px;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:11px 12px;color:var(--green-dark);font-size:12px;font-weight:800;cursor:pointer;list-style-position:inside}
.fw-address-additional>summary span{color:var(--muted);font-size:10px;font-weight:600}
.fw-address-additional[open]{padding:12px 10px 0}
.fw-address-additional[open]>summary{padding:0 2px 12px}
.fw-address-additional .fw-address-form-grid{margin-top:0}
