:root {
  --paper: #f7f7f8;
  --white: #ffffff;
  --ink: #111111;
  --muted: #6d6d72;
  --line: #d7d7da;
  --blue: #002fa7;
  --blue-soft: #e9efff;
  --danger: #c60025;
  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--paper); font-family: var(--font); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.masthead, .admin-header {
  min-height: 72px; padding: 0 max(24px, calc((100vw - 1240px) / 2)); display: flex; align-items: center;
  justify-content: space-between; border-bottom: 1px solid var(--ink); background: var(--white);
}
.brand { font-weight: 800; font-size: 18px; text-decoration: none; letter-spacing: -.02em; }
.region, .admin-header span { color: var(--muted); font-size: 13px; }
.public-shell { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: .85fr 1.15fr; min-height: calc(100vh - 130px); }
.hero { padding: 11vh 7vw 60px 0; border-right: 1px solid var(--ink); }
.eyebrow { margin: 0 0 24px; color: var(--blue); text-transform: uppercase; letter-spacing: .13em; font-size: 12px; font-weight: 800; }
.hero h1, .admin-title h1 { margin: 0; font-size: clamp(52px, 7vw, 108px); line-height: .9; letter-spacing: -.075em; }
.hero-copy { max-width: 420px; margin: 48px 0 0; color: var(--muted); font-size: 17px; line-height: 1.65; }
.redeem-panel { padding: 7vh 0 60px 7vw; }
.steps { margin: 0 0 80px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); list-style: none; border-top: 1px solid var(--line); }
.steps li { padding: 14px 8px 0 0; color: var(--muted); font-size: 13px; border-top: 3px solid transparent; margin-top: -2px; }
.steps li span { display: block; font-size: 30px; font-weight: 700; color: var(--line); margin-bottom: 8px; }
.steps li.is-active { color: var(--ink); border-top-color: var(--blue); }
.steps li.is-active span { color: var(--blue); }
.view { display: none; }
.view.is-visible { display: block; }
.view h2 { margin: 0 0 32px; font-size: 34px; letter-spacing: -.04em; }
label { display: grid; gap: 9px; font-size: 13px; font-weight: 700; }
.input-row { display: grid; grid-template-columns: 1fr auto; border: 1px solid var(--ink); background: var(--white); }
input, textarea { min-width: 0; border: 1px solid var(--line); background: var(--white); color: var(--ink); border-radius: 0; outline: none; }
input:focus, textarea:focus { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.input-row input { height: 62px; padding: 0 18px; border: 0; font-size: 17px; text-transform: uppercase; }
button { min-height: 46px; padding: 0 22px; border: 1px solid var(--blue); background: var(--blue); color: var(--white); font-weight: 750; border-radius: 0; }
button:hover { filter: brightness(.92); }
.secondary { color: var(--blue); background: var(--white); }
.text-button { padding: 0; border: 0; background: transparent; color: var(--ink); text-decoration: underline; min-height: auto; }
.form-error { min-height: 22px; color: var(--danger); font-size: 13px; }
.session-heading { display: flex; justify-content: space-between; align-items: end; gap: 28px; border-bottom: 1px solid var(--ink); padding-bottom: 24px; }
.label { margin: 0 0 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; }
.phone-number { padding: 0; min-height: 0; border: 0; color: var(--ink); background: transparent; font-size: clamp(30px, 5vw, 58px); letter-spacing: -.045em; }
.countdown { text-align: right; }
.countdown span { display: block; color: var(--blue); font-size: 30px; font-variant-numeric: tabular-nums; }
.countdown small { color: var(--muted); }
.status-line { display: flex; align-items: center; gap: 10px; padding: 20px 0; color: var(--muted); font-size: 14px; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--blue); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.72); } }
.message-empty { min-height: 230px; padding: 34px; display: grid; place-content: center; text-align: center; background: var(--blue-soft); border: 1px solid var(--blue); }
.empty-index { color: var(--blue); font-size: 68px; font-weight: 800; line-height: 1; }
.message-empty p { margin: 18px 0 4px; font-weight: 700; }
.message-empty small { color: var(--muted); }
.message-list { display: grid; gap: 12px; }
.message { padding: 18px; background: var(--white); border: 1px solid var(--ink); }
.message-code { color: var(--blue); font-size: 42px; font-weight: 800; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.message-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; margin-top: 10px; }
.message-content { margin: 12px 0 0; line-height: 1.55; overflow-wrap: anywhere; }
.session-actions { display: flex; gap: 10px; align-items: center; margin-top: 22px; flex-wrap: wrap; }
footer { max-width: 1240px; margin: 0 auto; padding: 20px 0; border-top: 1px solid var(--ink); display: flex; justify-content: space-between; font-size: 12px; }
.toast { position: fixed; right: 20px; bottom: 20px; max-width: min(380px, calc(100vw - 40px)); padding: 14px 18px; background: var(--ink); color: var(--white); transform: translateY(120px); transition: transform .2s; z-index: 20; }
.toast.is-visible { transform: translateY(0); }

