:root {
  font-family: "Inter", system-ui, sans-serif;
  color: #111827;
  background: #f9fafb;
}

body {
  margin: 0;
}

* {
  box-sizing: border-box;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px;
}

.site-header {
  background: #111827;
  color: #fff;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header a {
  color: #fff;
  margin-left: 12px;
  text-decoration: none;
}

.brand {
  font-weight: 700;
  font-size: 1.2rem;
}

.hero {
  padding: 48px 0;
}

.hero-actions {
  margin-top: 24px;
  display: flex;
  gap: 16px;
}

.inline-form {
  display: inline-flex;
}

.features {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 48px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  margin-bottom: 24px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 12px;
}

input,
textarea {
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  font-size: 1rem;
}

select {
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  font-size: 1rem;
  background: #fff;
}

.button {
  background: #2563eb;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.button.secondary {
  background: #e5e7eb;
  color: #111827;
}

.button.tertiary {
  background: transparent;
  color: #2563eb;
  border: 1px solid #93c5fd;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.package-card {
  margin: 0;
}

.invoice-link {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  word-break: break-all;
}

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

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.balance-chip {
  background: #eef2ff;
  color: #3730a3;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 600;
}

.voucher-list {
  display: grid;
  gap: 12px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.filter-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 16px;
  align-items: end;
}

.template-list {
  display: grid;
  gap: 12px;
}

.voucher {
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.voucher-actions {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.voucher-details {
  flex: 1;
}

.voucher-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.voucher-meta-grid {
  margin-top: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.badge-pass {
  background: #eef2ff;
  color: #3730a3;
}

.badge-status {
  background: #f3f4f6;
  color: #374151;
}

.badge-issued {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge-redeemed {
  background: #dcfce7;
  color: #166534;
}

.badge-expired {
  background: #fef9c3;
  color: #854d0e;
}

.badge-cancelled {
  background: #fee2e2;
  color: #991b1b;
}

.template {
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.template-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.wallet-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.link {
  color: #2563eb;
  text-decoration: none;
  font-size: 0.9rem;
}

.muted {
  color: #6b7280;
}

.alert {
  background: #fee2e2;
  color: #991b1b;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-weight: 600;
}

.alert.success {
  background: #dcfce7;
  color: #166534;
}

.alert.warning {
  background: #fef9c3;
  color: #854d0e;
}

.hidden {
  display: none;
}

.voucher-landing,
.voucher-status {
  border-top: 4px solid var(--brand-color, #2563eb);
}

.voucher-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: cover;
  background: #fff;
  border: 1px solid #e5e7eb;
}

.org-name {
  font-weight: 700;
  font-size: 1.1rem;
}

.voucher-body {
  display: grid;
  gap: 24px;
  grid-template-columns: minmax(0, 2fr) minmax(200px, 1fr);
}

.voucher-meta {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin: 16px 0;
}

.meta-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  font-weight: 600;
}

.meta-value {
  font-weight: 600;
}

.code-display {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  background: #f3f4f6;
  padding: 8px 12px;
  border-radius: 8px;
  display: inline-block;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.voucher-action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 16px 0;
}

.google-wallet-button {
  display: inline-flex;
  align-items: center;
  padding: 6px 0;
  max-width: 240px;
  width: 100%;
}

.google-wallet-button img {
  display: block;
  height: 40px;
  width: auto;
  max-width: 100%;
}

.wallet-note {
  font-size: 0.85rem;
}

.apple-wallet-button {
  border: 1px dashed #d1d5db;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: #6b7280;
  text-decoration: none;
  cursor: not-allowed;
  text-align: center;
}

.voucher-banner {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 20px;
  border: 1px solid #e5e7eb;
}

.voucher-actions-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.voucher-primary-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.voucher-qr {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qr-code {
  max-width: 100%;
}

.qr-code svg,
.qr-code img {
  max-width: 100%;
  width: 100%;
  height: auto;
}

.break-words {
  word-break: break-word;
  overflow-wrap: anywhere;
}

.template-counts {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.form-section {
  padding: 20px;
  border-radius: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  margin-bottom: 20px;
}

.form-section h2 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.section-help {
  margin-top: 4px;
  margin-bottom: 0;
}

.template-preview {
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 16px;
  background: #fff;
  margin-top: 12px;
}

.preview-title {
  font-weight: 700;
}

.preview-subtitle {
  color: #6b7280;
  margin-top: 4px;
}

.issue-sections {
  display: grid;
  gap: 16px;
}

.photo-preview img {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid #e5e7eb;
}

.upload-status {
  min-height: 20px;
}

.upload-status.loading::before {
  content: "⏳ ";
}

.pagination {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-actions {
  display: flex;
  gap: 8px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #111827;
  color: #ffffff;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 9999;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 768px) {
  .container {
    padding: 16px;
  }

  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .site-header a {
    margin-left: 0;
    margin-right: 12px;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .button:not(.secondary):not(.tertiary) {
    width: 100%;
  }

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

  .template-actions {
    width: 100%;
  }

  .template-actions .button,
  .template-actions form {
    width: 100%;
  }

  .template-actions form .button {
    width: 100%;
  }

  .voucher-body {
    grid-template-columns: 1fr;
  }

  .voucher-brand {
    flex-direction: column;
    align-items: flex-start;
  }

  .voucher-action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .voucher-actions-panel {
    order: 2;
  }

  .voucher-details {
    order: 1;
  }

  .voucher-primary-actions {
    align-items: stretch;
  }

  .apple-wallet-button {
    width: 100%;
  }
}

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

  .card {
    padding: 16px;
  }

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

  .code-display {
    font-size: 1.1rem;
  }
}

.voucher-qr {
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.qr-code svg {
  width: 180px;
  height: 180px;
}

.redeem-form {
  display: grid;
  gap: 16px;
}

.divider {
  border-top: 1px solid #e5e7eb;
  margin: 16px 0;
}

.redemption-list {
  display: grid;
  gap: 12px;
}

.redemption-item {
  border: 1px solid #e5e7eb;
  padding: 12px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.site-footer {
  border-top: 1px solid #e5e7eb;
  margin-top: 48px;
  padding: 16px 0;
}
