:root {
  color-scheme: light;
  font-family: "DM Sans", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --bg: #f7f7f3;
  --panel: #fff;
  --sidebar: #fafaf7;
  --text: #2c3029;
  --secondary: #656b60;
  --border: #e5e7dd;
  --field-border: #c8ccbf;
  --soft: #f1f2eb;
  --hero: #eeefe6;
  --orange: #ed7545;
  --orange-hover: #f1855a;
  --orange-ink: #a64524;
  --orange-soft: #fbece4;
  --green: #e9eee4;
  --green-ink: #425d3c;
  --error: #9c3d39;
  --error-soft: #faeeeb;
  --dark: #30362d;
  --shadow: 0 5px 28px #30362d08;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

h1, h2, h3, p { margin: 0; }
h2 { font-size: 21px; line-height: 1.35; }
h3 { font-size: 14px; line-height: 1.45; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button, a, .ab { -webkit-tap-highlight-color: transparent; }
::selection { background: #f8c8b4; }

:focus-visible {
  outline: 2px solid var(--orange-ink);
  outline-offset: 3px;
}

.shell {
  width: min(1120px, calc(100% - 64px));
  margin-inline: auto;
}

.topbar {
  background: var(--sidebar);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  min-height: 68px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -.65px;
  white-space: nowrap;
}

.brand-light { font-weight: 450; }
.brand-mark {
  display: block;
  position: relative;
  width: 28px;
  height: 28px;
  transform: rotate(-5deg);
}

.brand-mark::before, .brand-mark::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
}

.brand-mark::before {
  border-radius: 3px;
  background: var(--orange);
  box-shadow: 16px 0 var(--orange), 0 16px var(--orange);
}

.brand-mark::after {
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: var(--dark);
}

.topbar-label, .back-link {
  color: var(--secondary);
  font-size: 13px;
  font-weight: 550;
  white-space: nowrap;
}

.topbar-label {
  padding-left: 16px;
  border-left: 1px solid var(--border);
}

.brand:hover, .back-link:hover { color: var(--orange-ink); }

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 234px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-block: 28px 22px;
  padding: 34px 38px;
  background: var(--hero);
  border: 1px solid #e2e5d7;
  border-radius: 13px;
}

.hero-copy { max-width: 58%; }
.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--secondary);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .13em;
  line-height: 1.5;
}

.eyebrow::before {
  content: "";
  flex: 0 0 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--orange);
}

