@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;600;700&family=Noto+Serif+SC:wght@400;600&display=swap");

:root {
  --bg: #f4f6fb;
  --bg-strong: #6f9dff;
  --surface: #ffffff;
  --surface-muted: #f1f5ff;
  --panel-bg: #f9fafc;
  --sidebar-width: 260px;
  --toc-width: 220px;
  --text: #1f2a37;
  --muted: #6b7280;
  --primary: #5a7bff;
  --primary-700: #3f5dff;
  --accent: #1aa7a1;
  --danger: #e25555;
  --border: #e3e8f4;
  --shadow: 0 18px 40px rgba(24, 45, 95, 0.18);
  --shadow-soft: 0 12px 30px rgba(24, 45, 95, 0.12);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-display: "Outfit", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-body: "Noto Sans SC", "Outfit", "Microsoft YaHei", sans-serif;
  --font-markdown: "Noto Serif SC", "Noto Sans SC", "Microsoft YaHei", serif;
  --mermaid-font-family: var(--font-body);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

body.layout-share {
  scroll-behavior: smooth;
}

body.layout-auth {
  background: linear-gradient(135deg, #6f9dff 0%, #83b0ff 48%, #cfe0ff 100%);
}

body.layout-app,
body.layout-public {
  background-image: radial-gradient(circle at 10% 20%, rgba(90, 123, 255, 0.08), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(26, 167, 161, 0.08), transparent 40%);
}

body.layout-share {
  background: var(--bg);
  background-image: none;
  overflow-x: hidden;
}

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

a:hover {
  text-decoration: underline;
}

button,
input,
select,
textarea {
  font-family: var(--font-body);
}

.button {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button.primary {
  background: linear-gradient(135deg, var(--primary), #7d95ff);
  color: #fff;
  border: none;
}

.button.ghost {
  border-color: transparent;
  color: var(--muted);
  background: #f2f4ff;
}

.button.danger {
  border-color: var(--danger);
  color: var(--danger);
}

.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(27, 43, 74, 0.16);
}

.report-trigger {
  appearance: none;
  border: none;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.report-trigger.kb-chip {
  border: none;
}

.report-trigger.kb-chip:hover {
  background: #e1e8ff;
}

.w-full {
  width: 100%;
}

.input,
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

.input.small {
  width: 90px;
  padding: 6px 8px;
  border-radius: 8px;
}

label {
  font-weight: 600;
  font-size: 0.9rem;
}

.muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.flash,
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  margin-bottom: 12px;
}

.flash {
  background: #eef7f2;
  border: 1px solid #c9e6d7;
}

.layout-share .report-flash {
  display: none;
}

.layout-share .comment-flash {
  display: none;
}

.flash.error {
  background: #fff1f1;
  border: 1px solid #f3c6c6;
  color: #bf2f2f;
}

.alert.error {
  background: #fff1f1;
  border: 1px solid #f3c6c6;
  color: #bf2f2f;
}

.alert.info {
  background: #eef3ff;
  border: 1px solid #c9d6ff;
  color: #3756b7;
}

.notice {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #fff5e9;
  border: 1px dashed #f0b45b;
  font-size: 0.92rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 22px;
}

.card.danger-zone {
  border-color: #f0c4c4;
  background: #fff7f7;
}

.card + .card {
  margin-top: 18px;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e7eefc;
  color: #3559e0;
  font-size: 0.82rem;
  font-weight: 600;
}

.inline-form {
  display: inline;
}

.announcement-edit {
  display: inline-block;
  margin-left: 6px;
}

.announcement-edit summary {
  list-style: none;
}

.announcement-edit summary::-webkit-details-marker {
  display: none;
}

.announcement-edit-form {
  margin-top: 8px;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  background: #f7f9ff;
}

.filter-form {
  margin-bottom: 14px;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: var(--muted);
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.pagination-info {
  color: var(--muted);
  font-size: 0.92rem;
}

.pagination-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.modal[hidden] {
  display: none;
}

.modal-form {
  display: grid;
  gap: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.toast-stack {
  position: fixed;
  bottom: 20px;
  top: auto;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1200;
}

.toast {
  padding: 12px 16px;
  border-radius: 12px;
  background: #eef3ff;
  border: 1px solid #c9d6ff;
  color: #3144b5;
  box-shadow: var(--shadow-soft);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.error {
  background: #fff1f1;
  border-color: #f3c6c6;
  color: #bf2f2f;
}

.toast.is-hidden {
  opacity: 0;
  transform: translateY(-6px);
}

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

.scan-progress {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.scan-progress__bar {
  height: 8px;
  background: #eef2ff;
  border-radius: 999px;
  overflow: hidden;
}

.scan-progress__bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 200ms ease;
}

.scan-progress__status {
  color: var(--muted);
  font-size: 0.9rem;
}

.scan-log {
  max-height: 220px;
  overflow: auto;
  background: #f8faff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 0.86rem;
  color: var(--muted);
}

.scan-log > div {
  padding: 4px 0;
  border-bottom: 1px dashed #e2e7f7;
}

.scan-log > div:last-child {
  border-bottom: none;
}

.scan-progress__actions {
  display: flex;
  justify-content: flex-end;
}

.scan-snippet {
  max-width: 360px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
  white-space: normal;
}

.scan-comment-link {
  border: none;
  background: none;
  padding: 0;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}

/* Public */
.public-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 36px 20px 80px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 32px;
  padding: 36px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #f6f8ff 0%, #eef4ff 45%, #f4fbff 100%);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  align-items: center;
  position: relative;
  overflow: hidden;
}

.home-hero__main h1 {
  font-family: var(--font-display);
  font-size: 36px;
  margin: 8px 0 10px;
}

.home-hero__main .home-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.home-version {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(90, 123, 255, 0.12);
  color: #5c6aa8;
  font-size: 0.82rem;
  font-weight: 600;
}

.home-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(90, 123, 255, 0.12);
  color: var(--primary-700);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
}

.home-lead {
  color: var(--muted);
  line-height: 1.7;
  font-size: 1.05rem;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

.home-tip {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.home-hero__meta {
  margin-top: 16px;
  color: #55608c;
  font-size: 0.92rem;
}

.home-hero__visual {
  display: grid;
  gap: 16px;
}

.hero-card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  padding: 18px 20px;
  border: 1px solid rgba(210, 221, 245, 0.9);
  box-shadow: 0 10px 24px rgba(46, 70, 120, 0.12);
}

.hero-card__title {
  font-weight: 700;
  color: #2c3766;
  margin-bottom: 12px;
}

.hero-card__lines span {
  display: block;
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, #d7e1ff, #eef2ff);
  margin-bottom: 8px;
}

.hero-card__lines span:nth-child(2) {
  width: 88%;
}

.hero-card__lines span:nth-child(3) {
  width: 72%;
}

.hero-card__lines span:nth-child(4) {
  width: 64%;
}

.hero-card__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.82rem;
  color: #4159e3;
}

.hero-card__chips span {
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
  border: 1px solid #d7e2ff;
}

.hero-flow {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
  display: grid;
  gap: 6px;
}

.home-metrics {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.home-metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  display: grid;
  gap: 6px;
  box-shadow: var(--shadow-soft);
}

.home-metric strong {
  font-size: 1rem;
}

.home-metric span {
  color: var(--muted);
  font-size: 0.9rem;
}

.home-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 24px;
}

.home-section h2 {
  margin-top: 0;
  font-family: var(--font-display);
}

.home-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.home-card {
  background: #f7f9ff;
  border-radius: 14px;
  padding: 18px;
  border: 1px solid #e4e9f9;
}

.home-card h3 {
  margin-top: 0;
}

.home-steps {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.home-step {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #f7f9ff;
  border-radius: 12px;
  border: 1px solid #e4e9f9;
  padding: 12px 14px;
  font-weight: 600;
}

.home-step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.86rem;
}

.home-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding-top: 8px;
}

@media (max-width: 900px) {
  .home-hero {
    grid-template-columns: 1fr;
  }

  .home-hero__visual {
    order: -1;
  }
}

/* Auth */
.auth-shell {
  min-height: 100vh;
  padding: 48px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 92vw;
  max-width: 420px;
  background: var(--surface);
  border-radius: 20px;
  padding: 32px 30px;
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-logo {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #2f7cff, #4fd0ff);
  -webkit-background-clip: text;
  color: transparent;
  margin-bottom: 8px;
}

.auth-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin: 10px 0 6px;
}

.auth-subtitle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.auth-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.auth-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.auth-step span {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #dbe3ff;
  color: #4054c7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.auth-step.is-active {
  background: #eef3ff;
  border-color: #c9d6ff;
  color: #2b3a6f;
}

.auth-step.is-active span {
  background: var(--primary);
  color: #fff;
}

@media (max-width: 460px) {
  .auth-steps {
    grid-template-columns: 1fr;
  }
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-tabs {
  display: flex;
  gap: 6px;
  background: var(--surface-muted);
  border-radius: 999px;
  padding: 4px;
  margin: 12px 0 8px;
}

.auth-tab {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
}

.auth-tab.is-active {
  background: #fff;
  color: var(--primary-700);
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(82, 104, 214, 0.18);
}

.auth-field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-muted);
  border-radius: 12px;
  padding: 8px 12px;
  border: 1px solid transparent;
}

.auth-field > * + * {
  margin-left: 10px;
}

.auth-field:focus-within {
  border-color: rgba(90, 123, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(90, 123, 255, 0.15);
}

.auth-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: #fff;
  border-radius: 10px;
  color: #5268d6;
  box-shadow: 0 4px 10px rgba(82, 104, 214, 0.18);
}

.auth-icon svg {
  width: 18px;
  height: 18px;
}

.auth-input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 4px;
  font-size: 0.95rem;
  outline: none;
  min-width: 0;
}

