:root {
  --bg: #05080f;
  --surface: #0c1220;
  --surface-hover: #121a2c;
  --border: rgba(212, 175, 55, 0.2);
  --text: #f3efe6;
  --muted: #94a0b8;
  --accent: #c9a227;
  --accent-hover: #e4c04a;
  --gold: #d4af37;
  --gold-soft: rgba(212, 175, 55, 0.14);
  --success: #34d399;
  --error: #f87171;
  --warning: #fbbf24;
  --radius: 12px;
  --font-display: 'Cinzel', Georgia, serif;
  --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100vh;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a {
  color: var(--accent);
  text-decoration: none;
}

button {
  cursor: pointer;
  border: none;
  font-family: inherit;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 0.9rem;
}

.wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px;
}

.card-wide {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

.title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid var(--error);
  color: var(--error);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  margin-bottom: 12px;
  outline: none;
  font-size: 0.9rem;
}

.button {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  transition: background var(--radius) ease, opacity 0.15s ease;
}

.button:hover:not(:disabled) {
  background: var(--accent-hover);
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.field {
  margin-bottom: 4px;
}

.label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
}

.hidden {
  display: none !important;
}

.loading-text {
  color: var(--gold);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.loading-text {
  color: var(--gold);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.balance-badge {
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid rgba(212, 175, 55, 0.25);
}

.logout-btn {
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--error);
  font-size: 0.8rem;
  font-weight: 600;
}

.tab-row {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.tab-btn {
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border);
}

.tab-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.selected-banner {
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 0.85rem;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid rgba(212, 175, 55, 0.2);
}

.selected-banner button {
  background: none;
  border: none;
  color: var(--error);
  font-size: 0.8rem;
}

.voucher-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.voucher-card {
  padding: 14px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.88rem;
}

.voucher-card.selected {
  border-color: var(--accent);
  background: var(--gold-soft);
}

.voucher-card small {
  color: var(--muted);
  display: block;
  margin: 4px 0;
}

/* User voucher images: keep full image visible (no crop). */
.mcd-voucher-grid .voucher-card img,
#saved-panel .voucher-card img,
.voucher-grid .voucher-card img {
  width: 100% !important;
  height: auto !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center center !important;
  display: block;
  border-radius: 8px;
}

.select-btn {
  margin-top: 10px;
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
}

.log-section {
  margin-top: 20px;
}

.log-tabs {
  margin-bottom: 12px;
}

.history-scroll {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg);
  font-size: 0.82rem;
}

.history-table thead th {
  position: sticky;
  top: 0;
  text-align: left;
  padding: 10px 12px;
  background: var(--surface-hover);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.history-table td {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  vertical-align: top;
}

.history-table td:first-child {
  white-space: nowrap;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.history-empty-row td {
  color: var(--muted);
  text-align: center;
}

.redirect-card {
  width: 100%;
  max-width: 420px;
  padding: 32px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
}

.redirect-card .title {
  font-size: 1.3rem;
  margin-bottom: 12px;
}

.redirect-text {
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.redirect-button {
  display: inline-block;
  padding: 14px 24px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.redirect-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
}

.redirect-actions .redirect-button {
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}

.redirect-actions .mcd-btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.login-field {
  margin-bottom: 16px;
}

.login-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--muted);
}

.admin-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 1.2rem;
  font-weight: 700;
}

.admin-logout {
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.85rem;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 8px 18px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.tab.active {
  background: var(--accent);
  color: #fff;
}

.main {
  flex: 1;
  padding: 24px;
}

.form-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.form-row .input {
  flex: 1;
  min-width: 140px;
  margin-bottom: 0;
}

.input-sm {
  width: 120px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.add-btn {
  padding: 10px 18px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}

.table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.table-header {
  display: flex;
  padding: 12px 16px;
  background: var(--bg);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.table-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}

.row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}

.table-empty {
  padding: 16px;
  color: var(--muted);
}

.badge {
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge.on {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.badge.off {
  background: rgba(239, 68, 68, 0.15);
  color: var(--error);
}

.badge.info {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent);
}

.tx-row-unpaid {
  opacity: 0.92;
  background: rgba(239, 68, 68, 0.04);
}

.small-btn {
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--surface-hover);
  color: var(--text);
  font-size: 0.78rem;
  border: 1px solid var(--border);
}

.small-btn.danger {
  color: var(--error);
}

.mono {
  font-family: monospace;
}

.mono.license-ready {
  color: #ffe08a;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.pw-card {
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
}

.pw-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.pw-msg {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.pw-msg.ok {
  background: rgba(34, 197, 94, 0.12);
  color: var(--success);
  border: 1px solid var(--success);
}

.pw-msg.err {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border: 1px solid var(--error);
}

.col-2 {
  flex: 2;
}

.col-1 {
  flex: 1;
}

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

.health-monitor-status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}

.health-monitor-pill {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.health-monitor-pill.ok {
  background: rgba(34, 197, 94, 0.14);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.28);
}

.health-monitor-pill.warn {
  background: rgba(245, 158, 11, 0.14);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.28);
}

