:root {
  --bg: #07111f;
  --bg-soft: rgba(7, 17, 31, 0.76);
  --panel: rgba(13, 24, 41, 0.84);
  --panel-strong: rgba(8, 18, 33, 0.94);
  --line: rgba(255, 255, 255, 0.1);
  --text: #f3f5ed;
  --muted: #b3c0cf;
  --accent: #ff8f3d;
  --accent-strong: #ffb347;
  --secondary: #37d0c9;
  --danger: #f25f5c;
  --success: #5bd191;
  --warning: #ffce73;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
  --radius: 24px;
  --radius-sm: 16px;
  --font-head: "Bahnschrift SemiCondensed", "Trebuchet MS", "Microsoft YaHei", sans-serif;
  --font-body: "Segoe UI Variable", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 143, 61, 0.24), transparent 30%),
    radial-gradient(circle at bottom right, rgba(55, 208, 201, 0.2), transparent 35%),
    linear-gradient(160deg, #05101d 0%, #0a1628 45%, #10243a 100%);
  font-family: var(--font-body);
}

body {
  position: relative;
  overflow-x: hidden;
}

h1,
h2,
h3,
strong,
.eyebrow,
.primary-button,
.ghost-button,
.status-pill,
.stat-value {
  font-family: var(--font-head);
  letter-spacing: 0.02em;
}

.background-shell {
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  position: fixed;
  z-index: 0;
}

.orb {
  animation: drift 16s ease-in-out infinite alternate;
  border-radius: 999px;
  filter: blur(6px);
  position: absolute;
}

.orb-one {
  background: rgba(255, 143, 61, 0.18);
  height: 360px;
  left: -80px;
  top: 90px;
  width: 360px;
}

.orb-two {
  background: rgba(55, 208, 201, 0.18);
  bottom: 30px;
  height: 280px;
  right: -40px;
  width: 280px;
}

.orb-three {
  background: rgba(255, 179, 71, 0.16);
  height: 420px;
  left: 12%;
  top: -120px;
  width: 420px;
}

.orb-four {
  background: rgba(55, 208, 201, 0.16);
  bottom: -100px;
  height: 360px;
  right: 6%;
  width: 360px;
}

.grid-glow {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 36px 36px;
  inset: 0;
  mask-image: radial-gradient(circle at center, black 35%, transparent 80%);
  opacity: 0.55;
  position: absolute;
}

.page-wrap,
.admin-wrap {
  margin: 0 auto;
  max-width: 1200px;
  padding: 48px 20px 56px;
  position: relative;
  z-index: 1;
}

.page-wrap {
  max-width: 980px;
}

