:root {
  --red: #e11d24;
  --red-2: #8d0009;
  --red-3: #ff343b;
  --gold: #ffd21f;
  --gold-2: #b8860b;
  --black: #050505;
  --ink: #101014;
  --deep: #130004;
  --panel: rgba(18, 18, 24, 0.86);
  --panel-strong: rgba(8, 8, 12, 0.94);
  --white: #ffffff;
  --muted: #bfc0c7;
  --muted-dark: #5d5f69;
  --line: rgba(255, 255, 255, 0.12);
  --line-gold: rgba(255, 210, 31, 0.30);
  --line-red: rgba(225, 29, 36, 0.42);
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 12px 28px rgba(0, 0, 0, 0.24);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --speed: 180ms ease;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
}

body {
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--white);
  background:
    radial-gradient(circle at 12% -8%, var(--theme-bubble-primary, rgba(225, 29, 36, 0.42)), transparent 32%),
    radial-gradient(circle at 88% 2%, var(--theme-bubble-accent, rgba(255, 210, 31, 0.16)), transparent 30%),
    linear-gradient(145deg, var(--theme-bg-start, #030303) 0%, var(--theme-bg-middle, #130004) 54%, var(--theme-bg-end, #000) 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.7), transparent 75%);
}

img { max-width: 100%; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 8px;
  font-size: clamp(32px, 7vw, 46px);
  line-height: 1.02;
  letter-spacing: -1.3px;
}

h2 {
  margin: 0 0 0px;
  font-size: 19px;
  letter-spacing: -0.2px;
}

p { color: var(--muted); line-height: 1.45; }

.eyebrow {
  margin-bottom: 10px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

.eyebrow.dark { color: var(--red-2); }

.subtitle, .home-subtitle {
  max-width: 360px;
  margin: 0 auto 24px;
  text-align: center;
  color: var(--muted);
}

/* Shared controls */
label {
  display: block;
  margin-bottom: 8px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.2px;
}

input, select, button {
  min-height: 38px;
  font: inherit;
}

input, select {
  width: 100%;
  /*min-height: 38px;*/
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0, 0, 0, 0.46);
  color: var(--white);
  outline: none;
  transition: border-color var(--speed), box-shadow var(--speed), background var(--speed), transform var(--speed);
}

input { padding: 0 10px; font-size: 13px; align-content: center;}

textarea {
  width: 100%;
  min-height: 116px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0, 0, 0, 0.46);
  color: var(--white);
  font: inherit;
  font-size: 13px;
  resize: vertical;
  outline: none;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0 40px 0 12px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.2px;
  cursor: pointer;
  background-color: rgba(0, 0, 0, 0.50);
  background-image:
    linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23ffd21f' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: center, right 15px center;
  background-size: auto, 18px 18px;
}

select:hover {
  border-color: rgba(255, 210, 31, 0.55);
  background-color: rgba(0, 0, 0, 0.62);
}

select option {
  background: #111;
  color: #fff;
  font-weight: 800;
}

input::placeholder { color: rgba(255,255,255,0.42); }

input:focus, select:focus {
  border-color: var(--gold);
  background: rgba(0,0,0,0.64);
  box-shadow: 0 0 0 4px rgba(255, 210, 31, 0.13);
}

textarea:focus {
  border-color: var(--gold);
  background: rgba(0,0,0,0.64);
  box-shadow: 0 0 0 4px rgba(255, 210, 31, 0.13);
}

button,
.action-btn,
a.btn-primary,
a.btn-secondary,
a.btn-test,
a.btn-run,
a.qr-download,
a.ghost-btn {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--white);
  font-weight: 900;
  letter-spacing: 0.1px;
  background: linear-gradient(135deg, var(--red-3), var(--red-2));
  box-shadow: 0 14px 28px rgba(122, 0, 8, 0.34);
  transition: transform var(--speed), filter var(--speed), box-shadow var(--speed);
}

button:hover,
.action-btn:hover,
a.btn-primary:hover,
a.btn-secondary:hover,
a.btn-test:hover,
a.btn-run:hover,
a.qr-download:hover,
a.ghost-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 18px 34px rgba(122, 0, 8, 0.42);
}

button:active,
.action-btn:active,
a.btn-primary:active,
a.btn-secondary:active,
a.btn-test:active,
a.btn-run:active,
a.qr-download:active,
a.ghost-btn:active { transform: translateY(0); }

