.wallet-panel {
  position: fixed;
  inset: 0;
  z-index: 1600;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 50% 18%, rgba(63, 107, 82, 0.12), transparent 34%),
    rgba(248, 249, 251, 0.99);
  color: #111827;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

body.wallet-surface-open {
  overflow: hidden;
}

.wallet-panel[hidden],
.wallet-document-viewer[hidden] {
  display: none !important;
}

.wallet-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  flex: 0 0 auto;
}

.wallet-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.wallet-title-wrap h2 {
  margin: 0;
  font-size: 1.08rem;
}

.wallet-title-icon {
  font-size: 1.2rem;
}

.wallet-close,
.wallet-document-viewer-header button {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.06);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.wallet-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 18px 14px 18px;
}

.wallet-empty-state {
  margin: auto;
  width: min(520px, 100%);
  padding: 34px 24px;
  display: grid;
  justify-items: center;
  gap: 16px;
  border: 1px dashed rgba(63, 107, 82, 0.3);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.8);
  text-align: center;
  box-shadow: 0 16px 40px rgba(17, 24, 39, 0.07);
}

.wallet-empty-icon {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: rgba(63, 107, 82, 0.12);
  font-size: 2rem;
}

.wallet-empty-state p {
  margin: 0;
  max-width: 390px;
  color: #5b6470;
  line-height: 1.5;
}

.wallet-add-button {
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 14px;
  background: #3f6b52;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(63, 107, 82, 0.22);
}

.wallet-wheel-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.wallet-wheel-heading {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 10px 10px;
}

.wallet-wheel-heading h3 {
  margin: 0;
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.045em;
  color: #4b5563;
}

.wallet-wheel-heading span {
  font-size: 0.76rem;
  color: #6b7280;
}

.wallet-wheel {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 8px min(48vh, 360px);
  scroll-padding-top: 12px;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  perspective: 950px;
}

.wallet-wheel::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.wallet-document-card {
  position: relative;
  width: 100%;
  min-height: 126px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 0 0 12px;
  padding: 16px 16px;
  border: 1px solid rgba(63, 107, 82, 0.14);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  color: #111827;
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.07);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  cursor: pointer;
  transform-origin: center top;
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.wallet-document-card:focus-visible {
  outline: 3px solid rgba(63, 107, 82, 0.28);
  outline-offset: 3px;
}

.wallet-document-card.is-active {
  z-index: 5;
  background: linear-gradient(145deg, #3f6b52, #315742);
  border-color: rgba(255, 255, 255, 0.26);
  color: #fff;
  box-shadow: 0 20px 44px rgba(49, 87, 66, 0.28);
  transform: translateZ(26px) scale(1);
  opacity: 1;
}

.wallet-document-card.is-near-1 {
  z-index: 4;
  background: rgba(236, 245, 239, 0.96);
  border-color: rgba(63, 107, 82, 0.24);
  transform: translateZ(8px) scale(0.965);
  opacity: 0.9;
}

.wallet-document-card.is-near-2 {
  z-index: 3;
  background: rgba(247, 250, 248, 0.9);
  transform: scale(0.925);
  opacity: 0.68;
}

.wallet-document-card.is-near-3 {
  z-index: 2;
  transform: scale(0.89);
  opacity: 0.42;
}

.wallet-document-card.is-distant {
  z-index: 1;
  transform: scale(0.84);
  opacity: 0.18;
}

.wallet-document-card[data-wheel-direction="after"].is-near-1 {
  transform: rotateX(-3deg) translateZ(8px) scale(0.965);
}

.wallet-document-card[data-wheel-direction="after"].is-near-2 {
  transform: rotateX(-5deg) scale(0.925);
}

.wallet-document-card[data-wheel-direction="after"].is-near-3,
.wallet-document-card[data-wheel-direction="after"].is-distant {
  transform: rotateX(-7deg) scale(0.89);
}

.wallet-document-card[data-wheel-direction="before"].is-near-1 {
  transform: rotateX(3deg) translateZ(8px) scale(0.965);
}

.wallet-document-card[data-wheel-direction="before"].is-near-2 {
  transform: rotateX(5deg) scale(0.925);
}

.wallet-document-card[data-wheel-direction="before"].is-near-3,
.wallet-document-card[data-wheel-direction="before"].is-distant {
  transform: rotateX(7deg) scale(0.89);
}

.wallet-document-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  background: rgba(63, 107, 82, 0.1);
  font-size: 1.35rem;
  transition: transform 180ms ease, background 180ms ease;
}

.wallet-document-card.is-active .wallet-document-icon {
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.06);
}

.wallet-document-text {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.wallet-document-text strong,
.wallet-document-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-document-text strong {
  font-size: 0.96rem;
  transition: font-size 180ms ease;
}

.wallet-document-card.is-active .wallet-document-text strong {
  font-size: 1.06rem;
}

.wallet-document-text small {
  color: #6b7280;
  font-size: 0.78rem;
}

.wallet-document-text .wallet-document-offline {
  color: #3f6b52;
}

.wallet-document-card.is-active .wallet-document-text small,
.wallet-document-card.is-active .wallet-document-text .wallet-document-offline {
  color: rgba(255, 255, 255, 0.82);
}

.wallet-document-open {
  min-width: 72px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 13px;
  background: #fff;
  color: #315742;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  opacity: 0;
  transform: translateX(8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.wallet-document-card.is-active .wallet-document-open {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.wallet-document-open:disabled {
  visibility: hidden;
}

.wallet-document-viewer {
  position: fixed;
  inset: 0;
  z-index: 1800;
  display: grid;
  place-items: center;
  padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
}

.wallet-document-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 12, 20, 0.82);
}

.wallet-document-viewer-card {
  position: relative;
  z-index: 1;
  width: min(900px, 100%);
  height: min(92vh, 980px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.34);
}

.wallet-document-viewer-header {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px 8px 16px;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
}

.wallet-document-viewer-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-document-viewer-content {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  background: #f3f4f6;
}

.wallet-document-viewer-content img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.wallet-document-viewer-content iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

@media (max-width: 640px) {
  .wallet-body {
    padding: 14px 10px 10px;
  }

  .wallet-wheel-heading {
    padding-inline: 8px;
  }

  .wallet-document-card {
    min-height: 118px;
    grid-template-columns: auto minmax(0, 1fr);
    padding: 14px;
  }

  .wallet-document-open {
    grid-column: 2;
    justify-self: start;
    margin-top: 2px;
  }

  .wallet-document-viewer {
    padding: 0;
  }

  .wallet-document-viewer-card {
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wallet-document-card,
  .wallet-document-icon,
  .wallet-document-text strong,
  .wallet-document-open {
    transition: none;
  }

  .wallet-wheel {
    scroll-behavior: auto;
  }
}