.eyebrow-divider { color: #858c7d; }
.hero h1 {
  margin: 12px 0 10px;
  font-size: clamp(32px, 4.2vw, 53px);
  font-weight: 750;
  letter-spacing: -.035em;
  line-height: 1.18;
}

.title-dot { color: var(--orange); }
.hero-description, .section-description { color: var(--secondary); }
.hero-description { line-height: 1.75; }
.hero-art {
  position: absolute;
  z-index: -1;
  right: 25px;
  top: 50%;
  width: min(45%, 390px);
  height: auto;
  transform: translateY(-50%);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(275px, 320px);
  align-items: start;
  gap: 20px;
}

.workflow, .admin-panel {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.card {
  min-width: 0;
  padding: 24px 26px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.section-heading, .output-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-number {
  display: grid;
  flex: 0 0 30px;
  place-items: center;
  height: 30px;
  background: var(--orange-soft);
  color: var(--orange-ink);
  border-radius: 7px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.section-description {
  font-size: 14px;
  line-height: 1.65;
  margin: 8px 0 16px;
}

.state-tag {
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--soft);
  color: var(--secondary);
  font-size: 12px;
  white-space: nowrap;
}

.row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.row > .field { flex: 1 1 0; }
.verify-row { flex-wrap: wrap; }
.verify-row > .field { flex-basis: 210px; }

.field {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--field-border);
  border-radius: 7px;
  background: var(--sidebar);
  color: var(--text);
  font-size: 16px;
  transition: border-color .16s, background .16s;
}

.field::placeholder { color: var(--secondary); opacity: 1; }
.field:focus { background: var(--panel); border-color: var(--orange-ink); }
.field:disabled {
  border-color: var(--border);
  background: var(--soft);
  color: var(--secondary);
  cursor: not-allowed;
}
.field[readonly] { background: var(--soft); }

.code-field, pre, .command, td.code {
  font-family: Consolas, "SFMono-Regular", monospace;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--orange);
  color: #29190f;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
  transition: background .16s, border-color .16s;
}

button:hover { background: var(--orange-hover); }
button.ghost {
  border-color: var(--field-border);
  background: var(--panel);
  color: var(--text);
}

button.ghost:hover { background: var(--soft); }
button:disabled, button:disabled:hover {
  border-color: var(--border);
  background: var(--soft);
  color: var(--secondary);
  cursor: not-allowed;
}

.msg {
  margin-top: 10px;
  color: var(--secondary);
  font-size: 13px;
}

.msg:empty { margin: 0; }
.msg.ok { color: var(--green-ink); }
.msg.err { color: var(--error); }
.binding-info {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 7px;
  background: var(--green);
  color: var(--green-ink);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.tool-box {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.tool-actions { flex-wrap: wrap; }
.generator-fields, .ability-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  padding: 0;
  font-size: 14px;
  font-weight: 650;
}

.field-note {
  margin-left: 4px;
  color: var(--secondary);
  font-size: 12px;
  font-weight: 400;
}

.ability-field { margin: 16px 0 18px; }
.abilities {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 8px;
}

.abilities > p { grid-column: 1 / -1; margin: 0; }
.ab {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 64px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--sidebar);
  cursor: pointer;
}

.ab:hover, .ab.on { border-color: var(--orange-ink); }
.ab.on { background: var(--orange-soft); }
.ab:focus-within { outline: 2px solid var(--orange-ink); outline-offset: 2px; }
.ab input {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin: 3px 0 0;
  accent-color: var(--orange-ink);
}

.ab .n { display: block; font-size: 14px; font-weight: 650; }
.ab .d { display: block; color: var(--secondary); font-size: 12px; line-height: 1.5; }
.generator-fields:disabled .ab {
  border-color: var(--border);
  background: var(--sidebar);
  cursor: not-allowed;
}

.output {
  min-width: 0;
  margin: 14px 0 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--soft);
}

.output-heading { justify-content: space-between; margin-bottom: 9px; }
.output-heading label { font-weight: 650; }
.copy-btn { min-height: 36px; padding: 4px 10px; font-size: 12px; }

pre {
  margin: 0;
  color: var(--green-ink);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.command {
  min-height: 124px;
  resize: vertical;
  color: var(--green-ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.output-meta {
  margin-top: 8px;
  color: var(--secondary);
  font-size: 12px;
  overflow-wrap: anywhere;
}

/* ---------- 分批复制 ---------- */
.batch-box {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.split-limit {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--secondary);
  font-size: 12px;
}

.split-limit .field {
  width: 82px;
  min-height: 36px;
  padding: 4px 8px;
  font-size: 12px;
}

.batch-hint {
  margin: 0 0 10px;
  color: var(--secondary);
  font-size: 12px;
  line-height: 1.6;
}

.batch-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.batch-item {
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel);
}

.batch-item.final {
  border-color: var(--orange-ink);
  background: var(--orange-soft);
}

.batch-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.batch-title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 650;
}

.batch-len {
  color: var(--secondary);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.batch-text {
  max-height: 120px;
  overflow: auto;
  padding: 8px;
  border-radius: 5px;
  background: var(--soft);
  color: var(--green-ink);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: all;
  -webkit-user-select: all;
}

.guide h2 { margin-top: 5px; }
.guide-steps {
  display: grid;
  gap: 14px;
  margin: 16px 0 18px;
  padding: 0;
  list-style: none;
}

.guide-steps li {
  display: flex;
  gap: 10px;
}

.guide-steps li + li { padding-top: 14px; border-top: 1px solid var(--border); }
.guide-number {
  flex: 0 0 22px;
  color: var(--orange-ink);
  font-size: 11px;
  font-weight: 650;
  line-height: 20px;
  font-variant-numeric: tabular-nums;
}

.guide-steps p {
  margin-top: 3px;
  color: var(--secondary);
  font-size: 13px;
  line-height: 1.65;
}

.guide-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 11px;
  background: var(--green);
  border-radius: 8px;
  color: var(--green-ink);
  font-size: 12px;
}

.guide-note svg { flex-shrink: 0; }

.footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 5px 16px;
  margin-top: 26px;
  padding: 16px 0 22px;
  border-top: 1px solid var(--border);
  color: var(--secondary);
  font-size: 12px;
}

