/* MyFarmBox Singapore — Account page
   Uses /shared.css for global typography, buttons, forms, colours and header.
*/

[hidden] {
  display: none !important;
}
.address-list { display: grid; gap: 10px; }
.address-card { display:flex; justify-content:space-between; gap:12px; padding:13px; border:1px solid var(--mfb-border); border-radius:12px; }
.address-card small,.address-card strong { display:block; }
.address-card small { color:var(--mfb-green); font-size:11px; font-weight:800; text-transform:uppercase; }
.address-card strong { margin-top:4px; font-size:13px; line-height:1.45; }
.address-card button { border:0; background:transparent; color:var(--mfb-green-dark); font:inherit; font-size:12px; font-weight:700; text-decoration:underline; cursor:pointer; }

.account-auth-actions { margin: 24px 0 4px; }
.primary-login, .account-magic-row button { min-height: 48px; border: 0; border-radius: 10px; background: var(--mfb-green); color: #fff; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.primary-login { width: 100%; }
.account-auth-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--mfb-muted); font-size: 12px; }
.account-auth-divider::before, .account-auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--mfb-border); }
.account-magic-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.account-magic-row input { min-height: 48px; min-width: 0; }
.account-magic-row button { padding: 0 16px; }
.manual-account-lookup { margin-top: 20px; border-top: 1px solid var(--mfb-border); padding-top: 16px; }
.manual-account-lookup summary { color: var(--mfb-green-dark); cursor: pointer; font-size: 13px; font-weight: 700; }
.manual-account-lookup .login-grid { margin-top: 16px; }
@media (max-width: 520px) { .account-magic-row { grid-template-columns: 1fr; } }

.profile-setup {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--mfb-border);
  text-align: left;
}

.profile-setup h2 {
  margin: 4px 0 8px;
  font-size: 26px;
}

.profile-setup > p:not(.eyebrow):not(.form-message) {
  margin: 0 0 20px;
  color: var(--mfb-muted);
  font-size: 14px;
  line-height: 1.55;
}

.profile-setup input[readonly] {
  background: #f5f6f2;
  color: var(--mfb-muted);
}

.profile-setup > button {
  width: 100%;
  min-height: 48px;
  margin-top: 18px;
  border: 0;
  border-radius: 10px;
  background: var(--mfb-green);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.shell {
  padding-top: 34px;
  padding-bottom: 80px;
}

.login-card {
  max-width: 680px;
  margin: 58px auto;
  padding: 44px;
  border: 1px solid var(--mfb-border);
  border-radius: var(--mfb-radius-lg);
  background: var(--mfb-white);
  box-shadow: var(--mfb-shadow);
  text-align: center;
}

.login-mark {
  font-size: 46px;
}

.login-card h1 {
  margin-bottom: 0;
}

.login-card > p:not(.eyebrow):not(.form-message) {
  max-width: 520px;
  margin: 15px auto 26px;
  font-size: 16px;
  line-height: 1.65;
}

.login-grid,
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  text-align: left;
}

.login-card > button {
  width: 100%;
  min-height: 50px;
  margin-top: 17px;
  border: 0;
  border-radius: var(--mfb-radius-sm);
  background: var(--mfb-green);
  color: var(--mfb-white);
  font-size: 15px;
  font-weight: 700;
}

.login-card > button:hover {
  background: var(--mfb-green-dark);
}

.form-message {
  min-height: 18px;
  margin: 10px 0 0;
  color: #9f4338;
  font-size: 12px;
}

.account-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 22px;
  align-items: center;
  padding: 30px;
  border: 1px solid var(--mfb-border);
  border-radius: var(--mfb-radius-lg);
  background: linear-gradient(145deg, #edf4e9, #f8f7ee);
}

.avatar {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: var(--mfb-green);
  color: var(--mfb-white);
  font-family: var(--mfb-font-heading);
  font-size: 24px;
  font-weight: 800;
}

.hero-copy h1 {
  margin-bottom: 0;
}

.hero-copy p:last-child {
  margin: 9px 0 0;
  font-size: 13px;
}

.hero-actions {
  display: grid;
  gap: 9px;
}

.hero-actions button,
.panel-heading button {
  min-height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--mfb-green);
  color: var(--mfb-white);
  font-size: 12px;
  font-weight: 700;
}

.hero-actions button:hover,
.panel-heading button:hover {
  background: var(--mfb-green-dark);
}

.hero-actions .secondary {
  border: 1px solid var(--mfb-border);
  background: var(--mfb-white);
  color: var(--mfb-green-dark);
}

.hero-actions .secondary:hover {
  background: var(--mfb-green-light);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
  margin-top: 17px;
}