.health-monitor-pill.error {
  background: rgba(239, 68, 68, 0.14);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.28);
}

.health-monitor-text {
  font-size: 0.84rem;
  color: var(--muted);
}

.health-monitor-note {
  font-size: 0.82rem;
  color: var(--text-dim);
}

@media (max-width: 640px) {
  input,
  select,
  textarea,
  button,
  .input,
  .button {
    font-size: 16px !important;
  }

  .input,
  .button,
  .logout-btn,
  .admin-logout,
  .topup-btn,
  .tab-btn {
    min-height: 44px;
  }

  .wrapper {
    padding: 12px;
  }

  .card,
  .card-wide {
    padding: 18px 14px;
    border-radius: 14px;
  }

  .redirect-card {
    padding: 20px 14px;
    border-radius: 14px;
  }

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

  .history-scroll {
    max-height: 56vh;
  }

  .history-table {
    font-size: 0.9rem;
  }

  .history-table thead th {
    font-size: 0.74rem;
    padding: 10px;
  }

  .history-table td {
    padding: 11px 10px;
  }

  .admin-header {
    padding: 12px 16px;
  }

  .logo {
    font-size: 1.05rem;
  }

  .main {
    padding: 16px;
  }

  .tabs {
    padding: 10px 12px;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar {
    display: none;
  }
  .tab {
    white-space: nowrap;
    flex: 0 0 auto;
    padding: 9px 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .form-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .form-row .input,
  .form-row .input-sm,
  .form-row .add-btn {
    width: 100%;
    min-width: 0;
  }
  .add-btn {
    padding: 12px 18px;
  }

  .table {
    background: transparent;
    border: none;
    border-radius: 0;
    overflow: visible;
  }
  .table-header {
    display: none;
  }
  .table-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 14px;
    margin-bottom: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
  }
  .row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 14px;
    margin-bottom: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
  }
  .table-row > span {
    flex: none !important;
    width: 100%;
  }
  .row > span {
    flex: none !important;
    width: 100%;
  }
  .table-row > span:first-child {
    display: block;
    padding-bottom: 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
  }
  .row > span:first-child {
    display: block;
    padding-bottom: 8px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
  }
  .table-row > span[data-label] {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }
  .row > span[data-label] {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }
  .table-row > span[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex: 0 0 auto;
  }
  .row > span[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex: 0 0 auto;
  }
  .table-row span[data-label] .input-sm {
    width: 120px;
  }
  .row-actions {
    width: 100%;
    gap: 8px;
    padding-top: 4px;
  }
  .row-actions .small-btn {
    flex: 1;
    padding: 10px;
    text-align: center;
  }

  .pw-card {
    max-width: 100%;
    padding: 18px;
  }

  .admin-logout {
    min-height: 40px;
    font-size: 0.84rem;
  }

  .license-search-box .button,
  .license-search-box .logout-btn,
  .license-search-box .admin-logout {
    width: 100%;
    min-height: 42px;
  }

  .admin-layout {
    width: 100%;
    overflow-x: hidden;
  }

  .admin-header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }

  .header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .header-actions .admin-logout,
  .header-actions button.admin-logout {
    width: 100%;
    min-height: 44px;
    padding: 10px 10px;
    text-align: center;
    white-space: normal;
    line-height: 1.2;
  }

  .main {
    padding: 12px;
  }

  .row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 8px;
  }

  .row-actions .small-btn {
    width: 100%;
  }

  .table-row > span[data-label],
  .row > span[data-label] {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .table-row > span[data-label]::before,
  .row > span[data-label]::before {
    line-height: 1.1;
  }

  .table-row span[data-label] .input-sm {
    width: 100%;
  }

  .license-search-box {
    grid-template-columns: 1fr;
  }

  .license-metrics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .logo {
    font-size: 0.95rem;
    letter-spacing: 0.04em;
  }

  .header-actions {
    grid-template-columns: 1fr;
  }
}