.hero-card,
.form-shell,
.login-card,
.control-card,
.table-card,
.live-toolbar,
.dashboard-header,
.stat-card {
  backdrop-filter: blur(18px);
  background: linear-gradient(180deg, rgba(15, 27, 46, 0.9), rgba(10, 18, 31, 0.82));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-card {
  display: grid;
  gap: 28px;
  grid-template-columns: 1.2fr 0.9fr;
  margin-bottom: 24px;
  overflow: hidden;
  padding: 36px;
  position: relative;
}

.hero-card::after {
  background: linear-gradient(90deg, rgba(255, 143, 61, 0.28), transparent);
  content: "";
  inset: auto 0 0 0;
  height: 1px;
  position: absolute;
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 0.88rem;
  margin: 0 0 10px;
  text-transform: uppercase;
}

.hero-copy h1,
.dashboard-header h1,
.panel-title h1,
.panel-title h2 {
  margin: 0;
}

.hero-copy h1,
.dashboard-header h1 {
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 0.96;
}

.hero-text,
.panel-title p,
.status-time,
.field span,
.stat-label,
.activity-item small {
  color: var(--muted);
}

.hero-text {
  font-size: 1.02rem;
  line-height: 1.75;
  margin: 18px 0 0;
  max-width: 560px;
}

.status-row,
.header-actions,
.pagination-row,
.switch-row {
  align-items: center;
  display: flex;
  gap: 12px;
}

.status-row {
  flex-wrap: wrap;
}

.status-row {
  margin-top: 24px;
}

.status-pill {
  border: 1px solid transparent;
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.92rem;
  padding: 8px 14px;
}

.status-pill.online {
  background: rgba(91, 209, 145, 0.12);
  border-color: rgba(91, 209, 145, 0.32);
  color: var(--success);
}

.status-pill.offline {
  background: rgba(242, 95, 92, 0.12);
  border-color: rgba(242, 95, 92, 0.35);
  color: #ff9f9a;
}

.status-pill.active {
  background: rgba(91, 209, 145, 0.12);
  color: var(--success);
}

.status-pill.available {
  background: rgba(91, 209, 145, 0.12);
  color: var(--success);
}

.status-pill.queued {
  background: rgba(255, 206, 115, 0.12);
  color: var(--warning);
}

.status-pill.disabled {
  background: rgba(255, 206, 115, 0.12);
  color: var(--warning);
}

.status-pill.redeemed {
  background: rgba(55, 208, 201, 0.12);
  color: var(--secondary);
}

.stat-cluster,
.stats-grid {
  display: grid;
  gap: 16px;
}

.stat-cluster {
  align-content: center;
}

.stat-cluster.single-stat {
  grid-template-columns: minmax(0, 1fr);
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 24px;
}

.stat-card {
  padding: 22px;
  position: relative;
}

.stat-card.accent {
  background:
    linear-gradient(135deg, rgba(255, 143, 61, 0.22), rgba(16, 36, 58, 0.9)),
    linear-gradient(180deg, rgba(15, 27, 46, 0.9), rgba(10, 18, 31, 0.82));
}

.stat-label {
  display: block;
  font-size: 0.92rem;
}

.stat-value {
  display: block;
  font-size: clamp(2rem, 4vw, 3rem);
  margin-top: 8px;
}

.form-shell,
.login-card,
.control-card,
.table-card {
  padding: 28px;
}

.panel-title {
  margin-bottom: 18px;
}

.panel-title.compact {
  margin-bottom: 0;
}

.panel-title h2 {
  font-size: 1.5rem;
}

.redeem-form,
.stack-form {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 10px;
}

.field input,
.field textarea,
.inline-form input,
.inline-form select {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  color: var(--text);
  font: inherit;
  outline: none;
  padding: 14px 16px;
  transition:
    border-color 180ms ease,
    transform 180ms ease,
    background 180ms ease;
}

.field input:focus,
.field textarea:focus,
.inline-form input:focus,
.inline-form select:focus {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 143, 61, 0.6);
  transform: translateY(-1px);
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.query-link {
  text-decoration: none;
}

.query-entry-button {
  background: linear-gradient(135deg, rgba(55, 208, 201, 0.22), rgba(255, 143, 61, 0.22));
  border: 1px solid rgba(255, 179, 71, 0.55);
  box-shadow: 0 14px 28px rgba(255, 179, 71, 0.16);
  color: #fff7e8;
  font-size: 1.02rem;
  font-weight: 700;
  padding: 13px 22px;
}

.query-entry-button:hover {
  box-shadow: 0 18px 34px rgba(255, 179, 71, 0.22);
}

.primary-button,
.ghost-button {
  border-radius: 999px;
  cursor: pointer;
  font-size: 1rem;
  padding: 13px 18px;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    border-color 180ms ease;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border: none;
  box-shadow: 0 14px 28px rgba(255, 143, 61, 0.28);
  color: #101928;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.ghost-button.strong {
  border-color: rgba(55, 208, 201, 0.35);
}

.ghost-button.danger {
  border-color: rgba(242, 95, 92, 0.35);
  color: #ffb0ad;
}

.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.message-box {
  border-radius: 18px;
  margin-top: 16px;
  padding: 14px 16px;
}

.message-box.success {
  background: rgba(91, 209, 145, 0.12);
  border: 1px solid rgba(91, 209, 145, 0.3);
  color: #9ef0c0;
}

.message-box.error {
  background: rgba(242, 95, 92, 0.12);
  border: 1px solid rgba(242, 95, 92, 0.3);
  color: #ffb0ad;
}

.admin-wrap {
  max-width: 1320px;
}

.dashboard {
  display: block;
}

.dashboard-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
  padding: 28px;
}

