:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f6f5;
  color: #17201c;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: #f4f6f5;
}

button,
a {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(18, 111, 73, 0.25);
  outline-offset: 2px;
}

.topbar {
  border-bottom: 1px solid #dce2de;
  background: #ffffff;
}

.topbar__inner,
main {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar__inner {
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand__mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #17201c;
  color: #ffffff;
  font-size: 20px;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.25;
  letter-spacing: 0;
}

.brand p {
  margin-top: 4px;
  color: #68746e;
  font-size: 13px;
  line-height: 1.35;
}

.refresh {
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border: 1px solid #cbd4cf;
  border-radius: 6px;
  background: #ffffff;
  color: #17201c;
  cursor: pointer;
  font-weight: 700;
}

.refresh:hover {
  border-color: #8d9a93;
  background: #f8faf9;
}

.refresh:disabled {
  cursor: wait;
  opacity: 0.65;
}

.refresh.is-loading .refresh__icon {
  animation: spin 0.8s linear infinite;
}

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

main {
  padding: 30px 0 56px;
}

.summary {
  min-height: 72px;
  display: grid;
  grid-template-columns: 180px 180px 1fr;
  align-items: center;
  gap: 18px;
  padding-bottom: 26px;
  border-bottom: 1px solid #dce2de;
}

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

.summary__label {
  color: #68746e;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.summary__item strong {
  font-size: 28px;
  line-height: 1;
}

.summary__state {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #53605a;
  font-size: 13px;
  font-weight: 650;
}

.json-link {
  justify-self: end;
  color: #126f49;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.json-link:hover {
  text-decoration: underline;
}

.state-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #d39420;
  box-shadow: 0 0 0 4px rgba(211, 148, 32, 0.12);
}

.summary__state.is-ok .state-dot {
  background: #168454;
  box-shadow: 0 0 0 4px rgba(22, 132, 84, 0.12);
}

.summary__state.is-error .state-dot {
  background: #c6473b;
  box-shadow: 0 0 0 4px rgba(198, 71, 59, 0.12);
}

.promo-section {
  padding-top: 34px;
}

.promo-section--upcoming {
  margin-top: 40px;
  border-top: 1px solid #dce2de;
}

.section-heading {
  margin-bottom: 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
}

.section-heading__eyebrow {
  display: block;
  margin-bottom: 5px;
  color: #168454;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.section-heading__eyebrow--upcoming {
  color: #a7650e;
}

h2 {
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: 0;
}

.section-note {
  max-width: 680px;
  margin-top: 7px;
  color: #68746e;
  font-size: 13px;
  line-height: 1.45;
}

.promo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.promo-card {
  min-width: 0;
  min-height: 224px;
  display: flex;
  flex-direction: column;
  padding: 20px;
  border: 1px solid #d8dfdb;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(23, 32, 28, 0.04);
}

.promo-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.promo-card__status {
  color: #168454;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.copy-button {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border: 1px solid #d5ddd8;
  border-radius: 6px;
  background: #ffffff;
  color: #33413a;
  cursor: pointer;
  font-size: 19px;
}

.copy-button:hover {
  background: #f1f5f3;
}

.promo-card__code {
  max-width: 100%;
  margin-top: 8px;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
}

.promo-card__gift {
  margin-top: 14px;
  color: #27332d;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

.promo-card__meta {
  margin-top: 8px;
  color: #68746e;
  font-size: 13px;
  line-height: 1.45;
}

.promo-card__footer {
  min-height: 32px;
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}

.promo-card__expires {
  color: #53605a;
  font-size: 12px;
  font-weight: 650;
}

.verify-link {
  color: #126f49;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.verify-link:hover {
  text-decoration: underline;
}

.upcoming-list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid #d8dfdb;
  border-radius: 8px;
  background: #d8dfdb;
}

.upcoming-item {
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(220px, 1.4fr) minmax(160px, 0.9fr) 36px;
  align-items: center;
  gap: 18px;
  padding: 14px 18px;
  background: #ffffff;
}

.upcoming-item__code {
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-weight: 800;
  letter-spacing: 0;
}

.upcoming-item__name {
  font-weight: 700;
}

.upcoming-item__date {
  color: #a7650e;
  font-size: 13px;
  font-weight: 750;
}

.empty,
.error {
  padding: 22px;
  border: 1px dashed #c7d0ca;
  border-radius: 8px;
  color: #68746e;
  background: rgba(255, 255, 255, 0.5);
  text-align: center;
}

.error {
  margin-top: 24px;
  border-color: #e2b7b2;
  color: #8e2f27;
  background: #fff7f6;
}

.skeleton {
  min-height: 224px;
  border: 1px solid #e1e6e3;
  border-radius: 8px;
  background: linear-gradient(90deg, #ffffff 0%, #f1f4f2 50%, #ffffff 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}

@keyframes shimmer {
  to { background-position: -200% 0; }
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: min(360px, calc(100% - 40px));
  padding: 11px 14px;
  border-radius: 6px;
  background: #17201c;
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 760px) {
  .topbar__inner,
  main {
    width: min(100% - 28px, 1120px);
  }

  .topbar__inner {
    min-height: 80px;
  }

  .brand__mark {
    display: none;
  }

  .refresh {
    width: 42px;
    flex: 0 0 42px;
    padding: 0;
  }

  .refresh span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .summary {
    grid-template-columns: 1fr 1fr;
  }

  .summary__state {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .json-link {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .promo-grid {
    grid-template-columns: 1fr;
  }

  .upcoming-item {
    grid-template-columns: 1fr 36px;
    gap: 5px 12px;
  }

  .upcoming-item__name,
  .upcoming-item__date {
    grid-column: 1;
  }

  .upcoming-item .copy-button {
    grid-column: 2;
    grid-row: 1 / span 3;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
