:root {
  color-scheme: dark;
  --bg: #07080c;
  --bg-raised: #0c1016;
  --panel: rgba(13, 18, 26, 0.88);
  --panel-solid: #101722;
  --panel-soft: rgba(255, 255, 255, 0.045);
  --text: #edf7ff;
  --muted: #8b9aa9;
  --line: rgba(132, 255, 235, 0.16);
  --line-strong: rgba(132, 255, 235, 0.32);
  --brand: #27f6d2;
  --brand-2: #94f246;
  --accent: #27f6d2;
  --accent-dark: #0fbda1;
  --accent-soft: rgba(39, 246, 210, 0.12);
  --green: #94f246;
  --green-soft: rgba(148, 242, 70, 0.14);
  --amber: #ffb020;
  --amber-soft: rgba(255, 176, 32, 0.14);
  --red: #ff5d73;
  --red-soft: rgba(255, 93, 115, 0.13);
  --violet: #cf7dff;
  --violet-soft: rgba(207, 125, 255, 0.14);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
  --glow: 0 0 24px rgba(39, 246, 210, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(39, 246, 210, 0.08), transparent 260px),
    linear-gradient(90deg, rgba(39, 246, 210, 0.07) 1px, transparent 1px),
    linear-gradient(0deg, rgba(148, 242, 70, 0.045) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 48px 48px, 48px 48px, auto;
  color: var(--text);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  letter-spacing: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(39, 246, 210, 0.08), transparent),
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.025) 0, rgba(255, 255, 255, 0.025) 1px, transparent 1px, transparent 7px);
  opacity: 0.42;
  mix-blend-mode: screen;
  z-index: -1;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 30px;
  background: rgba(7, 9, 14, 0.86);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04), 0 14px 34px rgba(0, 0, 0, 0.26);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  white-space: nowrap;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(39, 246, 210, 0.7);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(39, 246, 210, 0.22), rgba(148, 242, 70, 0.08)),
    rgba(8, 13, 18, 0.94);
  color: var(--brand);
  box-shadow: inset 0 0 16px rgba(39, 246, 210, 0.14), 0 0 20px rgba(39, 246, 210, 0.2);
  font-size: 19px;
  line-height: 1;
}

nav {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

nav a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 6px;
}

nav a:hover,
nav a.active {
  color: var(--brand);
  border-color: rgba(39, 246, 210, 0.3);
  background: rgba(39, 246, 210, 0.08);
  box-shadow: inset 0 0 14px rgba(39, 246, 210, 0.08);
}

.notice-bar {
  position: sticky;
  top: 64px;
  z-index: 9;
  background:
    linear-gradient(90deg, rgba(255, 176, 32, 0.18), rgba(39, 246, 210, 0.08), rgba(148, 242, 70, 0.06)),
    rgba(8, 11, 15, 0.92);
  border-top: 1px solid rgba(255, 176, 32, 0.18);
  border-bottom: 1px solid rgba(255, 176, 32, 0.3);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(16px);
}

.notice-inner {
  width: min(1220px, calc(100vw - 32px));
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 auto;
  padding: 8px 0;
  color: #ffe0a4;
}

.notice-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid rgba(255, 176, 32, 0.38);
  border-radius: 6px;
  background: rgba(255, 176, 32, 0.18);
  color: #ffcc75;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.notice-text {
  flex: 1;
  min-width: 0;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.shell {
  width: min(1220px, calc(100vw - 32px));
  margin: 28px auto 56px;
}

.grid {
  display: grid;
  gap: 18px;
}

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

.panel,
.metric {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow), var(--glow);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.panel::before,
.metric::before,
.page-head::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(39, 246, 210, 0.82), rgba(148, 242, 70, 0.62), transparent);
  opacity: 0.72;
}

.page-head,
.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-head {
  min-height: 132px;
  align-items: center;
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(39, 246, 210, 0.12), rgba(148, 242, 70, 0.035) 42%, rgba(207, 125, 255, 0.08)),
    rgba(9, 13, 20, 0.9);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.page-head::after {
  content: "";
  position: absolute;
  right: 22px;
  bottom: 18px;
  width: 210px;
  height: 58px;
  border-right: 1px solid rgba(39, 246, 210, 0.26);
  border-bottom: 1px solid rgba(39, 246, 210, 0.26);
  opacity: 0.7;
}

.section-title {
  margin-bottom: 16px;
}

.head-actions,
.actions,
.row-actions,
.quick-actions,
.filters,
.form-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.head-actions {
  justify-content: flex-end;
  position: relative;
  z-index: 1;
}

.actions,
.row-actions,
.quick-actions {
  margin-top: 16px;
}

.compact-actions {
  margin-top: 0;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  color: #f8fdff;
  font-size: 30px;
  text-shadow: 0 0 22px rgba(39, 246, 210, 0.12);
}

h2 {
  color: #f4fbff;
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 800;
}

.muted {
  margin: 6px 0 0;
  color: var(--muted);
}

.tag,
.status,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}

