:root {
  color-scheme: dark;
  --ink: #0a0a0a;
  --panel: #121212;
  --panel-raised: #191919;
  --line: rgba(255, 255, 255, 0.1);
  --muted: #aaa69d;
  --cream: #f4f0e7;
  --gold: #c9a96e;
  --gold-bright: #e0c78f;
  --gold-wash: rgba(201, 169, 110, 0.14);
  --green: #7ed7a7;
  --red: #ff918d;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  --serif: Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--ink);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 85% -10%, rgba(201, 169, 110, 0.16), transparent 32rem),
    var(--ink);
  color: var(--cream);
  font-family: var(--sans);
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid var(--gold-bright);
  outline-offset: 3px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--cream);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2.35rem;
  height: 2.35rem;
  place-items: center;
  border: 1px solid rgba(201, 169, 110, 0.55);
  border-radius: 50%;
  color: var(--gold);
  font-family: var(--serif);
  font-size: 1.2rem;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-text strong {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.brand-text small {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--gold);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.12;
}

.muted {
  color: var(--muted);
}

.button {
  display: inline-flex;
  min-height: 2.8rem;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.72rem 1rem;
  border: 1px solid transparent;
  border-radius: 0.55rem;
  background: var(--gold);
  color: #111;
  font-weight: 750;
  text-decoration: none;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease;
}

.button:hover {
  background: var(--gold-bright);
  transform: translateY(-1px);
}

.button.secondary {
  border-color: var(--line);
  background: transparent;
  color: var(--cream);
}

.button.secondary:hover {
  border-color: rgba(201, 169, 110, 0.6);
  background: var(--gold-wash);
}

.button.quiet {
  min-height: auto;
  padding: 0.4rem 0.55rem;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

.button.quiet:hover {
  color: var(--cream);
}

.button.danger {
  background: transparent;
  border-color: rgba(255, 145, 141, 0.35);
  color: var(--red);
}

.field {
  display: grid;
  gap: 0.4rem;
}

.field label,
.field-label {
  color: #d7d2c8;
  font-size: 0.78rem;
  font-weight: 650;
}

input,
select {
  width: 100%;
  min-height: 2.8rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #0d0d0d;
  color: var(--cream);
  padding: 0.7rem 0.8rem;
}

input::placeholder {
  color: #74716b;
}

input:focus,
select:focus {
  border-color: var(--gold);
}

.empty-panel,
.error-panel {
  display: grid;
  min-height: 18rem;
  place-items: center;
  padding: 2rem;
  border: 1px dashed var(--line);
  border-radius: 1rem;
  color: var(--muted);
  text-align: center;
}

.error-panel strong {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--cream);
  font-family: var(--serif);
  font-size: 1.4rem;
}

.toast-region {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 100;
  display: grid;
  width: min(24rem, calc(100vw - 2rem));
  gap: 0.55rem;
}

.toast {
  padding: 0.9rem 1rem;
  border: 1px solid rgba(126, 215, 167, 0.35);
  border-radius: 0.65rem;
  background: #142019;
  box-shadow: var(--shadow);
  color: #d9f4e5;
  font-size: 0.88rem;
}

.toast.error {
  border-color: rgba(255, 145, 141, 0.4);
  background: #271414;
  color: #ffd6d4;
}

/* Staff */
.staff-shell {
  min-height: 100vh;
}

.staff-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 4.7rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem clamp(1rem, 3vw, 2.2rem);
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(18px);
}

.staff-identity {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  text-align: right;
}

.staff-identity strong,
.staff-identity span {
  display: block;
}

.staff-identity span {
  color: var(--muted);
  font-size: 0.72rem;
}

.staff-layout {
  display: grid;
  min-height: calc(100vh - 4.7rem);
  grid-template-columns: minmax(18rem, 23rem) minmax(0, 1fr);
}

.customer-sidebar {
  padding: 1.2rem;
  border-right: 1px solid var(--line);
  background: rgba(18, 18, 18, 0.72);
}

.sidebar-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
}

.customer-list {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
}

.customer-row {
  width: 100%;
  padding: 0.85rem;
  border: 1px solid transparent;
  border-radius: 0.7rem;
  background: transparent;
  color: var(--cream);
  text-align: left;
}

.customer-row:hover,
.customer-row.active {
  border-color: rgba(201, 169, 110, 0.3);
  background: var(--gold-wash);
}

