:root {
  color-scheme: light;
  --blue: #4163a3;
  --blue-dark: #263e76;
  --gold: #dec600;
  --gold-soft: #fff7a6;
  --ink: #222631;
  --muted: #657083;
  --line: #dfe5ef;
  --surface: #ffffff;
  --surface-soft: #f5f8ff;
  --danger: #b92d38;
  --success: #297352;
  --shadow: 0 24px 70px rgba(31, 49, 92, 0.17);
  font-family: "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(115deg, rgba(255, 248, 171, 0.56), transparent 28rem),
    linear-gradient(180deg, #ffffff 0%, #eef3ff 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background:
    repeating-linear-gradient(
      135deg,
      rgba(65, 99, 163, 0.055) 0,
      rgba(65, 99, 163, 0.055) 1px,
      transparent 1px,
      transparent 18px
    );
  mask-image: linear-gradient(180deg, #000, transparent 70%);
}

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

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

.site-header,
.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand-mark img {
  display: block;
  width: min(250px, 58vw);
  height: auto;
}

.top-nav {
  display: flex;
  gap: 10px;
}

.top-nav a,
.ghost-button,
.secondary-button,
.submit-button {
  min-height: 46px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 800;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.top-nav a {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(65, 99, 163, 0.2);
  padding: 0 16px;
  color: var(--blue-dark);
  background: rgba(255, 255, 255, 0.75);
}

.page-shell {
  padding: 18px 0 48px;
}

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  gap: 30px;
  align-items: center;
  min-height: 490px;
}

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: clamp(2.6rem, 6vw, 5.45rem);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.85rem;
  line-height: 1.18;
  letter-spacing: 0;
}

.lead {
  max-width: 650px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.72;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.hero-badges span {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(65, 99, 163, 0.16);
  border-radius: 999px;
  padding: 0 15px;
  color: var(--blue-dark);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 10px 24px rgba(65, 99, 163, 0.08);
  font-weight: 800;
}

.voucher-preview {
  position: relative;
  min-height: 400px;
  display: grid;
  place-items: center;
}

.ticket-glow {
  position: absolute;
  width: min(88%, 430px);
  aspect-ratio: 1.6 / 1;
  border: 1px solid rgba(65, 99, 163, 0.18);
  border-radius: 8px;
  transform: rotate(-8deg);
  background:
    linear-gradient(135deg, rgba(222, 198, 0, 0.26), rgba(65, 99, 163, 0.16)),
    #fff;
  filter: blur(0.2px);
  animation: floatCard 5s ease-in-out infinite;
}

.mini-ticket {
  position: relative;
  width: min(88%, 430px);
  min-height: 260px;
  overflow: hidden;
  border: 1px solid rgba(65, 99, 163, 0.18);
  border-radius: 8px;
  padding: 26px;
  background:
    linear-gradient(110deg, rgba(255, 255, 255, 0.92) 0%, rgba(255, 255, 255, 0.78) 46%, rgba(255, 247, 166, 0.96) 47%, rgba(222, 198, 0, 0.88) 100%);
  box-shadow: var(--shadow);
  animation: floatCard 5s ease-in-out infinite reverse;
}

.mini-ticket::after,
.voucher-result::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(105deg, transparent 20%, rgba(255, 255, 255, 0.55) 48%, transparent 72%);
  transform: translateX(-130%);
  animation: shine 4.2s ease-in-out infinite;
  pointer-events: none;
}

.mini-ticket img {
  width: 180px;
  max-width: 62%;
}

.mini-label {
  display: block;
  margin-top: 32px;
  color: var(--blue);
  font-weight: 900;
  text-transform: uppercase;
}

.mini-ticket strong {
  display: block;
  color: var(--blue-dark);
  font-size: 5.8rem;
  line-height: 0.9;
}

.mini-ticket small {
  color: var(--ink);
  font-weight: 900;
  letter-spacing: 0;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(310px, 0.88fr);
  gap: 24px;
  align-items: start;
}

.form-panel,
.terms-panel,
.voucher-result,
.admin-card,
.admin-panel {
  border: 1px solid rgba(65, 99, 163, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.form-panel,
.terms-panel {
  padding: 28px;
}

.form-header {
  margin-bottom: 22px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px 16px;
}

.spam-field {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 8px;
  color: var(--ink);
  font-weight: 800;
}

.field b {
  color: var(--gold);
}

.field-wide {
  grid-column: 1 / -1;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cdd6e8;
  border-radius: 8px;
  padding: 12px 13px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.field textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(65, 99, 163, 0.15);
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--danger);
  background: #fff8f8;
}

.error-message {
  min-height: 18px;
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;
}

.submit-button,
.secondary-button,
.ghost-button {
  border: 0;
  padding: 0 18px;
}

.submit-button {
  width: 100%;
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  box-shadow: 0 14px 28px rgba(65, 99, 163, 0.24);
}

.secondary-button {
  color: var(--blue-dark);
  background: linear-gradient(135deg, var(--gold-soft), #fff);
  border: 1px solid rgba(222, 198, 0, 0.6);
}

.ghost-button {
  color: var(--blue-dark);
  background: #fff;
  border: 1px solid rgba(65, 99, 163, 0.22);
}

.top-nav a:hover,
.submit-button:hover,
.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(65, 99, 163, 0.14);
}

.submit-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.sync-status {
  min-height: 22px;
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.sync-status.success {
  color: var(--success);
}

.sync-status.error {
  color: var(--danger);
}

.closed-notice {
  margin-bottom: 18px;
  border: 1px solid rgba(185, 45, 56, 0.22);
  border-radius: 8px;
  padding: 14px 16px;
  color: var(--danger);
  background: #fff8f8;
  font-weight: 800;
}

.terms-list {
  display: grid;
  gap: 16px;
  margin: 24px 0 0;
}

.terms-list div {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.terms-list dt {
  margin-bottom: 5px;
  color: var(--blue-dark);
  font-weight: 900;
}

.terms-list dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
}

.voucher-result {
  position: relative;
  overflow: hidden;
  margin-top: 28px;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(280px, 0.72fr) minmax(360px, 1.28fr);
  gap: 24px;
  align-items: center;
}

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

.voucher-canvas-wrap {
  min-width: 0;
  border-radius: 8px;
  background: #f6f8ff;
  box-shadow: inset 0 0 0 1px rgba(65, 99, 163, 0.12);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: revealUp 760ms ease forwards;
}

.reveal:nth-child(2) {
  animation-delay: 120ms;
}

@keyframes revealUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes floatCard {
  0%,
  100% {
    transform: translateY(0) rotate(-4deg);
  }
  50% {
    transform: translateY(-14px) rotate(2deg);
  }
}

@keyframes shine {
  0%,
  55% {
    transform: translateX(-130%);
  }
  100% {
    transform: translateX(130%);
  }
}

/* Admin */
.admin-page {
  min-height: 100vh;
}

.admin-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 48px;
}

.admin-login {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
}

.admin-card,
.admin-panel {
  padding: 26px;
}

.admin-card {
  width: min(460px, 100%);
}

.admin-card h1,
.admin-toolbar h1 {
  margin-bottom: 18px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.05;
}

.admin-card .field + .field {
  margin-top: 14px;
}

.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.75fr) minmax(0, 1.25fr);
  gap: 22px;
  align-items: start;
}

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