.btn-primary, .btn-submit { width: 100%; }
.btn-secondary { background: rgba(255,255,255,0.12); box-shadow: var(--shadow-soft); border: 1px solid var(--line); }
.btn-icon { min-width: 96px; white-space: nowrap; }

.hidden { display: none !important; }
.no-print { display: block; }

/* POS page */
.app, .pos-shell {
  width: 100%;
  max-width: 540px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 18px 30px;
  position: relative;
}

.brand-header {
  text-align: center;
}

.logo-button {
  min-height: 44px;
  min-height: auto;
  width: auto;
  padding: 0;
  margin: 0 auto 14px;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  display: block;
}

.logo-button:hover { transform: none; box-shadow: none; filter: none; }

.logo, .page-logo, .login-logo, .home-logo {
  display: block;
  margin-left: auto;
  margin-right: auto;
  filter: drop-shadow(0 14px 24px rgba(0,0,0,0.42));
}

.logo { width: 210px; cursor: pointer; transition: transform var(--speed), filter var(--speed); }
.logo-button:active .logo { transform: scale(0.94); }
.page-logo { width: 230px; }
.login-logo { width: 230px; margin-bottom: 22px; }
.home-logo { width: 280px; margin-bottom: 26px; }

.logo.refreshing { animation: logoPremiumPulse 0.48s ease both; }

@keyframes logoPremiumPulse {
  0% {
    transform: scale(1);
    filter: drop-shadow(0 14px 24px rgba(0,0,0,0.42));
  }
  40% {
    transform: scale(0.94);
    filter: drop-shadow(0 0 22px rgba(255, 210, 31, 0.38));
  }
  72% {
    transform: scale(1.035);
    filter: drop-shadow(0 0 28px rgba(225, 29, 36, 0.42));
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 14px 24px rgba(0,0,0,0.42));
  }
}

.flow-card, .info-panel, .login-box, .home-box {
  position: relative;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.flow-card {
  margin-bottom: 16px;
  padding: 18px;
  background: linear-gradient(180deg, rgba(24,24,30,0.92), rgba(8,8,12,0.94));
  border: 1px solid var(--line-red);
}

.primary-card { border-color: var(--line-gold); }

.info-panel {
  margin-bottom: 16px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(255,210,31,0.13), rgba(255,255,255,0.06));
  border: 1px solid var(--line-gold);
}

.section-title {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
  align-items: center;
}

.section-title.compact { margin-bottom: 0; align-items: flex-start;}
.section-title p { margin: 0; font-size: 14px; }
#customerInfo p { 
	margin: 4px 0; 
	color: var(--white);
	font-size: smaller;
	font-style: italic;
}

.pos-customer-info {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.14);
}

.step-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: linear-gradient(135deg, var(--gold), #fff1a8);
  color: #111;
  font-weight: 1000;
  box-shadow: 0 8px 18px rgba(255,210,31,0.20);
}

.status-dot {
  width: 14px;
  height: 14px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 7px rgba(255,210,31,0.12);
  flex: 0 0 auto;
}

.input-action-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.reader {
  margin-top: 12px;
  background: rgba(0,0,0,0.38);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.scanner-label {
  margin-top: 12px;
  color: var(--gold);
  font-weight: 900;
  text-align: center;
}

.footer {
  padding: 22px 0 4px;
  text-align: center;
  color: rgba(255,255,255,0.46);
  font-size: 13px;
}

.apk-version-label {
  margin-top: 4px;
  font-size: 11px;
  color: rgba(255,255,255,0.36);
}

/* Loading + popup */
.loading-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(225, 29, 36, 0.16), transparent 34%),
    rgba(0,0,0,0.84);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999;
  backdrop-filter: blur(8px);
}

.loader-card {
  width: min(250px, 74vw);
  padding: 28px 28px 24px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(24,24,30,0.90), rgba(8,8,12,0.94));
  border: 1px solid rgba(255, 210, 31, 0.22);
  box-shadow: 0 28px 80px rgba(0,0,0,0.55);
}

.spinner-logo {
  width: 112px;
  margin: 0 auto 22px;
  display: block;
  will-change: transform, filter, opacity;
  animation: logoBreath 1.55s ease-in-out infinite;
  transform-origin: center center;
}

.loader-bar {
  height: 4px;
  width: 100%;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
}

.loader-bar span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--gold));
  animation: loaderSweep 1.05s ease-in-out infinite;
}

