:root {
  --navy: #10233f;
  --blue: #0f5f9e;
  --blue-dark: #0a4778;
  --gold: #d99b2b;
  --ink: #182235;
  --muted: #64748b;
  --line: #d9e2ef;
  --soft: #f4f8fc;
  --panel: rgba(255, 255, 255, .9);
  --shadow: 0 24px 60px rgba(16, 35, 63, .12);
}

* { box-sizing: border-box; }

.staff-only { display: none; }
body.staff-mode section.hero.staff-only,
body.staff-mode section.grid.staff-only { display: grid; }
body.staff-mode nav .staff-only { display: inline-flex; }
body.staff-mode #public-purchase { display: none; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(15, 95, 158, .14), transparent 34rem),
    radial-gradient(circle at 90% 10%, rgba(217, 155, 43, .18), transparent 30rem),
    linear-gradient(180deg, #f8fbff 0%, #eef5fb 100%);
  min-height: 100vh;
}

button, input, textarea, select { font: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 46px);
  border-bottom: 1px solid rgba(217, 226, 239, .8);
  background: rgba(255, 255, 255, .84);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--navy);
}

.brand img {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 1.05rem; }
.brand small { color: var(--muted); font-weight: 700; }

nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

nav a, .ghost, .primary, .secondary {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

nav a, .ghost, .secondary {
  color: var(--blue);
  background: #eef6fd;
}

.primary {
  color: white;
  background: var(--blue);
  box-shadow: 0 12px 24px rgba(15, 95, 158, .22);
}

.primary:disabled, .secondary:disabled {
  opacity: .55;
  cursor: not-allowed;
}

main {
  width: min(1380px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 56px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-size: .76rem;
}

h1, h2 { margin: 0; color: var(--navy); letter-spacing: -.04em; }
h1 { font-size: clamp(2.2rem, 5vw, 4.8rem); line-height: .96; max-width: 980px; }
h2 { font-size: 1.45rem; }

.lead {
  max-width: 760px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.hero-card, .panel {
  border: 1px solid rgba(217, 226, 239, .9);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 24px;
  display: grid;
  gap: 4px;
}

.metric {
  color: var(--navy);
  font-size: 2.4rem;
  font-weight: 900;
}

.hero-card small {
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.purchase-panel {
  margin-top: 24px;
  max-width: 860px;
}

.recipient-panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  background: #f8fbff;
}

.recipient-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.recipient-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

.recipient-row strong {
  color: var(--navy);
  font-weight: 900;
  padding-bottom: 13px;
}

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

.preset-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  background: #fff;
  color: var(--navy);
  cursor: pointer;
  text-align: left;
}

.preset-card strong,
.preset-card span {
  display: block;
}

.preset-card strong {
  font-size: 2rem;
  font-weight: 900;
}

.preset-card span {
  color: var(--muted);
  font-weight: 800;
}

.preset-card.active {
  border-color: var(--blue);
  background: #eef7ff;
  box-shadow: 0 0 0 4px rgba(15, 95, 158, .1);
}

.grid {
  display: grid;
  grid-template-columns: minmax(320px, .78fr) minmax(420px, 1.22fr);
  gap: 22px;
  margin-top: 22px;
}

.panel {
  padding: 24px;
  min-width: 0;
}

.panel-heading {
  margin-bottom: 18px;
}

.row-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--navy);
  font-size: .88rem;
  font-weight: 900;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 13px;
  color: var(--ink);
  background: white;
  outline: none;
}

textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(15, 95, 158, .1); }

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

canvas {
  width: 100%;
  max-width: 760px;
  border-radius: 22px;
  background: white;
  box-shadow: inset 0 0 0 1px var(--line);
}

.preview-panel {
  display: grid;
  justify-items: center;
}

.preview-panel .panel-heading {
  justify-self: stretch;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.hint, .status-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.status-note.good { color: #047857; }
.status-note.bad { color: #b42318; }

.search {
  max-width: 310px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: white;
}

table {
  width: 100%;
  min-width: 740px;
  border-collapse: collapse;
}

th, td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  background: #f8fafc;
}

td { font-size: .92rem; }
tbody tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); text-align: center; padding: 32px; }

.code {
  font-weight: 900;
  color: var(--navy);
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: .75rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.pill.active { color: #075985; background: #e0f2fe; }
.pill.redeemed { color: #047857; background: #d1fae5; }
.pill.expired { color: #92400e; background: #fef3c7; }

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

.mini {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: var(--blue);
  padding: 7px 10px;
  font-weight: 900;
  cursor: pointer;
}

@media (max-width: 920px) {
  .topbar, .hero, .grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; }
  .two, .preset-grid, .recipient-row { grid-template-columns: 1fr; }
  .recipient-row strong { padding-bottom: 0; }
}