.auth-field-captcha {
  gap: 8px;
  flex-wrap: nowrap;
}

.captcha-img {
  width: 144px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: #fff;
  flex-shrink: 0;
  object-fit: cover;
}

.auth-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.auth-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* App layout */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 248px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  box-shadow: 0 20px 40px rgba(24, 45, 95, 0.08);
  position: sticky;
  top: 0;
  height: 100vh;
}

.app-logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--primary-700);
  margin-bottom: 24px;
}

.app-nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 600;
  transition: background 140ms ease, color 140ms ease;
}

.nav-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(90, 123, 255, 0.3);
}

.nav-item.is-active {
  background: rgba(90, 123, 255, 0.12);
  color: var(--primary-700);
}

.nav-item.is-active .nav-dot {
  background: var(--primary-700);
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-side-trigger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--primary-700);
  cursor: pointer;
}

.app-side-trigger svg {
  width: 20px;
  height: 20px;
}

.app-side-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
  z-index: 8;
}

body.app-side-open .app-side-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.app-side-open {
  overflow: hidden;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  color: #2b3a6f;
}

.topbar-version {
  margin-left: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #6674a5;
}

.topbar-version.is-update {
  color: #c44f2b;
  text-decoration: none;
}

.topbar-version.is-update:hover {
  text-decoration: underline;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-pill {
  padding: 6px 12px;
  border-radius: 999px;
  background: #f1f5ff;
  color: #3c4ad7;
  font-weight: 600;
}

.app-content {
  padding: 28px;
  flex: 1;
}

.app-content .card[id] {
  scroll-margin-top: 90px;
}

.app-footer {
  padding: 16px 28px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px dashed var(--border);
}

.app-footer a {
  color: var(--primary-700);
  text-decoration: none;
  font-weight: 600;
}

.app-footer a:hover {
  text-decoration: underline;
}

.share-footer {
  margin-top: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  background: linear-gradient(
    90deg,
    var(--panel-bg) 0,
    var(--panel-bg) var(--sidebar-width),
    var(--surface) var(--sidebar-width)
  );
  padding: 16px 0 24px;
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.share-shell--single + .share-footer {
  max-width: 1400px;
  background: var(--surface);
}

.share-footer a {
  color: var(--primary-700);
  text-decoration: none;
  font-weight: 600;
}

.share-footer a:hover {
  text-decoration: underline;
}

/* Share */
.share-page {
  min-height: 100vh;
  padding: 0 32px;
  background: transparent;
  display: flex;
  flex-direction: column;
}

.share-shell {
  display: flex;
  align-items: flex-start;
  min-height: 0;
  flex: 1;
  background: var(--surface);
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
  width: 100%;
}

.share-content,
.kb-main,
.share-article {
  min-width: 0;
  max-width: 100%;
}

.share-shell--single {
  max-width: 1400px;
  margin: 0 auto;
  justify-content: center;
}

.share-shell--single .share-content {
  flex: 0 1 auto;
  width: min(520px, 100%);
  margin: 0 auto;
  padding-left: 0;
  padding-right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
}

.share-shell--single .share-header {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.share-shell--single .share-header h1 {
  text-align: center;
  margin-left: 0;
  margin-right: 0;
}

.share-shell--single .share-gate {
  width: 100%;
  max-width: none;
  margin: 0 auto;
}

.share-shell--single .share-gate-form .input,
.share-shell--single .share-gate-form .button {
  width: 100%;
}

.share-shell--notebook {
  max-width: 1200px;
  margin: 0 auto;
}

.share-shell--doc {
  background: linear-gradient(
    90deg,
    var(--panel-bg) 0,
    var(--panel-bg) var(--toc-width),
    var(--surface) var(--toc-width)
  );
}

.share-shell--notebook {
  background: linear-gradient(
    90deg,
    var(--panel-bg) 0,
    var(--panel-bg) var(--sidebar-width),
    var(--surface) var(--sidebar-width)
  );
}
@media (min-width: 961px) {
  .share-shell[data-share-doc-id=""] .kb-sidebar {
    margin-top: 24px;
  }
}

.share-shell--doc .share-toc {
  border-top-left-radius: 22px;
  border-bottom-left-radius: 22px;
}

.share-shell--notebook .kb-sidebar {
  border-top-left-radius: 22px;
  border-bottom-left-radius: 22px;
}

.share-nav {
  width: 280px;
  border-right: 1px solid var(--border);
  background: #f7f9ff;
  padding: 24px 16px;
}

.share-nav-title {
  font-weight: 700;
  color: #2c3766;
}

.share-nav-list {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.share-nav-item {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
}

.share-nav-item.is-active {
  background: #eef2ff;
  border-color: #d9e2ff;
}

.share-content {
  flex: 1;
  padding: 32px 40px;
  min-width: 0;
  background: var(--surface);
}

.share-gate {
  max-width: 360px;
  margin: 18px auto 0;
  text-align: center;
  display: grid;
  gap: 12px;
}

.share-gate-note {
  color: var(--muted);
  font-size: 0.95rem;
}

.share-gate-form {
  display: grid;
  gap: 12px;
}

.share-header h1 {
  margin-top: 0;
}

.share-empty {
  padding: 60px 0;
  color: var(--muted);
  text-align: center;
}

.kb-main > .share-empty {
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.share-comments,
.share-report {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px dashed var(--border);
}


.comment-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.comment-header h2,
.share-report h2 {
  margin: 0;
  font-size: 1.05rem;
}

.comment-count {
  font-size: 0.9rem;
  color: var(--muted);
}

.comment-form,
.report-form {
  display: grid;
  gap: 12px;
}

.comment-list + .comment-form {
  margin-top: 16px;
}

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

.report-modal .modal-card {
  width: min(520px, 92vw);
}

.comment-modal .modal-card {
  width: min(640px, 92vw);
}

.report-captcha {
  grid-column: 1 / -1;
}

.report-captcha-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.report-captcha-row .input {
  flex: 1;
}

.comment-wide,
.report-wide {
  grid-column: 1 / -1;
}

.comment-captcha {
  grid-column: 1 / -1;
}

.comment-captcha-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.comment-captcha-row .input {
  flex: 1;
}

.comment-list {
  display: grid;
  gap: 0;
  margin-top: 12px;
}

.comment-item {
  margin-left: calc(var(--comment-depth, 0) * 32px);
}

.comment-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border-radius: 0;
  border: none;
  background: transparent;
  padding: 12px 0;
  box-shadow: none;
  border-bottom: 1px solid #edf1f7;
}

.comment-item:last-child > .comment-card {
  border-bottom: none;
}

.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #e7efff;
  color: #3756b7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex: 0 0 auto;
}

.comment-body {
  flex: 1;
  min-width: 0;
}

.comment-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.comment-index {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4455a6;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.comment-author {
  font-weight: 600;
  color: var(--text);
}

.comment-time {
  color: var(--muted);
}

.comment-menu {
  position: relative;
  margin-left: auto;
}

.comment-menu summary {
  list-style: none;
  cursor: pointer;
  font-weight: 700;
  color: var(--muted);
  padding: 4px 6px;
  border-radius: 6px;
}

.comment-menu summary::-webkit-details-marker {
  display: none;
}

.comment-menu summary:hover {
  background: #f3f5ff;
  color: var(--primary-700);
}

.comment-menu-list {
  position: absolute;
  right: 0;
  top: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
  padding: 6px;
  min-width: 120px;
  z-index: 5;
  display: grid;
  gap: 4px;
}

.comment-menu-item {
  appearance: none;
  border: none;
  background: transparent;
  text-align: left;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

.comment-menu-item:hover {
  background: #f1f5ff;
  color: var(--primary-700);
}

.comment-badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--primary-700);
  font-size: 0.72rem;
  font-weight: 600;
}

.comment-content {
  margin-top: 8px;
  line-height: 1.6;
  color: var(--text);
  word-break: break-word;
}

.comment-content img {
  max-width: 100%;
  border-radius: 10px;
  margin-top: 6px;
}

.comment-content p {
  margin: 0 0 8px;
}

.comment-content p:last-child {
  margin-bottom: 0;
}

.comment-footer {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.comment-reply-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.comment-reply-btn:hover {
  color: var(--primary-700);
}

.comment-children {
  margin-top: 12px;
  display: grid;
  gap: 12px;
}

.comment-editor {
  display: grid;
  gap: 8px;
}

.comment-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.comment-tool {
  border: none;
  background: #f1f5ff;
  color: var(--primary-700);
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.comment-tool:hover {
  background: #e6ecff;
}

.comment-tool svg {
  width: 18px;
  height: 18px;
}

.comment-emoji-panel {
  position: absolute;
  top: 36px;
  left: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  z-index: 5;
}

.comment-emoji {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
}

.comment-modal-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.comment-modal-fields {
  display: grid;
  gap: 12px;
}

.comment-modal form[data-comment-form] {
  display: grid;
  gap: 12px;
}

.report-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface);
}

.report-box > summary {
  list-style: none;
  cursor: pointer;
}

.report-box > summary::-webkit-details-marker {
  display: none;
}

.report-detail {
  max-width: 420px;
  white-space: normal;
  word-break: break-word;
  color: var(--text);
}

.comment-notify {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  white-space: normal;
}

.comment-notify-status {
  font-weight: 600;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.switch input {
  appearance: none;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #d7dce8;
  border: 1px solid #c6ccda;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease;
}

.switch input:checked {
  background: #5a7bff;
  border-color: #5a7bff;
}

.switch input:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.switch-slider {
  position: absolute;
  left: 3px;
  top: 50%;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transform: translateY(-50%);
  transition: transform 160ms ease;
  box-shadow: 0 2px 6px rgba(24, 45, 95, 0.2);
  pointer-events: none;
}

.switch input:checked + .switch-slider {
  transform: translate(18px, -50%);
}

.switch.is-disabled {
  opacity: 0.7;
}

.nav-label {
  flex: 1;
}

.nav-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: #e25555;
  color: #fff;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.kb-sidebar {
  width: var(--sidebar-width);
  border-right: 1px solid var(--border);
  background: transparent;
  padding: 16px 12px;
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  max-height: none;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.kb-side-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.kb-side-body:hover,
.kb-side-body:focus-within {
  scrollbar-width: thin;
}

.kb-side-body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.kb-side-body:hover::-webkit-scrollbar,
.kb-side-body:focus-within::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.kb-side-body::-webkit-scrollbar-thumb {
  background: rgba(90, 123, 255, 0.35);
  border-radius: 999px;
}

.kb-side-body::-webkit-scrollbar-track {
  background: transparent;
}

.kb-side-title {
  font-weight: 700;
  color: #2c3766;
  margin: 2px 4px 10px;
  flex: 0 0 auto;
  font-size: 0.85rem;
}

.kb-side-tabs {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 4px 6px 10px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.kb-side-tab {
  border: none;
  background: transparent;
  color: #5a6b9a;
  padding: 6px 2px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}

.kb-side-tab.is-active {
  color: var(--primary-700);
}

.kb-side-tab.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -11px;
  height: 2px;
  background: var(--primary);
  border-radius: 999px;
}

.kb-side-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kb-side-action {
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.kb-side-action svg {
  width: 16px;
  height: 16px;
  display: block;
}

.kb-side-action:hover {
  background: #eef2ff;
  color: var(--primary-700);
  border-color: #dbe3ff;
}

.kb-side-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.kb-tree {
  list-style: none;
  margin: 0;
  padding: 0;
  display: block;
  width: 100%;
}

.kb-tree-children {
  padding-left: 24px;
  margin-top: 2px;
}

.kb-tree[data-level="0"] {
  padding-left: 0;
}

.kb-tree-node {
  list-style: none;
}

.kb-tree-row {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
}

.kb-tree-toggle,
.kb-tree-spacer {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-right: -4px;
}

.kb-tree-toggle {
  border: none;
  background: transparent;
  color: #6c7bd8;
  cursor: pointer;
  border-radius: 6px;
  transition: background 140ms ease, color 140ms ease;
  line-height: 0;
}

.kb-tree-toggle:hover {
  background: rgba(108, 123, 216, 0.12);
}

.kb-tree-toggle-icon {
  width: 30px;
  height: 30px;
  display: block;
}

.kb-tree-toggle-icon--open {
  display: none;
}

.kb-tree-node.is-open > .kb-tree-row .kb-tree-toggle-icon--open {
  display: block;
}

.kb-tree-node.is-open > .kb-tree-row .kb-tree-toggle-icon--collapsed {
  display: none;
}

.kb-tree-node.is-collapsed > .kb-tree-children {
  display: none;
}

.kb-tree-item,
.kb-tree-folder {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  border-radius: 8px;
  color: var(--text);
  border: 1px solid transparent;
  flex: 1;
  white-space: nowrap;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease;
  font-size: 0.85rem;
  line-height: 24px;
}

.kb-tree-item:hover,
.kb-tree-folder:hover {
  text-decoration: none;
  transform: translateX(2px);
  background: rgba(90, 123, 255, 0.08);
}

.kb-tree-item.is-active {
  background: #e9eeff;
  color: var(--primary-700);
  font-weight: 600;
  border-color: #dbe3ff;
}

.kb-tree-folder {
  color: #4c5678;
  font-weight: 600;
}

.kb-tree-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
}

.kb-tree-label {
  line-height: 24px;
}

.kb-tree-icon--image {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  object-fit: contain;
}

.kb-tree-icon--default {
  width: 18px;
  height: 18px;
  display: block;
}

.kb-tree-icon--emoji {
  font-size: 16px;
  line-height: 1;
}

.kb-tree-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kb-main {
  flex: 1;
  padding: 32px 40px;
  min-width: 0;
  background: var(--surface);
}

.kb-main.is-loading {
  opacity: 0.65;
  transition: opacity 160ms ease;
}

.share-toc {
  width: var(--toc-width);
  border-right: 1px solid var(--border);
  background: transparent;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  position: sticky;
  top: 24px;
  height: calc(100vh - 48px);
  max-height: none;
  align-self: flex-start;
}

.share-toc-title {
  font-weight: 700;
  color: #2c3766;
  font-size: 0.85rem;
}

.share-toc-body {
  flex: 1;
  overflow: auto;
  min-height: 0;
  scroll-behavior: smooth;
  scrollbar-width: none;
  user-select: text;
}

.share-toc-body:hover,
.share-toc-body:focus-within {
  scrollbar-width: thin;
}

.share-toc-body::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.share-toc-body:hover::-webkit-scrollbar,
.share-toc-body:focus-within::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.share-toc-body::-webkit-scrollbar-thumb {
  background: rgba(90, 123, 255, 0.35);
  border-radius: 999px;
}

.share-toc-body::-webkit-scrollbar-track {
  background: transparent;
}

.share-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: inline-grid;
  min-width: 100%;
  width: max-content;
  gap: 4px;
  --toc-offset: 0px;
}

.share-toc-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.share-toc-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.share-toc-divider {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.share-toc-list--footnotes .share-toc-link {
  color: #6f7899;
}

.share-toc-list--footnotes .share-toc-level-num {
  color: #9aa3c7;
}

.share-toc--abs .share-toc-children {
  padding-left: 0;
  --toc-offset: 0px;
}

.share-toc--abs .share-toc-row {
  padding-left: var(--toc-abs-indent, 0px);
}

.share-toc--abs .share-toc-row::before {
  left: var(--toc-abs-indent, 0px);
}

.share-toc-footnote-index {
  margin-left: 4px;
  font-size: 0.65em;
  vertical-align: super;
  color: #9aa3c7;
  cursor: pointer;
}

.share-toc-footnote-index:hover {
  color: #5a7bff;
  text-decoration: underline;
}

.sps-footnote-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  height: 1em;
  margin-right: 0.25em;
  margin-left: 0.2em;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 6px;
  vertical-align: baseline;
  flex: 0 0 auto;
  font-size: 1em;
  line-height: 1;
  transform: translateY(0.06em);
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.sps-footnote-action svg {
  width: 1em;
  height: 1em;
  display: block;
  -webkit-tap-highlight-color: transparent;
}

.sps-footnote-action + sup {
  margin-left: 0.1em;
}

.sps-footnote-action:hover,
.sps-footnote-action:focus,
.sps-footnote-action:focus-visible,
.sps-footnote-action:active {
  background: transparent;
  outline: none;
  box-shadow: none;
}

.sps-footnote-window__header {
  touch-action: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.sps-footnote-window {
  position: fixed;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 220px;
  min-height: 140px;
  max-width: 90vw;
  max-height: 70vh;
  z-index: 1300;
}

.sps-footnote-window__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  cursor: move;
  user-select: none;
}

.sps-footnote-window__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sps-footnote-window__actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sps-footnote-window__btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--muted);
  padding: 0;
}

.sps-footnote-window__btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.sps-footnote-window__btn .sps-footnote-line-icon {
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sps-footnote-window__btn .sps-footnote-pin-icon {
  fill: currentColor;
}

.sps-footnote-window__btn:hover {
  background: rgba(90, 123, 255, 0.12);
  color: var(--primary);
}

.sps-footnote-window__btn.is-pinned {
  background: rgba(90, 123, 255, 0.18);
  color: var(--primary-700);
}

.sps-footnote-window__body {
  padding: 12px 14px;
  overflow: auto;
  font-family: var(--font-markdown);
  font-size: 0.95rem;
  color: var(--text);
}

.sps-footnote-window__body p {
  margin: 0 0 12px;
}

.sps-footnote-window__body p:last-child {
  margin-bottom: 0;
}

body.sps-footnote-resizing {
  user-select: none;
}

.sps-footnote-window__resize-handle {
  position: absolute;
  z-index: 2;
}

.sps-footnote-window__resize-handle.is-n {
  top: -4px;
  left: 12px;
  right: 12px;
  height: 8px;
  cursor: n-resize;
}

.sps-footnote-window__resize-handle.is-s {
  bottom: -4px;
  left: 12px;
  right: 12px;
  height: 8px;
  cursor: s-resize;
}

.sps-footnote-window__resize-handle.is-e {
  top: 12px;
  bottom: 12px;
  right: -4px;
  width: 8px;
  cursor: e-resize;
}

.sps-footnote-window__resize-handle.is-w {
  top: 12px;
  bottom: 12px;
  left: -4px;
  width: 8px;
  cursor: w-resize;
}

.sps-footnote-window__resize-handle.is-ne {
  top: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  cursor: ne-resize;
}

.sps-footnote-window__resize-handle.is-nw {
  top: -4px;
  left: -4px;
  width: 12px;
  height: 12px;
  cursor: nw-resize;
}

.sps-footnote-window__resize-handle.is-se {
  bottom: -4px;
  right: -4px;
  width: 12px;
  height: 12px;
  cursor: se-resize;
}

.sps-footnote-window__resize-handle.is-sw {
  bottom: -4px;
  left: -4px;
  width: 12px;
  height: 12px;
  cursor: sw-resize;
}

body.sps-footnote-dragging {
  user-select: none;
  cursor: move;
}

.share-toc-children {
  padding-left: 18px;
  --toc-offset: calc(var(--toc-offset) + 18px);
}

.share-toc-node {
  list-style: none;
}

.share-toc-row {
  display: flex;
  align-items: center;
  gap: 2px;
  position: relative;
  width: 100%;
}

.share-toc-row::before {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 2px;
  border-radius: 2px;
  background: transparent;
  pointer-events: none;
}

.share-toc-toggle {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.share-toc-toggle {
  border: none;
  background: transparent;
  color: #6c7bd8;
  cursor: pointer;
  border-radius: 6px;
}

.share-toc-toggle::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid currentColor;
  transition: transform 120ms ease;
}

.share-toc-node.is-open > .share-toc-row .share-toc-toggle::before {
  transform: rotate(90deg);
}

.share-toc-node.is-collapsed > .share-toc-children {
  display: none;
}

.share-toc-link {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 8px;
  color: var(--text);
  border: 1px solid transparent;
  flex: 1;
  white-space: nowrap;
  transition: color 160ms ease;
  font-size: 0.8rem;
  line-height: 1.4;
  position: relative;
  z-index: 1;
}

.share-toc-level {
  font-size: 0.75rem;
  font-weight: 400;
  color: #8a94b8;
  line-height: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: baseline;
}

.share-toc-level-num {
  color: #5a7bff;
  font-size: 0.7em;
  vertical-align: baseline;
  position: relative;
  top: 0.12em;
}

.share-toc-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.share-toc-link:hover {
  text-decoration: none;
}

.share-toc-link.is-active {
  color: var(--primary-700);
  font-weight: 600;
}

.share-toc-row.is-active::before {
  background: #5a7bff;
}

.share-toc-empty {
  color: var(--muted);
  font-size: 0.9rem;
}

.scroll-top {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: none;
  background: linear-gradient(135deg, #5a7bff, #7d95ff);
  color: #fff;
  box-shadow: 0 12px 24px rgba(32, 48, 90, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 20;
}

.scroll-top svg {
  width: 20px;
  height: 20px;
}

.scroll-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.kb-header {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.kb-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.kb-title {
  margin: 0;
  font-size: 28px;
  font-family: var(--font-display);
  flex: 1;
  min-width: 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.share-content .kb-header,
.kb-main .kb-header {
  max-width: 920px;
  margin: 0 auto 18px;
}

.share-article {
  max-width: 920px;
  margin: 0 auto;
}

.share-article .kb-header {
  max-width: none;
  margin: 0 0 18px;
}

.kb-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.kb-breadcrumbs > *::after {
  content: "/";
  margin: 0 6px;
  color: #cbd2e6;
}

.kb-breadcrumbs > *:last-child::after {
  content: "";
  margin: 0;
}

.kb-back {
  font-weight: 600;
  color: var(--primary-700);
}

.kb-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.kb-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4159e3;
  font-size: 0.82rem;
  font-weight: 600;
}

.link-button {
  appearance: none;
  border: none;
  padding: 0;
  margin-left: 6px;
  background: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

.kb-directory {
  display: grid;
  gap: 10px;
}

.kb-dir-head,
.kb-dir-row {
  display: grid;
  grid-template-columns: 2fr 2fr 1fr;
  gap: 16px;
  align-items: center;
}

.kb-dir-head {
  font-size: 0.82rem;
  color: var(--muted);
  padding: 0 12px;
}

.kb-dir-row {
  padding: 12px;
  border-radius: 12px;
  background: #f8faff;
  border: 1px solid transparent;
  color: var(--text);
}

.kb-dir-row:hover {
  text-decoration: none;
}

.kb-dir-row:hover {
  border-color: #dbe3ff;
  background: #f1f5ff;
}

.kb-dir-title {
  font-weight: 600;
}

.kb-dir-path,
.kb-dir-time {
  color: var(--muted);
  font-size: 0.88rem;
}

.kb-dir-time {
  text-align: right;
}

.markdown-source {
  display: none;
  width: 100%;
  min-height: 320px;
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f8faff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.7;
  color: #1f2430;
  resize: vertical;
}

.share-article.is-markdown .markdown-body {
  display: none;
}

.share-article.is-markdown .markdown-source {
  display: block;
}

.button.share-view-toggle {
  white-space: nowrap;
  font-size: 0.82rem;
  padding: 6px 12px;
  border: 1px solid #e6ebf7;
  border-radius: 8px;
  background: #ffffff;
  color: #4159e3;
  box-shadow: none;
}

.button.share-view-toggle:hover,
.button.share-view-toggle:focus-visible,
.button.share-view-toggle:active {
  transform: none;
  box-shadow: none;
  background: #eef2ff;
  border-color: #d6def3;
}

.markdown-body {
  line-height: 1.8;
  font-size: 16px;
  color: #2d3440;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  min-width: 0;
}

.markdown-body > * {
  max-width: 100%;
}

.share-content .markdown-body,
.kb-main .markdown-body {
  max-width: 920px;
  margin: 0 auto;
}

.share-article .markdown-body {
  max-width: none;
  margin: 0;
}

.markdown-body pre,
.markdown-body .highlight {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
}

.markdown-body table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}

.markdown-body img,
.markdown-body video {
  max-width: 100%;
  height: auto;
}

.markdown-body svg {
  max-width: 100%;
  height: auto;
}

.markdown-body .katex svg {
  height: inherit;
  width: 100%;
  max-width: none;
  max-height: none;
}

@media (max-width: 900px) {
  .markdown-body video {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: auto;
    object-fit: contain;
    display: block;
  }
}

.markdown-body img,
.comment-content img {
  cursor: zoom-in;
}

.markdown-body img.sps-emoji,
.comment-content img.sps-emoji,
.markdown-body img[src*="/emojis/"],
.comment-content img[src*="/emojis/"],
.markdown-body img[src*="emojis/"],
.comment-content img[src*="emojis/"] {
  width: 1.1em;
  height: 1.1em;
  max-width: none;
  max-height: none;
  border-radius: 0;
  vertical-align: -0.15em;
  cursor: default;
}

.markdown-body iframe {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 320px;
  margin: 12px auto;
}

.iframe-shell {
  width: 100%;
  max-width: 100%;
  margin: 12px auto;
  display: block;
  position: relative;
}

.iframe-shell iframe {
  display: block;
  border: 0;
  width: 100%;
  height: auto;
}

.iframe-fullscreen-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  cursor: pointer;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(2px);
}

.iframe-shell:hover .iframe-fullscreen-toggle,
.iframe-shell:focus-within .iframe-fullscreen-toggle {
  opacity: 1;
  pointer-events: auto;
}

.iframe-shell.is-fullscreen .iframe-fullscreen-toggle {
  opacity: 0;
  pointer-events: none;
}

.iframe-fullscreen-toggle svg {
  width: 18px;
  height: 18px;
}

.iframe-shell:fullscreen {
  margin: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  background: #000;
  display: flex;
}

.iframe-shell:fullscreen iframe {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  min-height: 0 !important;
  aspect-ratio: auto !important;
}

@media (max-width: 900px) {
  .iframe-fit {
    position: relative;
    overflow: hidden;
  }

  .iframe-fit::before {
    content: "";
    display: block;
    padding-top: var(--iframe-ratio, 56.25%);
  }

  .iframe-fit__inner,
  .iframe-fit iframe {
    position: absolute;
    inset: 0;
  }

  .iframe-fit iframe {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: auto !important;
  }
}

.markdown-body embed,
.markdown-body object {
  max-width: 100%;
}

.markdown-body .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.markdown-body pre code {
  display: inline-block;
  min-width: max-content;
  white-space: pre;
  word-break: normal;
  overflow-wrap: normal;
  max-width: none;
}

.markdown-body .katex {
  max-width: 100%;
  overflow-x: auto;
}

.share-side-trigger {
  position: fixed;
  left: 20px;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 1100;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: none;
  background: #fff;
  color: #2c3766;
  box-shadow: 0 12px 24px rgba(32, 48, 90, 0.2);
  cursor: pointer;
  font-weight: 600;
}

.share-side-trigger svg {
  width: 18px;
  height: 18px;
}

.share-side-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
  z-index: 1000;
}

body.share-side-open .share-side-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  font-family: var(--font-display);
  margin-top: 1.4em;
}

.markdown-body strong,
.markdown-body b {
  font-weight: 700;
}

.layout-share .markdown-body h1,
.layout-share .markdown-body h2,
.layout-share .markdown-body h3,
.layout-share .markdown-body h4,
.layout-share .markdown-body h5,
.layout-share .markdown-body h6 {
  scroll-margin-top: 120px;
}

.markdown-body pre {
  border-radius: 12px;
}

.katex-block {
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.markdown-body .katex-display::-webkit-scrollbar,
.katex-block::-webkit-scrollbar {
  width: 0;
  height: 0;
}

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

.markdown-body table th,
.markdown-body table td {
  border: 1px solid #e6e9f2;
  padding: 8px 10px;
}

.markdown-body blockquote {
  border-left: 4px solid #cad4ff;
  background: #f5f7ff;
  padding: 10px 16px;
  color: #46506b;
}

.markdown-body blockquote.md-alert {
  border-left: 4px solid var(--callout-color, #3b6df2);
  background: #ffffff;
  padding: 12px 16px;
  color: #2d3440;
}

.markdown-body blockquote.md-alert p:first-of-type {
  margin-top: 6px;
}

.markdown-body .md-diagram {
  margin: 16px 0;
  border-radius: 12px;
  border: 1px solid #e6e9f2;
  background: #fff;
  padding: 12px;
  overflow: auto;
}

.markdown-body .md-diagram svg {
  max-width: none;
  height: auto;
}

.markdown-body .md-echarts {
  width: 100%;
  min-height: 260px;
  height: 360px;
}

.markdown-body img {
  max-width: 100%;
  border-radius: 12px;
}

body.layout-share .markdown-body img,
body.layout-share .comment-content img {
  max-width: 80%;
}

.markdown-body .mermaid {
  background: #ffffff;
  border-radius: 12px;
  padding: 12px;
}

.markdown-body p > img,
.markdown-body p > svg,
.markdown-body p > video,
.markdown-body p > iframe,
.markdown-body p > canvas,
.markdown-body p > embed,
.markdown-body p > object,
.markdown-body p > a > img,
.markdown-body p > a > svg,
.markdown-body p > a > video,
.markdown-body p > a > iframe,
.markdown-body p > a > canvas,
.markdown-body p > a > embed,
.markdown-body p > a > object,
.markdown-body li > img,
.markdown-body li > svg,
.markdown-body li > video,
.markdown-body li > iframe,
.markdown-body li > canvas,
.markdown-body li > embed,
.markdown-body li > object,
.markdown-body li > a > img,
.markdown-body li > a > svg,
.markdown-body li > a > video,
.markdown-body li > a > iframe,
.markdown-body li > a > canvas,
.markdown-body li > a > embed,
.markdown-body li > a > object {
  display: block;
  margin: 12px auto;
}

.markdown-body p > img.sps-emoji,
.markdown-body li > img.sps-emoji,
.markdown-body p > a > img.sps-emoji,
.markdown-body li > a > img.sps-emoji,
.markdown-body p > img[src*="/emojis/"],
.markdown-body li > img[src*="/emojis/"],
.markdown-body p > a > img[src*="/emojis/"],
.markdown-body li > a > img[src*="/emojis/"],
.markdown-body p > img[src*="emojis/"],
.markdown-body li > img[src*="emojis/"],
.markdown-body p > a > img[src*="emojis/"],
.markdown-body li > a > img[src*="emojis/"] {
  display: inline-block;
  margin: 0;
}

.markdown-body figure {
  margin: 12px auto;
  text-align: center;
}

.markdown-body .md-diagram,
.markdown-body .mermaid {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.markdown-body .md-diagram > svg,
.markdown-body .md-diagram > img,
.markdown-body .md-diagram > canvas,
.markdown-body .mermaid > svg,
.markdown-body .mermaid > img {
  margin-left: auto;
  margin-right: auto;
  max-width: none;
  display: block;
}

.markdown-body .md-diagram svg,
.markdown-body .mermaid svg,
.markdown-body .md-diagram img,
.markdown-body .mermaid img {
  max-width: none;
  width: auto;
  height: auto;
  overflow: visible;
}

.markdown-body .mermaid > img,
.markdown-body .mermaid img {
  max-width: 100%;
}

.media-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  margin: 12px auto;
  text-align: center;
}

.media-scroll > img,
.media-scroll > svg,
.media-scroll > canvas,
.media-scroll > iframe,
.media-scroll > embed,
.media-scroll > object,
.media-scroll > video {
  display: inline-block;
  max-width: none;
}

@media (max-width: 900px) {
  .markdown-body pre,
  .markdown-body .highlight,
  .markdown-body table,
  .markdown-body .katex-display,
  .markdown-body .md-diagram,
  .markdown-body .mermaid,
  .media-scroll {
    touch-action: pan-x pan-y;
  }
}

.markdown-body figure,
.markdown-body .md-diagram,
.markdown-body .mermaid,
.markdown-body pre,
.markdown-body table,
.markdown-body .katex-display {
  max-width: 100%;
}

.markdown-body .md-diagram--plantuml img {
  display: block;
}

.code-block {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--color-border-default, #e1e6f0);
  background: transparent;
  margin: 8px 0;
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 6px;
  background: var(--color-canvas-subtle, #f6f8fa);
  border-bottom: none;
}

.code-header.is-no-lang {
  justify-content: flex-end;
}

.code-lang {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: lowercase;
  color: #4b5563;
}

.code-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 20px;
  height: 20px;
  justify-content: center;
  padding: 0;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: #4b5563;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}

.code-copy.is-copied {
  color: #111827;
}

.code-copy-icon {
  width: 14px;
  height: 14px;
}

.code-copy:hover,
.code-copy:focus-visible {
  color: #111827;
}

.code-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: stretch;
  max-width: 100%;
  overflow: auto;
}

.code-lines {
  margin: 0;
  padding: 2px 6px;
  background: #f2f4f8;
  color: #7b869c;
  border-right: 1px solid var(--color-border-default, #e1e6f0);
  text-align: right;
  user-select: none;
  overflow: hidden;
  min-width: 20px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.6;
}

.code-lines code {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  white-space: pre;
  display: block;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}

.code-body pre {
  margin: 0;
  padding: 2px 6px;
  background: var(--color-canvas-subtle, #f6f8fa);
  border-radius: 0;
  min-width: 0;
  overflow: visible;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.6;
}

.code-body pre code {
  display: block;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  min-width: 0;
}

.code-body pre code.hljs {
  padding: 0;
  background: transparent;
}

.code-copy::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: #111827;
  color: #fff;
  font-size: 0.72rem;
  padding: 4px 6px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(-2px);
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 2;
}

.code-copy:hover::after,
.code-copy:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

body.image-viewer-open {
  overflow: hidden;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  color: #f8fafc;
  font-family: var(--font-body);
}

.image-viewer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 10, 18, 0.86);
}

.image-viewer-ui {
  position: relative;
  height: 100%;
  padding: 0;
}

.image-viewer-count {
  position: absolute;
  top: 18px;
  left: 20px;
  font-size: 0.9rem;
  color: #d6dcf4;
  background: rgba(14, 18, 32, 0.6);
  padding: 6px 10px;
  border-radius: 999px;
  z-index: 2;
}

.image-viewer-actions {
  position: absolute;
  top: 16px;
  right: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px;
  border-radius: 999px;
  background: rgba(8, 10, 18, 0.55);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  z-index: 2;
}

.image-viewer-btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  border-radius: 999px;
  width: 36px;
  height: 36px;
  padding: 0;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

.image-viewer-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.image-viewer-btn svg {
  width: 18px;
  height: 18px;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

.image-viewer-btn-text {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.image-viewer-zoom {
  min-width: 52px;
  text-align: center;
  font-weight: 700;
}

.image-viewer-stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0;
  border-radius: 0;
  cursor: grab;
  touch-action: none;
  z-index: 1;
}

.image-viewer-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.4);
  cursor: grab;
  transition: transform 120ms ease;
  transform-origin: center;
}

.image-viewer-stage.is-dragging,
.image-viewer-stage.is-dragging .image-viewer-img {
  cursor: grabbing;
}

.image-viewer-stage.is-dragging .image-viewer-img {
  transition: none;
}

.image-viewer-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.image-viewer-nav svg {
  width: 18px;
  height: 18px;
  display: block;
}

.image-viewer-nav.prev {
  left: 6px;
}

.image-viewer-nav.next {
  right: 6px;
}

.image-viewer-nav:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.image-viewer-thumbs {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  max-width: min(90vw, 840px);
  padding: 8px;
  border-radius: 14px;
  background: rgba(14, 18, 32, 0.6);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  z-index: 2;
}

.image-viewer-thumbs::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.image-viewer-thumb {
  border: 2px solid transparent;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  cursor: pointer;
  flex: 0 0 auto;
  width: 56px;
  height: 40px;
  overflow: hidden;
}

.image-viewer-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-viewer-thumb.is-active {
  border-color: #fff;
}

/* Announcement modal */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 1000;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.modal-card {
  position: relative;
  width: min(560px, 94vw);
  background: var(--surface);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
  z-index: 1;
}

.modal-header {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 12px;
}

.modal-body {
  display: grid;
  gap: 12px;
  max-height: 60vh;
  overflow: auto;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.announcement-item {
  padding: 12px;
  border-radius: 12px;
  background: #f5f7ff;
}

.announcement-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.announcement-content {
  color: var(--muted);
  font-size: 0.92rem;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 1000;
}

.modal-card {
  width: min(520px, 94vw);
  background: var(--surface);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* Markdown alerts */
.md-alert {
  margin: 16px 0;
  font-size: 0.95rem;
  border-radius: 0;
  padding: 0 16px;
  border-left: 4px solid var(--callout-color, #3b6df2);
  background: #ffffff;
}

.md-alert__title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  margin: 0;
}

.md-alert > *:first-child {
  margin-top: 0;
}

.md-alert > *:last-child {
  margin-bottom: 0;
}

.md-alert > p {
  margin: 6px 0;
}

.md-alert__icon {
  font-size: 1.05em;
  line-height: 1;
}

.md-alert__label {
  color: var(--callout-color, #3b6df2);
}

.md-alert--note,
.md-alert--info {
  --callout-color: #3b6df2;
}

.md-alert--tip {
  --callout-color: #56b14e;
}

.md-alert--important {
  --callout-color: #7c4dff;
}

.md-alert--warning {
  --callout-color: #f08a24;
}

.md-alert--caution {
  --callout-color: #e14b3d;
}

.md-alert--success {
  --callout-color: #2fb171;
}

.md-alert--danger {
  --callout-color: #e14b3d;
}

.stats-settings {
  margin-bottom: 16px;
}

.stats-note {
  margin-top: 8px;
}

.stats-block {
  margin-top: 18px;
}

.stats-title {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 10px;
}

.stats-source {
  word-break: break-all;
}

.stats-charts {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.stats-chart {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface-muted);
}

.stats-subtitle {
  font-weight: 700;
  margin-bottom: 8px;
}

.stats-chart-list {
  display: grid;
  gap: 8px;
}

.stats-chart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 2fr) auto;
  gap: 10px;
  align-items: center;
}

.stats-label {
  font-size: 0.9rem;
}

.stats-bar-track {
  height: 8px;
  background: #e6eaf3;
  border-radius: 999px;
  overflow: hidden;
}

.stats-bar {
  height: 100%;
  background: #5b8def;
  border-radius: 999px;
}

.stats-value {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.9rem;
  min-width: 36px;
  text-align: right;
}

.stats-toggle {
  margin-top: 6px;
}

.stats-actions .inline-form {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 960px) {
  .app-shell {
    display: block;
  }

  .app-sidebar {
    width: min(78vw, 280px);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    border-right: 1px solid var(--border);
    border-bottom: none;
    transform: translateX(-100%);
    transition: transform 200ms ease, opacity 200ms ease;
    opacity: 0;
    pointer-events: none;
    z-index: 9;
  }

  body.app-side-open .app-sidebar {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .app-nav {
    grid-auto-flow: row;
  }

  .app-topbar {
    align-items: center;
    gap: 12px;
  }

  .app-side-trigger {
    display: inline-flex;
  }

  .search-box {
    width: 100%;
  }

  .table {
    display: block;
    overflow-x: auto;
    width: 100%;
  }

  .table th,
  .table td {
    white-space: nowrap;
  }

  .share-shell {
    flex-direction: column;
  }

  .share-shell--doc,
  .share-shell--notebook {
    background: var(--surface);
  }

  .share-nav {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    position: static;
    top: auto;
    max-height: none;
  }

  .kb-sidebar,
  .share-toc {
    width: min(78vw, 320px);
    border-right: 1px solid var(--border);
    border-bottom: none;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    max-height: none;
    background: var(--surface);
    box-shadow: var(--shadow);
    transform: translateX(-100%);
    transition: transform 200ms ease, opacity 200ms ease;
    opacity: 0;
    pointer-events: none;
    z-index: 1001;
  }

  .share-content,
  .kb-main {
    padding: 24px 20px 40px;
  }

  .kb-main > .share-empty {
    min-height: 0;
    margin: 0;
    padding: 0 16px;
    width: min(92vw, 520px);
    text-align: center;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
  }

  .share-page {
    padding: 0 16px;
  }

  .share-footer {
    max-width: 100%;
    background: var(--surface);
  }

  .comment-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .kb-title-row {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: flex-start;
  }


  .comment-item {
    margin-left: 0;
    padding-left: calc(var(--comment-depth, 0) * 16px);
  }

  .comment-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .comment-card {
    flex-direction: column;
  }

  .comment-head {
    position: relative;
    align-items: flex-start;
    gap: 6px 8px;
    padding-right: 34px;
  }

  .comment-menu {
    position: absolute;
    top: 0;
    right: 0;
    margin-left: 0;
    align-self: flex-start;
    flex: 0 0 auto;
    display: inline-flex;
  }

  .comment-menu summary {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
  }

  .comment-footer {
    justify-content: flex-start;
  }

  .comment-captcha-row {
    flex-direction: column;
    align-items: stretch;
  }

  .report-captcha-row {
    flex-direction: column;
    align-items: stretch;
  }

  .comment-menu-list {
    left: auto;
    right: 0;
    max-width: min(200px, 90vw);
  }

  .kb-dir-head,
  .kb-dir-row {
    grid-template-columns: 1fr;
  }

  .kb-dir-time {
    text-align: left;
  }

  .scroll-top {
    right: 20px;
    bottom: 20px;
  }

  .share-side-trigger {
    display: inline-flex;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px) + 48px);
  }

  body.share-side-open {
    overflow: hidden;
  }

  body.share-side-open .kb-sidebar,
  body.share-side-open .share-toc {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }

  .markdown-body {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .markdown-body h1,
  .markdown-body h2,
  .markdown-body h3,
  .markdown-body h4,
  .markdown-body h5,
  .markdown-body h6,
  .markdown-body p,
  .markdown-body li,
  .markdown-body blockquote,
  .markdown-body td,
  .markdown-body th,
  .markdown-body a,
  .markdown-body code {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .markdown-body pre,
  .markdown-body .highlight,
  .markdown-body table,
  .markdown-body .katex-display {
    overflow-x: auto;
    max-width: 100%;
  }

  .markdown-body pre,
  .markdown-body pre code {
    white-space: pre;
  }

  .markdown-body pre code {
    word-break: normal;
    overflow-wrap: normal;
  }
}

/* Admin home */
.admin-home {
  display: grid;
  gap: 20px;
}

.admin-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: linear-gradient(120deg, #ffffff 0%, #f1f5ff 55%, #eef7ff 100%);
  position: relative;
  overflow: hidden;
}

.admin-hero::after {
  content: "";
  position: absolute;
  right: -80px;
  top: -70px;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(90, 123, 255, 0.22), rgba(90, 123, 255, 0));
}

.admin-hero__main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.admin-hero__eyebrow {
  font-size: 0.85rem;
  font-weight: 600;
  color: #5c6aa9;
}

.admin-hero__title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  color: #25315f;
}

.admin-hero__meta {
  color: var(--muted);
  font-size: 0.95rem;
}

.admin-hero__aside {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  position: relative;
  z-index: 1;
}

.admin-hero__panel {
  min-width: 200px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.admin-hero__panel-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.admin-hero__panel-value {
  font-size: 28px;
  font-weight: 700;
  color: #2a3c78;
}

.admin-hero__panel-meta {
  margin-top: 6px;
  font-size: 0.9rem;
  color: #4b5ba8;
}

.admin-hero__panel-sub {
  margin-top: 4px;
  font-size: 0.82rem;
}

.admin-kpi-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.admin-kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-kpi__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.admin-kpi__head > div {
  min-width: 0;
}

.admin-kpi__label {
  font-size: 0.9rem;
  color: var(--muted);
}

.admin-kpi__value {
  font-size: 24px;
  font-weight: 700;
  color: #2a365e;
}

.admin-kpi__meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.admin-kpi__icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(90, 123, 255, 0.18), rgba(26, 167, 161, 0.12));
  color: var(--primary);
}

.admin-kpi__icon svg {
  width: 22px;
  height: 22px;
}

.admin-kpi__icon .kpi-icon--storage {
  width: 26px;
  height: 26px;
}

.admin-kpi__progress {
  height: 6px;
  border-radius: 999px;
  background: #edf0fb;
  overflow: hidden;
}

.admin-kpi__progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #7d95ff);
}

.admin-chart-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 900px) {
  .admin-chart-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.admin-chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-chart-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.admin-chart-card__title {
  font-weight: 600;
  color: #2a365e;
}

.admin-chart-card__meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.admin-chart-card__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-chart-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-chart-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--muted);
}