@keyframes logoBreath {
  0%, 100% {
    transform: scale(0.96);
    opacity: 0.78;
    filter: drop-shadow(0 0 0 rgba(255,210,31,0));
  }
  50% {
    transform: scale(1.04);
    opacity: 1;
    filter: drop-shadow(0 0 22px rgba(255,210,31,0.28));
  }
}

@keyframes loaderSweep {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(260%); }
}

.popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.58);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 18px;
}

.popup-box {
  width: min(360px, 94vw);
  padding: 26px;
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, #ffffff, #fff8dc);
  color: #111;
  text-align: center;
  border: 3px solid var(--gold);
  box-shadow: var(--shadow);
}

.popup-mark {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: #fff;
  font-weight: 1000;
}

#popupMessage {
  color: #111;
  font-size: 19px;
  font-weight: 900;
  margin-bottom: 18px;
}

.popup-box button { width: 100%; }

/* Home */
.home-body, .login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.home-shell, .login-wrapper {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  text-align: center;
}

.home-box {
  padding: 40px 24px;
  background: rgba(10,10,14,0.72);
  border: 1px solid var(--line-gold);
}

.glass-panel { backdrop-filter: blur(16px); }

/* Login */
.login-box {
  padding: 34px 28px;
  background: linear-gradient(180deg, #ffffff, #f7f7f7);
  color: #111;
  border: 3px solid var(--gold);
}

.login-box h1 {
  margin-bottom: 8px;
  color: var(--red-2);
}

.login-box p {
  margin: 0 0 22px;
  color: var(--muted-dark);
}

.login-box label { color: var(--red-2); text-align: left; }
.login-box input { background: #fff; color: #111; border: 2px solid #dddddd; margin-bottom: 14px; }
.login-box input:focus { border-color: var(--red); box-shadow: 0 0 0 4px rgba(225,29,36,0.12); }

.error {
  margin-top: 14px;
  color: var(--red-2);
  font-weight: 900;
}

/* QR admin */
.admin-hero {
  width: min(1060px, calc(100% - 32px));
  margin: 24px auto 14px;
  padding: 20px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,210,31,0.08));
  border: 1px solid var(--line-gold);
  box-shadow: var(--shadow-soft);
}

.admin-hero-inner {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 22px;
  align-items: center;
}

.admin-hero h1 { margin: 0 0 8px; text-align: left; }
.admin-hero p { margin: 0; }

.toolbar {
  width: min(1060px, calc(100% - 32px));
  margin: 0 auto 18px;
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 14px;
  align-items: stretch;
}

.select-card {
  margin: 0;
  min-height: 44px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  padding: 7px 12px;
  background: rgba(255,255,255,0.10);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
}