.tag {
  background: var(--accent-soft);
  color: var(--brand);
  border: 1px solid rgba(39, 246, 210, 0.36);
  box-shadow: inset 0 0 12px rgba(39, 246, 210, 0.06);
}

.status {
  background: rgba(255, 255, 255, 0.055);
  color: #cbd5e1;
  border: 1px solid rgba(203, 213, 225, 0.18);
}

.status-unused,
.status-completed {
  background: var(--green-soft);
  color: var(--green);
  border-color: rgba(148, 242, 70, 0.34);
}

.status-waiting-sms,
.status-number-issued,
.status-redeeming,
.status-reserved,
.status-replace-pending {
  background: var(--amber-soft);
  color: #ffd180;
  border-color: rgba(255, 176, 32, 0.34);
}

.status-cancelled,
.status-cancelled-replaced,
.status-expired {
  background: var(--red-soft);
  color: #ff9cab;
  border-color: rgba(255, 93, 115, 0.34);
}

.pill {
  min-height: 26px;
  padding: 3px 9px;
  background: var(--violet-soft);
  color: #e2bbff;
  border: 1px solid rgba(207, 125, 255, 0.22);
  font-size: 12px;
}

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

label {
  color: #a5b4c3;
  font-size: 14px;
}

input,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(132, 255, 235, 0.18);
  border-radius: 6px;
  background: rgba(3, 7, 12, 0.62);
  color: var(--text);
  outline: none;
  font: inherit;
}

input {
  height: 42px;
  padding: 0 12px;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--accent);
}

textarea {
  padding: 11px 12px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #667586;
}

input:focus,
textarea:focus {
  border-color: rgba(39, 246, 210, 0.72);
  box-shadow: 0 0 0 3px rgba(39, 246, 210, 0.11), 0 0 20px rgba(39, 246, 210, 0.1);
}

button,
.button-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid rgba(132, 255, 235, 0.24);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
  color: #dbeafe;
  cursor: pointer;
  font: inherit;
}