.customer-row-top,
.customer-row-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.customer-row-top strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-row-meta {
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.reward-dot {
  flex: 0 0 auto;
  padding: 0.16rem 0.44rem;
  border-radius: 99px;
  background: var(--gold);
  color: #111;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
}

.customer-workspace {
  width: 100%;
  max-width: 82rem;
  padding: clamp(1.1rem, 3vw, 2.2rem);
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.detail-header h1 {
  margin-bottom: 0.35rem;
  font-size: clamp(2rem, 4vw, 3rem);
}

.member-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
}

.metrics {
  display: grid;
  grid-template-columns: minmax(16rem, 1.5fr) repeat(2, minmax(9rem, 0.75fr));
  gap: 0.8rem;
}

.metric-card,
.workspace-card {
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: rgba(18, 18, 18, 0.85);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.02) inset;
}

.metric-card {
  min-height: 8.5rem;
  padding: 1rem;
}

.metric-label {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-value {
  display: block;
  margin-top: 0.4rem;
  color: var(--cream);
  font-family: var(--serif);
  font-size: 2rem;
}

.stamp-row {
  display: flex;
  gap: 0.55rem;
  margin-top: 1rem;
}

.stamp {
  display: grid;
  width: 2.45rem;
  height: 2.45rem;
  place-items: center;
  border: 1px dashed #5e5a53;
  border-radius: 50%;
  color: #5e5a53;
  font-family: var(--serif);
  font-size: 0.8rem;
}

.stamp.filled {
  border-style: solid;
  border-color: var(--gold);
  background: var(--gold-wash);
  color: var(--gold-bright);
}

.workspace-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 0.8rem;
}

.workspace-card {
  padding: 1.15rem;
}

.workspace-card.full {
  grid-column: 1 / -1;
}

.workspace-card h2 {
  margin-bottom: 0.35rem;
  font-size: 1.35rem;
}

.workspace-card .intro {
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.transaction-form {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(8rem, 0.7fr) auto;
  align-items: end;
  gap: 0.7rem;
}

.reward-card {
  border-color: rgba(201, 169, 110, 0.35);
  background:
    linear-gradient(135deg, rgba(201, 169, 110, 0.14), transparent 54%),
    rgba(18, 18, 18, 0.9);
}

.reward-card.no-reward {
  border-color: var(--line);
  background: rgba(18, 18, 18, 0.85);
}

.workspace-card .reward-progress-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.45rem;
}

.next-reward-highlight {
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
}

.reward-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.85rem 0;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.reward-total strong {
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 1.5rem;
}