.status-pill {
  width: fit-content;
  border-radius: 999px;
  padding: 8px 12px;
  color: var(--blue-dark);
  background: var(--surface-soft);
  border: 1px solid rgba(65, 99, 163, 0.2);
  font-weight: 900;
}

.switch-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.switch {
  position: relative;
  width: 58px;
  height: 32px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c9d1df;
  cursor: pointer;
}

.slider::before {
  position: absolute;
  width: 24px;
  height: 24px;
  left: 4px;
  top: 4px;
  border-radius: 50%;
  background: #fff;
  content: "";
  transition: transform 160ms ease;
}

.switch input:checked + .slider {
  background: var(--blue);
}

.switch input:checked + .slider::before {
  transform: translateX(26px);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  background: #fff;
}

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

th {
  color: var(--blue-dark);
  background: #f7f9ff;
  font-weight: 900;
}

td {
  color: var(--muted);
}

.empty-state {
  margin: 16px 0 0;
  color: var(--muted);
}

.service-manager {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.service-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  margin-top: 12px;
}

.service-list {
  display: grid;
  gap: 9px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.service-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: #fff;
}

.service-list span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 800;
}

.icon-button {
  min-width: 38px;
  min-height: 36px;
  border: 1px solid rgba(65, 99, 163, 0.2);
  border-radius: 8px;
  color: var(--blue-dark);
  background: var(--surface-soft);
  cursor: pointer;
  font-weight: 900;
}

@media (max-width: 940px) {
  .hero-section,
  .content-grid,
  .voucher-result,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .hero-section {
    min-height: 0;
    padding-top: 24px;
  }
}

@media (max-width: 640px) {
  .site-header,
  .page-shell,
  .admin-shell {
    width: min(100% - 22px, 1180px);
  }

  .site-header {
    min-height: 82px;
  }

  h1 {
    font-size: 2.55rem;
  }

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

  .form-panel,
  .terms-panel,
  .voucher-result,
  .admin-card,
  .admin-panel {
    padding: 20px;
  }

  .mini-ticket strong {
    font-size: 4.5rem;
  }

  .brand-mark img {
    width: min(210px, 62vw);
  }

  .admin-toolbar,
  .switch-row {
    align-items: stretch;
    flex-direction: column;
  }
}
