/* Muse CDK — emerald + gold luxury theme. No purple anywhere. */
:root {
  --emerald: #10b981;
  --emerald-bright: #34d399;
  --emerald-deep: #059669;
  --teal: #0d9488;
  --gold: #d4af37;
  --gold-light: #efd98a;
  --gold-deep: #a67c00;
  --danger: #f87171;
  --radius: 18px;
}

html[data-theme="dark"] {
  --bg: #0a0e0c;
  --surface: #121915;
  --surface-2: #0e130f;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f7f4;
  --muted: #98a39b;
  --input-bg: #0b100d;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --glow-emerald: 0 0 60px rgba(16, 185, 129, 0.22);
  --glow-gold: 0 0 40px rgba(212, 175, 55, 0.14);
  --banner-bg: rgba(212, 175, 55, 0.1);
  --banner-border: rgba(212, 175, 55, 0.35);
  --success-bg: rgba(16, 185, 129, 0.1);
  --success-border: rgba(16, 185, 129, 0.35);
  --error-bg: rgba(248, 113, 113, 0.09);
  --error-border: rgba(248, 113, 113, 0.35);
  --grad-text: linear-gradient(90deg, #34d399 0%, #a7e8c5 40%, #d4af37 100%);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f5f7f3;
  --surface: #ffffff;
  --surface-2: #eef1ea;
  --border: rgba(15, 21, 18, 0.1);
  --border-strong: rgba(15, 21, 18, 0.18);
  --text: #0f1512;
  --muted: #5b665e;
  --input-bg: #f7f9f5;
  --shadow: 0 18px 40px rgba(15, 21, 18, 0.12);
  --glow-emerald: 0 0 50px rgba(16, 185, 129, 0.18);
  --glow-gold: 0 0 36px rgba(212, 175, 55, 0.16);
  --banner-bg: rgba(212, 175, 55, 0.12);
  --banner-border: rgba(166, 124, 0, 0.4);
  --success-bg: rgba(5, 150, 105, 0.08);
  --success-border: rgba(5, 150, 105, 0.35);
  --error-bg: rgba(220, 38, 38, 0.06);
  --error-border: rgba(220, 38, 38, 0.3);
  --grad-text: linear-gradient(90deg, #059669 0%, #0d9488 45%, #a67c00 100%);
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(600px 300px at 50% -80px, rgba(16, 185, 129, 0.14), transparent 70%),
    radial-gradient(500px 260px at 85% 110%, rgba(212, 175, 55, 0.08), transparent 70%);
}

a { color: var(--emerald-bright); }
html[data-theme="light"] a { color: var(--emerald-deep); }

.wrap { max-width: 600px; margin: 0 auto; padding: 0 18px 48px; }

/* ---------- header ---------- */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 0 6px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.logo {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #10b981, #0d9488);
  box-shadow: var(--glow-emerald);
  color: #04120c; flex: none;
}
.logo svg { width: 22px; height: 22px; }
.brand-name { font-size: 19px; font-weight: 800; letter-spacing: 0.2px; line-height: 1.05; }
.brand-sub { font-size: 10.5px; font-weight: 700; letter-spacing: 3.5px; color: var(--gold); }
.header-actions { display: flex; align-items: center; gap: 9px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; }
.admin-btn {
  display: flex; align-items: center; gap: 7px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: 999px; padding: 9px 15px;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.admin-btn:hover { border-color: var(--gold); }
.admin-btn svg { width: 15px; height: 15px; }

/* ---------- hero ---------- */
.hero { text-align: center; padding: 26px 0 8px; }
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--gold-light);
  border: 1px solid var(--banner-border); background: var(--banner-bg);
  padding: 6px 13px; border-radius: 999px;
}
html[data-theme="light"] .badge { color: var(--gold-deep); }
.badge svg { width: 13px; height: 13px; }
.hero-icon {
  width: 72px; height: 72px; margin: 22px auto 14px; border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #10b981, #0d9488);
  box-shadow: var(--glow-emerald);
  color: #04120c;
}
.hero-icon svg { width: 36px; height: 36px; }
h1 {
  font-size: 38px; line-height: 1.1; margin: 0 0 10px; font-weight: 800;
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-sub { color: var(--muted); font-size: 15.5px; line-height: 1.55; margin: 0 auto 22px; max-width: 460px; }

/* ---------- steps ---------- */
.steps {
  list-style: none; display: flex; justify-content: center; gap: 0;
  padding: 0; margin: 0 0 26px;
}
.steps li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.steps li + li::before {
  content: ""; width: 26px; height: 2px; background: var(--border-strong);
  margin: 0 10px; border-radius: 2px;
}
.step-dot {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--border-strong); background: var(--surface);
  font-size: 13px; font-weight: 700; color: var(--muted);
}
.steps li.active { color: var(--text); }
.steps li.active .step-dot {
  background: var(--emerald); border-color: var(--emerald); color: #04120c;
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.5);
}
.steps li.done { color: var(--gold-light); }
html[data-theme="light"] .steps li.done { color: var(--gold-deep); }
.steps li.done .step-dot {
  background: var(--gold); border-color: var(--gold); color: #241a00;
}

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card-head { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 6px; }
.card-icon {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(16, 185, 129, 0.13); color: var(--emerald-bright);
  border: 1px solid rgba(16, 185, 129, 0.25);
}
html[data-theme="light"] .card-icon { color: var(--emerald-deep); }
.card-icon svg { width: 21px; height: 21px; }
.card h2 { font-size: 18px; margin: 2px 0 4px; }
.card p.desc { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0 0 18px 0; }
.card p.desc.small { font-size: 13px; }

