:root {
  color-scheme: dark;
  --bg: #05080d;
  --bg-2: #09111b;
  --surface: rgba(10, 18, 29, 0.86);
  --surface-strong: rgba(15, 27, 43, 0.94);
  --surface-soft: rgba(21, 35, 54, 0.76);
  --ink: #e9f8ff;
  --muted: #8da1b7;
  --line: rgba(79, 255, 214, 0.18);
  --line-strong: rgba(79, 255, 214, 0.34);
  --accent: #29f0c7;
  --accent-strong: #93ffe7;
  --accent-soft: rgba(41, 240, 199, 0.12);
  --gold: #ffbf47;
  --danger: #ff5f70;
  --warn: #ffbf47;
  --ok: #37f5a5;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.48);
  --glow: 0 0 28px rgba(41, 240, 199, 0.26);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 12%, rgba(41, 240, 199, 0.16), transparent 28%),
    radial-gradient(circle at 86% 18%, rgba(255, 191, 71, 0.11), transparent 24%),
    linear-gradient(180deg, #060a11 0%, #07111d 48%, #05070b 100%);
  color: var(--ink);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(79, 255, 214, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 255, 214, 0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.85), transparent 90%);
}

body::after {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(rgba(255, 255, 255, 0.025) 50%, transparent 50%);
  background-size: 100% 4px;
  opacity: 0.22;
}

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

h1, h2, h3, p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(34px, 5.5vw, 68px);
  line-height: 0.98;
  text-shadow: 0 0 24px rgba(41, 240, 199, 0.22);
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

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

textarea, input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 13px 14px;
  font: inherit;
  background: rgba(4, 9, 16, 0.72);
  color: var(--ink);
  outline: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

textarea::placeholder, input::placeholder {
  color: rgba(141, 161, 183, 0.74);
}

textarea:focus, input:focus, select:focus {
  border-color: var(--accent);
  background: rgba(4, 12, 20, 0.9);
  box-shadow: 0 0 0 4px rgba(41, 240, 199, 0.11), 0 0 26px rgba(41, 240, 199, 0.16);
}

textarea {
  min-height: 150px;
  resize: vertical;
}

button, .button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgba(147, 255, 231, 0.46);
  border-radius: 7px;
  padding: 12px 17px;
  min-height: 44px;
  background: linear-gradient(135deg, rgba(41, 240, 199, 0.94), rgba(17, 151, 133, 0.96));
  color: #03110e;
  font-weight: 850;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  overflow: hidden;
  box-shadow: 0 0 24px rgba(41, 240, 199, 0.22);
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

button::after, .button::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.36), transparent);
  transform: translateX(-140%);
  transition: transform 0.36s ease;
}

button:hover, .button:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 34px rgba(41, 240, 199, 0.36);
}

button:hover::after, .button:hover::after {
  transform: translateX(140%);
}

button:active, .button:active {
  transform: translateY(1px);
}

button.secondary, .button.secondary {
  background: rgba(17, 29, 45, 0.82);
  border-color: rgba(255, 191, 71, 0.34);
  color: #ffe0a0;
  box-shadow: 0 0 22px rgba(255, 191, 71, 0.08);
}

button.danger {
  background: rgba(255, 95, 112, 0.14);
  border-color: rgba(255, 95, 112, 0.38);
  color: #ffb5bf;
  box-shadow: 0 0 20px rgba(255, 95, 112, 0.08);
}

.topline {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.field label {
  color: #c3f8ee;
  font-size: 13px;
  font-weight: 820;
}

.password-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.password-toggle {
  min-width: 64px;
  min-height: 44px;
  padding: 10px 12px;
  white-space: nowrap;
}

.hint {
  font-size: 13px;
  color: var(--muted);
}

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

.notice {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px 15px;
  margin: 16px 0;
  background: rgba(10, 18, 29, 0.88);
  color: #d7edf5;
  box-shadow: var(--glow);
}

.notice.success {
  border-left-color: var(--ok);
  background: rgba(20, 66, 47, 0.45);
}

.notice.error {
  border-left-color: var(--danger);
  background: rgba(84, 26, 35, 0.42);
}

.redeem-page {
  min-height: 100vh;
  padding: clamp(18px, 4vw, 44px);
  background:
    radial-gradient(circle at 22% 20%, rgba(41, 240, 199, 0.19), transparent 28%),
    radial-gradient(circle at 78% 76%, rgba(255, 191, 71, 0.12), transparent 28%),
    linear-gradient(135deg, rgba(4, 8, 14, 0.88), rgba(8, 18, 31, 0.96));
}

.redeem-hero {
  width: min(1180px, 100%);
  min-height: calc(100vh - 88px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(390px, 0.72fr);
  align-items: center;
  gap: clamp(24px, 6vw, 76px);
}

.redeem-copy {
  display: grid;
  gap: 20px;
}

.redeem-copy h1 {
  max-width: 760px;
}

.redeem-copy p:not(.topline) {
  max-width: 670px;
  font-size: 17px;
}

.redeem-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.redeem-metrics div {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(13, 28, 44, 0.84), rgba(9, 17, 29, 0.74));
  padding: 15px;
  overflow: hidden;
  box-shadow: 0 0 24px rgba(41, 240, 199, 0.08);
}

.redeem-metrics div::before, .stat-card::before, .card::before, .table-card::before, .redeem-panel::before, .auth-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 1px solid rgba(147, 255, 231, 0.38);
  pointer-events: none;
}

