:root {
  --primary: #0052D9;
  --primary-light: #4080FF;
  --primary-bg: #E6F0FF;
  --primary-hover: #D1E0FF;
  --lake: #82C0C0;
  --success: #00B42A;
  --warning: #FF7D00;
  --error: #F53F3F;
  --title: #1D2129;
  --body: #4E5969;
  --note: #86909C;
  --divider: #E5E6EB;
  --page-bg: #F2F3F5;
  --card-bg: #FFFFFF;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 4px rgba(29, 33, 41, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 14px;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--page-bg);
  color: var(--body);
  line-height: 1.6;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-light);
}

.header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--divider);
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.logo {
  font-size: 18px;
  font-weight: 600;
  color: var(--title);
  letter-spacing: 0.5px;
}

.container {
  padding: 24px 0;
}

.page-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--title);
  margin: 0 0 8px;
  padding: 0 16px;
}

.page-desc {
  color: var(--note);
  margin: 0 0 20px;
  font-size: 13px;
  padding: 0 16px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: 0 4px 12px rgba(29, 33, 41, 0.1);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.input {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--title);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.input-wide {
  min-width: 240px;
  flex: 1;
}

.select {
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--title);
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.1s ease;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-light);
  box-shadow: 0 2px 8px rgba(0, 82, 217, 0.2);
}

.btn-default {
  background: var(--card-bg);
  border-color: var(--divider);
  color: var(--body);
}

.btn-default:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-danger {
  background: #fff;
  border-color: var(--error);
  color: var(--error);
}

.btn-danger:hover {
  background: #fff2f0;
}

.btn-sm {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.doc-list {
  display: grid;
  gap: 12px;
}

.doc-item {
  background: var(--card-bg);
  border: 1px solid var(--divider);
  border-radius: var(--radius-md);
  padding: 16px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
}

.doc-item:hover {
  border-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(0, 82, 217, 0.1);
  transform: translateY(-2px);
}

.doc-item:active {
  transform: translateY(0);
}

.doc-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--title);
  margin: 0 0 6px;
}

.doc-meta {
  font-size: 12px;
  color: var(--note);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.doc-category {
  display: inline-block;
  background: var(--primary-bg);
  color: var(--primary);
  padding: 1px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--note);
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--divider);
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--body);
  transition: all 0.2s ease;
}

.page-btn:hover:not(:disabled):not(.active) {
  border-color: var(--primary);
  color: var(--primary);
}

.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--title);
  font-weight: 500;
}

.form-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  color: var(--title);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  background: var(--page-bg);
  border: 1px solid var(--divider);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  align-items: center;
}

.toolbar-divider {
  width: 1px;
  height: 22px;
  background: var(--divider);
  margin: 0 2px;
}

.editor-toolbar button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--divider);
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--body);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.15s;
  flex-shrink: 0;
}

.editor-toolbar button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  pointer-events: none;
}

.editor-toolbar button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.editor-toolbar button.active {
  background: var(--primary-bg);
  border-color: var(--primary);
  color: var(--primary);
}

.editor-content {
  min-height: 360px;
  padding: 16px;
  border: 1px solid var(--divider);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--card-bg);
  color: var(--title);
  outline: none;
  overflow-y: auto;
  line-height: 1.7;
  transition: border-color 0.15s, box-shadow 0.15s;
  counter-reset: ordered-list;
}

.editor-content:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}

.editor-block {
  position: relative;
  padding: 6px 8px 6px 28px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  min-height: 1.7em;
  outline: none;
  transition: background-color 0.15s ease;
}

.editor-block.is-active {
  background-color: var(--primary-bg);
}

.editor-block.is-empty::before {
  content: attr(placeholder);
  color: var(--note);
  pointer-events: none;
}

.editor-block:not(.editor-block-ordered-list) {
  counter-reset: ordered-list;
}

.editor-block-ordered-list {
  counter-increment: ordered-list;
}

.editor-block-unordered-list:not(.is-empty)::before,
.editor-block-ordered-list:not(.is-empty)::before {
  position: absolute;
  left: 10px;
  top: 6px;
  color: var(--body);
  line-height: 1.7;
}

.editor-block-unordered-list:not(.is-empty)::before {
  content: '•';
}

.editor-block-ordered-list:not(.is-empty)::before {
  content: counter(ordered-list) '.';
}

.editor-block-heading-1 {
  font-size: 20px;
  font-weight: 600;
  color: var(--title);
}

.editor-block-heading-2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--title);
}

.editor-block-heading-3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--title);
}

.editor-block-quote {
  padding: 8px 12px 8px 16px;
  background: var(--primary-bg);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--body);
}

.detail-header {
  border-bottom: 1px solid var(--divider);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.detail-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--title);
  margin: 0 0 10px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.detail-body {
  color: var(--body);
  line-height: 1.8;
}

.detail-body h1,
.detail-body h2,
.detail-body h3 {
  color: var(--title);
  margin: 16px 0 10px;
}

.detail-body p {
  margin: 0 0 12px;
}

.detail-body ul,
.detail-body ol {
  margin: 0 0 12px;
  padding-left: 24px;
}

.detail-body blockquote {
  margin: 16px 0;
  padding: 12px 16px;
  background: var(--primary-bg);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--body);
}

.detail-body img {
  max-width: 100%;
}

.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px 0;
}

.landing-title {
  font-size: 28px;
  font-weight: 600;
  color: var(--title);
  margin: 0 0 12px;
}

.landing-desc {
  color: var(--note);
  margin: 0 0 32px;
  max-width: 420px;
}

.landing-btn {
  height: 44px;
  padding: 0 32px;
  font-size: 15px;
  border-radius: var(--radius-md);
}

.toast {
  position: fixed;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--title);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

.hidden {
  display: none !important;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.container,
.landing {
  animation: fadeInUp 0.35s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 16px 0;
  }

  .page-title,
  .page-desc {
    padding: 0 12px;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .input-wide {
    width: 100%;
    min-width: auto;
  }

  .header-inner {
    height: 48px;
  }

  .detail-actions {
    flex-direction: column;
  }

  .detail-actions .btn {
    width: 100%;
  }
}
