/* 通达AI平台 · 在线手册 — refined reading theme */
:root {
  --bg: #ffffff;
  --sidebar: #f7f7f5;
  --sidebar-ink: #232629;
  --bg-soft: #f4f4f1;
  --bg-hover: #ecece8;
  --ink: #1f2328;
  --ink-soft: #6b7280;
  --ink-faint: #9ca3af;
  --line: #e7e7e2;
  --line-strong: #d4d4ce;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff4ff;
  --accent-line: #bfdbfe;
  --note-bg: #eff6ff;
  --note-ink: #1e3a5f;
  --note-icon: #2563eb;
  --warn-bg: #fffbeb;
  --warn-ink: #78350f;
  --warn-icon: #d97706;
  --ok: #059669;
  --no: #dc2626;
  --code-bg: #f4f4f1;
  --code-ink: #b91c1c;
  --purple: #7c3aed;
  --pink: #db2777;
  --shadow-sm: 0 1px 2px rgba(15, 15, 15, 0.04);
  --shadow: 0 1px 2px rgba(15, 15, 15, 0.05), 0 8px 24px rgba(15, 15, 15, 0.04);
  --sidebar-w: 280px;
  --content-w: 820px;
  --radius: 8px;
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  --mono: "Cascadia Code", "SF Mono", "JetBrains Mono", Consolas, ui-monospace,
    monospace;
}

html[data-theme="dark"] {
  --bg: #191919;
  --sidebar: #1c1c1c;
  --sidebar-ink: #e8e8e6;
  --bg-soft: #202020;
  --bg-hover: #2c2c2c;
  --ink: #ebebe8;
  --ink-soft: #9b9a97;
  --ink-faint: #6f6e6b;
  --line: #2f2f2f;
  --line-strong: #404040;
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-soft: #1a2740;
  --accent-line: #2c4a78;
  --note-bg: #172534;
  --note-ink: #c7ddf5;
  --note-icon: #60a5fa;
  --warn-bg: #2f2818;
  --warn-ink: #f5e6b8;
  --warn-icon: #fbbf24;
  --ok: #34d399;
  --no: #f87171;
  --code-bg: #242424;
  --code-ink: #fca5a5;
  --purple: #c4b5fd;
  --pink: #f9a8d4;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

/* —— Icons —— */
.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.125em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.ic-ok { color: var(--ok); }
.ic-no { color: var(--no); }
.ic-warn { color: var(--warn-icon); }
.ic-note { color: var(--note-icon); }
.ic-accent { color: var(--accent); }
.ic-muted { color: var(--ink-soft); }
.ic-blue { color: var(--accent); }
.ic-purple { color: var(--purple); }
.ic-pink { color: var(--pink); }

/* —— Progress —— */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #7c3aed);
  z-index: 100;
  transition: width 0.1s linear;
}

/* —— Sidebar —— */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 40;
  padding: 16px 10px 12px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(145deg, #2563eb, #7c3aed);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.35);
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.brand-text strong {
  font-size: 13.5px;
  font-weight: 650;
  color: var(--sidebar-ink);
}

.brand-text span {
  font-size: 11.5px;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}

.toc {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.toc a {
  display: block;
  text-decoration: none;
  color: var(--ink-soft);
  border-radius: 6px;
  transition: background 0.12s ease, color 0.12s ease;
  outline: none;
}

.toc a:hover {
  background: var(--bg-hover);
  color: var(--ink);
}

.toc a:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
  color: var(--ink);
}

.toc a.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.toc-h1 {
  margin-top: 8px;
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 650;
  color: var(--ink);
}

.toc-h2 {
  padding: 5px 10px 5px 22px;
  font-size: 12.5px;
  font-weight: 400;
  position: relative;
}

.toc-h2::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--line-strong);
  transform: translateY(-50%);
}

.toc-h2.active::before {
  background: var(--accent);
}

.sidebar-foot {
  border-top: 1px solid var(--line);
  padding: 12px 6px 4px;
}

.theme-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink-soft);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.theme-btn:hover {
  background: var(--bg-hover);
  color: var(--ink);
  border-color: var(--ink-faint);
}