label.field-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; margin-bottom: 8px;
}
label.field-label svg { width: 15px; height: 15px; color: var(--gold); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"] {
  width: 100%; padding: 13px 15px; font-size: 15px;
  border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--input-bg); color: var(--text); outline: none;
  font-family: inherit;
}
input:focus { border-color: var(--emerald); box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.22); }
input::placeholder { color: var(--muted); opacity: 0.75; }
input.upper { text-transform: uppercase; }

.btn {
  width: 100%; padding: 14px; margin-top: 16px;
  border: none; border-radius: 12px; cursor: pointer;
  font-size: 15.5px; font-weight: 700; font-family: inherit;
  background: linear-gradient(135deg, #10b981, #0d9488);
  color: #04120c;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.32);
  transition: filter 0.15s, transform 0.05s;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: scale(0.99); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn svg { width: 17px; height: 17px; }
.btn.gold {
  background: linear-gradient(135deg, #d4af37, #b8860b);
  color: #241a00;
  box-shadow: 0 8px 24px rgba(212, 175, 55, 0.3);
}
.btn.ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border-strong); box-shadow: none;
}
.btn.small { width: auto; padding: 9px 16px; font-size: 13.5px; margin-top: 0; }

.helper { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 12.5px; margin: 13px 0 0; text-align: center; }
.helper svg { width: 13px; height: 13px; flex: none; }
.error {
  display: none; margin-top: 13px; padding: 11px 13px; border-radius: 10px;
  background: var(--error-bg); border: 1px solid var(--error-border);
  color: var(--danger); font-size: 13.5px; line-height: 1.5;
}
.error.show { display: block; }

.amount-banner {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--banner-border); background: var(--banner-bg);
  border-radius: 14px; padding: 15px 17px; margin-bottom: 18px;
}
.amount-banner .ticket { color: var(--gold); flex: none; }
.amount-banner .ticket svg { width: 24px; height: 24px; }
.amount-banner .amt { font-size: 17px; font-weight: 800; }
.amount-banner .amt span { color: var(--gold-light); }
html[data-theme="light"] .amount-banner .amt span { color: var(--gold-deep); }
.amount-banner .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.amount-banner .change { margin-left: auto; font-size: 13px; font-weight: 600; background: none; border: none; color: var(--emerald-bright); cursor: pointer; padding: 4px; }
html[data-theme="light"] .amount-banner .change { color: var(--emerald-deep); }

