/* --- buttons ---------------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 48px;
  padding: 0 var(--sp-5);
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--c-accent);
  color: var(--c-accent-ink);
  font-family: var(--font-display);
  font-size: var(--fs-md);
  letter-spacing: var(--tracking-display);
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform var(--t-fast) var(--ease-out),
    opacity var(--t-fast);
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn--block {
  width: 100%;
}

.btn--secondary {
  background: transparent;
  border-color: var(--c-line);
  color: var(--c-text);
}

.btn--ghost {
  background: transparent;
  color: var(--c-gold);
  padding: 0 var(--sp-2);
  min-height: 40px;
}

.btn--danger {
  background: transparent;
  border-color: var(--c-minus);
  color: var(--c-minus);
}

.btn--small {
  min-height: 36px;
  padding: 0 var(--sp-3);
  font-size: var(--fs-sm);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: var(--c-surface-2);
  color: var(--c-text);
  cursor: pointer;
}

.icon-btn svg,
.btn svg {
  width: 20px;
  height: 20px;
}

/* --- forms ------------------------------------------------------------------------------------ */

.field {
  display: grid;
  gap: var(--sp-1);
}

.field__label {
  font-size: var(--fs-sm);
  color: var(--c-muted);
}

.input {
  width: 100%;
  min-height: 48px;
  padding: 0 var(--sp-3);
  border: var(--border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  color: var(--c-text);
}

.input:focus {
  border-color: var(--c-gold);
  outline: none;
}

.input[aria-invalid="true"] {
  border-color: var(--c-minus);
}

.field__error,
.form-error {
  color: var(--c-minus);
  font-size: var(--fs-sm);
}

.checkbox {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  font-size: var(--fs-sm);
  color: var(--c-muted);
}

.checkbox input {
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
  accent-color: var(--c-accent);
  flex: none;
}

.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex: none;
  appearance: none;
  border-radius: 14px;
  background: var(--c-surface-3);
  cursor: pointer;
  transition: background var(--t-fast);
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c-text);
  transition: transform var(--t-fast) var(--ease-out);
}

.switch:checked {
  background: var(--c-accent);
}

.switch:checked::after {
  transform: translateX(20px);
}

/* --- cards, lists ------------------------------------------------------------------------------ */

.card {
  padding: var(--sp-4);
  border: var(--border);
  border-radius: var(--radius);
  background: var(--c-surface);
}

a.card,
button.card {
  color: inherit;
  text-decoration: none;
  text-align: left;
  font: inherit;
}

.card > svg {
  width: 24px;
  height: 24px;
  flex: none;
  color: var(--c-faint);
}

.card--tap {
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out);
}

.card--tap:active {
  transform: scale(0.985);
}

.section-title {
  margin: var(--sp-5) 0 var(--sp-3);
  color: var(--c-muted);
  font-size: var(--fs-sm);
}

.list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  border: var(--border);
  border-radius: var(--radius);
  background: var(--c-surface);
  overflow: hidden;
}

.list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: 56px;
  padding: var(--sp-3) var(--sp-4);
}

.list > li + li {
  border-top: var(--border);
}

.list-item > svg {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--c-muted);
}

.list-item__body {
  flex: 1;
  min-width: 0;
}