.history-list {
  display: grid;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.history-row:last-child {
  border-bottom: 0;
}

.history-row strong,
.history-row span {
  display: block;
}

.history-row .date,
.history-row .discount-note {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.history-row .discount-note {
  color: var(--green);
}

.empty-inline {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

dialog {
  width: min(31rem, calc(100vw - 2rem));
  border: 1px solid rgba(201, 169, 110, 0.35);
  border-radius: 1rem;
  background: var(--panel-raised);
  box-shadow: var(--shadow);
  color: var(--cream);
  padding: 0;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(4px);
}

.dialog-body {
  padding: 1.35rem;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dialog-header h2 {
  margin-bottom: 0.3rem;
}

.dialog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 1.1rem;
}

.qr-wrap {
  display: grid;
  place-items: center;
  margin: 1rem auto;
  padding: 1rem;
  border-radius: 0.8rem;
  background: white;
  width: min(18rem, 100%);
  aspect-ratio: 1;
}

.qr-wrap svg {
  display: block;
  width: 100%;
  height: 100%;
}

.claim-link {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.72rem;
}

/* Customer card */
.card-page {
  display: grid;
  min-height: 100vh;
  grid-template-rows: auto 1fr auto;
}

.card-header,
.card-footer {
  display: flex;
  width: min(46rem, calc(100% - 2rem));
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0;
}

.card-footer {
  justify-content: center;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.card-main {
  width: min(46rem, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1rem, 5vw, 3rem) 0;
}

.loyalty-card {
  position: relative;
  overflow: hidden;
  padding: clamp(1.2rem, 5vw, 2.3rem);
  border: 1px solid rgba(201, 169, 110, 0.42);
  border-radius: 1.2rem;
  background:
    radial-gradient(circle at 95% 0%, rgba(224, 199, 143, 0.2), transparent 17rem),
    linear-gradient(145deg, #1a1917, #0e0e0e 68%);
  box-shadow: var(--shadow);
}

.loyalty-card::after {
  position: absolute;
  right: -3rem;
  bottom: -6rem;
  width: 15rem;
  height: 15rem;
  border: 1px solid rgba(201, 169, 110, 0.12);
  border-radius: 50%;
  content: "";
}

.card-welcome {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.card-welcome h1 {
  margin-bottom: 0.3rem;
  font-size: clamp(2.2rem, 9vw, 4rem);
}

.member-code {
  flex: 0 0 auto;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

.customer-progress {
  position: relative;
  z-index: 1;
  margin-top: clamp(2rem, 7vw, 4rem);
}

.progress-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.progress-heading h2 {
  margin-bottom: 0;
  font-size: 1.3rem;
}

.progress-heading span {
  color: var(--gold-bright);
  font-size: 0.8rem;
}

.customer-stamps {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: clamp(0.45rem, 2vw, 0.8rem);
}

.customer-stamps .stamp {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  font-size: clamp(0.72rem, 3vw, 1rem);
}

.card-rule {
  position: relative;
  z-index: 1;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.reward-banner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  margin-top: 1.3rem;
  padding: 1.05rem;
  border: 1px solid rgba(201, 169, 110, 0.44);
  border-radius: 0.75rem;
  background: rgba(201, 169, 110, 0.12);
}

.reward-banner strong,
.reward-banner span {
  display: block;
}

.reward-banner strong {
  font-family: var(--serif);
  font-size: 1.25rem;
}

.reward-banner span {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.74rem;
}

.reward-percent {
  color: var(--gold-bright);
  font-family: var(--serif);
  font-size: 2rem;
  white-space: nowrap;
}

.customer-sections {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(13rem, 0.6fr);
  gap: 0.8rem;
  margin-top: 0.8rem;
}

.customer-section {
  padding: 1.1rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: rgba(18, 18, 18, 0.8);
}

.customer-section h2 {
  margin-bottom: 0.2rem;
  font-size: 1.25rem;
}

.member-qr-image {
  display: block;
  width: min(12rem, 100%);
  margin: 1rem auto;
  padding: 0.7rem;
  border-radius: 0.7rem;
  background: white;
}

.claimed-notice {
  margin-bottom: 0.8rem;
  padding: 0.8rem;
  border: 1px solid rgba(126, 215, 167, 0.3);
  border-radius: 0.65rem;
  background: rgba(126, 215, 167, 0.1);
  color: #c8f2db;
  font-size: 0.84rem;
}

.login-help {
  max-width: 28rem;
}

.login-help h1 {
  margin-bottom: 0.8rem;
  color: var(--cream);
}

.login-help p {
  margin-bottom: 0;
}

.login-help-actions {
  display: flex;
  justify-content: center;
  margin-top: 1.35rem;
}

.login-help-actions .button {
  min-width: 12rem;
}

@media (max-width: 900px) {
  .staff-layout {
    display: block;
  }

  .customer-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .customer-list {
    grid-auto-columns: minmax(14rem, 1fr);
    grid-auto-flow: column;
    overflow-x: auto;
    padding-bottom: 0.4rem;
    scroll-snap-type: x proximity;
  }

  .customer-row {
    scroll-snap-align: start;
  }

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

  .metrics .progress-metric {
    grid-column: 1 / -1;
  }
}

@media (max-width: 680px) {
  .staff-header {
    min-height: 4.2rem;
  }

  .staff-identity div {
    display: none;
  }

  .detail-header,
  .card-welcome {
    display: block;
  }

  .detail-actions {
    justify-content: stretch;
    margin-top: 0.8rem;
  }

  .detail-actions .button {
    flex: 1;
  }

  .member-code {
    display: inline-block;
    margin-top: 0.6rem;
  }

  .workspace-grid,
  .customer-sections {
    grid-template-columns: 1fr;
  }

  .workspace-card.full {
    grid-column: auto;
  }

  .transaction-form {
    grid-template-columns: 1fr;
  }

  .transaction-form .button {
    width: 100%;
  }

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

@media (max-width: 430px) {
  .login-help-actions .button {
    width: 100%;
  }

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

  .metrics .progress-metric {
    grid-column: auto;
  }

  .stamp-row {
    justify-content: space-between;
  }

  .stamp-row .stamp {
    width: 2.2rem;
    height: 2.2rem;
  }

  .customer-workspace {
    padding-inline: 0.8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
