:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-strong: #111111;
  --line: #dce3e5;
  --text: #172026;
  --muted: #65737b;
  --yellow: #facc15;
  --yellow-strong: #eab308;
  --brand: #111111;
  --radius: 8px;
  --shadow: 0 18px 42px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(0, 1fr);
  background: #eef3f4;
}

.auth-panel {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 30px;
  padding: 42px;
  background: var(--surface);
}

.single-auth {
  grid-template-columns: minmax(320px, 520px);
  justify-content: center;
  background: #ffffff;
}

.single-auth .auth-panel {
  width: 100%;
}

.access-only {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  background: #ffffff;
}

.access-button {
  width: min(260px, 42vw);
  min-height: 58px;
  font-size: 17px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--yellow);
  color: #111111;
  font-size: 13px;
  font-weight: 900;
}

.brand-lockup strong,
.brand-lockup span {
  display: block;
}

.brand-lockup strong {
  font-size: 15px;
}

.brand-lockup span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.auth-copy {
  display: grid;
  gap: 10px;
}

.eyebrow {
  color: #8a6a00;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-copy h1 {
  max-width: 430px;
  margin: 0;
  color: var(--text);
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: 0;
}

.auth-copy p {
  max-width: 430px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: #3f4f57;
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid #c4ced2;
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
}

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid #c4ced2;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: var(--yellow);
}

.button.dark {
  border-color: var(--brand);
  background: #111111;
  color: #ffffff;
}

.button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.auth-links a {
  color: var(--brand);
  font-weight: 800;
}

.access-grid {
  display: grid;
  gap: 12px;
}

.access-card {
  display: grid;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfc;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.access-card:hover {
  border-color: var(--yellow-strong);
  box-shadow: 0 12px 28px rgba(23, 32, 38, 0.08);
  transform: translateY(-1px);
}

.access-card span {
  color: #8a6a00;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.access-card strong {
  color: var(--text);
  font-size: 18px;
}

.auth-side {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 28px;
  padding: 42px;
  background:
    radial-gradient(circle at 18% 16%, rgba(250, 204, 21, 0.2), transparent 28%),
    #111111;
  color: #f7f3e3;
}

.shield-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--yellow);
  color: #111111;
}

.auth-side h2 {
  max-width: 520px;
  margin: 24px 0 8px;
  color: var(--yellow);
  font-size: 32px;
  line-height: 1.12;
}

.auth-side p {
  max-width: 560px;
  margin: 0;
  color: #d6d0ba;
  line-height: 1.6;
}

.db-note {
  width: fit-content;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid rgba(250, 204, 21, 0.28);
  border-radius: var(--radius);
  background: rgba(250, 204, 21, 0.08);
  color: var(--yellow);
  font-size: 13px;
  font-weight: 800;
}

.error-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 16px;
  background: #182328;
  color: #eff6f7;
}

.brand-lockup.dark span {
  color: #a8b8be;
}

.nav-section {
  display: grid;
  gap: 6px;
}