.footer span[aria-hidden] { color: var(--orange-ink); }
.hero-admin { min-height: 175px; gap: 16px; }
.hero-admin .hero-copy { max-width: none; }
.hero-admin h1 { font-size: clamp(30px, 4vw, 45px); }
.login-card { max-width: 540px; }
.admin-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 15px;
}
.admin-fields .span-2 { grid-column: span 2; }
select.field { cursor: pointer; }

.list-heading { justify-content: space-between; margin-bottom: 14px; }
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 13px;
}

th, td { padding: 10px 12px; text-align: left; vertical-align: middle; }
th { background: var(--soft); color: var(--secondary); font-size: 12px; }
th, tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
td.code { color: var(--green-ink); white-space: nowrap; }
td.dim { min-width: 90px; color: var(--secondary); overflow-wrap: anywhere; }
td:nth-child(4) { white-space: nowrap; }

.status {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--soft);
  color: var(--secondary);
  font-size: 12px;
  white-space: nowrap;
}

.status.active { background: var(--green); color: var(--green-ink); }
.status.expired { background: var(--orange-soft); color: var(--orange-ink); }
.status.pending { background: var(--hero); color: var(--orange-ink); }
.status.disabled { background: var(--soft); color: var(--secondary); }

.actions { display: flex; gap: 6px; }
.actions button { min-height: 34px; padding: 3px 8px; font-size: 12px; }

/* 备注单元格：平时是可点按钮，点开后变成输入框 */
button.note-btn {
  min-height: 0;
  max-width: 200px;
  padding: 2px 6px;
  border: 1px dashed var(--field-border);
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
button.note-btn:hover { border-color: var(--orange-ink); background: var(--orange-soft); }
button.note-btn.empty { color: var(--secondary); }
.note-input {
  width: 100%;
  min-width: 130px;
  max-width: 220px;
  padding: 4px 6px;
  border: 1px solid var(--orange-ink);
  border-radius: 5px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
}
button.danger {
  border-color: #e6c6c2;
  background: var(--error-soft);
  color: var(--error);
}
button.danger:hover { background: #f6deda; }

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 840px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .guide-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .guide-steps li + li { padding: 0 0 0 14px; border: 0; border-left: 1px solid var(--border); }
  .admin-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .shell { width: calc(100% - 32px); }
  .topbar-inner { min-height: 59px; }
  .hero { min-height: 155px; margin-block: 16px; padding: 20px; }
  .hero-copy { max-width: 100%; }
  .hero-art { display: none; }
  .hero h1 { margin-block: 9px; }
  .hero-description { font-size: 14px; }
  .hero-admin { align-items: flex-start; flex-direction: column; }
  .workspace, .workflow { gap: 14px; }
  .card { padding: 18px; }
  .verify-row { flex-direction: column; }
  .verify-row > .field { flex: auto; }
  .verify-row button, #genBtn { width: 100%; }
  .abilities { grid-template-columns: repeat(auto-fit, minmax(min(100%, 125px), 1fr)); }
  .guide-steps { grid-template-columns: minmax(0, 1fr); }
  .guide-steps li + li { padding: 12px 0 0; border: 0; border-top: 1px solid var(--border); }
}

@media (prefers-reduced-motion: reduce) {
  button, .field { transition: none; }
}
