:root {
  --background: #ffffff;
  --foreground: #09090b;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --card: #ffffff;
  --border: #e4e4e7;
  --input: #e4e4e7;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --secondary: #f4f4f5;
  --secondary-foreground: #18181b;
  --ring: #a1a1aa;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(9, 9, 11, 0.06), 0 16px 40px rgba(9, 9, 11, 0.05);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  background:
    linear-gradient(to right, rgba(228, 228, 231, 0.44) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(228, 228, 231, 0.44) 1px, transparent 1px);
  background-size: 36px 36px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid #18181b;
  border-radius: var(--radius);
  background: #18181b;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted-foreground);
  font-size: 12px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.85fr) minmax(620px, 1.4fr);
  gap: 20px;
  width: min(1480px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 22px 0 36px;
}

.panel,
.card,
.phone-frame {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.panel-header,
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--border);
}

.panel-title,
.card-title {
  margin: 0;
  font-size: 16px;
  line-height: 1.4;
  font-weight: 650;
}

.panel-desc,
.card-desc {
  margin: 4px 0 0;
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.5;
}

.panel-content,
.card-content {
  padding: 18px;
}

.phone-wrap {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.phone-frame {
  width: min(100%, 430px);
  overflow: hidden;
}


.layout.h5-layout {
  grid-template-columns: minmax(320px, 430px);
  justify-content: center;
  width: min(100vw - 24px, 520px);
}

.layout.h5-layout .phone-frame {
  width: 100%;
}

.layout.admin-layout {
  grid-template-columns: minmax(0, 1fr);
}

.phone-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px 8px;
  color: #18181b;
  font-size: 12px;
  font-weight: 650;
}

.phone-title {
  padding: 8px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.phone-title h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
  font-weight: 760;
}

.phone-title p {
  margin: 8px 0 0;
  color: var(--muted-foreground);
  font-size: 13px;
  line-height: 1.55;
}

.section-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field label,
.field-label {
  color: #27272a;
  font-size: 13px;
  font-weight: 600;
}

.field-hint {
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.45;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--input);
  border-radius: 6px;
  background: #ffffff;
  color: var(--foreground);
  padding: 8px 10px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.textarea {
  min-height: 94px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(161, 161, 170, 0.22);
}

.toggle-group,
.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--muted);
}

.segmented.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.toggle-item {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #52525b;
  font-size: 13px;
  font-weight: 600;
}

.toggle-item.active {
  background: #ffffff;
  color: #09090b;
  box-shadow: 0 1px 2px rgba(9, 9, 11, 0.08);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button.primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.button.secondary {
  border-color: var(--border);
  background: #ffffff;
  color: var(--foreground);
}

.button.ghost {
  background: transparent;
  color: var(--foreground);
}

.button.full {
  width: 100%;
}

.button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.upload {
  position: relative;
  display: flex;
  min-height: 92px;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  border: 1px dashed #c4c4c8;
  border-radius: var(--radius);
  background: #fafafa;
  padding: 12px;
}

.upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-title {
  color: #18181b;
  font-size: 13px;
  font-weight: 650;
}

.upload-state {
  display: inline-flex;
  width: fit-content;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted-foreground);
  background: #ffffff;
  font-size: 12px;
}

.upload.filled {
  border-style: solid;
  background: #f4f4f5;
}

.upload.filled .upload-state {
  color: #18181b;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 8px;
  background: #ffffff;
  color: #3f3f46;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge.dark {
  border-color: #18181b;
  background: #18181b;
  color: #ffffff;
}

.badge.muted {
  background: var(--muted);
}

.badge.dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}

.admin-grid {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 16px;
}

.merchant-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.merchant-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 12px;
  text-align: left;
}

.merchant-item.active {
  border-color: #18181b;
  box-shadow: inset 0 0 0 1px #18181b;
}

.merchant-line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.merchant-name {
  font-size: 14px;
  font-weight: 680;
}

.merchant-meta {
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.45;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid var(--border);
  padding: 0 18px;
}

.tab {
  min-height: 42px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted-foreground);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 650;
}

.tab.active {
  border-color: #18181b;
  color: #18181b;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kv {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  background: #fafafa;
}

.kv span {
  display: block;
  color: var(--muted-foreground);
  font-size: 12px;
}

.kv strong {
  display: block;
  margin-top: 4px;
  color: #18181b;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  background: #ffffff;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  vertical-align: middle;
}

th {
  color: var(--muted-foreground);
  font-weight: 650;
  background: #fafafa;
}

tr:last-child td {
  border-bottom: 0;
}

.workflow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.step {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafafa;
  padding: 10px;
}

.step.active {
  border-color: #18181b;
  background: #ffffff;
}

.step span {
  color: var(--muted-foreground);
  font-size: 12px;
}

.step strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
}

.generated-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.split-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: none;
  max-width: min(360px, calc(100vw - 36px));
  border: 1px solid #18181b;
  border-radius: var(--radius);
  background: #18181b;
  color: #ffffff;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 14px 36px rgba(9, 9, 11, 0.22);
}

.toast.show {
  display: block;
}

.hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions .button {
    flex: 1;
  }

  .layout {
    width: min(100vw - 24px, 520px);
    padding-top: 12px;
  }

  .field-row,
  .upload-grid,
  .detail-grid,
  .workflow {
    grid-template-columns: 1fr;
  }

  .panel-header,
  .card-header {
    flex-direction: column;
  }

  .tabs {
    overflow-x: auto;
  }
}


.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.help-button {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: #52525b;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(9, 9, 11, 0.48);
}

.nickname-modal {
  width: min(100%, 360px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 24px 80px rgba(9, 9, 11, 0.28);
  padding: 14px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: #18181b;
  font-size: 18px;
}

.wechat-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f4f4f5;
  padding: 18px 10px 10px;
}

.pay-sheet {
  border-radius: 18px 18px 8px 8px;
  background: #fff;
  padding: 14px;
}

.pay-sheet-top,
.pay-method {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #71717a;
  font-size: 12px;
}

.nickname-highlight {
  width: 72%;
  margin: 14px auto 6px;
  border: 3px solid #18181b;
  border-radius: 4px;
  background: #f4f4f5;
  padding: 6px;
  color: #71717a;
  font-size: 12px;
  text-align: center;
}

.pay-amount {
  text-align: center;
  color: #09090b;
  font-size: 34px;
  font-weight: 760;
  line-height: 1.2;
}

.pay-line {
  height: 1px;
  margin: 18px 0 12px;
  background: var(--border);
}

.pay-method strong {
  color: #18181b;
  font-weight: 650;
}

.pay-button {
  display: block;
  width: 58%;
  min-height: 42px;
  margin: 24px auto 4px;
  border: 0;
  border-radius: 8px;
  background: #18181b;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}


.nickname-screenshot {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f4f4f5;
}


.phone-title {
  text-align: center;
}

.submit-note {
  margin: -4px 2px 0;
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.65;
  text-align: center;
}


.input::placeholder,
.textarea::placeholder {
  color: #8a8a93;
  opacity: 1;
}

.input::-webkit-input-placeholder,
.textarea::-webkit-input-placeholder {
  color: #8a8a93;
}