.list-item__title {
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item__meta {
  color: var(--c-muted);
  font-size: var(--fs-sm);
}

.list-item--link {
  width: 100%;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.amount {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  white-space: nowrap;
}

.amount--plus {
  color: var(--c-plus);
}

.amount--minus {
  color: var(--c-minus);
}

.empty {
  padding: var(--sp-6) var(--sp-4);
  color: var(--c-muted);
  text-align: center;
}

.empty svg {
  width: 56px;
  height: 56px;
  margin: 0 auto var(--sp-3);
  opacity: 0.6;
}

/* --- chips, segmented control ------------------------------------------------------------------ */

.chips {
  display: flex;
  gap: var(--sp-2);
  overflow-x: auto;
  padding-bottom: var(--sp-1);
  scrollbar-width: none;
}

.chip {
  flex: none;
  min-height: 36px;
  padding: 0 var(--sp-4);
  border: var(--border);
  border-radius: 18px;
  background: transparent;
  color: var(--c-muted);
  cursor: pointer;
}

.chip[aria-pressed="true"] {
  border-color: var(--c-text);
  background: var(--c-text);
  color: var(--c-bg);
}

/* --- balance and progress ---------------------------------------------------------------------- */

.balance-card {
  position: relative;
  overflow: hidden;
  padding: var(--sp-5);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 100% 0%, rgb(215 38 61 / 35%), transparent 55%),
    linear-gradient(160deg, var(--c-surface-2), var(--c-surface));
  border: var(--border);
}

.balance-card__value {
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  line-height: 1;
  letter-spacing: 0.02em;
}

.balance-card__unit {
  margin-left: var(--sp-2);
  color: var(--c-muted);
  font-size: var(--fs-md);
  font-family: var(--font-body);
  letter-spacing: normal;
  text-transform: none;
}

.balance-card__pulse {
  animation: balance-pulse 700ms var(--ease-out);
}

@keyframes balance-pulse {
  30% {
    transform: scale(1.08);
    color: var(--c-plus);
  }
}

.expiry {
  display: inline-flex;
  gap: var(--sp-2);
  align-items: center;
  margin-top: var(--sp-3);
  padding: var(--sp-1) var(--sp-3);
  border-radius: 999px;
  background: rgb(242 177 52 / 12%);
  color: var(--c-warn);
  font-size: var(--fs-sm);
}

.progress {
  --p: 0;
  height: 8px;
  border-radius: 4px;
  background: var(--c-surface-3);
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  border-radius: inherit;
  background: var(--rarity, var(--c-accent));
  transform-origin: left;
  transform: scaleX(var(--p));
  transition: transform 600ms var(--ease-out);
}

/* --- client card QR ---------------------------------------------------------------------------- */

.qr-tile {
  display: flex;
  gap: var(--sp-4);
  align-items: center;
}

.qr-tile__code {
  width: 96px;
  flex: none;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: var(--c-qr-bg);
}

/* --- achievements ------------------------------------------------------------------------------ */

.r-common {
  --rarity: var(--rarity-common);
}

.r-rare {
  --rarity: var(--rarity-rare);
}

.r-epic {
  --rarity: var(--rarity-epic);
}

.r-legendary {
  --rarity: var(--rarity-legendary);
}

.badge {
  display: inline-block;
  padding: 2px var(--sp-2);
  border: 1px solid var(--rarity, var(--c-line));
  border-radius: 6px;
  color: var(--rarity, var(--c-muted));
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.ach-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--sp-3);
}

.ach-card {
  display: grid;
  gap: var(--sp-2);
  align-content: start;
  padding: var(--sp-3);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  background: var(--c-surface);
  text-align: left;
  cursor: pointer;
}

.ach-card--unlocked {
  border-color: color-mix(in srgb, var(--rarity) 55%, transparent);
  box-shadow: inset 0 0 24px color-mix(in srgb, var(--rarity) 12%, transparent);
}

.ach-icon {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  color: var(--rarity, var(--c-muted));
}

.ach-icon img {
  width: 100%;
  height: 100%;
}

.ach-card--locked .ach-icon img {
  filter: grayscale(1);
  opacity: 0.35;
}

.ach-card--unlocked .ach-icon {
  box-shadow: 0 0 18px color-mix(in srgb, var(--rarity) 45%, transparent);
}

.ach-card__title {
  font-family: var(--font-display);
  letter-spacing: 0.03em;
  line-height: 1.2;
}

.ach-card--locked .ach-card__title {
  color: var(--c-muted);
}

.ach-card__share {
  color: var(--c-faint);
  font-size: var(--fs-xs);
}

.ach-detail {
  display: grid;
  justify-items: center;
  gap: var(--sp-3);
  text-align: center;
}

.ach-detail > .stack {
  width: 100%;
}

.ach-detail .ach-icon {
  width: 120px;
  height: 120px;
}

/* --- coupons ----------------------------------------------------------------------------------- */

.coupon {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-4) var(--sp-4) var(--sp-4) var(--sp-5);
  border: 1px dashed var(--c-gold);
  border-radius: var(--radius);
  background: linear-gradient(120deg, rgb(232 176 74 / 10%), transparent 60%), var(--c-surface);
  text-align: left;
  cursor: pointer;
}

.coupon::before,
.coupon::after {
  content: "";
  position: absolute;
  left: -9px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--c-bg);
  border-right: 1px dashed var(--c-gold);
}

.coupon::before {
  top: calc(50% - 9px);
}

.coupon::after {
  display: none;
}

.coupon--archived {
  border-color: var(--c-line);
  opacity: 0.6;
}

.coupon__code {
  white-space: nowrap;
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  color: var(--c-gold);
}

.coupon__qr {
  width: 64px;
  padding: 4px;
  border-radius: 6px;
  background: var(--c-qr-bg);
}

/* Full-screen QR: maximum contrast, the counter scanner reads it from any distance. */
.qr-full {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  align-content: center;
  gap: var(--sp-4);
  padding: var(--sp-5);
  background: var(--c-qr-bg);
  color: #000;
  text-align: center;
  animation: fade-in var(--t-fast) ease-out;
}

.qr-full svg {
  width: min(86vw, 420px);
  height: auto;
}

.qr-full__code {
  font-family: var(--font-mono);
  font-size: var(--fs-xl);
  letter-spacing: 0.15em;
}

.qr-full__title {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  text-transform: uppercase;
  letter-spacing: var(--tracking-display);
}