.redeem-metrics strong {
  display: block;
  color: var(--ink);
  font-size: 19px;
}

.redeem-metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
}

.redeem-panel, .auth-card {
  position: relative;
  width: 100%;
  background: linear-gradient(180deg, rgba(14, 27, 43, 0.92), rgba(7, 15, 26, 0.92));
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow), var(--glow);
  padding: clamp(22px, 4vw, 34px);
  overflow: hidden;
}

.redeem-panel::after, .auth-card::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -24%;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(41, 240, 199, 0.18), transparent 66%);
  pointer-events: none;
  z-index: 0;
}

.redeem-panel > *, .auth-card > * {
  position: relative;
  z-index: 1;
}

.panel-head, .toolbar, .card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.panel-head p, .card-head p {
  font-size: 13px;
  margin-top: 5px;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(55, 245, 165, 0.32);
  border-radius: 999px;
  background: rgba(55, 245, 165, 0.11);
  color: #abffdd;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 850;
  box-shadow: 0 0 18px rgba(55, 245, 165, 0.16);
}

.status-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 12px var(--ok);
}

.results {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  min-width: 0;
}

.result {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(7, 14, 24, 0.86);
  min-width: 0;
  overflow: hidden;
}

.result.success {
  border-color: rgba(55, 245, 165, 0.28);
}

.result.failed {
  border-color: rgba(255, 95, 112, 0.24);
}

.result-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 10px;
  align-items: center;
}

.result-head p {
  grid-column: 2;
}

.result strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
  color: #d9fff7;
  min-width: 0;
}

.result pre {
  overflow: auto;
  max-width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(147, 255, 231, 0.18);
  border-radius: 7px;
  padding: 12px;
  margin: 12px 0 0;
}

.result-actions {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(255, 191, 71, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 191, 71, 0.07);
  padding: 12px;
}

.selection-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #ffe0a0;
  font-size: 13px;
  font-weight: 800;
}

.selection-tools label, .result-select {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #ffe0a0;
  font-size: 13px;
  font-weight: 800;
}

.selection-tools input, .result-select input {
  width: auto;
  accent-color: var(--accent);
}

.converter-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.converter-box span {
  color: var(--muted);
  font-size: 12px;
}

.format-link {
  display: grid;
  gap: 7px;
  justify-items: start;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(79, 255, 214, 0.12);
}

.format-link span {
  color: var(--muted);
  font-size: 12px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 16px;
  background:
    radial-gradient(circle at 50% 20%, rgba(41, 240, 199, 0.17), transparent 28%),
    linear-gradient(135deg, #05080d, #0b1725 58%, #05070b);
}

.auth-card {
  width: min(470px, 100%);
}

.auth-card h1 {
  font-size: 38px;
  margin: 8px 0 10px;
}

.admin-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(7, 13, 22, 0.98), rgba(8, 18, 30, 0.96)),
    radial-gradient(circle at top, rgba(41, 240, 199, 0.14), transparent 40%);
  color: #fff;
  padding: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(79, 255, 214, 0.18);
  box-shadow: 18px 0 60px rgba(0, 0, 0, 0.28);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 880;
  font-size: 17px;
  margin-bottom: 30px;
}

.brand > span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #127464);
  color: #03110e;
  box-shadow: 0 0 28px rgba(41, 240, 199, 0.34);
}

.brand small, .admin-user small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a, .nav button {
  justify-content: flex-start;
  width: 100%;
  background: transparent;
  border-color: transparent;
  color: #c9d8e5;
  padding: 10px;
  box-shadow: none;
}

