:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #697586;
  --line: #d8dee6;
  --soft: #f4f7f8;
  --panel: #ffffff;
  --brand: #16794a;
  --brand-deep: #0e5a38;
  --accent: #2457a6;
  --danger: #b42318;
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  background: #f5f7f7;
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.show-body {
  min-height: 100dvh;
  overflow: hidden;
  background: #eef1f2;
}

.show-root {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.wecycle-page {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 100vh;
  overflow: hidden;
  background-color: #ffffff;
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
}

.complaint-button {
  position: absolute;
  top: 10px;
  right: 20px;
  z-index: 2;
  min-width: 57px;
  height: 25px;
  border: 1px solid rgba(31, 41, 51, 0.35);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.55);
  color: rgba(31, 41, 51, 0.62);
  font-size: 12px;
  letter-spacing: 0;
}

.top-logo {
  position: absolute;
  top: var(--logo-top-px, 16px);
  left: var(--logo-left, 50%);
  z-index: 1;
  display: block;
  width: var(--logo-width-px, 260px);
  max-width: 92%;
  height: auto;
  transform: translateX(-50%);
  object-fit: contain;
  pointer-events: none;
}

.code-box {
  position: relative;
  margin: 0 auto;
  box-sizing: content-box;
}

.code-box img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.guide-copy {
  width: var(--copy-width, 240px);
  margin: var(--copy-margin, 25px) auto 0;
  color: var(--copy-color, #2d2e2d);
  text-align: center;
  font-family: var(
    --copy-family,
    "Trebuchet MS",
    Verdana,
    Helvetica,
    "Microsoft YaHei",
    sans-serif
  );
  font-size: var(--copy-font, 15px);
  font-weight: var(--copy-weight, 400);
  line-height: var(--copy-line, 25px);
  white-space: pre-line;
  word-break: break-word;
}

.guide-copy.is-free {
  position: absolute;
  top: var(--copy-free-top-px, 300px);
  left: var(--copy-free-left, 50%);
  width: var(--copy-free-width, 240px);
  margin: 0;
  transform: translateX(-50%);
}

.custom-text-block {
  position: absolute;
  z-index: 3;
  margin: 0;
  transform: translateX(-50%);
  white-space: pre-line;
  word-break: break-word;
  letter-spacing: 0;
  pointer-events: none;
}

.benefit-count {
  position: absolute;
  left: var(--benefit-left, 50%);
  bottom: var(--benefit-bottom-px, 22px);
  z-index: 3;
  width: var(--benefit-width-px, 330px);
  margin: 0;
  transform: translateX(-50%);
  color: var(--benefit-color, #2d2e2d);
  font-family:
    "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0;
  text-align: center;
  word-break: break-word;
  pointer-events: none;
}

.closed-state {
  height: 100dvh;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: #697586;
  text-align: center;
}

.closed-mark {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border: 1px solid #d8dee6;
  border-radius: 50%;
  color: #8b98a8;
  font-size: 34px;
}

.admin-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.brand-block {
  min-width: 0;
}

.brand-block h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: 0;
}

.brand-block p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  min-height: 0;
}

.settings-panel,
.preview-panel {
  min-width: 0;
}

.settings-panel {
  height: calc(100dvh - 65px);
  overflow: auto;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: #ffffff;
}

.preview-panel {
  min-height: calc(100dvh - 65px);
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(36, 87, 166, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(22, 121, 74, 0.05) 1px, transparent 1px), #f3f6f5;
  background-size: 28px 28px;
}

.field-group {
  margin: 0 0 24px;
  padding: 0;
  border: 0;
}

.field-group legend {
  margin-bottom: 12px;
  color: #111827;
  font-size: 14px;
  font-weight: 700;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
}

.field span,
.check-field span {
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.text-input,
.textarea-input,
.number-input,
.select-input {
  width: 100%;
  border: 1px solid #cfd7df;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  outline: none;
}

.text-input,
.number-input,
.select-input {
  height: 40px;
  padding: 0 11px;
}

.textarea-input {
  min-height: 112px;
  resize: vertical;
  padding: 10px 11px;
  line-height: 1.5;
}

.text-input:focus,
.textarea-input:focus,
.number-input:focus,
.select-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22, 121, 74, 0.12);
}

.upload-row,
.inline-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.range-row {
  display: grid;
  grid-template-columns: 1fr 72px;
  gap: 10px;
  align-items: center;
}

.range-row input[type="range"] {
  width: 100%;
  accent-color: var(--brand);
}

.color-row {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
}

.color-row input[type="color"] {
  width: 48px;
  height: 40px;
  padding: 3px;
  border: 1px solid #cfd7df;
  border-radius: 6px;
  background: #ffffff;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 0;
}

.check-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.layer-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.stable-qr-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  align-items: center;
}

.stable-qr-card img {
  width: 140px;
  height: 140px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.visit-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.visit-stat {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7faf9;
}

.visit-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.visit-stat strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 22px;
  line-height: 1.15;
}

.field-help {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.button {
  min-height: 40px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #cfd7df;
  border-radius: 6px;
  background: #ffffff;
  color: #243b53;
  text-decoration: none;
  font-weight: 650;
  white-space: nowrap;
}

.button:hover {
  border-color: #9fb0bf;
  background: #f9fbfb;
}

.button.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #ffffff;
}

.button.primary:hover {
  border-color: var(--brand-deep);
  background: var(--brand-deep);
}

.button.danger {
  border-color: rgba(180, 35, 24, 0.24);
  color: var(--danger);
}

.button.full {
  width: 100%;
}

.hidden-input {
  display: none;
}

.form-actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.split-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.phone-frame {
  width: min(390px, calc(100vw - 56px));
  aspect-ratio: 9 / 19.5;
  padding: 10px;
  border: 1px solid rgba(31, 41, 51, 0.22);
  border-radius: 30px;
  background: #111827;
  box-shadow: 0 24px 70px rgba(31, 41, 51, 0.22);
}

.phone-screen {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  border-radius: 22px;
  background: #ffffff;
}

.complaint-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f6f8f9;
}

.complaint-form {
  width: min(420px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.complaint-form h1 {
  margin: 0 0 14px;
  font-size: 20px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 20;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 6px;
  background: #111827;
  color: #ffffff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, -4px);
}

@media (min-width: 560px) {
  .wecycle-page {
    max-width: 430px;
    box-shadow: 0 18px 60px rgba(31, 41, 51, 0.14);
  }
}

@media (max-width: 860px) {
  .admin-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .settings-panel {
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .preview-panel {
    min-height: auto;
  }
}

@media (max-width: 480px) {
  .admin-topbar,
  .settings-panel {
    padding-left: 16px;
    padding-right: 16px;
  }

  .top-actions,
  .split-actions,
  .layer-toolbar {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .top-actions {
    display: grid;
  }

  .button {
    width: 100%;
  }

  .upload-row,
  .inline-row {
    grid-template-columns: 1fr;
  }
}
