:root {
  color-scheme: light;
  --bg: #f5efe1;
  --panel: rgba(255, 251, 244, 0.92);
  --panel-strong: #fff9f0;
  --ink: #1f1a17;
  --muted: #6d635c;
  --accent: #0f8b8d;
  --accent-strong: #0a6f71;
  --danger: #c44536;
  --line: rgba(31, 26, 23, 0.12);
  --shadow: 0 18px 40px rgba(43, 33, 18, 0.12);
  --radius: 8px;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "Space Grotesk", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 139, 141, 0.18), transparent 34%),
    radial-gradient(circle at bottom right, rgba(196, 69, 54, 0.14), transparent 28%),
    linear-gradient(160deg, #f5efe1 0%, #e5ddcc 100%);
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

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

.page-public {
  max-width: 760px;
}

.hero {
  margin-bottom: 24px;
}

.hero.compact {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: clamp(2.2rem, 6vw, 4rem);
  line-height: 0.96;
}

h2 {
  font-size: 1.15rem;
}

.lead {
  max-width: 56ch;
  margin-top: 14px;
  color: var(--muted);
}

.refund-warning {
  margin: 16px 0 0;
  padding: 14px 16px;
  border: 2px solid #c1121f;
  border-radius: 8px;
  background: rgba(193, 18, 31, 0.1);
  color: #c1121f;
  font-size: 1.08rem;
  line-height: 1.45;
  font-weight: 800;
}

.service-notice {
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(15, 139, 141, 0.32);
  border-radius: 8px;
  background: rgba(15, 139, 141, 0.1);
  color: var(--accent-strong);
  line-height: 1.45;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
  backdrop-filter: blur(12px);
}

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

.grid-form {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

label,
label span {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(31, 26, 23, 0.15);
  background: rgba(255, 255, 255, 0.9);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: var(--accent-strong);
}

button:disabled,
button:disabled:hover {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

button[aria-busy="true"]::before {
  width: 14px;
  height: 14px;
  content: "";
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}

button.secondary {
  background: #efe6d5;
  color: var(--ink);
}

button.danger {
  background: var(--danger);
}

#cancel-activation {
  min-width: 104px;
}

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

.message {
  min-height: 1.2em;
  margin: 12px 0 0;
  color: var(--muted);
}

.hidden {
  display: none;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.admin-stats .panel {
  margin-bottom: 0;
}

.stat-panel strong {
  display: block;
  font-size: 2rem;
  line-height: 1.1;
}

.stat-subtext {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.status-grid strong,
.label {
  display: block;
}

.phone-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.phone-line strong {
  min-width: 0;
  word-break: break-all;
}

.icon-button {
  display: inline-flex;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 8px;
  background: #efe6d5;
  color: var(--ink);
}

.icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.label {
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.button-row,
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.voucher-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.inline-search {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.inline-search input {
  min-width: 180px;
  max-width: 320px;
}

.inline-search button {
  flex: 0 0 auto;
}

.compact-search {
  margin-bottom: 0;
}

.voucher-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.generated-codes-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.generated-codes-toolbar button {
  padding: 8px 12px;
}

.selected-count {
  color: var(--muted);
  font-size: 0.92rem;
}

.cancel-control {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.countdown {
  min-width: 12ch;
  color: var(--muted);
  font-size: 0.92rem;
}

.table-wrap {
  overflow-x: auto;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.pagination-actions {
  display: flex;
  gap: 8px;
}

.pagination button {
  padding: 8px 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

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

th {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.checkbox-cell {
  width: 44px;
  text-align: center;
}

.checkbox-cell input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

.code-block {
  margin: 14px 0 0;
  padding: 14px;
  border-radius: 8px;
  background: #1f1a17;
  color: #f6efe1;
  font-family: var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
}

.pill {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(15, 139, 141, 0.12);
  color: var(--accent-strong);
}

.pill.consumed {
  background: rgba(15, 139, 141, 0.14);
}

.pill.failed,
.pill.cancelled_by_user,
.pill.expired_consumed {
  background: rgba(196, 69, 54, 0.14);
  color: #8d2519;
}

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

.row-actions button {
  padding: 8px 10px;
}

td > button.danger {
  padding: 8px 10px;
}

@media (max-width: 720px) {
  .page {
    width: min(100% - 20px, 1100px);
    padding: 22px 0 36px;
  }

  .panel {
    padding: 16px;
  }

  .inline-search,
  .compact-search {
    align-items: stretch;
    width: 100%;
  }

  .inline-search input {
    max-width: none;
  }

  h1 {
    font-size: 2.2rem;
  }
}
