:root {
  --bg: #f3f3f3;
  --panel: #ffffff;
  --panel-muted: #f8f8f8;
  --ink: #111111;
  --muted: #666666;
  --line: #d5d5d5;
  --line-strong: #a9a9a9;
  --shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 12px;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  background: var(--bg);
}

code {
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #ffffff;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 12px;
  overflow-wrap: anywhere;
  word-break: normal;
}

.page-shell {
  width: min(1160px, 100%);
  margin: 0 auto;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.topbar h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0;
}

.topbar p,
.section-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.top-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.text-link {
  color: #111111;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-link:hover {
  color: #444444;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.summary-strip div {
  min-width: 118px;
  padding: 6px 9px;
  border-left: 1px solid var(--line);
  background: var(--panel-muted);
}

.summary-strip div:first-child {
  border-left: 0;
}

.summary-strip dt {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
}

.summary-strip dd {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, 0.82fr);
  gap: 10px;
  align-items: start;
}

.panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.guide-shell {
  width: min(1040px, 100%);
}

.guide-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.guide-nav {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 3px;
}

.guide-nav h2 {
  margin: 0 0 6px;
  font-size: 15px;
}

.guide-nav a {
  display: block;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: #111111;
  text-decoration: none;
}

.guide-nav a:hover {
  border-color: var(--line);
  background: var(--panel-muted);
}

.guide-content {
  display: grid;
  gap: 10px;
}

.doc-section {
  scroll-margin-top: 12px;
}

.download-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 2px solid #111111;
  background: #ffffff;
}

.download-panel h2 {
  margin: 0 0 5px;
  font-size: 20px;
}

.download-panel p {
  margin: 0;
  color: #333333;
  line-height: 1.6;
}

.eyebrow {
  margin-bottom: 4px;
  color: #555555;
  font-size: 12px;
  font-weight: 700;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid #111111;
  border-radius: 4px;
  color: #ffffff;
  background: #111111;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.download-link:hover {
  background: #333333;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.doc-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.doc-card {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-muted);
}

.doc-card h3 {
  margin: 0 0 5px;
  font-size: 14px;
}

.doc-card p,
.note-box p,
.faq-list p {
  margin: 0;
  color: #333333;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.step-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 22px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.step-list.compact {
  margin-top: 8px;
}

.note-box {
  margin-top: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
}

.note-box strong {
  display: block;
  margin-bottom: 4px;
}

.note-box.warning {
  border-color: var(--line-strong);
  background: var(--panel-muted);
}

.check-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.check-table div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.check-table div:first-child {
  border-top: 0;
}

.check-table span {
  color: #333333;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.faq-list {
  display: grid;
  gap: 6px;
}

.faq-list details {
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
}

.faq-list summary {
  padding: 8px 9px;
  cursor: pointer;
  font-weight: 700;
}

.faq-list p {
  padding: 0 9px 9px;
}

.preview-panel {
  position: sticky;
  top: 12px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.compact-head {
  align-items: start;
}

.section-head h2 {
  margin: 0 0 3px;
  font-size: 16px;
  font-weight: 700;
}

.section-line {
  height: 1px;
  margin: 4px 0 10px;
  background: var(--line);
}

.form-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 4px;
  margin-bottom: 8px;
}

.field > span,
.box-title {
  color: #222222;
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 6px 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

input[type="hidden"] {
  display: none;
}

.field textarea {
  resize: vertical;
  line-height: 1.45;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid #333333;
  outline-offset: 1px;
}

.check-field {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 6px;
  align-items: center;
  min-height: 34px;
  padding: 20px 0 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
}

.check-field input,
.inline-checks input,
.check-list input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.small-actions,
.button-row,
.inline-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.small-actions {
  justify-content: flex-end;
}

.inline-checks {
  margin: 8px 0 10px;
}

.inline-checks label {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-muted);
}

.compact-box {
  margin: 8px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-muted);
}

.check-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.notify-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
}

.check-list label,
.notify-row label {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  min-height: 24px;
  white-space: nowrap;
}

.btn {
  min-height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 5px 10px;
  color: var(--ink);
  background: #f7f7f7;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.btn:hover {
  background: #eeeeee;
}

.btn-primary {
  border-color: #111111;
  color: #ffffff;
  background: #111111;
}

.btn-primary:hover {
  background: #333333;
}

.btn-small {
  min-height: 26px;
  padding: 3px 8px;
  font-size: 12px;
}

.primary-actions {
  margin-top: 8px;
}

.file-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.meta-list {
  display: grid;
  gap: 0;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.meta-list div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-top: 1px solid var(--line);
  background: var(--panel-muted);
}

.meta-list div:first-child {
  border-top: 0;
}

.meta-list span {
  color: var(--muted);
}

.preview-panel textarea {
  min-height: 190px;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 12px;
}

#statusOutput {
  min-height: 84px;
}

.technical-preview {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-muted);
}

.technical-preview summary {
  padding: 7px 8px;
  cursor: pointer;
  font-weight: 700;
}

.technical-preview .field {
  padding: 0 8px 8px;
}

.mini-dialog {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 52px 12px 12px;
  background: rgba(0, 0, 0, 0.28);
}

.mini-dialog.is-open {
  display: flex;
}

.dialog-window {
  width: min(720px, 100%);
  max-height: calc(100vh - 80px);
  border: 1px solid #222222;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.dialog-window.wide {
  width: min(860px, 100%);
}

.dialog-window header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #efefef;
}

.dialog-window h2 {
  margin: 0;
  font-size: 15px;
}

.dialog-body {
  max-height: calc(100vh - 132px);
  overflow: auto;
  padding: 10px;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #ffffff;
  color: #111111;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 980px) {
  .topbar,
  .layout,
  .guide-layout {
    grid-template-columns: 1fr;
  }

  .summary-strip {
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
  }

  .preview-panel {
    position: static;
  }

  .guide-nav {
    position: static;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .guide-nav h2 {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  body {
    padding: 8px;
  }

  .two-col,
  .three-col,
  .check-list,
  .doc-grid,
  .doc-grid.two {
    grid-template-columns: 1fr;
  }

  .section-head {
    display: grid;
  }

  .guide-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .guide-nav a {
    padding: 6px;
    font-size: 13px;
  }

  .check-table div {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .download-panel {
    grid-template-columns: 1fr;
  }

  .download-link {
    width: 100%;
  }

  .small-actions,
  .button-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .small-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .compact-head {
    gap: 8px;
  }

  .small-actions {
    justify-content: stretch;
  }

  .preset-actions {
    grid-template-columns: 1fr;
  }

  .dialog-window,
  .dialog-window.wide {
    width: 100%;
    max-height: calc(100vh - 24px);
  }

  .mini-dialog {
    align-items: flex-start;
    padding: 12px 8px;
  }

  .dialog-body {
    max-height: calc(100vh - 76px);
  }

  .btn,
  .file-btn {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
}