.select-card span {
  color: var(--gold);
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.select-card select {
  min-height: 38px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.select-card input {
  min-height: 38px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.qr-toolbar {
  width: min(1180px, calc(100% - 32px));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: 10px;
}

.qr-toolbar .select-card {
  min-width: 0;
  height: 46px;
  padding: 4px 12px;
  grid-template-columns: 1fr;
}

.qr-toolbar .select-card input {
  width: 100%;
}

.qr-toolbar .btn-primary,
.qr-toolbar .btn-secondary,
.qr-toolbar .action-btn,
.qr-toolbar-spacer {
  width: 100%;
  height: 46px;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.qr-toolbar-spacer {
  visibility: hidden;
}

.sheet {
  width: 100%;
  margin: 0 auto 30px;
  padding: 20px;
}

/* QR card print styles are shared by the QR page and registration print output. */

/* Redeem mode compatibility */
body.redeem-mode {
  background:
    radial-gradient(circle at 12% -8%, rgba(91, 44, 178, 0.42), transparent 32%),
    radial-gradient(circle at 88% 2%, rgba(0, 194, 255, 0.16), transparent 30%),
    linear-gradient(145deg, #03030a 0%, #160022 54%, #000 100%);
}

body.redeem-mode button, body.redeem-mode .action-btn {
  background: linear-gradient(135deg, #6d5dfc, #351179);
}

@media screen and (max-width: 900px) {
  .admin-hero-inner { grid-template-columns: 1fr; text-align: center; }
  .admin-hero h1 { text-align: center; }
  .toolbar { grid-template-columns: 1fr; }
  .qr-toolbar { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media screen and (max-width: 460px) {
  .input-action-row { grid-template-columns: 1fr; }
  .btn-icon { width: 100%; }
  h1 { font-size: 34px; }
  .flow-card, .info-panel { border-radius: 22px; }
}

@media print {
  @page { size: A4; margin: 10mm; }

  * { box-shadow: none !important; }
  body { background: white !important; color: #111 !important; }
  body::before, .no-print, .admin-hero, .toolbar { display: none !important; }

  .sheet {
    width: auto;
    padding: 0;
    margin: 0;
    background: transparent;
  }
}

.admin-mini-btn {
  min-height: 0;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.58);
  background: rgba(255,255,255,0.08);
  box-shadow: none;
  margin-bottom: 8px;
}

.admin-mini-btn:hover {
  box-shadow: none;
  filter: brightness(1.05);
}

/* Shared app surfaces */
.page-shell,
.test-shell,
.admin-config-page .page {
  width: min(1120px, calc(100% - 32px));
  margin: 28px auto;
}

.page-title {
  margin: 0 0 18px;
  color: var(--gold);
  font-size: 30px;
  letter-spacing: 0;
}

.sync-panel,
.data-panel,
.panel,
.main-settings-card,
.admin-config-page .card,
.admin-config-page .hero {
  background: var(--panel);
  border: 1px solid var(--line-gold);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  margin-bottom: 18px;
}

.settings-collapse {
  overflow: hidden;
}

.settings-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.settings-summary h2 {
  margin: 0;
}

.settings-summary::after {
  content: "-";
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,210,31,0.12);
  color: var(--gold);
  border: 1px solid var(--line-gold);
  font-weight: 900;
}

.settings-collapse:not([open]) .settings-summary::after {
  content: "+";
}

.settings-collapse > .main-settings-grid,
.settings-collapse > .step2-review-grid,
.settings-collapse > .settings-card-body {
  margin-top: 14px;
}

.section-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 12px 0 0;
}

.description,
.muted,
.summary-text {
  color: var(--muted);
}

.button-row,
.page-actions,
.nav-actions,
.panel-head,
.test-header,
.row,
.run-controls,
.schema-actions,
.field-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.page-actions,
.panel-head,
.test-header {
  justify-content: space-between;
  padding-bottom: 20px;
}

.nav-actions {
  justify-content: flex-end;
}

.form-grid,
.main-settings-grid,
.setup-grid,
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.customer-id-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.step2-review-grid,
.status-strip,
.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding-bottom: 20px;
}

.step2-review-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric,
.status-item,
.setting-field,
.item,
.table-row {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.metric span,
.status-item span {
  display: block;
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  text-align: center;
}

.metric strong,
.status-item strong {
  display: block;
  margin-top: 4px;
  color: var(--white);
  font-size: 16px;
  text-align: center;
}

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

.sms-settings-grid .sms-template-field:first-of-type {
  grid-column: 1 / -1;
}

.template-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.template-head .mini-action {
  min-height: 32px;
  padding: 0 12px;
  white-space: nowrap;
}

.sync-error-detail {
  color: #ffd8d8;
  font-weight: 900;
}

.theme-settings-layout {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.theme-panel {
  display: grid;
  gap: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.theme-panel-head,
.theme-save-row,
.theme-preset-row,
.theme-preset-actions,
.theme-color-field,
.theme-color-choice {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-panel-head,
.theme-preset-row {
  justify-content: space-between;
}

.theme-panel h3 {
  margin: 0;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.theme-save-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}

.theme-save-row input {
  width: 100%;
}

.theme-preset-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.theme-preset-row {
  min-height: 48px;
  justify-content: space-between;
}

.theme-preset-row strong {
  display: block;
  color: var(--white);
  font-size: 13px;
}

.theme-preset-actions {
  justify-content: flex-end;
}

.theme-icon-btn {
  width: 34px;
  min-height: 32px;
  padding: 0;
  font-size: 17px;
  line-height: 1;
}

.theme-color-grid {
  margin-top: 0;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.theme-color-field {
  min-height: 48px;
  justify-content: space-between;
}

.theme-color-field .setting-label {
  min-width: 0;
}

.theme-color-choice {
  justify-content: flex-end;
  flex: 0 0 auto;
}

.theme-color-hex {
  width: 96px;
  min-height: 34px;
  text-transform: uppercase;
}

.theme-color-picker {
  width: 42px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 0px;
  border: 0px solid rgba(255,255,255,0.2);
  background: transparent;
  cursor: pointer;
}

.conditions {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.conditions li {
  border-left: 3px solid var(--gold);
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
}

.step-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
}

.actions {
  display: grid;
  grid-template-columns: 120px 120px;
  gap: 10px;
  align-items: end;
}

.limit-wrap,
.label,
.run-controls label,
.setting-field,
.side-label {
  display: grid;
  gap: 6px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 800;
}

.limit-wrap {
  grid-column: 1 / -1;
}

.timing-top-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
}

.timing-panel-head {
  flex: 1 1 auto;
  padding-bottom: 0;
}

.timing-points-wrap {
  max-width: 280px;
  margin: 0;
}

.timing-points {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  align-items: start;
  padding-top: 5px;
}

.timing-point {
  display: flex;
  align-items: center;
  gap: 5px;
  max-height: 10px;
  padding: 0;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.timing-point input {
  width: 12px;
  height: 12px;
  accent-color: var(--gold);
  margin: 0;
}

.btn-test,
.btn.secondary,
.btn-secondary {
  background: rgba(255,255,255,0.12);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.btn-run,
.btn-primary,
.btn,
.mini-action {
  background: linear-gradient(135deg, var(--red-3), var(--red-2));
}

.btn.ghost {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--line);
}

.btn.danger,
.status-warn,
.log-fail {
  color: #ffd8d8;
}

.btn.danger {
  background: linear-gradient(135deg, #ff343b, #7d0007);
}

.status,
.status-ok,
.log-ok {
  font-weight: 900;
  color: #9ff5be;
}

.status-bad {
  color: #ffe0e0;
  font-weight: 900;
}

.status-pill {
  display: inline-grid;
  place-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.status-strip .active-filter {
  border-color: rgba(255, 210, 31, 0.72);
  background: rgba(255, 210, 31, 0.12);
}

.redemption-monitor-page .status-strip a {
  text-decoration: none;
}

.redemption-monitor-page .page {
  width: min(1680px, calc(100% - 20px));
  max-width: none;
  grid-template-columns: minmax(0, 1fr);
}

.redemption-monitor-page .wrap {
  width: 100%;
}

.redemption-monitor-page .status-strip {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.redemption-monitor-page .data-table-wrap {
  overflow-x: visible;
}

.redemption-monitor-page .data-table {
  width: 100%;
  min-width: 0;
  table-layout: auto;
}

.redemption-monitor-page .data-table th,
.redemption-monitor-page .data-table td {
  white-space: nowrap;
  padding-left: 8px;
  padding-right: 8px;
  font-size: 12px;
}

.status.fail,
.notice-error,
.err {
  color: #ffe0e0;
}

.status.wait,
.notice-warning,
.warn {
  color: #fff2bd;
}

.notice-success,
.msg {
  background: rgba(8, 95, 45, 0.72);
  border: 1px solid rgba(77, 209, 119, 0.62);
  color: #d8ffe0;
}

.notice-error,
.err {
  background: rgba(95, 0, 0, 0.72);
  border: 1px solid rgba(255, 120, 120, 0.62);
}

.notice-warning,
.warn {
  background: rgba(97, 73, 0, 0.72);
  border: 1px solid rgba(255, 210, 31, 0.62);
}

.notice-success,
.notice-error,
.notice-warning,
.msg,
.err,
.warn {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  line-height: 1.45;
}

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

table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(0,0,0,0.30);
}

th,
td,
.data-table th,
.data-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  color: var(--white);
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th,
.data-table th {
  background: rgba(255,210,31,0.12);
  color: var(--gold);
}

tr:last-child td {
  border-bottom: 0;
}

pre,
.results {
  max-height: 420px;
  overflow: auto;
  margin: 14px 0 0;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: #08080c;
  color: #f9fafb;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.inline-results {
  width: 100%;
}

.test-runs-page .inline-results {
  grid-column: 1 / -1;
}

/* Switches */
.setting-head,
.switch-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex: 0 0 auto;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
  min-height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255,255,255,0.18);
  transition: var(--speed);
  border-radius: 999px;
  border: 1px solid var(--line);
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  top: 50%;
  background: white;
  transition: var(--speed);
  border-radius: 50%;
  transform: translateY(-50%);
}

.switch input:checked + .slider {
  background: linear-gradient(135deg, var(--red), var(--red-2));
  border-color: var(--red);
}

.switch input:checked + .slider:before {
  transform: translate(19px, -50%);
}

/* Sync and test utilities */
.sync-page .result-panel {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.test-runs-page .test-shell {
  width: min(1120px, calc(100% - 32px));
}

.test-runs-page .stack,
.vehicle-rows {
  display: grid;
  gap: 8px;
}

.test-runs-page .test-status-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: stretch;
}

.test-runs-page .test-status-strip #restoreBtn {
  align-self: stretch;
  width: 100%;
  min-width: 0;
  background: rgba(255, 210, 31, 0.14);
  border: 1px solid rgba(255, 210, 31, 0.62);
  color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05), var(--shadow-soft);
}

.test-runs-page .setup-entry-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
}

.test-runs-page .row input {
  flex: 1 1 auto;
  min-width: 0;
}

.test-runs-page .setup-icon-btn {
  flex: 0 0 42px;
  width: 42px;
  min-height: 0;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.test-runs-page .setup-remove-btn {
  background: rgba(225, 29, 36, 0.18);
  border-color: rgba(255, 52, 59, 0.64);
  color: #ffd8d8;
}

.test-runs-page .setup-add-btn {
  background: rgba(35, 124, 255, 0.18);
  border-color: rgba(86, 158, 255, 0.72);
  color: #d9e9ff;
}

/* Admin configuration */
.admin-config-page .page {
  max-width: 1400px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 24px;
  align-items: start;
}

.admin-config-page .wrap {
  min-width: 0;
}

.admin-config-page .hero-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.admin-config-page .key {
  display: block;
  color: var(--gold);
  font-size: 10px;
  margin-top: 4px;
  opacity: .85;
  overflow-wrap: anywhere;
}

.admin-config-page .schema-cache-line,
.admin-config-page .hint {
  color: var(--muted);
  font-size: 12px;
}

.admin-config-page .hint:not(.schema-cache-line),
.admin-config-page .switch-hint,
.admin-config-page .no-fields-note {
  display: none;
}

.admin-config-page .schema-actions form {
  margin: 0;
  display: inline;
}

.admin-config-page .mini-action {
  width: auto;
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--line-gold);
  color: var(--gold);
  text-decoration: none;
  font-size: 11px;
  font-weight: 900;
  box-shadow: none;
}

.admin-config-page .field-grid {
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
}

.admin-config-page .business-grid.field-grid {
  grid-template-columns: repeat(4, minmax(230px, 1fr));
}

.schema-mapping-page .page {
  display: block;
  width: min(1640px, calc(100% - 28px));
  max-width: 1640px;
}

.schema-mapping-page .wrap {
  width: 100%;
}

.schema-mapping-page .business-grid.field-grid,
.schema-mapping-page .field-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.schema-mapping-page .field-grid .item {
  min-width: 0;
  padding: 10px;
}

.schema-mapping-page .field-grid .item label {
  display: grid;
  gap: 3px;
  min-width: 0;
  margin: 0 0 7px;
}

.schema-mapping-page .mapping-title {
  min-width: 0;
  color: var(--white);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.schema-mapping-page .key {
  margin-top: 0;
  font-size: 9.5px;
  line-height: 1.15;
}

.schema-mapping-page .field-select,
.schema-mapping-page .table-select {
  width: 100%;
  min-width: 0;
  height: 34px;
  min-height: 34px;
  padding: 0 28px 0 8px;
  font-size: 10.5px;
  font-weight: 700;
}

.admin-config-page .config-section {
  padding: 0;
  overflow: hidden;
}

.admin-config-page .config-section > summary.section-head {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  margin: 0;
}

.admin-config-page .config-section > summary.section-head::-webkit-details-marker {
  display: none;
}

.admin-config-page .config-section > summary.section-head::after {
  content: "+";
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,210,31,0.12);
  color: var(--gold);
  border: 1px solid var(--line-gold);
  font-weight: 900;
}

.admin-config-page .config-section[open] > summary.section-head::after {
  content: "-";
}

.admin-config-page .config-section .section-body {
  padding: 0 18px 18px;
}

.admin-config-page .item.unmapped,
.admin-config-page .field-select.unmapped,
.admin-config-page .table-select.unmapped {
  border-color: var(--red);
  box-shadow: 0 0 0 2px rgba(225,29,36,.18);
}

.admin-config-page .item.unmapped label::after {
  content: "UNMAPPED";
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 9px;
  font-weight: 900;
}

.admin-config-page .switch-panel {
  position: sticky;
  top: 12px;
  background: var(--panel-strong);
  border: 1px solid var(--line-gold);
  border-radius: var(--radius-md);
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.admin-config-page .switch-group,
.admin-config-page .data-panel {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 9px 0 0;
  padding: 10px;
}

.admin-config-page .switch-title {
  color: var(--gold);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
}

.admin-config-page .switch-title::-webkit-details-marker {
  display: none;
}

.admin-config-page .switch-label,
.admin-config-page .setting-label {
  color: var(--white);
  font-size: 12px;
  font-weight: 800;
}

.admin-config-page #mysqlSettingsBox {
  margin-top: 14px;
}

.admin-config-page .actions {
  position: sticky;
  bottom: 0;
  display: block;
  /*background: linear-gradient(180deg, rgba(5,5,5,0), rgba(5,5,5,.96) 35%);*/
  padding: 22px 0 0;
}

.admin-config-page .actions button {
  width: 100%;
}

.admin-config-page .number-setting {
  max-width: 90px;
}

.admin-config-page .theme-settings-layout {
  gap: 22px;
  margin-top: 18px;
}

.admin-config-page .theme-panel {
  background: rgba(255,255,255,0.075);
  border: 1px solid var(--line-gold);
  border-radius: var(--radius-sm);
  padding: 18px;
}

.admin-config-page .theme-panel-head {
  min-height: 38px;
}

.admin-config-page .theme-save-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.admin-config-page .theme-preset-row,
.admin-config-page .theme-color-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
}

.admin-config-page .theme-preset-row strong,
.admin-config-page .theme-color-field .setting-label {
  min-width: 0;
  color: var(--white);
  font-size: 13px;
}

.admin-config-page .theme-preset-actions,
.admin-config-page .theme-color-choice {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.admin-config-page .theme-color-grid {
  grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
}

.admin-config-page .text-setting {
  max-width: 160px;
}

.theme-color-control {
  min-height: 40px;
  padding: 4px;
  cursor: pointer;
}

.restore-theme-btn {
  width: auto;
}

.suffix-combo {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(140px, 1fr);
  gap: 10px;
  align-items: center;
}

.suffix-combo .suffix-fixed-input.hidden {
  display: none;
}

.customer-id-grid .setting-field:has(.suffix-combo) {
  grid-column: span 2;
}

/* Registration */
.registration-page .app,
.registration-shell {
  max-width: 660px;
  padding-left: 14px;
  padding-right: 14px;
}

.registration-shell form {
  display: grid;
  gap: 7px;
}

.registration-shell .flow-card,
.registration-shell .primary-card,
.registration-shell .info-panel {
  padding: 16px;
  border-radius: 18px;
}

.registration-shell label {
  margin: 7px 0 3px;
  line-height: 1.15;
}

.registration-secondary {
  width: 100%;
  margin-top: 2px;
}

.otp-panel {
  margin: 4px 0 2px;
  padding: 10px;
  border: 1px solid var(--line-gold);
  border-radius: 12px;
  background: rgba(255, 210, 31, 0.08);
}

.otp-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--gold);
  font-size: 14px;
}

#otpHelp {
  margin: 8px 0 10px;
  font-size: 13px;
}

#otpCountdown {
  min-width: 58px;
  text-align: right;
  color: var(--white);
  font-weight: 900;
}

#successMessage {
  color: var(--white);
  margin-top: 4px;
}

.optional-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

#customerName,
#address {
  text-transform: uppercase;
}

#email {
  text-transform: lowercase;
}