.admin-chart {
  width: 100%;
  height: 220px;
  font-family: var(--font-body);
}

.admin-chart text {
  font-family: var(--font-body);
  font-weight: 500;
}

.admin-chart__grid line {
  stroke: #edf0fb;
  stroke-width: 1;
}

.admin-chart__axis text {
  fill: var(--muted);
  font-size: 9px;
  font-weight: 400;
  font-family: var(--font-body);
}

.admin-chart__unit {
  fill: var(--muted);
  font-size: 9px;
  font-weight: 400;
  font-family: var(--font-body);
}

.admin-chart__axis-line {
  stroke: #dfe6f6;
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke-width: 2.4;
}

.chart-area {
  opacity: 0.2;
}

.chart-line--primary {
  stroke: var(--primary);
}

.chart-area--primary {
  fill: rgba(90, 123, 255, 0.25);
}

.chart-line--accent {
  stroke: var(--accent);
}

.chart-line--secondary {
  stroke: #f29b6e;
}

.chart-area--secondary {
  fill: rgba(242, 155, 110, 0.24);
}

.chart-line--info {
  stroke: #6c8bff;
}

.chart-area--info {
  fill: rgba(108, 139, 255, 0.2);
}

.chart-line--storage {
  stroke: #2ea7b0;
}