.theme-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent);
}

.sidebar-meta {
  margin: 10px 4px 0;
  font-size: 11px;
  color: var(--ink-faint);
  text-align: center;
}

/* —— Mobile toggle —— */
.nav-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 50;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  box-shadow: var(--shadow);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}

.nav-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent);
}

.nav-toggle .icon {
  width: 20px;
  height: 20px;
}

.sidebar-backdrop {
  display: none;
}

/* —— Main —— */
.main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}

/* —— Cover —— */
.cover {
  max-width: calc(var(--content-w) + 96px);
  margin: 0 auto;
  padding: 80px 48px 44px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.cover::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 180px;
  background:
    radial-gradient(ellipse 60% 80% at 15% 0%, rgba(37, 99, 235, 0.08), transparent 60%),
    radial-gradient(ellipse 40% 70% at 85% 0%, rgba(124, 58, 237, 0.06), transparent 55%);
  pointer-events: none;
}

html[data-theme="dark"] .cover::before {
  background:
    radial-gradient(ellipse 60% 80% at 15% 0%, rgba(96, 165, 250, 0.1), transparent 60%),
    radial-gradient(ellipse 40% 70% at 85% 0%, rgba(167, 139, 250, 0.08), transparent 55%);
}

.cover > * {
  position: relative;
}

.cover-kicker {
  margin: 0 0 20px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 600;
}

.cover-title {
  margin: 0 0 16px;
  font-size: clamp(34px, 5vw, 46px);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cover-meta {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 13.5px;
}

.cover-desc {
  margin: 0 0 28px;
  max-width: 40em;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.8;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cover-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 550;
  font-family: inherit;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
}

.btn.primary:hover {
  background: var(--accent-hover);
}

.btn.ghost {
  background: var(--bg);
  color: var(--ink);
  border-color: var(--line-strong);
}

.btn.ghost:hover {
  background: var(--bg-hover);
  border-color: var(--ink-faint);
}

/* —— Article —— */
.doc {
  max-width: calc(var(--content-w) + 96px);
  margin: 0 auto;
  padding: 28px 48px 96px;
}

.doc .block {
  max-width: var(--content-w);
}

h1,
h2,
h3 {
  letter-spacing: -0.015em;
  color: var(--ink);
  scroll-margin-top: 28px;
}

h1.block {
  margin: 52px 0 12px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: 28px;
  line-height: 1.3;
  font-weight: 700;
}

.h1-block:first-child h1,
.doc > .h1-block:first-of-type h1 {
  margin-top: 8px;
  padding-top: 0;
  border-top: none;
}

.h1-block {
  margin: 0;
}

h2.block {
  margin: 36px 0 10px;
  font-size: 21px;
  line-height: 1.35;
  font-weight: 650;
}

h3.block {
  margin: 26px 0 8px;
  font-size: 17px;
  font-weight: 650;
}

p.block {
  margin: 10px 0;
  max-width: 42em;
  overflow-wrap: anywhere;
}

p.block strong {
  font-weight: 650;
  color: var(--ink);
}

p.caption {
  margin: 6px 0 22px;
  font-size: 12.5px;
  color: var(--ink-faint);
  letter-spacing: 0.01em;
}

p.label {
  margin: 20px 0 8px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

code.inline {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 0.12em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--line);
}

/* —— Lists —— */
.doc ul,
.doc ol {
  margin: 8px 0 16px;
  padding-left: 1.35em;
  max-width: 42em;
}

.doc li {
  margin: 5px 0;
  padding-left: 0.2em;
}

.doc li > ul,
.doc li > ol {
  margin: 4px 0 6px;
}

.doc ul {
  list-style: disc;
}

.doc ol {
  list-style: decimal;
}

.doc ul ul {
  list-style: circle;
}

.doc li::marker {
  color: var(--ink-faint);
}

/* —— Callouts —— */
.callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  max-width: 42em;
  line-height: 1.7;
  font-size: 14.5px;
  border: 1px solid transparent;
}

