:root {
  --bg: #08101a;
  --surface: rgba(13, 22, 34, 0.82);
  --surface-2: rgba(17, 29, 44, 0.92);
  --line: rgba(255, 255, 255, 0.12);
  --text: #f3f7fb;
  --muted: #9fb0c3;
  --accent: #18d6ff;
  --gold: #ffb84d;
  --pink: #ff3d8f;
  --green: #5ee7a8;
  --danger: #ff5d5d;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 520px at 0% 0%, rgba(24, 214, 255, 0.12), transparent 58%),
    radial-gradient(700px 500px at 100% 0%, rgba(255, 61, 143, 0.12), transparent 54%),
    var(--bg);
}

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

.wrap {
  width: min(1380px, calc(100% - 28px));
  margin: 0 auto;
  padding: 34px 0;
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 16, 26, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.admin-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.admin-brand {
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.admin-nav {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-link,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.admin-link {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.86rem;
  color: #d7e2ef;
  background: rgba(255, 255, 255, 0.045);
}

.admin-link:hover,
.btn:hover {
  border-color: rgba(24, 214, 255, 0.36);
}

.btn.primary {
  color: #071018;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  border-color: transparent;
}

.btn.danger {
  color: #fff;
  background: rgba(255, 93, 93, 0.18);
  border-color: rgba(255, 93, 93, 0.36);
}

.btn.ghost {
  background: transparent;
}

.btn.small {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 0.82rem;
}

.admin-hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 22px;
  margin-bottom: 30px;
  padding: 8px 0 4px;
}

.admin-hero h1,
.card h2,
.login-card h1 {
  margin: 0;
  letter-spacing: 0;
}

.admin-hero h1 {
  font-size: clamp(2rem, 4vw, 4rem);
}

.admin-kicker {
  display: inline-flex;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.helper,
.admin-hint,
small {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.admin-user-pill,
.badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
  font-weight: 800;
}

.badge.danger {
  color: #fff;
  background: rgba(255, 93, 93, 0.22);
  border-color: rgba(255, 93, 93, 0.34);
}

.badge.good,
.status-confirmed,
.status-paid,
.status-checked-in,
.pay-paid {
  color: #062016;
  background: var(--green);
  border-color: transparent;
}

.status-cancelled,
.status-refunded,
.pay-cancelled,
.pay-refunded {
  color: #fff;
  background: rgba(255, 93, 93, 0.22);
  border-color: rgba(255, 93, 93, 0.34);
}

.status-pending,
.pay-pending {
  color: #071018;
  background: var(--gold);
  border-color: transparent;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 34px;
}

.stat-card,
.card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
}

.stat-card {
  min-height: 116px;
  padding: 20px;
  display: grid;
  align-content: space-between;
}

.stat-card.compact {
  min-height: 92px;
}

.stat-card span {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.stat-card strong {
  font-size: 2.2rem;
}

.card {
  padding: 28px;
  margin-bottom: 34px;
}

.card--calm {
  background: rgba(13, 22, 34, 0.68);
}

.card--large {
  padding: 30px;
}

.panel-chapter {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin: 42px 0 18px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
}

.panel-chapter:first-of-type {
  margin-top: 16px;
}

.panel-chapter--sub {
  margin-top: 34px;
}

.panel-chapter span {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  color: #071018;
  background: linear-gradient(135deg, var(--accent), var(--gold));
  font-weight: 950;
  font-size: 0.9rem;
}

.panel-chapter h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2vw, 2.1rem);
}

.panel-chapter p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.ticket-editor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.ticket-editor-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
}

.ticket-editor-card h3 {
  margin: 0;
}

.admin-grid.two {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 24px;
  margin-bottom: 34px;
}

.section-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.section-top.sub {
  margin-top: 34px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.section-top h2,
.section-top h3 {
  margin: 0;
}

.section-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
  align-items: end;
}

label {
  display: block;
  margin-bottom: 7px;
  color: #d7e2ef;
  font-size: 0.86rem;
  font-weight: 800;
}

.input,
textarea.input,
select.input {
  width: 100%;
  min-height: 44px;
  padding: 11px 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  background: rgba(4, 8, 14, 0.72);
  outline: none;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(24, 214, 255, 0.12);
}

textarea.input {
  resize: vertical;
}

.color-input {
  padding: 4px;
}

.filter-actions,
.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.compact-form,
.event-form,
.row-edit-form,
.login-form {
  display: grid;
  gap: 16px;
}

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

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.04);
}

.payment-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.checkin-card {
  display: grid;
  gap: 14px;
}

.scanner-frame {
  position: relative;
  min-height: 280px;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid rgba(24, 214, 255, 0.28);
  background:
    linear-gradient(135deg, rgba(24, 214, 255, 0.09), rgba(255, 61, 143, 0.08)),
    rgba(4, 8, 14, 0.76);
}

.checkin-card--large .scanner-frame {
  min-height: 430px;
}

.scan-history {
  display: grid;
  gap: 8px;
}

.scan-history-item {
  padding: 10px 12px;
  border-radius: var(--radius);
  font-weight: 800;
  background: rgba(94, 231, 168, 0.1);
  border: 1px solid rgba(94, 231, 168, 0.22);
}