.nassco-select-wrap {
  position: relative;
  width: 100%;
  margin: 0;
}

.nassco-select-wrap::after {
  content: none;
}

.vehicle-row {
  display: grid;
  grid-template-columns: minmax(155px, 1.1fr) minmax(155px, 1.1fr) minmax(135px, .95fr) 36px;
  gap: 8px;
  align-items: center;
}

.vehicle-row .vehicle-plate,
.vehicle-remove {
  height: 38px;
}

.vehicle-remove {
  min-height: 38px;
  width: 36px;
  padding: 0;
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
  background: rgba(225, 29, 36, 0.72);
}

.qr-download-card.qr-preview-card {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-areas: "img meta" "img actions";
  column-gap: 12px;
  row-gap: 8px;
  align-items: center;
  width: 100%;
  padding-top: 15px;
  padding-bottom: 15px;
}

.qr-download-card.qr-preview-card .qr-preview-img {
  grid-area: img;
  width: 220px;
  height: auto;
  padding: 0;
  border-radius: 10px;
  align-self: center;
  justify-self: center;
}

.qr-download-card.qr-preview-card .qr-preview-meta {
  grid-area: meta;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-self: start;
}

.qr-download-card.qr-preview-card .qr-preview-meta strong {
  color: var(--gold);
}