.voucher-thumb {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: 8px;
  margin-bottom: 8px;
  display: block;
}

.voucher-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hover);
  color: var(--muted);
  font-size: 1.6rem;
  font-weight: 700;
}

.voucher-form-card {
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 24px;
}

.vform {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vform .input {
  margin-bottom: 0;
}

.vform-actions {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.vform-actions .button {
  flex: 1;
  width: auto;
}

.voucher-toggle {
  margin-bottom: 16px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}

.file-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
}

.file-field:hover {
  border-color: var(--accent);
  color: var(--text);
}

.img-preview {
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.voucher-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.vcard {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.vcard.is-disabled {
  opacity: 0.55;
}

.vthumb {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 10px;
}

.vthumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-hover);
  color: var(--muted);
  font-size: 1.4rem;
  font-weight: 700;
}

.vbody {
  flex: 1;
  min-width: 0;
}

.vtitle {
  display: block;
}

.vsub {
  display: block;
  color: var(--muted);
  margin: 2px 0;
}

.vmeta {
  font-size: 0.78rem;
  color: var(--muted);
  font-family: monospace;
}

.vside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.vactions {
  display: flex;
  gap: 6px;
}

@media (max-width: 640px) {
  .voucher-form-card {
    max-width: 100%;
  }
  .vcard {
    flex-wrap: wrap;
  }
  .vbody {
    flex: 1 1 60%;
  }
  .vside {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .vactions {
    flex: 1;
  }
  .vactions .small-btn {
    flex: 1;
    padding: 9px;
  }
}

.topup-btn {
  background: var(--accent);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
}

.topup-btn:hover {
  background: var(--accent-hover);
}

.topup-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}

.topup-modal.hidden {
  display: none;
}

.topup-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}

@media (max-width: 640px) {
  .topup-card {
    padding: 16px 12px;
    border-radius: 14px;
  }

  .topup-close {
    min-width: 40px;
    min-height: 40px;
  }
}

.topup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.topup-close {
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  padding: 4px 8px;
}

.topup-presets {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 8px 0 12px;
}

.topup-preset {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-size: 0.85rem;
}

.topup-preset:hover {
  border-color: var(--accent);
}

.topup-pay-line {
  text-align: center;
  margin: 12px 0 4px;
}

.topup-meta {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

#topup-qr-canvas {
  display: block;
  margin: 0 auto 12px;
  border-radius: 8px;
  background: #fff;
  padding: 8px;
}

.topup-status {
  text-align: center;
  margin-bottom: 12px;
  color: var(--warning);
}

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

.button.secondary {
  background: var(--surface-hover);
  color: var(--text);
  border: 1px solid var(--border);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* ── FN CREATIVE · MCD Theme ── */
.mcd-body {
  position: relative;
  overflow-x: hidden;
}

.mcd-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 80%, rgba(15, 40, 70, 0.35), transparent 40%),
    linear-gradient(180deg, #030508 0%, #05080f 40%, #070c16 100%);
}

.mcd-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d4af37' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.mcd-banner-top,
.mcd-banner-wrap,
.mcd-main,
.mcd-footer,
.mcd-body > .wrapper,
.mcd-body > main,
.mcd-body > .admin-layout {
  position: relative;
  z-index: 1;
}

.mcd-banner-top {
  max-width: 920px;
  margin: 20px auto 0;
  padding: 0 16px;
}

.mcd-banner {
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid rgba(212, 175, 55, 0.25);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  display: block;
}

.mcd-main {
  max-width: 920px;
  margin: 0 auto;
  padding: 8px 16px 32px;
}

.mcd-panel {
  background: linear-gradient(145deg, rgba(12, 18, 32, 0.95), rgba(8, 12, 22, 0.98));
  border: 1px solid rgba(212, 175, 55, 0.22);
  border-radius: 18px;
  padding: 28px 24px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
}

.mcd-panel-wide {
  padding: 24px 22px;
}

.mcd-panel-head,
.mcd-dash-header {
  margin-bottom: 20px;
}

.mcd-dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.12);
}