.stats-grid article {
  padding: 20px;
  border: 1px solid var(--mfb-border);
  border-radius: var(--mfb-radius);
  background: var(--mfb-white);
  box-shadow: var(--mfb-shadow-sm);
}

.stats-grid small,
.stats-grid strong {
  display: block;
}

.stats-grid small {
  font-size: 11px;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.stats-grid strong {
  margin-top: 6px;
  color: var(--mfb-deep);
  font-family: var(--mfb-font-heading);
  font-size: 24px;
  font-weight: 800;
}

.upcoming-card {
  display: flex;
  justify-content: space-between;
  gap: 22px;
  align-items: center;
  margin-top: 17px;
  padding: 24px;
  border: 1px solid rgba(67, 141, 53, 0.3);
  border-radius: var(--mfb-radius);
  background: var(--mfb-white);
  box-shadow: var(--mfb-shadow-sm);
}

.upcoming-card h2 {
  margin: 0;
  font-size: 25px;
}

.upcoming-card p {
  margin: 7px 0 0;
  font-size: 13px;
}

.upcoming-meta {
  display: grid;
  justify-items: end;
  gap: 7px;
}

.upcoming-meta span {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--mfb-green-light);
  color: var(--mfb-green-dark);
  font-size: 10px;
  font-weight: 700;
}

.upcoming-meta strong {
  font-size: 18px;
}

.upcoming-meta button {
  min-height: 40px;
  padding: 0 13px;
  border: 0;
  border-radius: 9px;
  background: var(--mfb-green);
  color: var(--mfb-white);
  font-size: 11px;
  font-weight: 700;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px;
  margin-top: 17px;
}

.panel {
  padding: 22px;
  border: 1px solid var(--mfb-border);
  border-radius: var(--mfb-radius);
  background: var(--mfb-white);
  box-shadow: var(--mfb-shadow-sm);
}

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

.panel-heading h2 {
  margin: 0;
  font-size: 23px;
}

.panel-heading button {
  min-height: 38px;
  padding: 0 12px;
}

.profile-panel dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

.profile-panel dl div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
}

.profile-panel dt {
  color: var(--mfb-muted);
  font-size: 12px;
}

.profile-panel dd {
  margin: 0;
  color: var(--mfb-deep);
  font-size: 14px;
  font-weight: 700;
}

.address-panel address {
  color: var(--mfb-deep);
  font-size: 15px;
  line-height: 1.7;
  font-style: normal;
}

.address-panel > p {
  margin: 11px 0 0;
  font-size: 12px;
}

.orders-panel {
  margin-top: 17px;
}

.orders-list {
  display: grid;
  gap: 11px;
}

.order-card {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 15px;
  border: 1px solid rgba(24, 51, 35, 0.08);
  border-radius: 14px;
  background: #fbfcf9;
}

.order-main strong,
.order-main small {
  display: block;
}

.order-main strong {
  color: var(--mfb-deep);
  font-size: 14px;
}

.order-main small,
.order-meta small {
  margin-top: 4px;
  font-size: 10px;
}

.order-meta strong {
  display: block;
  color: var(--mfb-green-dark);
  font-size: 12px;
}

.order-status {
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--mfb-green-light);
  color: var(--mfb-green-dark);
  font-size: 9px;
  font-weight: 700;
}

.order-card button {
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--mfb-border);
  border-radius: 9px;
  background: var(--mfb-white);
  color: var(--mfb-green-dark);
  font-size: 10px;
  font-weight: 700;
}

.order-card button:hover {
  background: var(--mfb-green-light);
}

.orders-empty {
  padding: 27px;
  text-align: center;
}

.orders-empty span {
  font-size: 34px;
}

.orders-empty p {
  margin-bottom: 8px;
}

.orders-empty a {
  color: var(--mfb-green-dark);
  font-weight: 700;
}

.support-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 22px;
  margin-top: 17px;
  padding: 24px;
  border-radius: var(--mfb-radius);
  background: var(--mfb-deep);
  color: var(--mfb-white);
}

.support-card h2 {
  margin: 0;
  color: var(--mfb-white);
  font-size: 24px;
}

.support-card p:last-child {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.support-actions {
  display: flex;
  gap: 9px;
}

.support-actions a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border-radius: 10px;
  background: var(--mfb-white);
  color: var(--mfb-green-dark);
  font-size: 11px;
  font-weight: 700;
}

.edit-dialog,
.order-dialog {
  width: min(640px, calc(100vw - 28px));
  padding: 28px;
  border: 0;
  border-radius: var(--mfb-radius-lg);
  background: var(--mfb-white);
  box-shadow: 0 30px 100px rgba(20, 54, 29, 0.25);
}

