:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #dbe2ee;
  --line-strong: #c9d2e3;
  --text: #172033;
  --muted: #5c6b82;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --shadow: 0 14px 40px rgba(23, 32, 51, 0.08);
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
}

body {
  line-height: 1.65;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.layout {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 20;
  width: 232px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 18px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.main {
  grid-column: 2;
}

.brand {
  padding: 4px 6px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.brand-kicker {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-title {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.15;
}

.brand-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav a,
.ghost-link {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 7px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.nav a.active {
  background: #eaf1ff;
  color: var(--accent-dark);
}

.sidebar-block {
  margin-top: 14px;
  padding: 10px 6px 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 4px;
}

.sidebar-label {
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
}

.main {
  min-width: 0;
  padding: 26px 22px 40px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 2px 18px;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0 8px;
  font-size: 36px;
  line-height: 1.15;
  letter-spacing: 0;
}

.page-head p {
  margin: 0;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 6px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.doc-shell {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 14px;
}

.markdown {
  min-width: 0;
  overflow-wrap: break-word;
  padding: 26px 28px 34px;
}

.markdown > :first-child {
  margin-top: 0;
}

.markdown h1 {
  margin-top: 0;
  font-size: 32px;
}

.markdown h2 {
  margin: 28px 0 10px;
  padding-top: 6px;
  border-top: 1px solid #edf1f6;
  font-size: 22px;
}

.markdown h3 {
  margin: 20px 0 8px;
  font-size: 18px;
}

.markdown p {
  margin: 10px 0;
}

.markdown ul,
.markdown ol {
  margin: 10px 0;
  padding-left: 22px;
}

.markdown li + li {
  margin-top: 4px;
}

.markdown code {
  padding: 2px 6px;
  border-radius: 4px;
  background: #eef2f7;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 0.92em;
}

.markdown pre {
  overflow-x: auto;
  margin: 12px 0;
  padding: 14px 16px;
  border: 1px solid #d8deea;
  border-radius: 8px;
  background: #0f172a;
  color: #e5e7eb;
  font-family: Consolas, Monaco, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.55;
}

.markdown pre code {
  padding: 0;
  background: transparent;
  color: inherit;
}

.markdown table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  width: 100%;
  margin: 12px 0;
  border-collapse: collapse;
  border: 1px solid #d8deea;
}

.markdown th,
.markdown td {
  padding: 9px 11px;
  border-bottom: 1px solid #e4e8f0;
  text-align: left;
  vertical-align: top;
}

.markdown th {
  background: #eef2f8;
}

.status {
  min-height: 20px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 960px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    bottom: auto;
    left: auto;
    z-index: 10;
    width: auto;
    max-height: 54vh;
    height: auto;
    padding: 14px 12px;
    min-height: auto;
    overflow-y: auto;
    border: 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
  }

  .main {
    grid-column: 1;
  }

  .brand {
    margin-bottom: 10px;
    padding-bottom: 10px;
  }

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

  .sidebar-block {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }

  .sidebar-label {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 18px 12px 28px;
  }

  .sidebar {
    max-height: 62vh;
  }

  .nav,
  .sidebar-block {
    grid-template-columns: 1fr;
  }

  .page-head {
    flex-direction: column;
  }

  h1 {
    font-size: 28px;
  }

  .markdown {
    padding: 20px 16px 26px;
  }
}