.nav-label {
  padding: 0 10px 6px;
  color: #8da1a9;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.nav-link {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 9px 10px;
  border-radius: var(--radius);
  color: #d8e3e6;
  font-size: 14px;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-footer span,
.sidebar-footer strong {
  display: block;
}

.sidebar-footer span {
  color: #a8b8be;
  font-size: 12px;
}

.sidebar-footer strong {
  margin-top: 4px;
  font-size: 13px;
}

.main {
  min-width: 0;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 249, 0.94);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.content {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 26px 28px 40px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.cols-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.section-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}

.section-header h2 {
  margin: 0;
  font-size: 17px;
}

.section-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.stack {
  display: grid;
  gap: 12px;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

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

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

.list-row strong {
  font-size: 14px;
}

.list-row span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button.danger {
  border-color: #fecaca;
  color: #991b1b;
}

.button.full {
  width: 100%;
}

.stat {
  min-height: 126px;
  display: grid;
  align-content: center;
  gap: 8px;
}

.stat-value {
  font-size: 30px;
  font-weight: 900;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef3f4;
  color: #3f4f57;
  font-size: 12px;
  font-weight: 800;
}

.badge.green {
  background: #def7ec;
  color: #0f5132;
}

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

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 13px;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.table-muted {
  color: var(--muted);
  font-size: 12px;
}

.form-error,
.form-success {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 800;
}

.form-error {
  border: 1px solid #fecaca;
  background: #fee2e2;
  color: #991b1b;
}

.form-success {
  border: 1px solid #bbf7d0;
  background: #def7ec;
  color: #166534;
}

.program-summary {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfc;
}

.program-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.program-summary strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.search-box {
  width: 100%;
  min-height: 42px;
  padding: 10px 11px;
  border: 1px solid #c4ced2;
  border-radius: var(--radius);
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.search-submit {
  width: 42px;
  height: 42px;
}

.muted-copy {
  margin: 0;
  color: var(--muted);
}

.reward-ready {
  width: fit-content;
  margin-top: 7px !important;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fef3c7;
  color: #7c4a03 !important;
  font-weight: 800;
}

.restaurant-loyalty-card {
  width: min(100%, 390px);
  min-height: 480px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px;
  border: 1px solid rgba(5, 5, 5, 0.18);
  border-radius: 10px;
  background: linear-gradient(160deg, #facc15 0%, #f6c000 58%, #eab308 100%);
  color: #050505;
  box-shadow: 0 20px 42px rgba(94, 68, 0, 0.22);
}

.restaurant-card-head,
.restaurant-card-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.restaurant-card-logo {
  display: grid;
  gap: 0;
  font-size: 16px;
  font-weight: 900;
  line-height: 0.95;
  text-transform: uppercase;
}

.restaurant-card-logo span,
.restaurant-card-logo strong {
  color: #050505;
}

.restaurant-card-logo strong {
  font-size: 32px;
}

.restaurant-card-count {
  text-align: right;
}

.restaurant-loyalty-card span {
  display: block;
  color: rgba(5, 5, 5, 0.72);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.restaurant-loyalty-card strong {
  display: block;
  margin-top: 4px;
  color: #050505;
  font-size: 17px;
}

.restaurant-card-count strong,
.restaurant-card-footer strong {
  font-size: 22px;
}

.restaurant-card-footer {
  margin-top: auto;
}

.burger-stamp-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(38px, 1fr));
  gap: 10px;
  align-items: end;
}

.burger-stamp {
  min-width: 0;
  display: grid;
  place-items: center;
  gap: 2px;
  opacity: 0.55;
}

.burger-stamp.filled {
  opacity: 1;
}

.burger-bun {
  width: 34px;
  height: 15px;
  border-radius: 999px 999px 8px 8px;
  background: #050505;
}

.burger-patty {
  width: 30px;
  height: 7px;
  border-radius: 99px;
  background: #050505;
}

.burger-cup {
  width: 23px;
  height: 18px;
  display: grid !important;
  place-items: center;
  border-radius: 3px 3px 8px 8px;
  background: #050505;
  color: #facc15 !important;
  font-size: 7px !important;
  font-weight: 900 !important;
}

.admin-business-row {
  align-items: start;
}

.admin-page-narrow {
  max-width: 620px;
}

.admin-page-wide {
  max-width: 1040px;
}

.customer-detail-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.credential-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
  border: 1px solid #c5ead7;
  border-radius: var(--radius);
  background: #e9fff3;
  color: #133928;
}

.credential-panel span {
  color: #18734a;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.credential-panel h2 {
  margin: 4px 0 0;
}

.credential-panel dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
}

.credential-panel dt {
  color: #416456;
  font-size: 12px;
  font-weight: 800;
}

.credential-panel dd {
  margin: 4px 0 0;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.admin-table td:last-child,
.admin-table th:last-child {
  width: 110px;
  text-align: right;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #c4ced2;
  border-radius: var(--radius);
  background: #ffffff;
  color: #111111;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--yellow-strong);
  background: #fff8d5;
}

.icon-button.danger {
  color: #b42318;
}

.icon-button.danger:hover {
  border-color: #f5b5ae;
  background: #fff1f0;
}

.program-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.program-detail-grid section,
.rule-card,
.join-link-card {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfc;
}

.program-detail-grid span,
.rule-card span,
.join-link-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.program-detail-grid strong,
.rule-card strong,
.join-link-card strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.qr-preview {
  display: grid;
  place-items: center;
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.qr-preview img {
  width: min(280px, 80vw);
  height: auto;
}

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

.wallet-actions-under-card {
  margin-top: 16px;
}

@media (max-width: 860px) {
  .auth-page {
    grid-template-columns: 1fr;
  }

  .auth-panel,
  .auth-side {
    min-height: auto;
    padding: 28px 18px;
  }

  .auth-copy h1,
  .auth-side h2 {
    font-size: 28px;
  }

  .app-shell,
  .grid.cols-2,
  .grid.cols-3,
  .grid.cols-4,
  .split {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .credential-panel dl {
    grid-template-columns: 1fr;
  }

  .program-detail-grid {
    grid-template-columns: 1fr;
  }

  .wallet-actions {
    grid-template-columns: 1fr;
  }
}
