:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #19201c;
  --muted: #66716a;
  --line: #dfe6e1;
  --brand: #ff474d;
  --brand-dark: #d82f36;
  --soft: #eef6f0;
  --shadow: 0 18px 48px rgba(31, 41, 35, 0.08);
}

* { box-sizing: border-box; }
html { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, textarea, select { font: inherit; }

.shell { max-width: 860px; margin: 0 auto; padding: 22px 14px 48px; }
.shell.wide { max-width: 1120px; }
.hero {
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 18px 10px;
}
.hero.compact { min-height: 120px; }
.eyebrow { color: var(--brand); font-weight: 800; font-size: 12px; letter-spacing: 0; margin: 0 0 8px; }
h1 { font-size: clamp(32px, 8vw, 56px); line-height: 1; margin: 0 0 12px; letter-spacing: 0; }
h2 { font-size: 22px; margin: 0 0 10px; }
.sub, .muted { color: var(--muted); line-height: 1.7; }
.quota-alert {
  display: inline-flex;
  align-items: center;
  border: 1px solid #ffb7ba;
  border-radius: 999px;
  padding: 3px 9px;
  background: #fff2f3;
  color: #b4232a;
  font-weight: 900;
  line-height: 1.45;
}
.quota-pill, .button-link {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
}
.button-link.full {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  text-align: center;
}
.contact-chip {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 10px 14px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(31, 41, 35, 0.08);
}
.contact-chip.wechat {
  border-color: #a6d9b5;
  background: #effaf2;
  color: #14743c;
}
.contact-chip.qq {
  border-color: #afd0f5;
  background: #f0f7ff;
  color: #1d5fa8;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
  margin: 14px 0;
}
.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--soft);
  border-radius: 8px;
  padding: 12px;
  color: #245236;
  line-height: 1.6;
}
.inline-actions, .topline, .copybar, .admin-grid, .search-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero .inline-actions { justify-content: flex-end; gap: 8px; }
.hero .quota-pill, .hero .button-link, .hero .contact-chip { padding: 10px 12px; }
.topline { justify-content: space-between; margin-bottom: 12px; }
.search-row { margin: 12px 0 14px; align-items: end; }
.search-row label { min-width: min(420px, 100%); flex: 1; }
.search-row button { min-width: 104px; }

form { display: grid; gap: 14px; }
label { display: grid; gap: 7px; font-weight: 700; color: #2d3832; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9faf9;
  color: var(--ink);
  outline: none;
}
textarea { min-height: 150px; resize: vertical; line-height: 1.7; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); background: #fff; }
.form-grid, .admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.admin-grid { grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr) 120px; align-items: end; }

button, .secondary, .ghost {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 14px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.primary { background: var(--brand); border-color: var(--brand); color: white; font-weight: 800; }
.primary:hover { background: var(--brand-dark); }
.secondary { background: #eef3ef; }
.secondary.active { border-color: var(--brand); color: var(--brand); background: #fff5f5; font-weight: 800; }
.ghost { background: transparent; }
.full { width: 100%; }
button:disabled { opacity: 0.55; cursor: wait; }

.tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tab {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
  text-align: center;
  background: #f9faf9;
}
.tab input { width: auto; margin-right: 4px; }
.tab.active { border-color: var(--brand); color: var(--brand); background: #fff5f5; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 10px 0 16px; }
.plan {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 14px 13px;
  background: #fbfcfb;
  box-shadow: 0 12px 28px rgba(31, 41, 35, 0.07);
}
.plan::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
}
.plan:nth-child(1) {
  border-color: #ffc2c5;
  background: #fff7f7;
}
.plan:nth-child(1)::before { background: #ff474d; }
.plan:nth-child(2) {
  border-color: #b9dec5;
  background: #f3fbf5;
}
.plan:nth-child(2)::before { background: #28a05a; }
.plan:nth-child(3) {
  border-color: #bfd4f2;
  background: #f4f8ff;
}
.plan:nth-child(3)::before { background: #2f6fd6; }
.plan strong { display: block; margin-bottom: 6px; }
.plan span { color: var(--muted); font-size: 14px; line-height: 1.5; }
.result-block {
  margin: 12px 0;
}
.result-block-script {
  margin-top: 18px;
}
.script-label {
  width: fit-content;
  margin: 0 auto 8px;
  color: var(--brand);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.2;
}
.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  margin: 0;
  background: #fbfcfb;
}
.result-meta-card {
  background: #fbfcfb;
}
.result-text { white-space: pre-wrap; line-height: 1.85; }
.copybar { margin-top: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { border-bottom: 1px solid var(--line); padding: 12px 10px; text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions input { max-width: 110px; padding: 9px; }
.customer-actions { margin-top: 8px; }
.customer-actions input { max-width: 360px; }
.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  margin: 0 4px 6px 0;
  background: #f7faf7;
  color: #46534c;
  font-size: 12px;
  font-weight: 800;
}
.badge.ok { border-color: #b7dfc7; background: #ecfff3; color: #14743c; }
.badge.danger { border-color: #ffc6c6; background: #fff2f2; color: #b42318; }
.note-preview { color: var(--muted); font-size: 12px; line-height: 1.55; max-width: 160px; }
.inline-editor, .log-detail { margin-top: 8px; }
.inline-editor summary, .log-detail summary { cursor: pointer; color: var(--brand); font-weight: 800; }
.log-detail summary {
  color: var(--ink);
  max-width: 520px;
  line-height: 1.55;
}
.log-box {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  padding: 10px;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.65;
}
.log-box strong { display: block; margin: 6px 0 4px; }
.hidden { display: none !important; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(80px);
  background: #17201b;
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  opacity: 0;
  transition: 0.2s ease;
  max-width: calc(100vw - 28px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .hero { align-items: flex-start; flex-direction: column; padding-top: 18px; min-height: 160px; }
  .form-grid, .plans, .tabs, .admin-grid { grid-template-columns: 1fr; }
  .notice { align-items: flex-start; flex-direction: column; }
  .panel { padding: 14px; }
}