.qr-download-card.qr-preview-card .qr-preview-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.qr-card-warning {
  color: var(--gold);
  font-size: 12px;
  line-height: 1.35;
}

.qr-download-card.qr-preview-card .qr-preview-actions .qr-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 70px;
  max-width: 70px;
  min-height: 36px;
  border: 0;
  border-radius: var(--radius-md);
  padding: 8px 10px;
  color: var(--white);
  cursor: pointer;
  font-weight: 900;
  letter-spacing: 0.1px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  font-size: 13px;
  text-align: center;
  box-shadow: 0 14px 28px rgba(122, 0, 8, 0.34);
}

.register-again-card {
  margin-top: 10px;
  padding-top: 20px;
}

/* QR cards */
.print-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86mm, 86mm));
  gap: 8mm;
  justify-content: center;
}

.saved-qr-card-shell {
  width: 86mm;
  min-height: 64mm;
  display: flex;
  page-break-inside: avoid;
  break-inside: avoid;
}

.saved-qr-card-img {
  width: 86mm;
  height: auto;
  display: block;
  border-radius: 16px;
  box-shadow: 0 18px 34px rgba(0,0,0,0.22);
}

.saved-qr-card-missing {
  width: 86mm;
  min-height: 64mm;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 16px;
  border: 1px dashed rgba(255,255,255,0.28);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

.saved-qr-card-missing strong {
  color: var(--white);
}

/* Deploy helper */
.deploy-page .box {
  max-width: 760px;
  margin: 30px auto;
  background: var(--panel);
  border: 1px solid var(--line-gold);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.deploy-page .note {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.deploy-page .danger {
  background: rgba(97,73,0,.72);
  border: 1px solid var(--line-gold);
  padding: 12px;
  border-radius: var(--radius-sm);
  margin: 16px 0 16px 0;;
}

.deploy-page .ok,
.deploy-page .err {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.45;
}

.deploy-page .ok {
  background: rgba(8, 95, 45, 0.86);
  border: 1px solid rgba(77, 209, 119, 0.76);
  color: #d8ffe0;
}

.deploy-page .err {
  background: rgba(120, 0, 0, 0.86);
  border: 1px solid rgba(255, 120, 120, 0.76);
  color: #ffe0e0;
}

.deploy-page .danger label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.deploy-page .deploy-preview-form {
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line-soft);
}

.deploy-page .deploy-choice-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin: 12px 0 18px;
}

.deploy-page .deploy-choice-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 9px 10px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.04);
  font-size: 14px;
  font-weight: 800;
}