.qr-full__close {
  position: absolute;
  top: calc(var(--sp-4) + var(--safe-top));
  right: var(--sp-4);
  background: #eee;
  color: #000;
}

/* --- bottom navigation ------------------------------------------------------------------------- */

.nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(100%, var(--app-max));
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  border-top: var(--border);
  background: rgb(15 13 12 / 92%);
  backdrop-filter: blur(12px);
  transform: translateX(-50%);
}

.nav__item {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 2px;
  color: var(--c-faint);
  font-size: 11px;
  text-decoration: none;
}

.nav__item svg {
  width: 24px;
  height: 24px;
}

.nav__item[aria-current="page"] {
  color: var(--c-text);
}

.nav__item[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 0;
  width: 28px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--c-accent);
}

.nav__dot {
  position: absolute;
  top: 8px;
  left: calc(50% + 8px);
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--c-accent);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
}

/* --- banners, toasts, sheets ------------------------------------------------------------------- */

.banner {
  display: flex;
  gap: var(--sp-3);
  align-items: center;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  background: var(--c-surface-2);
  font-size: var(--fs-sm);
}

.banner > svg {
  width: 20px;
  height: 20px;
  flex: none;
}

.banner--offline {
  position: sticky;
  top: 0;
  z-index: 15;
  border-radius: 0;
  background: #3b2a12;
  color: var(--c-warn);
  justify-content: center;
}

.toasts {
  position: fixed;
  top: calc(var(--sp-3) + var(--safe-top));
  left: 50%;
  z-index: 60;
  display: grid;
  gap: var(--sp-2);
  width: min(calc(100% - 2 * var(--sp-4)), calc(var(--app-max) - 2 * var(--sp-4)));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: var(--sp-3) var(--sp-4);
  border: var(--border);
  border-radius: var(--radius);
  background: var(--c-surface-2);
  box-shadow: var(--shadow);
  animation: toast-in var(--t-med) var(--ease-spring);
}

.toast--plus {
  border-color: color-mix(in srgb, var(--c-plus) 60%, transparent);
}

.toast--error {
  border-color: var(--c-minus);
}

.toast--leaving {
  animation: toast-out var(--t-med) ease-in forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.96);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-12px);
  }
}

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
  justify-items: center;
  background: var(--c-scrim);
  animation: fade-in var(--t-fast) ease-out;
}

.sheet {
  width: min(100%, var(--app-max));
  max-height: 88dvh;
  overflow-y: auto;
  padding: var(--sp-5) var(--sp-4) calc(var(--sp-5) + var(--safe-bottom));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--c-surface);
  animation: sheet-in var(--t-med) var(--ease-out);
}

@keyframes sheet-in {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* --- brand line on the home screen ------------------------------------------------------------ */

.brand {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  color: var(--c-gold);
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.brand img {
  width: 32px;
  height: 32px;
  flex: none;
}

.greeting {
  overflow-wrap: anywhere;
}

/* --- auth -------------------------------------------------------------------------------------- */

.auth {
  display: grid;
  gap: var(--sp-5);
  padding-top: var(--sp-6);
}

.auth__logo {
  width: 88px;
  height: 88px;
  margin: 0 auto;
}

.auth__title {
  text-align: center;
}

.link-row {
  display: flex;
  justify-content: center;
  gap: var(--sp-4);
  font-size: var(--fs-sm);
}

/* --- profile ----------------------------------------------------------------------------------- */

.avatar {
  width: 72px;
  height: 72px;
  flex: none;
  border-radius: 50%;
  background: var(--c-surface-3);
  object-fit: cover;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: var(--fs-xl);
  color: var(--c-muted);
}

.policy {
  font-size: var(--fs-sm);
  color: var(--c-muted);
}

.policy h1,
.policy h2,
.policy h3 {
  color: var(--c-text);
  margin: var(--sp-4) 0 var(--sp-2);
}

.policy p,
.policy ul {
  margin: 0 0 var(--sp-3);
}

.spinner {
  width: 28px;
  height: 28px;
  margin: var(--sp-6) auto;
  border: 3px solid var(--c-surface-3);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- notification center ----------------------------------------------------------------------- */

.bell {
  position: relative;
  flex: none;
}

.bell .nav__dot {
  top: -2px;
  left: auto;
  right: -2px;
}

.notice {
  align-items: flex-start;
  text-align: left;
}

.notice__icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  background: var(--c-surface-2);
  color: var(--c-muted);
}

.notice__icon svg {
  width: 20px;
  height: 20px;
}

.notice--unread .notice__icon {
  background: var(--c-accent);
  color: var(--c-accent-ink);
}

.notice--highlight {
  background: var(--c-surface-2);
}

.notice__text {
  margin: 0;
  color: var(--c-muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.notice__image {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}