/* ---------- result ---------- */
.result { text-align: center; padding: 8px 0 2px; }
.result-icon {
  width: 66px; height: 66px; margin: 6px auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.result-icon svg { width: 32px; height: 32px; }
.result-icon.ok { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--emerald-bright); }
.result-icon.bad { background: var(--error-bg); border: 1px solid var(--error-border); color: var(--danger); }
.result-icon.wait { background: var(--banner-bg); border: 1px solid var(--banner-border); color: var(--gold); }
.result h2 { margin: 0 0 8px; font-size: 21px; }
.result p { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0 0 6px; }
.result .order-no {
  display: inline-block; margin-top: 10px; padding: 8px 14px;
  border: 1px dashed var(--border-strong); border-radius: 10px;
  font-size: 13.5px; font-weight: 700; letter-spacing: 0.4px;
}
.spinner {
  width: 30px; height: 30px; border-radius: 50%;
  border: 3px solid rgba(212, 175, 55, 0.25); border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- history ---------- */
.history-toggle {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 14px; font-weight: 600; padding: 6px 0 14px;
  font-family: inherit;
}
.history-toggle:hover { color: var(--text); }
.history-toggle svg { width: 16px; height: 16px; }
.history-panel { display: none; }
.history-panel.open { display: block; }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab {
  flex: 1; padding: 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); font-size: 13.5px; font-weight: 600; font-family: inherit;
}
.tab.active { background: rgba(16, 185, 129, 0.13); border-color: rgba(16, 185, 129, 0.4); color: var(--emerald-bright); }
html[data-theme="light"] .tab.active { color: var(--emerald-deep); }
.hist-item {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 13px 15px; margin-bottom: 10px; background: var(--surface-2);
}
.hist-item .row1 { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 700; }
.hist-item .row2 { color: var(--muted); font-size: 12.5px; margin-top: 5px; line-height: 1.5; }
.pill { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.pill.processing { background: var(--banner-bg); color: var(--gold-light); border: 1px solid var(--banner-border); }
html[data-theme="light"] .pill.processing { color: var(--gold-deep); }
.pill.delivered { background: var(--success-bg); color: var(--emerald-bright); border: 1px solid var(--success-border); }
html[data-theme="light"] .pill.delivered { color: var(--emerald-deep); }
.pill.failed { background: var(--error-bg); color: var(--danger); border: 1px solid var(--error-border); }
.pill.active { background: var(--success-bg); color: var(--emerald-bright); border: 1px solid var(--success-border); }
html[data-theme="light"] .pill.active { color: var(--emerald-deep); }
.pill.used { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border-strong); }
.pill.locked { background: var(--banner-bg); color: var(--gold-light); border: 1px solid var(--banner-border); }
html[data-theme="light"] .pill.locked { color: var(--gold-deep); }
.pill.deactivated { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border-strong); }
.empty { text-align: center; color: var(--muted); font-size: 13.5px; padding: 18px 0 8px; line-height: 1.6; }

/* ---------- features / footer ---------- */
.features { display: flex; justify-content: space-around; gap: 10px; padding: 12px 0 20px; }
.feature { text-align: center; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.feature b { display: block; color: var(--text); font-size: 13.5px; margin-bottom: 3px; }
.feature svg { width: 20px; height: 20px; color: var(--gold); margin-bottom: 7px; }
footer { text-align: center; color: var(--muted); font-size: 12.5px; padding-top: 8px; line-height: 1.7; }
footer .gold { color: var(--gold); font-weight: 700; }

/* ---------- admin ---------- */
.back-link { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; color: var(--muted); font-size: 13.5px; cursor: pointer; padding: 0; margin-bottom: 16px; font-family: inherit; }
.back-link:hover { color: var(--text); }
.back-link svg { width: 15px; height: 15px; }
.field { margin-bottom: 14px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--muted); cursor: pointer; padding: 6px; display: flex; }
.pw-toggle svg { width: 18px; height: 18px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.stat { border: 1px solid var(--border); border-radius: 13px; padding: 13px 10px; text-align: center; background: var(--surface-2); }
.stat .num { font-size: 21px; font-weight: 800; }
.stat .num.gold { color: var(--gold); }
.stat .num.green { color: var(--emerald-bright); }
html[data-theme="light"] .stat .num.green { color: var(--emerald-deep); }
.stat .lbl { font-size: 11.5px; color: var(--muted); margin-top: 3px; font-weight: 600; }
.admin-section h3 { font-size: 16px; margin: 0 0 12px; }
.form-row { display: flex; gap: 10px; }
.form-row .grow { flex: 1; }
.form-row input { margin-bottom: 0; }
.muted-note { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin: 10px 0 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.6px; padding: 8px 6px; border-bottom: 1px solid var(--border); }
td { padding: 10px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
td code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.table-wrap { overflow-x: auto; }
.mini-btn {
  background: none; border: 1px solid var(--border-strong); color: var(--text);
  border-radius: 8px; padding: 5px 10px; font-size: 12px; font-weight: 600;
  cursor: pointer; margin-right: 5px; font-family: inherit; white-space: nowrap;
}
.mini-btn:hover { border-color: var(--gold); }
.mini-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.wallet-box {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px solid var(--banner-border); background: var(--banner-bg);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 18px; font-size: 13.5px;
}
.wallet-box b { color: var(--gold-light); }
html[data-theme="light"] .wallet-box b { color: var(--gold-deep); }
.wallet-box .warn { color: var(--danger); font-weight: 700; }
.hidden { display: none !important; }
@media (max-width: 480px) {
  h1 { font-size: 31px; }
  .card { padding: 20px 17px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .steps li { font-size: 11.5px; }
}