.mcd-user-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.mcd-guide-item {
  border: 1px solid rgba(212, 175, 55, 0.2);
  background: rgba(9, 14, 24, 0.75);
  border-radius: 10px;
  padding: 10px 12px;
  color: #d8e0ef;
  font-size: 0.8rem;
  line-height: 1.45;
}

.mcd-guide-item strong {
  color: var(--gold);
}

.mcd-quick-actions-wrap {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.mcd-quick-btn {
  min-width: 62px;
  padding: 7px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.18), rgba(212, 175, 55, 0.08));
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 700;
}

.mcd-quick-btn:hover {
  border-color: rgba(228, 192, 74, 0.55);
  color: #f3d67a;
}

.mcd-quick-hint {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 8px;
  color: #d1b972;
}

.mcd-step {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid rgba(212, 175, 55, 0.2);
  padding: 4px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}

.mcd-title {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, 1.55rem);
  font-weight: 600;
  color: #fff;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}

.mcd-desc {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 18px;
}

.mcd-desc em {
  color: var(--gold);
  font-style: normal;
  font-weight: 600;
}

.mcd-input {
  background: rgba(5, 8, 15, 0.8);
  border-color: rgba(212, 175, 55, 0.18);
}

.mcd-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
}

.mcd-btn-primary {
  background: linear-gradient(135deg, #b8922a, #e4c04a);
  color: #1a1205;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-top: 4px;
  box-shadow: 0 8px 20px rgba(180, 142, 33, 0.25);
}

.mcd-btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #d4af37, #f0d78c);
}

.mcd-btn-gold {
  background: linear-gradient(135deg, #b8922a, #d4af37);
  color: #1a1205;
  font-weight: 700;
  border: none;
  min-width: 120px;
}

.mcd-btn-gold:hover {
  background: linear-gradient(135deg, #d4af37, #e8c956);
}

.mcd-btn-ghost {
  background: transparent;
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: var(--muted);
}

.mcd-btn-ghost:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.mcd-hints {
  list-style: none;
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 10px;
  background: rgba(212, 175, 55, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.1);
}

.mcd-hints li {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 4px 0 4px 18px;
  position: relative;
  line-height: 1.45;
}

.mcd-hints li::before {
  content: '◆';
  position: absolute;
  left: 0;
  color: var(--gold);
  font-size: 0.55rem;
  top: 8px;
}

.mcd-hints strong {
  color: var(--gold);
}

.mcd-trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.mcd-trust-item {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(212, 175, 55, 0.12);
  border: 1px solid rgba(212, 175, 55, 0.25);
  color: #e7cc7a;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.license-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 8px;
  padding: 7px 12px;
  font-size: 0.78rem;
  min-height: 34px;
}

.mcd-inline-action {
  margin-top: 10px !important;
}

.mcd-panel .error {
  border-radius: 10px;
}

.mcd-dash-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.mcd-balance {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 120px;
}

.mcd-balance-label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.85;
}

.mcd-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 10px;
  opacity: 0.85;
}

.mcd-tabs .tab-btn.active {
  background: linear-gradient(135deg, #b8922a, #d4af37);
  color: #1a1205;
  border-color: transparent;
}

.mcd-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.mcd-field-note {
  margin: 2px 0 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.mcd-mini-note {
  margin-top: 6px;
  color: #cdb778;
  font-size: 0.78rem;
}

.mcd-voucher-grid {
  margin-bottom: 8px;
}

.mcd-voucher-grid .voucher-card {
  border-color: rgba(212, 175, 55, 0.25);
  background: linear-gradient(160deg, rgba(8, 12, 20, 0.9), rgba(5, 8, 14, 0.95));
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}

.mcd-voucher-grid .voucher-card:hover {
  transform: translateY(-1px);
  border-color: rgba(212, 175, 55, 0.45);
}

.mcd-table-wrap {
  border-color: rgba(212, 175, 55, 0.15);
}

.mcd-log {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid rgba(212, 175, 55, 0.1);
}

.mcd-footer {
  max-width: 920px;
  margin: 0 auto;
  padding: 16px 20px 28px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.mcd-footer-dot {
  margin: 0 8px;
  color: var(--gold);
  opacity: 0.5;
}

.mcd-modal {
  border: 1px solid rgba(212, 175, 55, 0.25);
  background: linear-gradient(160deg, #0c1220, #080d18);
}

.topup-pay-line {
  font-size: 1rem;
}

.topup-meta {
  color: #d2dbeb;
  font-size: 0.82rem;
}

#topup-status {
  font-weight: 700;
}

.mcd-presets .topup-preset:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.mcd-qr-frame {
  padding: 12px;
  border-radius: 12px;
  background: #fff;
  width: fit-content;
  margin: 0 auto 12px;
  border: 2px solid rgba(212, 175, 55, 0.3);
}

.mcd-qr-frame canvas {
  display: block;
  margin: 0;
  padding: 0;
  background: transparent;
}

#loading.wrapper {
  align-items: flex-start;
  padding-top: 40px;
}

.mcd-body > .wrapper {
  align-items: center;
  padding-top: 16px;
}

.logo {
  font-family: var(--font-display);
  color: var(--gold);
  letter-spacing: 0.08em;
}

.login-title {
  font-family: var(--font-display);
  color: var(--gold);
}

/* Hide loyalty/offer id inputs from user-facing page. */
#tab-manual,
#manual-fields,
#manual-panel .mcd-field-grid,
#manual-panel .field label[for="loyalty-input"],
#manual-panel .field label[for="reward-input"],
#manual-panel #loyalty-input,
#manual-panel #reward-input {
  display: none !important;
}

.license-search-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.license-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  margin: 0 0 12px;
}

