body {
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  flex-direction: column;
  background:
    radial-gradient(circle at 12% 10%, rgba(238, 247, 223, 0.9), transparent 28%),
    linear-gradient(180deg, #ffffff 0%, #fbfcf8 100%);
}

body.account-modal-open {
  overflow: hidden;
}

.account-shell {
  width: min(1360px, calc(100% - 48px));
  flex: 1 0 auto;
  margin: 0 auto;
  padding: 22px 0 46px;
}

.account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: clamp(28px, 5vw, 54px);
}

.account-brand img {
  width: 92px;
  height: 64px;
  object-fit: contain;
}

.account-header__link {
  color: var(--olive);
  font-size: 14px;
  font-weight: 540;
  text-decoration: none;
}

.account-auth,
.account-dashboard {
  display: grid;
  gap: 22px;
}

.account-auth {
  grid-template-columns: minmax(0, 0.8fr) minmax(420px, 1fr);
  align-items: start;
}

.account-auth__copy {
  display: grid;
  gap: 14px;
  padding-top: 34px;
}

.account-auth__eyebrow {
  color: var(--olive);
  font-size: 14px;
  font-weight: 620;
}

.account-auth__copy h1 {
  margin: 0;
  color: var(--olive-dark);
  font-size: clamp(34px, 4.8vw, 54px);
  font-weight: 500;
  line-height: 1.04;
}

.account-auth__copy p,
.account-card p,
.loyalty-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.account-auth__desktop-break {
  display: block;
}

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

.account-auth__panel {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.account-auth__switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid rgba(101, 123, 47, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  padding: 5px;
}

.account-auth__switch button {
  min-height: 42px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #596050;
  font-weight: 620;
  transition:
    background 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.account-auth__switch button.is-active {
  background: var(--olive);
  color: var(--white);
  box-shadow: 0 10px 22px rgba(101, 123, 47, 0.2);
}

.account-card {
  display: grid;
  gap: 14px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: rgba(255, 255, 255, 0.9);
  padding: 20px;
  box-shadow: var(--shadow-card);
}

.account-card h2 {
  margin: 0;
  color: var(--olive-dark);
  font-size: 22px;
  font-weight: 540;
}

.account-card label {
  display: grid;
  gap: 7px;
  color: #2d312c;
  font-size: 13px;
  font-weight: 540;
}

.account-card input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--white);
  color: var(--olive-dark);
  padding: 0 13px;
}

.account-card button,
.account-auth__forms button {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  background: var(--olive);
  color: var(--white);
  padding: 0 16px;
  font-weight: 620;
}

.account-message {
  grid-column: 1 / -1;
  min-height: 20px;
  margin: 0;
  color: var(--olive);
  font-size: 14px;
}

.account-message.is-error {
  color: #9b2f28;
}

.account-footer {
  margin-top: auto;
}

.account-dashboard {
  grid-template-columns: minmax(340px, 0.92fr) minmax(320px, 1fr);
  align-items: start;
}

.loyalty-card-wrap {
  display: grid;
  gap: 10px;
  perspective: 1400px;
}

.loyalty-card {
  position: relative;
  width: 100%;
  min-height: 390px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  box-shadow: none;
  transform-style: preserve-3d;
  -webkit-tap-highlight-color: transparent;
}

.loyalty-card__inner {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 28px;
  transform-style: preserve-3d;
  transition: transform 620ms cubic-bezier(0.2, 0.8, 0.2, 1);
  box-shadow: 0 24px 64px rgba(48, 56, 43, 0.24);
}

.loyalty-card.is-flipped .loyalty-card__inner {
  transform: rotateY(180deg);
}

.loyalty-card__face {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: space-between;
  gap: 24px;
  overflow: hidden;
  border-radius: 28px;
  color: var(--white);
  padding: 26px;
  opacity: 1;
  visibility: visible;
  transform-style: preserve-3d;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition:
    opacity 160ms ease,
    visibility 160ms ease;
}

.loyalty-card__face::before {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 82% 12%, rgba(255, 255, 255, 0.24), transparent 25%),
    radial-gradient(circle at 0% 100%, rgba(238, 247, 223, 0.18), transparent 30%);
  content: "";
  pointer-events: none;
}

.loyalty-card__face--front {
  background: linear-gradient(135deg, #657b2f 0%, #30382b 100%);
  transform: rotateY(0deg);
}

.loyalty-card__face--back {
  align-content: center;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--olive-dark);
  transform: rotateY(180deg);
}

.loyalty-card__face--back::before {
  background:
    radial-gradient(circle at 82% 12%, rgba(101, 123, 47, 0.12), transparent 28%),
    radial-gradient(circle at 4% 96%, rgba(110, 64, 42, 0.08), transparent 26%);
}