.nav a span, .nav button span {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: #98aabd;
  font-size: 12px;
  font-weight: 900;
}

.nav a.active {
  background: linear-gradient(135deg, rgba(41, 240, 199, 0.18), rgba(255, 191, 71, 0.08));
  border: 1px solid rgba(41, 240, 199, 0.34);
  color: #f2fffc;
  border-radius: 8px;
  font-weight: 850;
  box-shadow: 0 0 24px rgba(41, 240, 199, 0.12);
}

.nav a.active span {
  background: var(--accent);
  color: #03110e;
}

.nav a:hover, .nav button:hover {
  background: rgba(41, 240, 199, 0.09);
  box-shadow: none;
}

.nav-logout {
  margin-top: 20px;
}

.admin-main {
  padding: 28px;
  width: min(1280px, 100%);
}

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

.admin-topbar h1 {
  font-size: 32px;
  margin-top: 6px;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 16, 27, 0.86);
  padding: 10px 12px;
  min-width: 150px;
  font-weight: 850;
  box-shadow: 0 0 22px rgba(41, 240, 199, 0.09);
}

.admin-user > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid rgba(41, 240, 199, 0.26);
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 18px;
}

.stat-card, .card, .table-card {
  position: relative;
  background: linear-gradient(180deg, rgba(13, 26, 42, 0.92), rgba(7, 14, 24, 0.92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24), 0 0 18px rgba(41, 240, 199, 0.07);
  overflow: hidden;
}

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

.stat-card span {
  color: #a8c4d7;
  font-size: 13px;
  font-weight: 850;
}

.stat-card strong {
  display: block;
  margin: 12px 0 8px;
  color: #f0fffb;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1;
  text-shadow: 0 0 18px rgba(41, 240, 199, 0.18);
}

.stat-card small {
  color: var(--muted);
}

.card {
  padding: 20px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

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

.stack-form {
  margin-top: 12px;
}

.table-card {
  padding: 0;
}

.table-card .toolbar {
  padding: 18px 20px 6px;
  align-items: center;
}

.mini-link {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: rgba(41, 240, 199, 0.08);
  font-size: 13px;
  font-weight: 850;
}

.table-scroll {
  overflow-x: auto;
}

.bulkbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 20px;
  border-top: 1px solid rgba(79, 255, 214, 0.1);
  border-bottom: 1px solid rgba(79, 255, 214, 0.1);
}

.table-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #d5e9f3;
  font-weight: 800;
  white-space: nowrap;
}

.table-check input {
  width: auto;
  accent-color: var(--accent);
}

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

.row-actions form {
  margin: 0;
}

.row-actions button {
  min-height: 34px;
  padding: 8px 10px;
  font-size: 13px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  margin-top: 8px;
  background: transparent;
}

th, td {
  text-align: left;
  padding: 13px 14px;
  border-bottom: 1px solid rgba(79, 255, 214, 0.12);
  vertical-align: top;
}

th {
  font-size: 12px;
  color: #8eb5c9;
  background: rgba(255, 255, 255, 0.025);
  text-transform: uppercase;
  letter-spacing: 0;
}

td {
  color: #d5e9f3;
}

td pre {
  max-width: 520px;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #d5e9f3;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 32px;
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(141, 161, 183, 0.26);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 850;
  background: rgba(141, 161, 183, 0.12);
  color: #cfddea;
  white-space: nowrap;
}

.badge.ok {
  background: rgba(55, 245, 165, 0.12);
  border-color: rgba(55, 245, 165, 0.28);
  color: #adffdc;
}

.badge.warn {
  background: rgba(255, 191, 71, 0.14);
  border-color: rgba(255, 191, 71, 0.3);
  color: #ffe0a0;
}

.badge.danger {
  background: rgba(255, 95, 112, 0.13);
  border-color: rgba(255, 95, 112, 0.32);
  color: #ffb5bf;
}

.code-block, .code-output {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
  color: #adffdc;
}

.code-output {
  min-height: 240px;
}

@media (max-width: 980px) {
  .redeem-hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .redeem-copy {
    padding-top: 28px;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid, .two-col {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .redeem-page, .admin-main {
    padding: 16px;
  }

  .redeem-metrics, .grid, .two-col, .form-grid {
    grid-template-columns: 1fr;
  }

  .admin-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-user {
    width: 100%;
  }

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

  button, .button {
    width: 100%;
  }
}
