* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, var(--bg-gradient-from, #667eea) 0%, var(--bg-gradient-to, #764ba2) 100%);
  min-height: 100vh;
  padding: 20px;
  position: relative;
}

.user-menu {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
}

.user-menu-btn {
  padding: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: #64748b;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-menu-btn:hover {
  background: rgba(255, 255, 255, 1);
  transform: translateY(-1px);
}

.user-dropdown {
  position: absolute;
  top: 50px;
  right: 0;
  background: white;
  border-radius: 8px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
}

.user-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  padding: 12px 16px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-size: 14px;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s ease;
}

.dropdown-item:hover {
  background: #f8f9fa;
}

.dropdown-item:first-child {
  border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
  border-radius: 0 0 8px 8px;
}

.dropdown-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 4px 0;
}

.main-content {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.container {
  background: var(--card-bg, #ffffff);
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  padding: 40px;
  max-width: 500px;
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .header {
    padding-top: 48px;
  }

  .user-menu {
    top: 10px;
    right: 10px;
  }

  .user-menu-btn {
    width: 36px;
    height: 36px;
  }

  .user-dropdown {
    min-width: 160px;
    top: 46px;
  }

  .container {
    padding: 20px;
    margin: 20px auto;
  }

  .main-content {
    padding: 0 10px;
  }
}

.header {
  position: relative;
  text-align: center;
  margin-bottom: 10px;
  padding-top: 65px;
}

.header h1,
.title-centered {
  color: var(--card-text, #333);
  font-size: 28px;
  margin-bottom: 8px;
}

.header p {
  color: var(--muted-text, #666);
  font-size: 16px;
  margin-bottom: 5px; /* small bottom margin as requested */
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.brand-top-left {
  position: absolute;
  top: 0;
  left: 0;
  margin-bottom: 0;
}

.brand-logo {
  width: 32px;
  height: 32px;
  background-image: var(--logo-image-url, url('/theme/logo.png'));
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  border-radius: 0;
  margin-bottom: 0;
}

@media (min-width: 640px) {
  .brand-logo {
    width: 40px; 
    height: 40px;
  }
}

@media (min-width: 768px) {
  .brand-logo {
    width: 48px;
    height: 48px;
  }
}

.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--card-text, #333);
  font-weight: 500;
}

input,
select {
  width: 100%;

  padding: 12px 16px;
  border: 2px solid var(--border-color, #e1e5e9);
  border-radius: 12px;
  font-size: 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--focus-color, #667eea);
  box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--button-primary-from, #667eea) 0%, var(--button-primary-to, #764ba2) 100%);
  color: var(--button-primary-text, #ffffff);
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}


/* Utility and extracted styles from index.html */
.hidden {
  display: none;
}

.muted-help {
  color: #666;
  font-size: 12px;
}

.error-message {
  background: #fee;
  color: #c33;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 14px;
  border: 1px solid #fcc;
}

.pass-type-info {
  background: var(--panel-bg, rgba(15, 23, 42, 0.05));
  padding: 12px;
  border-radius: var(--card-radius, 8px);
  margin-bottom: 25px;
  font-size: 14px;
  color: var(--muted-text, #555);
}

#backToUserIdBtn {
  background: var(--secondary-button-bg, #6c757d);
  margin-top: 32px;
}

.icon-box {
  background: var(--divider, #e2e8f0);
  padding: 6px;
  border-radius: var(--small-radius, 6px);
}

.wallet-btn-inner {
  padding: 8px 16px;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-pre {
  white-space: pre-wrap;
  background: var(--panel-bg, #f8f9fa);
  padding: 10px;
  border-radius: var(--small-radius, 6px);
}

#errorBackBtn {
  margin-top: 15px;
}

.loading {
  display: none;
  text-align: center;
  padding: 40px 20px;
}

.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--spinner-color, #667eea);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 15px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.qr-loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.qr-loading-spinner .spinner {
  width: 30px;
  height: 30px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #667eea;
  margin: 0 auto 10px;
}

.qr-loading-spinner p {
  margin: 0;
  font-size: 14px;
  color: #666;
}

.qr-result {
  display: none;
  text-align: center;
  padding: 15px;
  background: var(--card-bg, #ffffff);
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  max-width: 500px;
  margin: 0 auto;
}

.error-result {
  display: none;
  margin-top: 20px;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  background: var(--error-bg, #f8d7da);
  border: 1px solid var(--error-border, #f5c6cb);
  color: var(--error-text, #721c24);
}

.error-message {
  display: none;
  margin: 15px 0;
  padding: 15px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  font-size: 16px;
  line-height: 1.5;
  text-align: left;
}

.qr-header {
  background: linear-gradient(135deg, var(--qr-header-from, #667eea) 0%, var(--qr-header-to, #764ba2) 100%);
  color: white;
  padding: 20px;
  border-radius: 12px 12px 0 0;
  margin: -40px -40px 20px -40px;
}

.qr-title {
  font-size: 20px;
  font-weight: bold;
  margin-bottom: 8px;
}

.qr-description {
  font-size: 14px;
  opacity: 0.9;
}

.qr-code-wrapper {
  position: relative;
  display: inline-block;
  margin: 10px 0;
}

.qr-code-bg {
  position: absolute;
  inset: -12px;
  background: linear-gradient(135deg, var(--qr-bg-from, #667eea) 0%, var(--qr-bg-to, #764ba2) 100%);
  border-radius: 16px;
  filter: blur(8px);
  opacity: 0.3;
}

.qr-code-container {
  position: relative;
  background: white;
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.qr-code-inner {
  background: white;
}

.pass-info-card {
  margin-top: 16px;
  background: var(--panel-bg, #f8f9fa);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #555;
}

.wallet-type-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.wallet-buttons {
  margin-top: 12px;
  display: flex;
  gap: 4px;
  padding: 8px 16px;
  background: var(--card-bg, #ffffff);
  border-top: 1px solid var(--divider, #e2e8f0);
  border-radius: 0 0 12px 12px;
  margin: 12px -40px -40px -40px;
  justify-content: center;
}

.back-btn {
  padding: 6px 12px;
  background: transparent;
  color: var(--muted-2, #64748b);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background-color 0.2s;
}

.back-btn:hover {
  background: var(--hover-muted-bg, #f1f5f9);
}

.wallet-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.wallet-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.google-wallet-btn {
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}

@media (max-width: 480px) {
  .qr-result {
    padding: 12px;
    margin: 0 8px;
    border-radius: 8px;
  }

  .qr-header {
    margin-bottom: 16px;
  }

  .qr-title {
    font-size: 18px;
    margin-bottom: 8px;
  }

  .qr-description {
    font-size: 13px;
  }

  .qr-code-container {
    padding: 8px;
    border-radius: 8px;
  }

  .qr-code-wrapper {
    margin: 8px 0;
  }

  .wallet-buttons {
    padding: 6px 12px;
    margin: 8px -12px -12px -12px;
    gap: 2px;
  }

  .pass-info-card {
    margin-top: 12px;
    padding: 12px;
  }
}

.google-wallet-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.google-wallet-btn img {
  height: 36px;
  width: auto;
  min-height: 36px;
}

.apple-wallet-btn {
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
}

.apple-wallet-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.apple-wallet-btn img {
  height: 36px;
  width: auto;
  min-height: 36px;
}


/* Icons for Apple/Google in pass list */
.pass-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: inline-block;
  border-radius: 4px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}



/* Modern pass list styles */
.pass-summary-card {
  background: var(--panel-bg, #f8f9fa);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--card-text, #334155);
  font-size: 14px;
}

.pass-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.pass-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
}

.pass-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #0f172a;
}

.pass-badge .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06) inset;
}

.pass-badge .dot.apple {
  background: #0a0a0a;
}

.pass-badge .dot.google {
  background: conic-gradient(#ea4335 0 25%, #fbbc05 25% 50%, #34a853 50% 75%, #4285f4 75% 100%);
}

.pass-badge .dot.other {
  background: #64748b;
}

.pass-badge .pass-name {
  letter-spacing: .2px;
}

.status-badge {
  margin-left: 6px;
  font-size: 12px;
  color: #16a34a;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  text-transform: lowercase;
}

.qr-small-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-color, #e2e8f0);
  background: var(--muted-bg, #f8fafc);
  color: #334155;
  cursor: pointer;
  font-weight: 600;
  transition: all .15s ease;
}

.qr-small-btn:hover {
  background: #eef2ff;
  border-color: #c7d2fe;
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .pass-item {
    padding: 8px 10px;
  }

  .qr-small-btn {
    padding: 6px 8px;
  }
}

/* Chip for template display name and subtle user id */
.pass-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #575964;
  color: #e2e8f0;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
}

.user-id-muted {
  margin-top: 10px;
  color: #64748b;
  font-size: 13px;
}

/* Wallet cards */
.wallet-card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.wallet-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}

.wallet-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
}

.wallet-card .left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wallet-card .logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 8px;
}

.wallet-card .titles {
  display: flex;
  flex-direction: column;
}

.wallet-card .title {
  font-weight: 700;
  color: #0f172a;
}

.wallet-card .subtitle {
  font-size: 13px;
  color: #64748b;
}

.wallet-card .right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-existing {
  background: #ecfdf5;
  color: #16a34a;
  border: 1px solid #a7f3d0;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-create {
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.chevron {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
}

@media (max-width: 480px) {
  .wallet-card {
    padding: 12px 12px;
  }
}