.edit-dialog::backdrop,
.order-dialog::backdrop {
  background: rgba(13, 33, 20, 0.5);
  backdrop-filter: blur(5px);
}

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

.dialog-heading h2 {
  margin: 0;
  font-size: 26px;
}

.dialog-heading > button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--mfb-border);
  border-radius: 9px;
  background: var(--mfb-white);
  color: var(--mfb-green-dark);
  font-size: 19px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 19px;
}

.dialog-actions button {
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--mfb-border);
  border-radius: 10px;
  background: var(--mfb-white);
  color: var(--mfb-green-dark);
  font-size: 12px;
  font-weight: 700;
}

.dialog-actions .primary {
  border-color: var(--mfb-green);
  background: var(--mfb-green);
  color: var(--mfb-white);
}

.order-dialog-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.order-dialog-meta div {
  padding: 12px;
  border-radius: 10px;
  background: #f6f8f4;
}

.order-dialog-meta small,
.order-dialog-meta strong {
  display: block;
}

.order-dialog-meta small {
  font-size: 9px;
}

.order-dialog-meta strong {
  margin-top: 3px;
  color: var(--mfb-deep);
  font-size: 12px;
}

.order-dialog-items {
  display: grid;
  gap: 9px;
  margin-top: 17px;
}

.order-dialog-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.order-dialog-item span {
  color: var(--mfb-muted);
}

.order-dialog-item strong {
  color: var(--mfb-deep);
}

.order-dialog-total {
  display: flex;
  justify-content: space-between;
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid var(--mfb-border);
  font-size: 16px;
  font-weight: 700;
}

.order-dialog-total strong {
  font-size: 22px;
}

.reorder-button {
  width: 100%;
  min-height: 46px;
  margin-top: 17px;
  border: 0;
  border-radius: 10px;
  background: var(--mfb-green);
  color: var(--mfb-white);
  font-size: 12px;
  font-weight: 700;
}

.reorder-button:hover {
  background: var(--mfb-green-dark);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 90;
  max-width: min(360px, calc(100vw - 30px));
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--mfb-border);
  border-radius: var(--mfb-radius-sm);
  background: var(--mfb-white);
  box-shadow: var(--mfb-shadow-lg);
}

.toast > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--mfb-green-light);
  color: var(--mfb-green);
  font-weight: 800;
}

.toast strong,
.toast small {
  display: block;
}

.toast strong {
  font-size: 12px;
}

.toast small {
  margin-top: 2px;
  font-size: 10px;
}

/* Leaflet delivery pin */

.map-section {
  margin-top: 4px;
  padding: 15px;
  border: 1px solid var(--mfb-border);
  border-radius: 14px;
  background: #fbfcf9;
}

.map-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 11px;
}

.map-heading > div > span,
.map-heading > div > small {
  display: block;
}

.map-heading > div > span {
  margin: 0;
  color: var(--mfb-deep);
  font-size: 14px;
  font-weight: 700;
}

.map-heading > div > small {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.45;
}

.map-heading button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--mfb-border);
  border-radius: 9px;
  background: var(--mfb-white);
  color: var(--mfb-green-dark);
  font-size: 10px;
  font-weight: 700;
}

.map-heading button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#address-map {
  width: 100%;
  height: 330px;
  overflow: hidden;
  border: 1px solid var(--mfb-border);
  border-radius: var(--mfb-radius-sm);
  background: #e7eee2;
}

.map-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
}

.map-status-row span {
  color: var(--mfb-muted);
  font-size: 10px;
}

.map-status-row span.ready {
  color: var(--mfb-green-dark);
  font-weight: 700;
}

.map-status-row span.error {
  color: #9f4338;
  font-weight: 700;
}

.map-status-row strong {
  color: var(--mfb-green-dark);
  font-size: 10px;
  white-space: nowrap;
}

.leaflet-container {
  font-family: var(--mfb-font-body);
}

.leaflet-control-attribution {
  font-size: 8px;
}