.license-metric-card {
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  padding: 10px;
}

.license-metric-title {
  font-size: 11px;
  opacity: 0.8;
  margin-bottom: 5px;
}

.license-metric-value {
  font-size: 16px;
  font-weight: 700;
  color: #fff4d4;
}

.copy-key-btn {
  margin-left: 6px;
  padding: 4px 8px;
  border: 1px solid rgba(212, 175, 55, 0.5);
  background: transparent;
  color: #f8e7b8;
  border-radius: 6px;
  cursor: pointer;
  font-size: 11px;
}

.copy-key-btn:hover {
  border-color: rgba(212, 175, 55, 0.9);
  color: #fff4d4;
}

.balance-history-card {
  margin-top: 14px;
}

.balance-history-note {
  margin: 0 0 8px;
  font-size: 12px;
  opacity: 0.8;
}

@media (max-width: 640px) {
  .mcd-field-grid {
    grid-template-columns: 1fr;
  }

  .mcd-user-guide {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .mcd-trust-strip {
    gap: 6px;
  }

  .mcd-trust-item {
    font-size: 0.78rem;
    padding: 6px 10px;
  }

  .mcd-dash-header {
    flex-direction: column;
  }

  .mcd-balance {
    align-items: flex-start;
  }

  .mcd-panel {
    border-radius: 14px;
    padding: 18px 14px;
  }

  .mcd-title {
    font-size: 1.2rem;
    letter-spacing: 0.02em;
  }

  .mcd-desc {
    font-size: 0.86rem;
    margin-bottom: 14px;
  }

  .mcd-field-note,
  .mcd-mini-note {
    font-size: 0.76rem;
  }

  .mcd-main {
    padding-left: 10px;
    padding-right: 10px;
  }

  .mcd-dash-actions {
    width: 100%;
  }

  .mcd-dash-actions .button,
  .mcd-dash-actions .logout-btn,
  .mcd-dash-actions .tab-btn {
    width: 100%;
    min-height: 42px;
  }

  .license-copy-btn {
    display: inline-flex;
    margin-left: 0;
    margin-top: 8px;
    width: fit-content;
    max-width: 100%;
  }

  .mcd-steps-inline {
    flex-direction: column;
    align-items: stretch;
  }

  .mcd-stepper {
    flex-wrap: wrap;
    gap: 6px;
  }
}

/* ── UX refresh: clearer member flow ── */
.mcd-alert-error {
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.mcd-btn-block {
  display: block;
  width: 100%;
  text-align: center;
  box-sizing: border-box;
}

.mcd-btn-secondary {
  background: rgba(212, 175, 55, 0.12);
  color: var(--gold);
  border: 1px solid rgba(212, 175, 55, 0.35);
  padding: 12px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
}

.mcd-btn-secondary:hover {
  background: rgba(212, 175, 55, 0.2);
}

.mcd-flow-card {
  margin-bottom: 16px;
}

.mcd-field-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin: -6px 0 12px;
  line-height: 1.4;
}

.mcd-field-hint-center {
  text-align: center;
  margin-top: 12px;
}

.mcd-input-license {
  font-family: monospace;
  letter-spacing: 0.06em;
  font-size: 0.95rem;
}

.mcd-info-box {
  background: rgba(9, 14, 24, 0.65);
  border: 1px dashed rgba(212, 175, 55, 0.35);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.mcd-info-title {
  font-weight: 700;
  color: var(--gold);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.mcd-info-text {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 10px;
}

.mcd-checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}

.mcd-checklist li {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 6px 0;
  border-bottom: 1px solid rgba(212, 175, 55, 0.08);
  line-height: 1.45;
}

.mcd-checklist li:last-child {
  border-bottom: none;
}

.mcd-checklist-ordered {
  list-style: decimal;
  padding-left: 20px;
  margin: 12px 0 16px;
}

.mcd-checklist-ordered li {
  border-bottom: none;
  padding: 4px 0;
  color: #c8d0e0;
}

.mcd-license-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  border: 1px solid rgba(212, 175, 55, 0.15);
}

.mcd-license-strip-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mcd-chip-btn {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: var(--gold);
}

.mcd-balance-card {
  min-width: 120px;
}

.mcd-btn-logout {
  color: var(--muted) !important;
  border-color: rgba(148, 160, 184, 0.35) !important;
}

.mcd-steps-inline {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.mcd-steps-inline-item {
  flex: 1;
  min-width: 90px;
  font-size: 0.78rem;
  color: #c5cede;
  background: rgba(9, 14, 24, 0.8);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
}

.mcd-steps-inline-item span {
  display: inline-block;
  width: 20px;
  height: 20px;
  line-height: 20px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.25);
  color: var(--gold);
  font-weight: 700;
  font-size: 0.72rem;
  margin-right: 4px;
}

.mcd-section-label-main {
  margin-top: 4px;
  font-size: 1rem;
}

.mcd-section-sub {
  font-size: 0.82rem;
  color: var(--muted);
  margin: -8px 0 12px;
  line-height: 1.45;
}

.mcd-claim-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(212, 175, 55, 0.12);
}