.chart-area--storage {
  fill: rgba(46, 167, 176, 0.22);
}

.range-toggle {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: #f2f4ff;
}

.range-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}

.range-btn.is-active {
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 6px 12px rgba(90, 123, 255, 0.2);
}

.range-slider {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.range-slider input[type="range"] {
  flex: 1;
  min-width: 160px;
}

.range-slider__value {
  font-size: 0.82rem;
  color: var(--muted);
}

.admin-legend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.legend-dot.is-primary {
  background: var(--primary);
}

.legend-dot.is-accent {
  background: var(--accent);
}

.admin-governance-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.admin-governance-grid .card + .card {
  margin-top: 0;
}

.admin-governance {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-governance__label {
  color: var(--muted);
  font-size: 0.9rem;
}

.admin-governance__value {
  font-size: 26px;
  font-weight: 700;
  color: #2a365e;
}

.admin-governance__meta {
  font-size: 0.9rem;
  color: #5f6fad;
}

@media (max-width: 900px) {
  .admin-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-hero__aside {
    width: 100%;
    justify-content: flex-start;
  }

  .admin-hero__panel {
    width: 100%;
  }
}

@media (prefers-color-scheme: dark) {
  body.layout-share {
    color-scheme: dark;
    --bg: #424c62;
    --bg-strong: #59667f;
    --surface: #55627a;
    --surface-muted: #5f6c87;
    --panel-bg: #4f5b72;
    --text: #f7f9fc;
    --muted: #e8ecf3;
    --primary: #86adff;
    --primary-700: #a4bfff;
    --accent: #43d3c7;
    --danger: #f28482;
    --border: #8292b4;
    --shadow: 0 18px 40px rgba(18, 24, 40, 0.22);
    --shadow-soft: 0 12px 30px rgba(18, 24, 40, 0.14);
  }

  body.layout-share {
    background: var(--bg);
  }

  body.layout-share {
    scrollbar-color: #b8c0cf var(--bg);
  }

  body.layout-share::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }

  body.layout-share::-webkit-scrollbar-track {
    background: var(--bg);
  }

  body.layout-share::-webkit-scrollbar-thumb {
    background: #b8c0cf;
    border-radius: 999px;
    border: 2px solid var(--bg);
  }

  body.layout-share .input,
  body.layout-share select,
  body.layout-share textarea {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
  }

  body.layout-share .input::placeholder,
  body.layout-share textarea::placeholder {
    color: #7d8aa3;
  }

  body.layout-share .button.ghost {
    background: rgba(122, 162, 255, 0.12);
    color: #c7d2fe;
    border-color: transparent;
  }

  body.layout-share .report-trigger.kb-chip:hover {
    background: rgba(122, 162, 255, 0.18);
  }

  body.layout-share .share-nav {
    background: var(--panel-bg);
    border-color: var(--border);
  }

  body.layout-share .kb-sidebar,
  body.layout-share .share-toc {
    background: var(--panel-bg);
    box-shadow: 0 -24px 0 0 var(--panel-bg);
  }

  body.layout-share .share-nav-title {
    color: #e2e8f0;
  }

  body.layout-share .share-nav-item.is-active {
    background: rgba(122, 162, 255, 0.18);
    border-color: rgba(122, 162, 255, 0.35);
  }

  body.layout-share .share-content,
  body.layout-share .kb-main,
  body.layout-share .share-shell {
    background: var(--surface);
  }

  body.layout-share .comment-card {
    border-bottom-color: var(--border);
  }

  body.layout-share .comment-avatar {
    background: rgba(122, 162, 255, 0.2);
    color: #c7d2fe;
  }

  body.layout-share .comment-index,
  body.layout-share .comment-badge,
  body.layout-share .kb-chip {
    background: rgba(122, 162, 255, 0.15);
    color: #c7d2fe;
  }

  body.layout-share .comment-menu summary:hover {
    background: rgba(122, 162, 255, 0.16);
    color: #c7d2fe;
  }

  body.layout-share .comment-menu-item:hover {
    background: rgba(122, 162, 255, 0.16);
    color: #e2e8f0;
  }

  body.layout-share .comment-tool {
    background: rgba(122, 162, 255, 0.12);
    color: #c7d2fe;
  }

  body.layout-share .comment-tool:hover {
    background: rgba(122, 162, 255, 0.22);
  }

  body.layout-share .share-side-trigger {
    background: #0f172a;
    color: var(--text);
    box-shadow: 0 12px 24px rgba(2, 6, 23, 0.55);
  }

  body.layout-share .kb-side-tab {
    color: #93a4c8;
  }

  body.layout-share .kb-side-tab.is-active {
    color: #c7d2fe;
  }

  body.layout-share .kb-side-action {
    color: #9aa3b2;
  }

  body.layout-share .kb-side-action:hover {
    background: rgba(122, 162, 255, 0.16);
    border-color: rgba(122, 162, 255, 0.35);
    color: #c7d2fe;
  }

  body.layout-share .kb-tree-item.is-active {
    background: rgba(122, 162, 255, 0.18);
    border-color: rgba(122, 162, 255, 0.35);
    color: #e2e8f0;
  }

  body.layout-share .kb-tree-folder {
    color: #cbd5f5;
  }

  body.layout-share .share-toc-title,
  body.layout-share .kb-side-title {
    color: #e2e8f0;
  }

  body.layout-share .share-toc-list--footnotes .share-toc-link,
  body.layout-share .share-toc-level,
  body.layout-share .share-toc-footnote-index {
    color: #94a3b8;
  }

  body.layout-share .share-toc-level-num {
    color: #7aa2ff;
  }

  body.layout-share .kb-breadcrumbs > *::after {
    color: #3b455f;
  }

  body.layout-share .kb-dir-row {
    background: rgba(86, 98, 122, 0.92);
    border-color: transparent;
  }

  body.layout-share .kb-dir-row:hover {
    background: rgba(104, 119, 149, 0.95);
    border-color: rgba(122, 162, 255, 0.35);
  }

  body.layout-share .markdown-source {
    background: var(--surface-muted);
    border-color: var(--border);
    color: #f7f9fc;
  }

  body.layout-share .button.share-view-toggle {
    background: rgba(122, 162, 255, 0.12);
    border-color: rgba(122, 162, 255, 0.3);
    color: #c7d2fe;
  }

  body.layout-share .button.share-view-toggle:hover,
  body.layout-share .button.share-view-toggle:focus-visible,
  body.layout-share .button.share-view-toggle:active {
    background: rgba(122, 162, 255, 0.2);
    border-color: rgba(122, 162, 255, 0.45);
  }

  body.layout-share .markdown-body {
    color: var(--text);
  }

  body.layout-share .markdown-body table th,
  body.layout-share .markdown-body table td {
    border-color: var(--border);
  }

  body.layout-share .markdown-body blockquote {
    border-left-color: #9aa9c7;
    background: #657493;
    color: #eef2f8;
  }

  body.layout-share .markdown-body blockquote.md-alert {
    background: var(--surface-muted);
    color: var(--text);
  }

  body.layout-share .md-alert {
    background: var(--surface-muted);
    border-left-color: var(--callout-color, #7da4ff);
    color: var(--text);
  }

  body.layout-share .markdown-body .md-diagram,
  body.layout-share .markdown-body .mermaid {
    background: var(--surface);
    border-color: transparent;
  }

  body.layout-share .markdown-body pre,
  body.layout-share .markdown-body .highlight {
    background: var(--surface-muted);
  }

  body.layout-share .code-block {
    border-color: var(--border);
    background: var(--surface-muted);
  }

  body.layout-share .code-header,
  body.layout-share .code-body pre {
    background: var(--surface-muted);
  }

  body.layout-share .code-lang,
  body.layout-share .code-copy {
    color: #a5b4d6;
  }

  body.layout-share .code-copy.is-copied,
  body.layout-share .code-copy:hover,
  body.layout-share .code-copy:focus-visible {
    color: #e2e8f0;
  }

  body.layout-share .code-lines {
    background: #7384ab;
    color: #c3ccda;
    border-right-color: var(--border);
  }

  body.layout-share .hljs {
    color: #c9d1d9;
    background: transparent;
  }

  body.layout-share .hljs-doctag,
  body.layout-share .hljs-keyword,
  body.layout-share .hljs-meta .hljs-keyword,
  body.layout-share .hljs-template-tag,
  body.layout-share .hljs-template-variable,
  body.layout-share .hljs-type,
  body.layout-share .hljs-variable.language_ {
    color: #ff7b72;
  }

  body.layout-share .hljs-title,
  body.layout-share .hljs-title.class_,
  body.layout-share .hljs-title.class_.inherited__,
  body.layout-share .hljs-title.function_ {
    color: #d2a8ff;
  }

  body.layout-share .hljs-attr,
  body.layout-share .hljs-attribute,
  body.layout-share .hljs-literal,
  body.layout-share .hljs-meta,
  body.layout-share .hljs-number,
  body.layout-share .hljs-operator,
  body.layout-share .hljs-selector-attr,
  body.layout-share .hljs-selector-class,
  body.layout-share .hljs-selector-id,
  body.layout-share .hljs-variable {
    color: #79c0ff;
  }

  body.layout-share .hljs-meta .hljs-string,
  body.layout-share .hljs-regexp,
  body.layout-share .hljs-string {
    color: #a5d6ff;
  }

  body.layout-share .hljs-built_in,
  body.layout-share .hljs-symbol {
    color: #ffa657;
  }

  body.layout-share .hljs-code,
  body.layout-share .hljs-comment,
  body.layout-share .hljs-formula {
    color: #8b949e;
  }

  body.layout-share .hljs-name,
  body.layout-share .hljs-quote,
  body.layout-share .hljs-selector-pseudo,
  body.layout-share .hljs-selector-tag {
    color: #7ee787;
  }

  body.layout-share .hljs-subst {
    color: #c9d1d9;
  }

  body.layout-share .hljs-section {
    color: #79c0ff;
    font-weight: 700;
  }

  body.layout-share .hljs-bullet {
    color: #f2cc60;
  }

  body.layout-share .hljs-emphasis {
    color: #c9d1d9;
    font-style: italic;
  }

  body.layout-share .hljs-strong {
    color: #c9d1d9;
    font-weight: 700;
  }

  body.layout-share .hljs-addition {
    color: #7ee787;
    background-color: rgba(46, 160, 67, 0.2);
  }

  body.layout-share .hljs-deletion {
    color: #ff7b72;
    background-color: rgba(248, 81, 73, 0.2);
  }

  body.layout-share .markdown-body {
    background: var(--surface);
    --color-canvas-default: var(--surface);
    --color-canvas-subtle: var(--surface-muted);
    --color-border-default: var(--border);
    --color-border-muted: rgba(90, 104, 134, 0.7);
    --color-fg-default: var(--text);
    --color-fg-muted: var(--muted);
    --color-fg-subtle: #c3ccda;
    --color-accent-fg: var(--primary);
    --color-accent-emphasis: var(--primary);
    --color-neutral-muted: rgba(99, 116, 150, 0.28);
    --color-attention-subtle: rgba(242, 196, 109, 0.22);
    --color-danger-fg: var(--danger);
  }

  body.layout-share .code-copy::after {
    background: #1f2937;
  }

  body.layout-share .switch input {
    background: #1f2937;
    border-color: #334155;
  }

  body.layout-share .switch-slider {
    background: #e2e8f0;
  }
}

@media (prefers-color-scheme: dark) and (max-width: 960px) {
  body.layout-share .kb-sidebar,
  body.layout-share .share-toc {
    box-shadow: 0 -24px 0 0 var(--panel-bg), var(--shadow);
  }
}

/*Admin,Auth,Public dark mode*/
@media (prefers-color-scheme: dark) {
  body.layout-app,
  body.layout-auth,
  body.layout-public {
    color-scheme: dark;
    --bg: #424c62;
    --bg-strong: #59667f;
    --surface: #55627a;
    --surface-muted: #5f6c87;
    --panel-bg: #4f5b72;
    --text: #f7f9fc;
    --muted: #e8ecf3;
    --primary: #86adff;
    --primary-700: #a4bfff;
    --accent: #43d3c7;
    --danger: #f28482;
    --border: #8292b4;
    --shadow: 0 18px 40px rgba(18, 24, 40, 0.22);
    --shadow-soft: 0 12px 30px rgba(18, 24, 40, 0.14);
  }
  /*Admin override*/
  body.layout-app .topbar-title { color: var(--text); }
  body.layout-app .user-pill { background: rgba(122, 162, 255, 0.15); color: #c7d2fe; }
  body.layout-app .app-sidebar { background: var(--panel-bg); }
  body.layout-app .input,
  body.layout-app select,
  body.layout-app textarea { background: var(--surface); }
  body.layout-app .input::placeholder,
  body.layout-app textarea::placeholder { color: #8292b4; }
  body.layout-app .button.ghost { background: rgba(122, 162, 255, 0.12); color: #c7d2fe; }
  body.layout-app .card.danger-zone { background: #6b4f4f; border-color: #9e6a6a; }
  body.layout-app .admin-hero { background: linear-gradient(120deg, var(--surface) 0%, #596882 55%, #556078 100%); }
  body.layout-app .admin-hero__title { color: var(--text); }
  body.layout-app .admin-hero__eyebrow { color: var(--muted); }
  body.layout-app .admin-hero__panel { background: var(--surface); }
  body.layout-app .admin-hero__panel-value { color: var(--text); }
  body.layout-app .admin-hero__panel-meta { color: var(--muted); }
  body.layout-app .admin-kpi__value { color: var(--text); }
  body.layout-app .admin-kpi__progress { background: var(--surface-muted); }
  body.layout-app .admin-chart-card__title { color: var(--text); }
  body.layout-app .admin-chart__grid line { stroke: var(--border); }
  body.layout-app .admin-chart__axis-line { stroke: var(--border); }
  body.layout-app .range-toggle { background: var(--surface-muted); }
  body.layout-app .range-btn.is-active { background: var(--surface); }
  body.layout-app .topbar-version { color: var(--muted); }
  body.layout-app .topbar-version.is-update { color: #ff6535; }
  body.layout-app .admin-governance__value { color: var(--text); }
  body.layout-app .admin-governance__meta { color: var(--muted); }
  body.layout-app input[type="checkbox"] { accent-color: var(--primary); }
  body.layout-app input[type="checkbox"]:disabled { opacity: .70; }
  body.layout-app .notice { background: #635a44; border-color: #8f7e5c; color: var(--muted); }
  body.layout-app .toast { background: var(--surface); border-color: var(--border); color: var(--primary); }
  body.layout-app .toast.error { background: #6b4f4f; border-color: #9e6a6a; color: var(--danger); }
  body.layout-app .flash { background: var(--panel-bg); border-color: var(--border); }
  body.layout-app .flash.error { background: #6b4f4f; border-color: #9e6a6a; color: var(--danger); }
  /*Auth override*/
  body.layout-auth {
    background: linear-gradient(135deg, #424c62 0%, #4f5b72 48%, #55627a 100%);
  }
  body.layout-auth .auth-icon { background: var(--surface-muted); color: #a4bfff; box-shadow: none; }
  body.layout-auth .auth-input { color: var(--text); }
  body.layout-auth .auth-input::placeholder { color: #8292b4; }
  /*Public homepage override*/
  body.layout-public {
    background-image: radial-gradient(circle at 10% 20%, rgba(90,123,255,0.08), transparent 45%),
      radial-gradient(circle at 80% 0%, rgba(26,167,161,0.06), transparent 40%);
  }
  body.layout-public .home-hero { background: linear-gradient(135deg, var(--surface) 0%, #596882 45%, #556078 100%); }
  body.layout-public .hero-card { background: var(--panel-bg); border-color: var(--border); box-shadow: 0 10px 24px rgba(18,24,40,0.18); }
  body.layout-public .hero-card__title { color: var(--text); }
  body.layout-public .hero-card__lines span { background: linear-gradient(90deg, var(--border), var(--surface-muted)); }
  body.layout-public .hero-card__chips { color: var(--primary); }
  body.layout-public .hero-card__chips span { background: var(--surface-muted); border-color: var(--border); }
  body.layout-public .home-card { background: var(--surface-muted); border-color: var(--border); }
  body.layout-public .home-step { background: var(--surface-muted); border-color: var(--border); }
  body.layout-public .home-step span { background: var(--primary-700); color: #1e2538; }
  body.layout-public .home-hero__meta { color: var(--muted); }
  body.layout-public .home-version { color: var(--primary-700); background: rgba(134,173,255,0.12); }
  body.layout-public .button.primary { background: linear-gradient(135deg, #4a6ee0, #5a7bff); color: #fff; }
  body.layout-share .announcement-item { background: var(--surface-muted); }
  body.layout-app .announcement-item { background: var(--surface-muted); }
}