@media (max-width: 850px) {
  .account-hero {
    grid-template-columns: auto 1fr;
  }

  .hero-actions {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .order-card {
    grid-template-columns: 1fr auto;
  }

  .order-meta {
    display: none;
  }

  .support-card {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .shell {
    padding: 12px 10px 55px;
  }

  .login-card {
    margin: 25px auto;
    padding: 26px 17px;
  }

  .login-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .full {
    grid-column: auto;
  }

  .account-hero {
    grid-template-columns: 58px 1fr;
    padding: 18px;
  }

  .avatar {
    width: 58px;
    height: 58px;
    border-radius: 17px;
    font-size: 18px;
  }

  .account-hero h1 {
    font-size: 31px;
    letter-spacing: -2px;
  }

  .hero-actions {
    gap: 7px;
  }

  .stats-grid {
    gap: 8px;
  }

  .stats-grid article {
    padding: 14px;
  }

  .stats-grid small {
    font-size: 8px;
  }

  .stats-grid strong {
    font-size: 19px;
  }

  .upcoming-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .upcoming-meta {
    justify-items: start;
  }

  .panel {
    padding: 16px;
  }

  .panel-heading h2 {
    font-size: 19px;
  }

  .profile-panel dl div {
    grid-template-columns: 92px 1fr;
  }

  .profile-panel dt,
  .profile-panel dd {
    font-size: 11px;
  }

  .order-dialog-meta {
    grid-template-columns: 1fr;
  }

  .support-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .support-actions a {
    justify-content: center;
    text-align: center;
  }

  .dialog-actions {
    grid-template-columns: 1fr;
  }

  .map-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .map-heading button {
    width: 100%;
  }

  #address-map {
    height: 270px;
  }

  .map-status-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}


/* Saved delivery location */

.saved-location-wrap {
  margin-top: 18px;
  padding-top: 17px;
  border-top: 1px solid var(--mfb-border);
}

.saved-location-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 11px;
}

.saved-location-heading strong,
.saved-location-heading small {
  display: block;
}

.saved-location-heading strong {
  color: var(--mfb-deep);
  font-size: 14px;
}

.saved-location-heading small {
  margin-top: 3px;
  font-size: 11px;
}

.saved-location-heading > span {
  color: var(--mfb-green-dark);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

#saved-address-map {
  width: 100%;
  height: 230px;
  overflow: hidden;
  border: 1px solid var(--mfb-border);
  border-radius: var(--mfb-radius-sm);
  background: #e7eee2;
}

/* Prevent the global shared image rule from breaking Leaflet tiles and icons. */
.leaflet-container img,
.leaflet-container .leaflet-tile,
.leaflet-container .leaflet-marker-icon,
.leaflet-container .leaflet-marker-shadow {
  max-width: none !important;
  max-height: none !important;
}

.mfb-map-pin {
  position: relative;
  width: 34px;
  height: 34px;
  border: 4px solid var(--mfb-white);
  border-radius: 50% 50% 50% 0;
  background: var(--mfb-green);
  box-shadow: 0 8px 18px rgba(24, 51, 35, 0.28);
  transform: rotate(-45deg);
}

.mfb-map-pin::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--mfb-white);
  transform: translate(-50%, -50%);
}

.edit-dialog {
  max-height: calc(100vh - 28px);
  overflow-y: auto;
}

#address-map {
  height: 360px;
}

@media (max-width: 620px) {
  .saved-location-heading {
    flex-direction: column;
    gap: 5px;
  }

  #saved-address-map {
    height: 210px;
  }

  #address-map {
    height: 310px;
  }
}


/* Final Leaflet reliability fix */

.map-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.map-actions button {
  min-height: 40px;
}

.map-help {
  margin: 9px 0 0;
  color: var(--mfb-muted);
  font-size: 10px;
  line-height: 1.45;
}

/*
Leaflet's tile images must never inherit the site's responsive image sizing.
Explicit tile dimensions prevent Safari from collapsing the tile layer.
*/
.leaflet-container .leaflet-tile {
  width: 256px !important;
  height: 256px !important;
  max-width: none !important;
  max-height: none !important;
}

.leaflet-container .leaflet-marker-icon,
.leaflet-container .leaflet-marker-shadow {
  max-width: none !important;
  max-height: none !important;
}

.leaflet-container {
  width: 100% !important;
  min-width: 0;
  isolation: isolate;
}

#address-map,
#saved-address-map {
  position: relative;
  width: 100% !important;
}

@media (max-width: 620px) {
  .map-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
  }

  .map-actions button {
    width: 100%;
  }
}


/* v26: reliable saved-map preview */
.saved-address-map-frame {
  width: 100%;
  height: 230px;
  display: block;
  border: 1px solid var(--mfb-border);
  border-radius: var(--mfb-radius-sm);
  background: #e7eee2;
}

@media (max-width: 620px) {
  .saved-address-map-frame {
    height: 210px;
  }
}


/* v28 independent edit-map controller */
#address-map.leaflet-container {
  width: 100% !important;
  height: 360px !important;
  display: block;
  background: #e7eee2;
}

#address-map .leaflet-pane,
#address-map .leaflet-control {
  z-index: auto;
}

#address-map .leaflet-tile {
  width: 256px !important;
  height: 256px !important;
  max-width: none !important;
  max-height: none !important;
}

@media (max-width: 620px) {
  #address-map.leaflet-container {
    height: 310px !important;
  }
}