.mcd-quantity-field {
  max-width: 140px;
}

.mcd-btn-claim {
  margin-top: 4px;
}

.mcd-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px 0 16px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
}

.mcd-stepper-item {
  flex: 1;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.3;
}

.mcd-stepper-item span {
  display: block;
  width: 22px;
  height: 22px;
  line-height: 22px;
  margin: 0 auto 4px;
  border-radius: 50%;
  background: rgba(148, 160, 184, 0.2);
  font-weight: 700;
  font-size: 0.7rem;
}

.mcd-stepper-item.active {
  color: var(--gold);
}

.mcd-stepper-item.active span {
  background: rgba(212, 175, 55, 0.35);
  color: #fff4d4;
}

.mcd-stepper-line {
  width: 12px;
  height: 2px;
  background: rgba(212, 175, 55, 0.2);
  flex-shrink: 0;
}

.mcd-pay-alert {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: #fde68a;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.45;
  margin-bottom: 12px;
}

.mcd-pay-highlight {
  color: #fff4d4;
  font-weight: 700;
}

.mcd-qr-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 10px;
}

.mcd-qr-expiry {
  text-align: center;
  font-size: 0.82rem;
  color: var(--warning);
  font-weight: 600;
  margin: 0 0 8px;
}

.mcd-pay-summary {
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: rgba(0, 0, 0, 0.2);
}

.mcd-pay-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  padding: 6px 0;
  border-bottom: 1px solid rgba(212, 175, 55, 0.08);
}

.mcd-pay-summary-row:last-child {
  border-bottom: none;
}

.mcd-pay-summary-row span {
  color: var(--muted);
}

.mcd-license-success {
  text-align: center;
  padding: 16px;
  margin-bottom: 14px;
  border-radius: 14px;
  border: 1px solid rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.08);
}

.mcd-license-success-title {
  font-size: 0.85rem;
  color: var(--success);
  font-weight: 700;
  margin-bottom: 8px;
}

.mcd-license-success-key {
  font-size: 1.15rem;
  color: #fff4d4;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.mcd-license-success-hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 8px;
}

.mcd-redirect-panel {
  max-width: 420px;
  text-align: center;
}

#saved-panel:not(.hidden) {
  margin-bottom: 8px;
}
