/* Account panel + authenticated buy + password modal */

.account-page {
  background: #f8fafc;
}

.account-main {
  padding-bottom: 0;
}

.account-shell {
  width: min(100% - 40px, 1180px);
  margin-inline: auto;
  padding-block: 48px 72px;
}

@media (max-width: 639px) {
  .account-shell {
    width: min(100% - 24px, 1180px);
    padding-block: 28px 48px;
  }
}

.account-shell__title,
.buy-shell__title {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
}

.account-shell__email {
  margin: 0.45rem 0 0;
  color: #64748b;
  font-size: 0.95rem;
  word-break: break-word;
}

.account-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 1.25rem;
}

@media (max-width: 639px) {
  .account-summary {
    grid-template-columns: 1fr;
  }
}

.account-summary__item {
  padding: 0.75rem 0.9rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
}

.account-summary__label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

.account-summary__value {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: #0f172a;
}

.account-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin-top: 1.75rem;
}

@media (max-width: 899px) {
  .account-layout {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.account-sidebar {
  position: sticky;
  top: 5rem;
}

@media (max-width: 899px) {
  .account-sidebar {
    position: static;
  }
}

.account-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.4rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

@media (max-width: 899px) {
  .account-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

.account-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.55rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #64748b;
  text-decoration: none;
}

@media (max-width: 899px) {
  .account-nav__link {
    flex: 1 1 auto;
    justify-content: center;
  }
}

.account-nav__link:hover {
  color: #7c3aed;
  background: #f8fafc;
}

.account-nav__link.is-active {
  color: #6d28d9;
  background: #f5f3ff;
}

.account-nav__icon {
  display: inline-flex;
  color: inherit;
}

.account-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 1rem;
  padding: 1.35rem 1.25rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

@media (min-width: 640px) {
  .account-card {
    padding: 1.5rem 1.6rem;
  }
}

.account-card--sticky {
  position: sticky;
  top: 5rem;
}

.account-card__head {
  margin-bottom: 1.1rem;
}

.account-card__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.account-card__lead {
  margin: 0.3rem 0 0;
  color: #64748b;
  font-size: 0.92rem;
  line-height: 1.5;
}

.account-card__actions {
  margin-top: 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.account-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.15rem;
}

.account-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0.15rem;
  border-bottom: 1px solid #f1f5f9;
}

.account-row:last-child {
  border-bottom: 0;
}

.account-row__icon {
  display: inline-flex;
  color: #7c3aed;
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.account-row__label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.account-row__value {
  margin: 0.15rem 0 0;
  font-size: 0.98rem;
  color: #0f172a;
  word-break: break-word;
}

.account-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #f1f5f9;
  color: #475569;
}

.account-badge--ok {
  background: #ecfdf5;
  color: #047857;
}

.account-note {
  margin: 1.1rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  background: #f8fafc;
  color: #64748b;
  font-size: 0.92rem;
  line-height: 1.55;
}

.account-alert {
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.92rem;
  line-height: 1.5;
}

.account-alert--ok {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.account-alert--error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.account-alert--warn {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.account-fields {
  margin: 0;
  display: grid;
  gap: 0.85rem;
}

.account-fields--compact {
  gap: 0.65rem;
}

.account-fields__row {
  display: grid;
  gap: 0.2rem;
}

@media (min-width: 520px) {
  .account-fields__row {
    grid-template-columns: 8.5rem 1fr;
    align-items: center;
    gap: 1rem;
  }
}

.account-fields__row dt {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.account-fields__row dd {
  margin: 0;
  font-size: 0.95rem;
  color: #0f172a;
  word-break: break-word;
}

.account-field {
  display: grid;
  gap: 0.35rem;
}

.account-field span {
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
}

.account-field input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 0.55rem;
  font: inherit;
  color: #0f172a;
  background: #fff;
}

.account-field input:focus {
  outline: 2px solid rgba(124, 58, 237, 0.35);
  border-color: #7c3aed;
}

.account-empty {
  text-align: center;
  padding: 1.25rem 0.25rem;
}

.account-empty__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.75rem;
  height: 3.75rem;
  margin-bottom: 0.75rem;
  border-radius: 999px;
  background: #f5f3ff;
  color: #7c3aed;
}

.account-empty__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.account-empty__text {
  margin: 0.5rem auto 0;
  max-width: 30rem;
  color: #64748b;
  line-height: 1.6;
}

.account-empty__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.account-empty--pending {
  text-align: left;
  padding: 0.25rem 0;
}

.account-benefits {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.65rem;
  text-align: left;
}

.account-benefits--list {
  grid-template-columns: 1fr;
}

.account-benefits__item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 0.65rem;
  background: #fafafa;
  font-size: 0.9rem;
  font-weight: 600;
  color: #334155;
}

.account-benefits__icon {
  display: inline-flex;
  color: #7c3aed;
  flex-shrink: 0;
}

.account-code {
  font-size: 0.85rem;
  padding: 0.15rem 0.4rem;
  border-radius: 0.35rem;
  background: #f1f5f9;
  color: #334155;
}

.btn-icon {
  display: inline-flex;
  margin-right: 0.35rem;
  vertical-align: -0.15em;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Account menu */
.account-menu {
  position: relative;
}

.account-menu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.25rem 0.35rem 0.25rem 0.25rem;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  max-width: 14rem;
}

.account-menu__trigger:hover {
  border-color: #cbd5e1;
}

.account-menu__avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #7c3aed, #9333ea);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.account-menu__label {
  display: grid;
  gap: 0.05rem;
  min-width: 0;
  text-align: left;
}