.loyalty-card:not(.is-flipped) .loyalty-card__face--back,
.loyalty-card.is-flipped .loyalty-card__face--front {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loyalty-card__face > * {
  position: relative;
  z-index: 1;
  transform: translateZ(1px);
}

.loyalty-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.loyalty-card__top img {
  width: 86px;
  height: 58px;
  object-fit: contain;
}

.loyalty-card__face--front .loyalty-card__top img {
  filter: brightness(0) invert(1);
}

.loyalty-card__face--back .loyalty-card__top img {
  filter: none;
}

.loyalty-card__face--back .loyalty-card__top span {
  color: #6e402a;
}

.loyalty-card__label {
  display: block;
  margin-bottom: 6px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  font-weight: 560;
}

.loyalty-card__face--back .loyalty-card__label {
  color: var(--muted);
}

.loyalty-card__name {
  display: block;
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 520;
  line-height: 1;
}

.loyalty-card__balance {
  justify-self: start;
}

.loyalty-card__balance span {
  display: block;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  font-weight: 560;
}

.loyalty-card__balance strong {
  display: block;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 580;
  line-height: 1;
}

.loyalty-card__bottom-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
}

.loyalty-card__bottom-row > span:first-child {
  min-width: 0;
  color: rgba(255, 255, 255, 0.88);
  font-size: 15px;
  font-weight: 560;
}

.loyalty-card__rate,
.loyalty-card p {
  color: rgba(255, 255, 255, 0.78);
}

.loyalty-card__qr {
  display: grid;
  place-items: center;
  justify-self: center;
  width: min(235px, 72%);
  aspect-ratio: 1;
  border-radius: 22px;
  background: var(--white);
  padding: 8px;
}

.loyalty-card__back-content {
  display: grid;
  justify-items: center;
  gap: 18px;
  align-self: center;
  transform: translateY(-14px);
}

.loyalty-card__qr img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.loyalty-card__back-copy {
  max-width: 26ch;
  color: #6e402a;
  font-size: 16px;
  font-weight: 560;
  line-height: 1.25;
  text-align: center;
}

.loyalty-card-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.account-card--profile {
  grid-column: 2;
}

.account-profile-form {
  display: grid;
  gap: 12px;
}

.account-profile-actions {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(92px, 3fr);
  gap: 10px;
}

.account-profile-actions__logout {
  border: 1px solid var(--line) !important;
  background: rgba(255, 255, 255, 0.86) !important;
  color: var(--olive-dark) !important;
}

.account-profile-actions__logout:hover {
  background: #f4f5ef !important;
}

.account-profile-form__message {
  min-height: 20px;
  margin: 0;
  color: var(--olive);
  font-size: 13px;
}

.account-profile-form__message.is-error {
  color: #9b2f28;
}

.account-profile-data dd {
  max-width: 70%;
  word-break: break-word;
}

.account-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

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

.account-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(32, 37, 30, 0.36);
  backdrop-filter: blur(8px);
}

.account-modal__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 470px);
  padding: 22px;
  box-shadow: 0 28px 82px rgba(48, 56, 43, 0.28);
}

.account-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.account-modal__header button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--white);
  color: var(--olive-dark);
  padding: 0;
}

.account-modal__header svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

.account-modal__actions {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(92px, 3fr);
  gap: 10px;
}

.account-modal__actions button[type="button"] {
  border: 1px solid var(--line);
  background: #f5f6f0;
  color: var(--olive-dark);
}

.account-card dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.account-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
}

.account-card dt {
  color: var(--muted);
}

.account-card dd {
  margin: 0;
  color: var(--olive-dark);
  font-weight: 540;
  text-align: right;
}

@media (max-width: 860px) {
  .account-shell {
    width: min(430px, 100%);
    padding: 14px 14px 46px;
  }

  .account-auth,
  .account-dashboard,
  .account-auth__forms {
    grid-template-columns: 1fr;
  }

  .account-auth__copy {
    padding-top: 0;
  }

  .account-auth__desktop-break {
    display: none;
  }

  .account-brand,
  body.account-has-card .account-brand {
    display: none;
  }

  .account-header {
    min-height: 0;
    margin-bottom: 10px;
  }

  .account-card--profile {
    grid-column: auto;
  }

  .account-profile-data dd {
    max-width: 62%;
  }

  .account-modal {
    align-items: end;
    padding: 12px;
  }

  .account-modal__panel {
    width: 100%;
    border-radius: 24px;
    padding: 18px;
  }

  .loyalty-card {
    min-height: 370px;
  }

  .loyalty-card__face {
    padding: 22px;
    gap: 16px;
  }

  .loyalty-card__bottom-row {
    width: 100%;
    align-items: center;
    gap: 12px;
  }

  .loyalty-card__bottom-row > span:first-child,
  .loyalty-card__rate {
    font-size: 12px;
    line-height: 1.15;
    white-space: nowrap;
  }

  .loyalty-card__qr {
    width: min(198px, 64%);
  }

  .loyalty-card__back-copy {
    font-size: 13px;
  }
}

.scanner-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(300px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.scanner-camera h1 {
  margin: 0 0 8px;
  color: var(--olive-dark);
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 520;
}

.scanner-camera video {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 18px;
  background: #1f241d;
  object-fit: cover;
}

.scanner-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.scanner-actions button:last-child {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--olive-dark);
}

.scanner-manual,
.scanner-bonus {
  display: grid;
  gap: 12px;
}

.scanner-result {
  position: sticky;
  top: 22px;
}

@media (max-width: 860px) {
  .scanner-grid {
    grid-template-columns: 1fr;
  }

  .scanner-result {
    position: static;
  }
}