button:hover,
.button-link:hover {
  border-color: rgba(39, 246, 210, 0.66);
  color: var(--brand);
  background: rgba(39, 246, 210, 0.08);
  box-shadow: 0 0 18px rgba(39, 246, 210, 0.12);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary,
.primary-link {
  border-color: rgba(39, 246, 210, 0.72);
  background: linear-gradient(135deg, rgba(39, 246, 210, 0.95), rgba(148, 242, 70, 0.8));
  color: #061012;
  font-weight: 800;
  box-shadow: 0 0 22px rgba(39, 246, 210, 0.18);
}

.primary:hover,
.primary-link:hover {
  color: #041010;
  background: linear-gradient(135deg, #78ffe9, #bcff73);
}

.secondary {
  border-color: rgba(148, 242, 70, 0.36);
  color: var(--green);
}

.ghost {
  border-color: rgba(255, 93, 115, 0.32);
  color: #ff9cab;
}

.danger {
  border-color: rgba(255, 93, 115, 0.58);
  background: var(--red-soft);
  color: #ffb4bf;
}

.danger:hover {
  border-color: rgba(255, 93, 115, 0.82);
  background: rgba(255, 93, 115, 0.2);
  color: #ffd7dd;
}

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

.small {
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.message {
  min-height: 22px;
  color: var(--muted);
}

.message.error,
.error-note {
  color: var(--red);
}

.error-note {
  max-width: 280px;
  margin: 6px 0 0;
  font-size: 12px;
  word-break: break-word;
}

.kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  border-bottom: 1px solid rgba(132, 255, 235, 0.12);
  gap: 16px;
}

.kv strong,
.mono {
  font-family: Consolas, "SFMono-Regular", monospace;
}

.copy-row {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid rgba(132, 255, 235, 0.12);
}

.copy-row div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.copy-row span {
  color: var(--muted);
  font-size: 13px;
}

.copy-row strong {
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 20px;
  word-break: break-all;
}

.icon-copy {
  min-width: 64px;
  flex: 0 0 auto;
}

.countdown-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.countdown-card {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px;
  border: 1px solid rgba(132, 255, 235, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(39, 246, 210, 0.06), rgba(255, 255, 255, 0.025)),
    rgba(3, 7, 12, 0.54);
}

.countdown-card span {
  color: var(--muted);
  font-size: 13px;
}

.countdown-card strong {
  color: var(--brand);
  font-size: 18px;
  font-family: Consolas, "SFMono-Regular", monospace;
}

.timeline {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.timeline div {
  padding-left: 12px;
  border-left: 2px solid rgba(39, 246, 210, 0.28);
}

.auth-panel {
  max-width: 430px;
  margin: 80px auto;
}

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

.metric {
  display: grid;
  gap: 7px;
}

.metric span,
.metric em {
  color: var(--muted);
  font-style: normal;
}

.metric strong {
  color: #faffff;
  font-size: 24px;
  overflow-wrap: anywhere;
}

.metric em {
  font-size: 12px;
}

.admin-layout,
.dashboard-grid,
.bulk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
  margin-bottom: 18px;
}

.bulk-grid {
  grid-template-columns: minmax(360px, 0.85fr) minmax(420px, 1.15fr);
}

.admin-list {
  display: grid;
  gap: 10px;
}

.admin-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  border-bottom: 1px solid rgba(132, 255, 235, 0.12);
}

.admin-list-row:last-child {
  border-bottom: 0;
}

.admin-list-row strong {
  color: var(--brand);
}

.quick-actions {
  align-items: stretch;
}

.quick-action {
  flex: 1 1 200px;
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 14px;
  border: 1px solid rgba(132, 255, 235, 0.14);
  border-radius: 8px;
  background: rgba(3, 7, 12, 0.34);
}

.quick-action:hover {
  border-color: rgba(39, 246, 210, 0.46);
  background: rgba(39, 246, 210, 0.07);
}

.quick-action strong {
  color: var(--brand);
}

.quick-action span {
  color: var(--muted);
  font-size: 13px;
}

.compact-list {
  display: grid;
  gap: 8px;
}

.compact-row {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(132, 255, 235, 0.12);
}

.compact-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.compact-row div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.compact-row span:not(.status) {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.table-toolbar {
  align-items: flex-end;
}

.compact-toolbar {
  margin: 16px 0 10px;
}

.bulk-toolbar {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(132, 255, 235, 0.14);
  border-radius: 8px;
  background: rgba(3, 7, 12, 0.38);
}

.bulk-toolbar strong {
  color: var(--brand);
}

.anchor-section {
  scroll-margin-top: 92px;
}

.filters {
  justify-content: flex-end;
}

.search-input {
  width: min(340px, 100%);
}

.filter-chip {
  min-height: 34px;
  padding: 0 11px;
  font-size: 13px;
}

.filter-chip.active {
  border-color: rgba(39, 246, 210, 0.72);
  background: rgba(39, 246, 210, 0.12);
  color: var(--brand);
  font-weight: 800;
}

.inline-form {
  display: grid;
  grid-template-columns: 160px minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.tool-sections {
  display: grid;
  gap: 16px;
}

.tool-sections > form + form {
  padding-top: 16px;
  border-top: 1px solid rgba(132, 255, 235, 0.12);
}

.import-row {
  grid-template-columns: minmax(180px, 1fr) auto;
}

.generated-box {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(132, 255, 235, 0.12);
}

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

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

.settings-grid label {
  display: grid;
  gap: 7px;
}

.config-sections {
  display: grid;
  gap: 16px;
}

.config-sections > form + form {
  padding-top: 16px;
  border-top: 1px solid rgba(132, 255, 235, 0.12);
}

.form-footer {
  justify-content: space-between;
}

.bulk-input {
  min-height: 132px;
  font-family: Consolas, "SFMono-Regular", monospace;
}

.bulk-input.compact-input {
  min-height: 92px;
}

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

.result-note {
  margin: 8px 0 0;
  color: #ffe0a4;
  word-break: break-word;
}

.code-list {
  margin: 0;
  padding: 14px;
  background: rgba(3, 7, 12, 0.82);
  color: #dffef8;
  border: 1px solid rgba(39, 246, 210, 0.18);
  border-radius: 6px;
  overflow: auto;
}

.generated-code-list {
  min-height: 154px;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(132, 255, 235, 0.16);
  border-radius: 8px;
  background: rgba(3, 7, 12, 0.44);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  background: transparent;
}

#ordersTable {
  min-width: 1180px;
}

.combined-table {
  min-width: 1260px;
}

.status-stack,
.order-cell {
  display: grid;
  gap: 6px;
}

.status-stack {
  justify-items: start;
}

.order-cell .mono,
.order-cell .muted {
  font-size: 12px;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(132, 255, 235, 0.1);
  text-align: left;
  vertical-align: middle;
}

.check-cell {
  width: 44px;
  text-align: center;
}

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

tbody tr:hover {
  background: rgba(39, 246, 210, 0.045);
}

th {
  color: #a9bac8;
  font-weight: 800;
  background: rgba(8, 13, 20, 0.96);
  position: sticky;
  top: 0;
  z-index: 1;
}

.copy-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.copy-cell .mono {
  overflow: hidden;
  text-overflow: ellipsis;
}

.copy-btn {
  min-height: 28px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.empty-state {
  min-height: 68px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 900px) {
  .topbar {
    height: auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
    gap: 10px;
  }

  .notice-bar {
    position: static;
  }

  .notice-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    padding: 10px 0;
  }

  nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .grid.two,
  .metrics,
  .inline-form,
  .settings-grid,
  .import-row,
  .admin-layout,
  .dashboard-grid,
  .bulk-grid,
  .countdown-grid {
    grid-template-columns: 1fr;
  }

  .page-head,
  .section-title,
  .form-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-head {
    min-height: auto;
  }

  .page-head::after {
    display: none;
  }

  .head-actions,
  .filters {
    width: 100%;
    justify-content: flex-start;
  }

  .search-input {
    width: 100%;
  }
}