.callout .icon {
  width: 1.15em;
  height: 1.15em;
  margin-top: 0.2em;
  stroke-width: 2;
}

.callout.note {
  background: var(--note-bg);
  color: var(--note-ink);
  border-color: color-mix(in srgb, var(--note-icon) 18%, transparent);
}

.callout.note .callout-icon {
  color: var(--note-icon);
}

.callout.warning {
  background: var(--warn-bg);
  color: var(--warn-ink);
  border-color: color-mix(in srgb, var(--warn-icon) 22%, transparent);
}

.callout.warning .callout-icon {
  color: var(--warn-icon);
}

.callout.checklist {
  background: var(--bg-soft);
  color: var(--ink);
  border-color: var(--line);
}

.callout.checklist .callout-icon {
  color: var(--ok);
}

.callout-icon {
  display: inline-flex;
  flex-shrink: 0;
  line-height: 1;
}

/* —— Code —— */
pre.code-block {
  margin: 14px 0 18px;
  padding: 14px 16px;
  background: var(--code-bg);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow-x: auto;
  max-width: 100%;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

html[data-theme="dark"] pre.code-block {
  box-shadow: none;
}

pre.code-block code {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink);
  white-space: pre;
}

/* —— Tables —— */
.table-wrap {
  margin: 12px 0 22px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-width: 100%;
  background: var(--bg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  line-height: 1.55;
  background: var(--bg);
}

thead th {
  text-align: left;
  font-weight: 650;
  background: var(--bg-soft);
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  white-space: nowrap;
  font-size: 12.5px;
  letter-spacing: 0.01em;
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--ink);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: color-mix(in srgb, var(--bg-soft) 70%, transparent);
}

td .icon {
  width: 0.95em;
  height: 0.95em;
}

/* —— Images —— */
.img-block {
  margin: 18px 0 6px;
  max-width: 100%;
}

.img-block img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--bg-soft);
}

/* —— Footer —— */
.doc-footer {
  max-width: calc(var(--content-w) + 96px);
  margin: 0 auto;
  padding: 0 48px 80px;
}

.footer-card {
  max-width: var(--content-w);
  border-top: 1px solid var(--line);
  padding-top: 28px;
  color: var(--ink-soft);
}

.footer-card strong {
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 650;
}

.footer-card p {
  margin: 8px 0 0;
  font-size: 13.5px;
  max-width: 40em;
  line-height: 1.7;
}

/* —— To top —— */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, background 0.12s ease;
  font-size: 16px;
  z-index: 30;
  display: grid;
  place-items: center;
}

.to-top.show {
  opacity: 1;
  pointer-events: auto;
}

.to-top:hover {
  background: var(--bg-hover);
}

.to-top:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--accent);
}

/* —— Reduced motion —— */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

/* —— Responsive —— */
@media (max-width: 960px) {
  .nav-toggle {
    display: inline-flex;
  }

  .sidebar {
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 48px rgba(0, 0, 0, 0.2);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 15, 0.4);
    z-index: 35;
  }

  .sidebar-backdrop[hidden] {
    display: none;
  }

  .main {
    margin-left: 0;
  }

  .cover,
  .doc,
  .doc-footer {
    padding-left: 20px;
    padding-right: 20px;
  }

  .cover {
    padding-top: 72px;
  }

  .cover-desc,
  .doc li,
  td {
    overflow-wrap: anywhere;
  }

  h1.block {
    font-size: 24px;
  }

  h2.block {
    font-size: 19px;
  }

  .cover-title {
    font-size: 30px;
  }

  .btn {
    min-height: 44px;
  }
}

/* —— Print —— */
@media print {
  .sidebar,
  .nav-toggle,
  .progress,
  .to-top,
  .cover-actions,
  .cover::before {
    display: none !important;
  }

  .main {
    margin-left: 0;
  }

  .doc,
  .cover,
  .doc-footer {
    max-width: none;
    padding: 0;
  }

  a {
    color: inherit;
    text-decoration: none;
  }

  pre.code-block {
    white-space: pre-wrap;
  }
}