.account-menu__name {
  font-size: 0.78rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 9rem;
}

.account-menu__sub {
  font-size: 0.68rem;
  color: #94a3b8;
}

.account-menu__chevron {
  color: #94a3b8;
  flex-shrink: 0;
}

.account-menu__panel {
  position: absolute;
  top: calc(100% + 0.45rem);
  right: 0;
  z-index: 60;
  min-width: 15.5rem;
  padding: 0.65rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.85rem;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

.account-menu__head-email {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
}

.account-menu__head-sub {
  margin: 0.15rem 0 0;
  font-size: 0.72rem;
  color: #94a3b8;
}

.account-menu__sep {
  margin: 0.45rem 0;
  border: 0;
  border-top: 1px solid #e2e8f0;
}

.account-menu__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 0;
  border-radius: 0.5rem;
  background: transparent;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}

.account-menu__item:hover {
  background: #f8fafc;
  color: #7c3aed;
}

.account-menu__item--danger {
  color: #b91c1c;
}

.account-menu__item--danger:hover {
  background: #fef2f2;
  color: #991b1b;
}

.account-menu__icon {
  display: inline-flex;
  color: inherit;
}

.account-menu__logout-form {
  margin: 0;
}

/* Buy */
.buy-shell__back {
  display: inline-block;
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #7c3aed;
  text-decoration: none;
}

.buy-shell__back:hover {
  text-decoration: underline;
}

.buy-shell__title {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.15rem);
  letter-spacing: -0.03em;
}

.buy-shell__lead {
  margin: 0.45rem 0 0;
  color: #64748b;
  font-size: 1rem;
}

.buy-panel {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.75rem;
  padding: 1.5rem;
  border-radius: 1.25rem;
  background: #fff;
  border: 1px solid #e8e4f5;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.05);
}

@media (min-width: 880px) {
  .buy-panel {
    grid-template-columns: minmax(0, 1.4fr) 14rem;
    gap: 1.75rem;
    padding: 1.75rem 1.85rem;
    align-items: start;
  }
}

.buy-panel__cta {
  width: 100%;
  max-width: 22rem;
  justify-content: center;
}

.buy-panel__note {
  margin: 0.7rem 0 0;
  font-size: 0.88rem;
  color: #64748b;
}

.buy-panel__soon {
  padding: 1rem 1.1rem;
  border-radius: 0.9rem;
  background: linear-gradient(180deg, #fffbeb, #fff7ed);
  border: 1px solid #fde68a;
}

.buy-panel__soon-title {
  margin: 0;
  font-weight: 750;
  color: #92400e;
}

.buy-panel__soon-text {
  margin: 0.35rem 0 0;
  color: #a16207;
  line-height: 1.5;
  font-size: 0.92rem;
}

.buy-includes {
  margin: 1.35rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.75rem;
}

.buy-includes li {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  color: #334155;
  font-weight: 500;
  line-height: 1.4;
}

.buy-includes__icon {
  display: inline-flex;
  flex-shrink: 0;
  margin-top: 0.1rem;
  color: #7c3aed;
}

.buy-panel__side {
  padding: 1rem 1.1rem;
  border-radius: 0.95rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.buy-panel__side-label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.buy-panel__status {
  margin: 0.4rem 0 0;
  font-weight: 700;
  color: #475569;
}

.buy-panel__status--ok {
  color: #047857;
}

.buy-panel__home {
  margin-top: 1rem;
  width: 100%;
  justify-content: center;
}

/* legacy buy layout (unused) */
.buy-layout {
  display: none;
}

.btn-lg {
  padding: 0.75rem 1.25rem;
  font-size: 1rem;
}

/* Password modal */
body.pw-modal-open {
  overflow: hidden;
}

.pw-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.pw-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.pw-modal__panel {
  position: relative;
  z-index: 1;
  width: min(100%, 26rem);
  max-height: min(90vh, 40rem);
  overflow: auto;
  padding: 1.25rem;
  background: #fff;
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.2);
}

.pw-modal__head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: start;
  margin-bottom: 1rem;
}

.pw-modal__icon {
  display: inline-flex;
  color: #7c3aed;
  margin-top: 0.15rem;
}

.pw-modal__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

.pw-modal__lead {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
  color: #64748b;
  line-height: 1.45;
}

.pw-modal__close {
  display: inline-flex;
  padding: 0.25rem;
  border: 0;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  border-radius: 0.35rem;
}

.pw-modal__close:hover {
  background: #f1f5f9;
}

.pw-modal__form {
  display: grid;
  gap: 0.85rem;
}

.pw-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 0.35rem;
}

.pw-input {
  position: relative;
}

.pw-input input {
  padding-right: 2.5rem;
}

.pw-input__toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  padding: 0.35rem;
  border: 0;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 0.35rem;
}

.pw-input__toggle:hover {
  color: #475569;
  background: #f8fafc;
}

/* Footer logout button */
.site-footer__logout {
  margin: 0;
}

.site-footer__logout button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.site-footer__logout button:hover {
  color: #7c3aed;
}

@media (max-width: 639px) {
  .site-header__actions {
    width: 100%;
  }

  .account-menu {
    width: 100%;
  }

  .account-menu__trigger {
    width: 100%;
    max-width: none;
    justify-content: flex-start;
  }

  .account-menu__panel {
    left: 0;
    right: 0;
    min-width: 0;
  }
}