.deploy-page .deploy-button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.deploy-page input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  height: 18px;
  flex: 0 0 18px;
  accent-color: var(--gold);
}

#debugBtn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 9999;
  width: auto;
  background: #c00000;
  padding: 10px 14px;
  border-radius: 8px;
}

@media screen and (max-width: 900px) {
  .admin-config-page .page,
  .step-row,
  .summary,
  .status-strip,
  .setup-grid,
  .customer-id-grid,
  .step2-review-grid {
    grid-template-columns: 1fr;
  }

  .admin-config-page .page {
    display: block;
  }

  .test-runs-page .test-status-strip {
    grid-template-columns: 1fr;
  }

  .admin-config-page .switch-panel {
    position: static;
    margin-top: 18px;
  }

  .admin-config-page .business-grid.field-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media screen and (max-width: 760px) {
  .actions {
    grid-template-columns: 1fr 1fr;
  }

  .vehicle-row {
    grid-template-columns: 1fr;
  }

  .vehicle-remove {
    width: 100%;
  }

  .print-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .saved-qr-card-shell,
  .saved-qr-card-img,
  .saved-qr-card-missing {
    width: min(100%, 360px);
    margin: 0 auto;
  }
}

@media print {
  .print-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, 1fr);
    justify-content: center;
    gap: 6mm;
  }
}
