:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #0f766e;
  --primary-strong: #0b5f59;
  --accent: #2563eb;
  --warning: #b45309;
  --danger: #b91c1c;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 32px;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}

.brand-mark,
.product-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 8px;
  font-weight: 800;
}

.top-links {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

.home {
  max-width: 1080px;
  margin: 0 auto;
  padding: 68px 24px;
}

.home h1 {
  margin: 0 0 12px;
  font-size: 42px;
  letter-spacing: 0;
}

.home p {
  max-width: 660px;
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 36px;
}

.product-card {
  min-height: 176px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.product-card:hover {
  border-color: rgba(15, 118, 110, 0.35);
  transform: translateY(-2px);
}

.product-card h2 {
  margin: 18px 0 10px;
  font-size: 22px;
}

.product-card p {
  font-size: 14px;
}

.doc-layout {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr) 220px;
  gap: 24px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 28px;
}

.sidebar,
.toc {
  position: sticky;
  top: 88px;
  align-self: start;
  max-height: calc(100vh - 112px);
  overflow: auto;
}

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

.sidebar h3,
.toc h3 {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--muted);
}

.category-title {
  margin: 18px 0 8px;
  font-weight: 700;
}

.doc-link {
  display: block;
  padding: 9px 10px;
  margin: 3px 0;
  color: var(--muted);
  border-radius: 6px;
  font-size: 14px;
}

.doc-link.active,
.doc-link:hover {
  color: var(--primary);
  background: #ecfdf5;
}

.article {
  min-height: calc(100vh - 112px);
  padding: 36px 48px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.article h1 {
  margin: 0 0 26px;
  font-size: 34px;
}

.article-body {
  line-height: 1.86;
  font-size: 16px;
}

.article-body h2,
.article-body h3,
.article-body h4 {
  margin-top: 32px;
  scroll-margin-top: 88px;
}

.article-body img {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
}

.article-body th,
.article-body td {
  padding: 10px 12px;
  border: 1px solid var(--line);
}

.article-empty {
  display: grid;
  place-items: center;
  min-height: 420px;
  color: var(--muted);
  text-align: center;
}

.toc {
  color: var(--muted);
  font-size: 13px;
}

.toc a {
  display: block;
  padding: 6px 0;
}

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

.admin-nav {
  padding: 24px 18px;
  color: #d1d5db;
  background: #111827;
}

.admin-nav .brand {
  color: #ffffff;
  margin-bottom: 28px;
}

.nav-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 11px 12px;
  margin-bottom: 8px;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.nav-section-title {
  margin: 18px 12px 10px;
  color: #9ca3af;
  font-size: 13px;
}

.nav-button.active,
.nav-button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.workspace-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.workspace-title h1 {
  margin: 0 0 8px;
  font-size: 28px;
}

.workspace-title p {
  margin: 0;
  color: var(--muted);
}

.admin-main {
  padding: 28px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.panel-header h1,
.panel-header h2 {
  margin: 0;
  font-size: 22px;
}

.panel-body {
  padding: 20px;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 14px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  color: #ffffff;
  background: var(--primary);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button.secondary {
  color: var(--text);
  background: #eef2f7;
}

.button.danger {
  background: var(--danger);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px;
  background: #f9fafb;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}

.toolbar button {
  min-width: 34px;
  height: 32px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 5px;
  cursor: pointer;
}

.editor {
  min-height: 360px;
  padding: 18px;
  line-height: 1.8;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 0 0 6px 6px;
  outline: none;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.status {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 12px;
}

.status.published {
  color: var(--primary);
  background: #d1fae5;
}

.status.preview {
  color: var(--warning);
  background: #fef3c7;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.message {
  margin-top: 12px;
  color: var(--danger);
  font-size: 14px;
}

@media (max-width: 1080px) {
  .doc-layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .toc {
    display: none;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 0 18px;
  }

  .home h1 {
    font-size: 32px;
  }

  .doc-layout,
  .admin-shell {
    display: block;
    padding: 16px;
  }

  .sidebar,
  .toc {
    position: static;
    max-height: none;
    margin-bottom: 16px;
  }

  .article {
    padding: 24px 18px;
  }

  .admin-nav {
    border-radius: 0;
  }

  .admin-main {
    padding: 16px 0;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}