.scan-history-item.error {
  background: rgba(255, 93, 93, 0.12);
  border-color: rgba(255, 93, 93, 0.3);
}

.scanner-frame video,
.scanner-placeholder {
  width: 100%;
  height: 100%;
  min-height: 280px;
}

.scanner-frame video {
  object-fit: cover;
}

.scanner-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 900;
}

.scanner-frame::after {
  content: "";
  position: absolute;
  inset: 26px;
  border: 2px solid rgba(94, 231, 168, 0.9);
  border-radius: var(--radius);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.18);
  pointer-events: none;
}

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

.scan-result {
  padding: 12px;
  border-radius: var(--radius);
  font-weight: 800;
  line-height: 1.45;
}

.scan-result.ok {
  color: #062016;
  background: var(--green);
}

.scan-result.error {
  color: #ffe2e2;
  background: rgba(255, 93, 93, 0.16);
  border: 1px solid rgba(255, 93, 93, 0.32);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  min-width: 1900px;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.table th,
.table td {
  padding: 15px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.075);
  vertical-align: top;
  text-align: left;
}

.table tbody tr:hover {
  background: rgba(255, 255, 255, 0.035);
}

.table th {
  color: #dce7f5;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.table td strong,
.table td small {
  display: block;
}

code {
  display: inline-block;
  padding: 6px 8px;
  border-radius: var(--radius);
  color: var(--accent);
  background: rgba(24, 214, 255, 0.09);
  white-space: nowrap;
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 260px;
}

.copy-row code {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qr-link {
  display: inline-flex;
  width: fit-content;
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: var(--radius);
  color: #071018;
  background: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
}

.row-actions {
  min-width: 240px;
  margin-top: 8px;
}

.row-quick-action {
  margin-top: 8px;
}

.row-actions summary {
  list-style: none;
  width: fit-content;
}

.row-actions summary::-webkit-details-marker {
  display: none;
}

.row-actions[open] {
  padding: 10px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.045);
}

.row-actions form + form {
  margin-top: 8px;
}

.event-editor {
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.045);
}

.event-editor + .event-editor {
  margin-top: 16px;
}

.event-editor summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.event-editor summary::-webkit-details-marker {
  display: none;
}

.event-form {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
}

.toggle input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.registration-edit-card {
  max-width: 1120px;
  margin-inline: auto;
}

.registration-edit-form {
  display: grid;
  gap: 26px;
}

.admin-section-title {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-section-title:first-child {
  padding-top: 0;
  border-top: 0;
}

.admin-section-title span {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #071018;
  background: var(--gold);
  font-size: 0.78rem;
  font-weight: 950;
}

.admin-section-title h2 {
  margin: 0;
}

.admin-section-title p {
  margin: 4px 0 0;
  color: var(--muted);
}

.edit-toggle {
  min-height: 44px;
}

.guest-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
}

.guest-edit-card {
  display: grid;
  gap: 9px;
  min-width: 0;
  margin: 0;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.guest-edit-card legend {
  padding: 0 6px;
  color: var(--gold);
  font-weight: 900;
}

.sticky-edit-actions {
  position: sticky;
  bottom: 14px;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(7, 10, 18, 0.88);
  backdrop-filter: blur(16px);
}

.email-stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.progress-bar {
  width: min(280px, 100%);
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress-bar.big {
  width: 100%;
  height: 16px;
  margin: 12px 0 18px;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), #f7df9f);
}

.action-stack,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.campaign-editor-form,
.preview-stack {
  display: grid;
  gap: 16px;
}

.campaign-editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.code-editor {
  min-height: 560px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.55;
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.email-preview {
  width: 100%;
  min-height: 360px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: #fff;
}

.mobile-preview {
  width: min(390px, 100%);
  justify-self: center;
}

.alert {
  padding: 14px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius);
  font-weight: 800;
}

.alert.error {
  color: #ffdede;
  background: rgba(255, 93, 93, 0.14);
  border: 1px solid rgba(255, 93, 93, 0.3);
}

.login {
  max-width: 460px;
  padding-top: 9vh;
}

.login-card {
  display: grid;
  gap: 16px;
}

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

@media (max-width: 1180px) {
  .stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-grid,
  .admin-grid.two,
  .ticket-editor-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .wrap {
    width: min(100% - 20px, 1380px);
  }

  .admin-header .wrap,
  .admin-hero,
  .section-top,
  .event-editor summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-nav {
    justify-content: flex-start;
  }

  .admin-link,
  .btn {
    white-space: normal;
  }

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

  .payment-status-grid {
    grid-template-columns: 1fr;
  }

  .campaign-editor-grid {
    grid-template-columns: 1fr;
  }

  .code-editor {
    min-height: 380px;
  }

  .card {
    padding: 16px;
  }

  .copy-row,
  .row-actions {
    min-width: 0;
  }

  .copy-row {
    align-items: stretch;
    flex-direction: column;
  }

  .copy-row code {
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .sticky-edit-actions {
    position: static;
    flex-direction: column-reverse;
  }

  .sticky-edit-actions .btn {
    width: 100%;
  }
}