.admin-login-page { display: grid; place-items: center; }
.login-shell { width: min(900px, calc(100% - 32px)); display: grid; grid-template-columns: 240px 1fr; border: 1px solid var(--ink); background: var(--white); }
.login-index { display: grid; place-items: center; color: var(--white); background: var(--blue); font-size: 160px; font-weight: 800; }
.login-card { padding: 70px; }
.login-card h1 { font-size: 52px; margin: 0 0 42px; letter-spacing: -.06em; }
.login-card form { display: grid; gap: 18px; }
.login-card input { height: 52px; padding: 0 14px; }
.login-card > a { display: inline-block; margin-top: 28px; color: var(--muted); font-size: 13px; }

.admin-header div, .admin-header nav { display: flex; align-items: center; gap: 18px; }
.admin-header a { font-size: 13px; }
.admin-shell { max-width: 1240px; margin: 0 auto; padding: 56px 0 90px; }
.admin-title { margin-bottom: 48px; }
.admin-title h1 { font-size: clamp(48px, 7vw, 90px); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--ink); margin-bottom: 24px; }
.stats-grid article { padding: 24px; border-right: 1px solid var(--ink); background: var(--white); }
.stats-grid article:last-child { border-right: 0; }
.stats-grid span { color: var(--blue); font-size: 12px; }
.stats-grid strong { display: block; margin: 22px 0 8px; font-size: 44px; font-variant-numeric: tabular-nums; }
.stats-grid small { color: var(--muted); }
.admin-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 24px; margin-bottom: 24px; }
.admin-card, .table-card { padding: 26px; border: 1px solid var(--ink); background: var(--white); }
.card-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 22px; }
.card-heading h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.card-heading span { color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid input { width: 100%; height: 46px; padding: 0 12px; font-weight: 400; }
.result-box { width: 100%; height: 180px; margin: 18px 0 10px; padding: 14px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; line-height: 1.5; }
.result-box.compact { height: 110px; white-space: pre-wrap; overflow: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 14px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.status { display: inline-block; padding: 5px 8px; border: 1px solid currentColor; }
.status-available { color: var(--blue); }
.status-in_use { color: #7a5100; }
.status-retired, .status-expired { color: var(--muted); }
.empty-cell { text-align: center; color: var(--muted); padding: 40px; }

@media (max-width: 900px) {
  .masthead, .admin-header { padding-inline: 20px; }
  .public-shell { display: block; padding: 0 20px; }
  .hero { min-height: auto; padding: 70px 0 55px; border-right: 0; border-bottom: 1px solid var(--ink); }
  .hero h1 { font-size: clamp(54px, 16vw, 82px); }
  .hero-copy { margin-top: 30px; }
  .redeem-panel { padding: 44px 0 70px; }
  .steps { margin-bottom: 52px; }
  footer { margin-inline: 20px; }
  .admin-shell { padding: 34px 16px 70px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid article:nth-child(2) { border-right: 0; }
  .stats-grid article:nth-child(-n+2) { border-bottom: 1px solid var(--ink); }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .masthead { min-height: 60px; }
  .hero { padding-top: 48px; }
  .hero h1 { font-size: 52px; }
  .steps li { font-size: 11px; }
  .steps li span { font-size: 22px; }
  .input-row { grid-template-columns: 1fr; }
  .input-row button { width: 100%; }
  .session-heading { align-items: start; flex-direction: column; }
  .countdown { text-align: left; }
  .phone-number { font-size: 34px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-index { display: none; }
  .login-card { padding: 40px 24px; }
  .admin-header span { display: none; }
  .stats-grid strong { font-size: 34px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label.full { grid-column: auto; }
}

