:root {
  color: #1b2430;
  background: #f3f5f7;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px 16px 48px;
}

.top, main {
  max-width: 1100px;
  margin: 0 auto;
}

.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 16px;
}

h1, h2, p { margin-top: 0; }

h1 { margin-bottom: 4px; font-size: 1.8rem; }

h2 { font-size: 1.15rem; }

.subtitle, .hint, .version { color: #3d4b5c; }

.warn-text { color: #8a3b12; font-weight: 600; }
.keep-lines { white-space: pre-wrap; }

.banner-warn { border-color: #d9a066; background: #fff8f0; }

.inventory { padding-left: 1.2rem; }
.inventory li { margin-bottom: 0.75rem; }

.pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #f7f9fb;
  border: 1px solid #e1e7ee;
  padding: 8px;
  font-size: 0.85rem;
}

table.slots {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

table.slots th, table.slots td {
  border: 1px solid #d5dde6;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.notice.error { color: #a12020; }

.issue-list {
  margin: 8px 0 0;
  padding-left: 1.2em;
  color: #a12020;
}

.issue-list li { margin: 4px 0; }

.card {
  background: #fff;
  border: 1px solid #d5dde6;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.section-head h2 { margin-bottom: 0; }

.history-title {
  margin: 20px 0 8px;
  font-size: 1rem;
  color: #3d4b5c;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid #e1e7ee;
}

.history-item p { margin: 0; }

.history-item .hint { margin-top: 2px; }

.button {
  appearance: none;
  border: 1px solid #1f5fbf;
  background: #1f5fbf;
  color: #fff;
  border-radius: 6px;
  padding: 10px 14px;
  min-height: 44px;
  font: inherit;
  cursor: pointer;
}

.button.secondary {
  background: #fff;
  color: #1f5fbf;
}

.button:disabled, .button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

label.button { display: inline-flex; align-items: center; }

#file-input,
#v64-file {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

a.button {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.table-wrap { overflow-x: auto; }

.phases {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  list-style: none;
}

.phases li {
  border: 1px solid #d5dde6;
  border-radius: 999px;
  padding: 6px 12px;
  background: #f7f9fb;
}

.phases li.is-current {
  border-color: #1f5fbf;
  font-weight: 700;
}

.phases li.is-current::after {
  content: " · 进行中";
  font-weight: 600;
}

.phases li.is-done { background: #e7f0ea; }

.phases li.is-failed {
  border-color: #a33b3b;
  background: #fdf3f2;
  font-weight: 700;
}

#legacy-tools summary {
  cursor: pointer;
  margin-bottom: 8px;
}

.summary-grid, .editor-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.metric, .editor {
  border: 1px solid #e1e7ee;
  border-radius: 6px;
  padding: 8px;
}

.metric strong, .metric span { display: block; }

.metric.partial { background: #f7f4ea; }

.table-wrap { overflow-x: auto; }

#v64-live-preview {
  margin-top: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th, td {
  border-bottom: 1px solid #e1e7ee;
  text-align: left;
  vertical-align: top;
  padding: 8px;
  white-space: normal;
  word-break: break-word;
}

.status {
  display: inline-block;
  border: 1px solid #8a97a6;
  border-radius: 4px;
  padding: 2px 6px;
}

.status-READY { border-color: #2e7d32; }
.status-NEEDS_INFO { border-color: #9a6b00; }
.status-UNSUPPORTED { border-color: #b85c38; }
.status-RULE_CONFLICT { border-color: #a33b3b; }
.status-INVALID_INPUT { border-color: #555; }
.status-DEMO_ONLY { border-color: #5c4d8a; }

.note {
  background: #f4f7fb;
  border-left: 4px solid #1f5fbf;
  padding: 8px 12px;
}

.error {
  background: #fdf3f2;
  border-left: 4px solid #a33b3b;
  padding: 8px 12px;
}

table.analysis thead th.sheet-title {
  background: #1f3b57;
  color: #fff;
  text-align: center;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  padding: 12px 8px;
}

table.analysis thead th.sheet-banner {
  background: #f7f9fb;
  color: #3d4b5c;
  font-size: 0.75rem;
  font-weight: 500;
  text-align: left;
  padding: 6px 8px;
}

table.analysis {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.82rem;
}

table.analysis th,
table.analysis td {
  border: 1px solid #d5dde6;
  padding: 6px 8px;
  vertical-align: middle;
  white-space: normal;
}

table.analysis thead th {
  background: #e7edf3;
  color: #1f3b57;
  text-align: center;
  font-weight: 700;
}

table.analysis td.code,
table.analysis td.mark {
  text-align: center;
  white-space: nowrap;
}

table.analysis td.desc {
  text-align: left;
  min-width: 180px;
}

.sheet-card {
  padding: 20px 0 0;
  overflow: hidden;
}

.sheet-card h2 {
  margin: 0 0 16px;
  padding-left: 20px;
}

.sheet-card img {
  display: block;
  width: 100%;
  height: auto;
}

table.seq-grid {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  background: #fff;
}

table.seq-grid td {
  min-width: 22px;
  height: 16px;
  padding: 0 1px;
  border: 1px solid #d5dde6;
  text-align: center;
  font-size: 11px;
  line-height: 16px;
  color: #1f3b57;
}

table.analysis td.seq {
  padding: 0;
  background: #fff;
}

label.field {
  display: block;
  margin-bottom: 8px;
}

input[type="text"], input[type="number"], select {
  width: 100%;
  max-width: 320px;
  min-height: 40px;
  font: inherit;
  padding: 6px 8px;
}

details { margin-top: 8px; }

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}

.form-row input, .form-row select, .form-row textarea {
  min-height: 44px;
  border: 1px solid #d5dde6;
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
}

.plan-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.plan {
  border: 1px solid #d5dde6;
  border-radius: 8px;
  padding: 12px;
}

.plan h3 { margin: 0 0 6px; font-size: 1rem; }
.plan p { margin: 0 0 8px; }
.plan .button { width: 100%; justify-content: center; }

#shop-form #shop-token {
  width: 220px;
  max-width: 100%;
  flex: 0 1 220px;
}

#shop-form #shop-plan {
  width: auto;
  max-width: none;
  flex: 0 0 auto;
}

#shop-form #shop-count {
  width: 88px;
  max-width: 88px;
  flex: 0 0 88px;
}

#shop-codes {
  width: 100%;
  min-height: 140px;
  font-family: Consolas, "Microsoft YaHei", monospace;
}

.row-edit {
  border-top: 1px solid #e1e7ee;
  padding-top: 8px;
  margin-top: 8px;
}

@media (max-width: 760px) {
  body { padding: 12px 10px 32px; }
  .top, .summary-grid, .editor-grid, .section-head, .history-item { display: block; }
  .button, label.button { width: 100%; justify-content: center; }
  h1 { font-size: 1.45rem; }
  .form-row input, .form-row select, .form-row textarea { width: 100%; }
}