.live-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 16px 20px;
}

.sync-meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 24px;
}

.switch-row {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 14px 16px;
}

.field-hint {
  color: var(--muted);
  display: block;
  line-height: 1.5;
  margin-top: -4px;
}

.switch-row input {
  accent-color: var(--accent);
  height: 18px;
  width: 18px;
}

.activity-list {
  display: grid;
  gap: 12px;
  max-height: 360px;
  overflow-y: auto;
}

.activity-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  display: grid;
  gap: 8px;
  padding: 14px 16px;
}

.activity-item strong {
  font-size: 1rem;
}

.inventory-block {
  margin-top: 24px;
}

.query-shell {
  max-width: 980px;
}

.query-result-card {
  margin-top: 16px;
}

.inventory-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin-bottom: 18px;
}

.inventory-stat {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 18px;
}

.inventory-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.inventory-actions a {
  text-decoration: none;
}

.inventory-batch-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0;
}

.inventory-batch-tools input {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: var(--text);
  flex: 1 1 260px;
  font: inherit;
  padding: 12px 16px;
}

.inventory-table-scroll {
  margin-bottom: 16px;
}

.inventory-table {
  min-width: 640px;
}

.compact-table {
  min-width: 980px;
}

.table-card {
  overflow: hidden;
}

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

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.inline-form input,
.inline-form select {
  min-width: 180px;
}

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

.data-table {
  border-collapse: collapse;
  min-width: 920px;
  width: 100%;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

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

.feedback-editor {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.compact-table .feedback-editor {
  min-width: 200px;
}

.feedback-editor textarea {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  min-height: 90px;
  padding: 10px 12px;
  resize: vertical;
}

.feedback-editor button {
  background: rgba(55, 208, 201, 0.1);
  border: 1px solid rgba(55, 208, 201, 0.28);
  border-radius: 999px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  padding: 9px 12px;
}

.table-actions button {
  font-size: 0.86rem;
  padding: 8px 12px;
}

.mini-button {
  padding: 8px 12px;
}

.collapsible-text {
  margin-bottom: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.collapsible-text summary {
  align-items: center;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
}

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

.summary-action {
  color: var(--accent-strong);
  font-size: 0.86rem;
}

.collapsible-body {
  color: var(--text);
  line-height: 1.65;
  margin-top: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.remark-block summary {
  font-size: 0.92rem;
}

.compact-note {
  font-size: 0.84rem;
  line-height: 1.4;
  margin-top: 4px;
}

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

.activity-title {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.activity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.code-cell {
  max-width: 220px;
  word-break: break-all;
}

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

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

.pagination-row {
  justify-content: space-between;
  margin-top: 16px;
}

.reveal {
  animation: riseIn 540ms ease both;
}

.reveal-delay {
  animation-delay: 120ms;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(18px, -22px, 0) scale(1.08);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1024px) {
  .hero-card,
  .admin-grid {
    grid-template-columns: 1fr;
  }

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

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

  .dashboard-header,
  .live-toolbar,
  .table-toolbar,
  .pagination-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .page-wrap,
  .admin-wrap {
    padding: 24px 14px 40px;
  }

  .hero-card,
  .form-shell,
  .login-card,
  .control-card,
  .table-card,
  .live-toolbar,
  .dashboard-header,
  .stat-card {
    border-radius: 20px;
    padding: 22px;
  }

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

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

  .primary-button,
  .ghost-button,
  .inline-form input,
  .inline-form select {
    width: 100%;
  }

  .status-row {
    align-items: stretch;
    flex-direction: column;
  }

  .table-actions {
    min-width: 160px;
  }
}
