:root {
  --primary: #1a2332;
  --primary-soft: #2a3a52;
  --accent: #2563eb;
  --accent-light: #3b82f6;
  --accent-dark: #1d4ed8;
  --accent-wash: #eff5ff;
  --text: #1f2937;
  --text-light: #6b7280;
  --muted: #94a3b8;
  --bg: #f8fafc;
  --bg-warm: #f3f6fb;
  --surface: #fff;
  --border: #e2e8f0;
  --success: #0f9f72;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 8px 30px rgba(15, 23, 42, .07);
  --shadow-lg: 0 24px 70px rgba(15, 23, 42, .14);
  --nav-height: 72px;
  --container: 1240px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 100px; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
img { max-width: 100%; height: auto; }
code, pre { font-family: var(--mono); }
.container { width: min(var(--container), calc(100% - 48px)); margin-inline: auto; }
.eyebrow {
  display: inline-block;
  color: var(--accent);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .17em;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-height);
  border-bottom: 1px solid rgba(226, 232, 240, .9);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(16px);
}
.nav-row { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--primary); }
.brand:hover { color: var(--primary); }
.brand-mark {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-light));
  box-shadow: 0 7px 16px rgba(37, 99, 235, .22);
  font-size: 1.18rem;
  font-weight: 800;
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.25; }
.brand-copy strong { font-size: .98rem; }
.brand-copy small { color: var(--text-light); font-size: .7rem; }
.public-nav { display: flex; align-items: center; gap: 20px; font-size: .9rem; }
.public-nav a { color: var(--text); font-weight: 600; }
.public-nav form { margin: 0; }
.nav-user { color: var(--text-light); font-size: .84rem; }
.nav-login {
  padding: 8px 16px;
  border-radius: 9px;
  color: #fff !important;
  background: var(--primary);
}
.text-button {
  padding: 0;
  border: 0;
  color: var(--text-light);
  background: transparent;
  font-size: .86rem;
}
.text-button:hover { color: var(--accent); }

.site-footer { padding: 30px 0; border-top: 1px solid var(--border); background: #fff; }
.footer-row { display: flex; justify-content: space-between; color: var(--text-light); font-size: .82rem; }

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 700;
  font-size: .9rem;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--accent); box-shadow: 0 6px 18px rgba(37, 99, 235, .2); }
.button-primary:hover { color: #fff; background: var(--accent-dark); }
.button-secondary { color: var(--primary); border-color: var(--border); background: #fff; }
.button-secondary:hover { color: var(--accent); border-color: #bfdbfe; background: var(--accent-wash); }
.button-ghost { color: var(--text); background: rgba(255, 255, 255, .66); border-color: rgba(226, 232, 240, .95); }
.button-danger-ghost { color: var(--danger); border-color: #fecaca; background: #fff5f5; }
.button-full { width: 100%; }
.button-small { min-height: 34px; padding: 5px 12px; font-size: .79rem; }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }

.flash-stack { margin-top: 18px; display: grid; gap: 9px; }
.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .05);
  font-size: .88rem;
}
.flash-success { color: #087554; border-color: #a7f3d0; background: #f0fdf9; }
.flash-error { color: #a51d1d; border-color: #fecaca; background: #fff6f6; }
.flash-info { color: #1e4f9d; border-color: #bfdbfe; background: #f4f8ff; }
.flash-close { border: 0; color: inherit; background: transparent; font-size: 1.2rem; line-height: 1; }

.landing-page { background: #fff; }
.landing-hero {
  position: relative;
  min-height: 650px;
  display: flex;
  align-items: center;
  overflow: hidden;
  background:
    linear-gradient(120deg, rgba(248, 250, 252, .98) 0%, rgba(241, 246, 255, .94) 58%, rgba(235, 242, 255, .98) 100%);
}
.landing-hero::after {
  position: absolute;
  inset: 0;
  content: "";
  opacity: .4;
  background-image: radial-gradient(rgba(37, 99, 235, .18) .7px, transparent .7px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to right, transparent 25%, #000 100%);
}
.hero-glow { position: absolute; border-radius: 50%; filter: blur(3px); pointer-events: none; }
.hero-glow-one { width: 440px; height: 440px; right: -100px; top: -130px; background: rgba(59, 130, 246, .1); }
.hero-glow-two { width: 320px; height: 320px; left: 15%; bottom: -250px; background: rgba(37, 99, 235, .08); }
.landing-grid {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: 80px;
  align-items: center;
  padding-block: 70px;
}
.landing-copy h1 {
  margin: 18px 0 20px;
  color: var(--primary);
  font-size: clamp(2.6rem, 5vw, 4.65rem);
  line-height: 1.1;
  letter-spacing: -.045em;
}
.landing-copy h1 span { color: var(--accent); }
.landing-copy > p { max-width: 610px; margin: 0; color: var(--text-light); font-size: 1.06rem; }
.landing-actions { display: flex; gap: 12px; margin-top: 32px; }
.landing-actions .button { min-height: 48px; padding-inline: 22px; }
.secure-note { display: flex; align-items: center; gap: 8px; margin-top: 24px; color: var(--text-light); font-size: .8rem; }
.secure-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px rgba(15, 159, 114, .1); }

.landing-visual { position: relative; }
.visual-window {
  position: relative;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 35px 90px rgba(30, 64, 175, .16);
  transform: perspective(1400px) rotateY(-5deg) rotateX(2deg);
}
.window-bar { height: 39px; display: flex; align-items: center; gap: 6px; padding: 0 15px; border-bottom: 1px solid #e7edf5; background: #f8fafc; }
.window-bar i { width: 7px; height: 7px; border-radius: 50%; background: #cbd5e1; }
.window-bar i:first-child { background: #fb7185; }
.window-bar i:nth-child(2) { background: #fbbf24; }
.window-bar i:nth-child(3) { background: #34d399; }
.window-bar span { margin-left: auto; color: #94a3b8; font: 600 .62rem var(--mono); }
.visual-layout { display: grid; grid-template-columns: 145px 1fr; min-height: 355px; }
.visual-sidebar { padding: 24px 15px; border-right: 1px solid #e7edf5; background: #fbfdff; }
.visual-label { display: block; margin-bottom: 17px; color: #94a3b8; font-size: .62rem; font-weight: 800; letter-spacing: .08em; }
.visual-sidebar b { display: block; margin: 5px 0; padding: 8px 9px; border-radius: 7px; color: #64748b; font-size: .7rem; font-weight: 600; }
.visual-sidebar b:nth-of-type(2) { color: var(--accent); background: var(--accent-wash); }
.visual-content { padding: 34px 30px; }
.visual-kicker { color: var(--accent); font-size: .59rem; font-weight: 800; letter-spacing: .14em; }
.visual-content h3 { margin: 8px 0 23px; color: var(--primary); font-size: 1.55rem; }
.visual-lines, .visual-code { display: grid; gap: 9px; }
.visual-lines i { display: block; width: 100%; height: 6px; border-radius: 8px; background: #e9eef6; }
.visual-lines i.short { width: 66%; }
.visual-code { margin-top: 30px; padding: 18px; border-radius: 9px; background: #0f172a; }
.visual-code i { height: 5px; width: 92%; border-radius: 5px; background: #3b82f6; }
.visual-code i:nth-child(2) { width: 73%; background: #93c5fd; }
.visual-code i.short { width: 46%; background: #64748b; }
.floating-card {
  position: absolute;
  left: -32px;
  bottom: -25px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 19px;
  border: 1px solid #e5ecf6;
  border-radius: 13px;
  background: #fff;
  box-shadow: var(--shadow-lg);
  font-size: .78rem;
  line-height: 1.45;
}
.floating-card > strong { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; color: #fff; background: var(--accent); }
.floating-card small { color: var(--muted); }
.landing-features { padding: 34px 0; border-top: 1px solid var(--border); background: #fff; }
.feature-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.feature-strip > div { display: flex; gap: 13px; align-items: baseline; }
.feature-strip strong { color: var(--primary); }
.feature-strip span { color: var(--text-light); font-size: .87rem; }

.auth-page, .access-page { background: var(--bg-warm); }
.auth-section, .access-section { min-height: calc(100vh - var(--nav-height) - 92px); display: grid; place-items: center; padding: 58px 24px; }
.auth-card {
  width: min(440px, 100%);
  padding: 42px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-icon {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 15px;
  color: #fff;
  background: #09bb07;
  box-shadow: 0 8px 20px rgba(9, 187, 7, .2);
  font-weight: 800;
  font-size: 1.3rem;
}
.auth-card h1 { margin: 9px 0 5px; color: var(--primary); font-size: 1.8rem; letter-spacing: -.025em; }
.auth-lead { margin: 0 0 25px; color: var(--text-light); font-size: .9rem; }
.auth-footnote { margin: 22px 0 0; color: var(--muted); font-size: .74rem; }
.auth-footnote a { text-decoration: underline; }
.stack-form { display: grid; gap: 8px; text-align: left; }
.stack-form label, .bulk-link-form label, .document-edit-grid label { color: #4b5563; font-size: .8rem; font-weight: 650; }
.stack-form input, .stack-form textarea, .bulk-link-form input, .bulk-link-form textarea,
.document-edit-grid input, .search-large input, .sidebar-search input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dbe3ed;
  border-radius: 8px;
  outline: none;
  color: var(--text);
  background: #fff;
  font-size: .9rem;
}
.stack-form input:focus, .stack-form textarea:focus, .bulk-link-form input:focus,
.bulk-link-form textarea:focus, .search-large input:focus, .sidebar-search input:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .12);
}
.stack-form .button { margin-top: 10px; }
.dev-banner {
  display: grid;
  gap: 2px;
  margin: 0 0 20px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 9px;
  color: #1e4f9d;
  background: #f3f8ff;
  text-align: left;
  font-size: .76rem;
}
.dev-banner strong { font-size: .8rem; }
.wechat-qr-wrap { position: relative; width: 248px; max-width: 100%; margin: 0 auto; padding: 4px; }
.wechat-qr { display: block; width: 240px; height: 240px; max-width: 100%; }
.qr-corner { position: absolute; width: 23px; height: 23px; border-color: var(--accent); border-style: solid; }
.qr-corner-tl { top: 0; left: 0; border-width: 3px 0 0 3px; border-radius: 8px 0 0; }
.qr-corner-tr { top: 0; right: 0; border-width: 3px 3px 0 0; border-radius: 0 8px 0 0; }
.qr-corner-bl { bottom: 0; left: 0; border-width: 0 0 3px 3px; border-radius: 0 0 0 8px; }
.qr-corner-br { right: 0; bottom: 0; border-width: 0 3px 3px 0; border-radius: 0 0 8px; }
.login-status { color: var(--text-light); font-size: .86rem; }

.access-card {
  width: min(670px, 100%);
  padding: 44px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}
.lock-mark {
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 18px;
  color: var(--accent);
  background: var(--accent-wash);
  font-size: 1.9rem;
  font-weight: 800;
}
.access-card h1 { margin: 8px 0 8px; color: var(--primary); font-size: 1.8rem; letter-spacing: -.025em; }
.access-card > p { max-width: 510px; margin: 0 auto; color: var(--text-light); font-size: .9rem; }
.contact-qr {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 450px;
  margin: 30px auto 22px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: #fbfdff;
  text-align: left;
}
.contact-qr img { width: 150px; height: 150px; border-radius: 8px; }
.contact-qr div { display: grid; gap: 4px; }
.contact-qr strong { color: var(--primary); font-size: 1.05rem; }
.contact-qr span { color: var(--text); font-size: .84rem; }
.contact-qr small { color: var(--text-light); font-size: .74rem; }
.access-account { display: inline-block; padding: 7px 13px; border-radius: 30px; color: var(--text-light); background: var(--bg); font-size: .76rem; }

.page-heading {
  padding: 64px 0 48px;
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(circle at 85% 10%, rgba(37, 99, 235, .09), transparent 35%),
    #fff;
}
.page-heading h1 { margin: 9px 0 7px; color: var(--primary); font-size: clamp(2rem, 4vw, 2.8rem); letter-spacing: -.035em; }
.page-heading p { margin: 0; color: var(--text-light); }
.compact-heading { padding: 44px 0 38px; }
.group-section, .search-section { padding: 46px 0 70px; }
.group-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 17px; }
.group-card {
  position: relative;
  display: flex;
  min-height: 145px;
  align-items: center;
  gap: 19px;
  padding: 25px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
  transition: .22s ease;
}
.group-card:hover { border-color: #bfdbfe; color: var(--text); box-shadow: var(--shadow); transform: translateY(-2px); }
.group-index { color: #b9c6d8; font: 700 .82rem var(--mono); }
.group-card-body { flex: 1; }
.group-card h2 { margin: 0 0 4px; color: var(--primary); font-size: 1.12rem; }
.group-card p { margin: 0; color: var(--text-light); font-size: .82rem; }
.group-arrow { color: var(--accent); font-size: 1.4rem; }
.empty-state { padding: 70px 24px; border: 1px dashed #cbd5e1; border-radius: var(--radius); color: var(--text-light); text-align: center; background: rgba(255, 255, 255, .5); }
.empty-state strong { color: var(--primary); font-size: 1.05rem; }
.empty-state p { margin: 6px 0 0; font-size: .86rem; }

.docs-shell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr) 200px;
  gap: 24px;
  align-items: start;
  padding-block: 28px 64px;
}
.docs-sidebar, .toc-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 24px);
  max-height: calc(100vh - var(--nav-height) - 48px);
  overflow: auto;
}
.docs-sidebar { padding: 18px 14px 20px; border-right: 1px solid var(--border); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 17px; }
.sidebar-head a { color: var(--text-light); font-size: .75rem; }
.sidebar-head a:hover { color: var(--accent); }
.sidebar-close { display: none; border: 0; color: var(--text-light); background: transparent; font-size: 1.4rem; }
.docs-sidebar h2 { margin: 0 0 12px; color: var(--primary); font-size: .98rem; }
.sidebar-search { display: flex; margin-bottom: 17px; }
.sidebar-search input { padding: 8px 10px; border-radius: 8px 0 0 8px; font-size: .78rem; }
.sidebar-search button { width: 36px; border: 1px solid #dbe3ed; border-left: 0; border-radius: 0 8px 8px 0; color: var(--text-light); background: #fff; }
.document-list { display: grid; gap: 3px; }
.document-list a {
  display: grid;
  grid-template-columns: 23px 1fr;
  gap: 6px;
  padding: 8px 9px;
  border-radius: 7px;
  color: #526072;
  font-size: .8rem;
  line-height: 1.5;
}
.document-list a span { color: #a7b4c6; font: 600 .67rem var(--mono); padding-top: 2px; }
.document-list a:hover { color: var(--accent); background: #f4f8ff; }
.document-list a.active { color: var(--accent); background: var(--accent-wash); font-weight: 650; }
.document-list a.active span { color: var(--accent); }
.sidebar-toggle { display: none; }
.sidebar-scrim { display: none; }

.reader-main { min-width: 0; }
.reader-topbar { display: flex; align-items: center; justify-content: space-between; min-height: 28px; margin-bottom: 12px; color: var(--text-light); font-size: .76rem; }
.breadcrumbs { display: flex; gap: 7px; }
.breadcrumbs a { color: var(--text-light); }
.reading-panel {
  position: relative;
  min-height: 68vh;
  padding: 48px clamp(34px, 5vw, 72px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 5px 22px rgba(15, 23, 42, .035);
  overflow: hidden;
}
.reader-watermark {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}
.reader-watermark span {
  position: absolute;
  color: rgba(37, 99, 235, .05);
  font-size: .73rem;
  white-space: nowrap;
  transform: rotate(-24deg);
}
.reader-content { position: relative; z-index: 1; color: #263244; font-size: 1rem; line-height: 1.9; overflow-wrap: anywhere; }
[data-protected="true"] .reader-content { user-select: none; -webkit-user-select: none; }
.reader-content h1, .reader-content h2, .reader-content h3, .reader-content h4 {
  color: var(--primary);
  line-height: 1.35;
  letter-spacing: -.02em;
  scroll-margin-top: 100px;
}
.reader-content h1 { margin: 0 0 30px; padding-bottom: 18px; border-bottom: 1px solid var(--border); font-size: 2.05rem; }
.reader-content h2 { margin: 45px 0 16px; font-size: 1.52rem; }
.reader-content h3 { margin: 34px 0 12px; font-size: 1.2rem; }
.reader-content h4 { margin: 27px 0 9px; font-size: 1.02rem; }
.reader-content p { margin: 12px 0; }
.reader-content a { text-decoration: underline; text-underline-offset: 3px; }
.reader-content ul, .reader-content ol { padding-left: 25px; }
.reader-content li { margin: 6px 0; }
.reader-content blockquote { margin: 22px 0; padding: 12px 18px; border-left: 3px solid var(--accent-light); border-radius: 0 7px 7px 0; color: #526072; background: #f6f9fe; }
.reader-content aside.callout { margin: 22px 0; padding: 16px 18px; border: 1px solid #cfe0ff; border-radius: 9px; background: #f4f8ff; }
.reader-content :not(pre) > code { padding: 2px 5px; border: 1px solid #e2e8f0; border-radius: 5px; color: #be185d; background: #f8fafc; font-size: .87em; }
.reader-content pre {
  position: relative;
  margin: 22px 0;
  padding: 22px;
  border: 1px solid #1e293b;
  border-radius: 10px;
  overflow: auto;
  color: #dbeafe;
  background: #0f172a;
  line-height: 1.65;
  font-size: .85rem;
}
.reader-content pre code { color: inherit; background: none; }
.code-copy-button {
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 5px 9px;
  border: 1px solid rgba(148, 163, 184, .32);
  border-radius: 6px;
  color: #cbd5e1;
  background: rgba(15, 23, 42, .82);
  font-size: .69rem;
}
.code-copy-button:hover { color: #fff; border-color: #64748b; }
.reader-content table { display: block; width: 100%; margin: 24px 0; border-collapse: collapse; overflow-x: auto; font-size: .9rem; }
.reader-content th, .reader-content td { min-width: 110px; padding: 9px 12px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.reader-content th { color: var(--primary); background: #f4f7fb; font-weight: 700; }
.reader-content figure { margin: 26px 0; text-align: center; }
.reader-content figure img { border: 1px solid var(--border); border-radius: 9px; cursor: zoom-in; }
.reader-content figcaption { margin-top: 7px; color: var(--text-light); font-size: .78rem; }
.unsupported-block { padding: 10px 12px; border-radius: 7px; color: var(--text-light); background: var(--bg); font-size: .84rem; }
.reader-pagination { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 58px; padding-top: 24px; border-top: 1px solid var(--border); }
.reader-pagination a { display: grid; gap: 3px; color: var(--text); }
.reader-pagination a:hover strong { color: var(--accent); }
.reader-pagination small { color: var(--text-light); font-size: .69rem; }
.reader-pagination strong { font-size: .82rem; font-weight: 650; }
.reader-pagination .next { text-align: right; }
.toc-sidebar { padding: 8px 0 8px 15px; border-left: 1px solid var(--border); }
.toc-sidebar > strong { display: block; margin-bottom: 12px; color: var(--primary); font-size: .77rem; }
.toc-sidebar nav { display: grid; gap: 3px; }
.toc-sidebar a { display: block; padding: 4px 0; color: var(--text-light); font-size: .73rem; line-height: 1.5; }
.toc-sidebar a:hover { color: var(--accent); }
.toc-sidebar .toc-level-2 { padding-left: 8px; }
.toc-sidebar .toc-level-3 { padding-left: 17px; font-size: .7rem; }
.toc-sidebar .toc-level-4 { padding-left: 25px; font-size: .68rem; }
.toc-empty { color: var(--muted); font-size: .73rem; }

.search-large { display: flex; gap: 9px; max-width: 660px; margin-top: 22px; }
.search-large input { flex: 1; padding: 12px 14px; }
.search-results { max-width: 900px; }
.result-count { margin: 0 0 18px; color: var(--text-light); font-size: .84rem; }
.search-result {
  display: block;
  padding: 21px 23px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  background: #fff;
  transition: .2s ease;
}
.search-result + .search-result { margin-top: 12px; }
.search-result:hover { color: var(--text); border-color: #bfdbfe; box-shadow: var(--shadow); }
.search-result strong { color: var(--primary); font-size: 1rem; }
.search-result p { margin: 7px 0 11px; color: var(--text-light); font-size: .86rem; }
.search-result mark { padding: 0 2px; border-radius: 3px; color: #854d0e; background: #fef3c7; }
.search-result span { color: var(--accent); font-size: .75rem; font-weight: 650; }
.back-link { display: inline-block; margin-bottom: 12px; color: var(--text-light); font-size: .78rem; }

.legal-section { max-width: 850px; padding-block: 65px 90px; }
.legal-section h1 { margin: 8px 0 5px; color: var(--primary); font-size: 2.5rem; letter-spacing: -.04em; }
.legal-date { color: var(--muted); font-size: .78rem; }
.legal-copy { margin-top: 32px; padding: 35px 40px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.legal-copy h2 { margin: 30px 0 8px; color: var(--primary); font-size: 1.08rem; }
.legal-copy h2:first-child { margin-top: 0; }
.legal-copy p { color: #4b5563; font-size: .9rem; }
.privacy-note { padding: 12px; border-radius: 7px; color: #7c5a12 !important; background: #fffbeb; font-size: .8rem !important; }
.simple-message { min-height: 65vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-block: 70px; text-align: center; }
.simple-message h1 { margin: 8px 0 3px; color: var(--primary); }
.simple-message p { max-width: 560px; margin: 0 0 22px; color: var(--text-light); }
.error-code { color: #cbd5e1; font: 800 4rem var(--mono); letter-spacing: -.08em; }
.success-mark { display: grid; width: 60px; height: 60px; place-items: center; border-radius: 50%; color: #fff; background: var(--success); font-size: 1.8rem; }

.image-lightbox { position: fixed; z-index: 200; inset: 0; display: grid; place-items: center; padding: 50px; background: rgba(8, 15, 30, .9); }
.image-lightbox[hidden] { display: none; }
.image-lightbox img { max-width: min(1200px, 92vw); max-height: 85vh; object-fit: contain; border-radius: 8px; box-shadow: 0 20px 80px rgba(0, 0, 0, .45); }
.lightbox-close { position: absolute; top: 20px; right: 25px; border: 0; color: #fff; background: transparent; font-size: 2.3rem; }

/* Admin */
.admin-page { display: flex; min-height: 100vh; background: #f4f7fb; }
.admin-sidebar {
  position: fixed;
  z-index: 60;
  inset: 0 auto 0 0;
  display: flex;
  width: 238px;
  flex-direction: column;
  padding: 22px 16px;
  color: #cbd5e1;
  background: var(--primary);
}
.admin-brand { display: flex; align-items: center; gap: 10px; padding: 2px 5px 24px; color: #fff; }
.admin-brand:hover { color: #fff; }
.admin-brand span:last-child { display: grid; line-height: 1.35; }
.admin-brand strong { font-size: .92rem; }
.admin-brand small { color: #8294ad; font-size: .65rem; }
.admin-nav { display: grid; gap: 4px; }
.admin-nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; color: #aebbd0; font-size: .82rem; }
.admin-nav a span { width: 17px; color: #7186a4; text-align: center; }
.admin-nav a:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.admin-nav a.active { color: #fff; background: rgba(59, 130, 246, .28); }
.admin-nav a.active span { color: #93c5fd; }
.admin-sidebar-foot { display: grid; gap: 10px; margin-top: auto; padding: 18px 9px 5px; border-top: 1px solid rgba(255, 255, 255, .09); color: #8fa0b8; font-size: .72rem; }
.admin-sidebar-foot a, .admin-sidebar-foot .text-button { color: #aebbd0; font-size: .73rem; }
.admin-main { width: calc(100% - 238px); min-width: 0; margin-left: 238px; }
.admin-topbar {
  display: flex;
  height: 58px;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, .9);
  color: var(--text-light);
  font-size: .73rem;
}
.admin-env-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #f59e0b; }
.admin-top-user { color: var(--primary); font-weight: 700; }
.admin-menu-toggle { display: none; border: 0; color: var(--text); background: transparent; font-size: 1.2rem; }
.admin-flashes { margin: 18px 30px 0; }
.admin-content { padding: 27px 30px 60px; }
.admin-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.admin-page-head h1 { margin: 5px 0 3px; color: var(--primary); font-size: 1.75rem; letter-spacing: -.03em; }
.admin-page-head p { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; color: var(--text-light); font-size: .8rem; }
.head-actions { display: flex; gap: 9px; align-items: center; }
.head-actions form { margin: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { padding: 18px 20px; border: 1px solid var(--border); border-radius: 11px; background: #fff; }
.stat-card > span { display: block; color: var(--text-light); font-size: .75rem; }
.stat-card strong { display: block; margin: 4px 0 0; color: var(--primary); font-size: 1.8rem; line-height: 1.3; }
.stat-card small { color: var(--muted); font-size: .69rem; }
.stat-card.warning { border-color: #fed7aa; background: #fffaf3; }
.stat-card.warning strong { color: #b45309; }
.admin-two-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .8fr); gap: 18px; align-items: start; }
.content-admin-layout { grid-template-columns: minmax(0, 1.7fr) minmax(280px, .75fr); }
.group-admin-layout { grid-template-columns: minmax(0, 1.4fr) minmax(280px, .65fr); }
.admin-panel { padding: 20px; border: 1px solid var(--border); border-radius: 11px; background: #fff; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 17px; }
.panel-head h2 { margin: 0 0 2px; color: var(--primary); font-size: 1rem; }
.panel-head p { margin: 0; color: var(--text-light); font-size: .73rem; }
.panel-empty, .empty-cell { padding: 28px 12px; color: var(--muted); text-align: center; font-size: .8rem; }
.admin-side-stack { display: grid; gap: 18px; }
.side-form-panel { align-self: start; }
.table-wrap { width: 100%; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: .78rem; }
.admin-table th { padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-light); text-align: left; font-size: .69rem; font-weight: 650; white-space: nowrap; }
.admin-table td { padding: 12px 10px; border-bottom: 1px solid #edf1f6; color: #4b5563; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table td strong { display: block; color: var(--primary); font-weight: 650; }
.admin-table td small { display: block; margin-top: 2px; color: var(--muted); font-size: .67rem; }
.table-link { color: var(--accent); font-size: .76rem; font-weight: 650; }
.badge { display: inline-block; padding: 3px 7px; border-radius: 20px; color: #64748b; background: #f1f5f9; font-size: .65rem; line-height: 1.5; white-space: nowrap; }
.badge-success { color: #087554; background: #e9fbf5; }
.badge-warning { color: #a65a05; background: #fff7e7; }
.badge-error { color: #b91c1c; background: #fff0f0; }
.compact-list { display: grid; gap: 1px; }
.compact-list a { display: grid; gap: 2px; padding: 10px 0; border-bottom: 1px solid #edf1f6; color: var(--text); }
.compact-list a:last-child { border-bottom: 0; }
.compact-list strong { color: var(--primary); font-size: .8rem; }
.compact-list span { max-width: 100%; overflow: hidden; color: #b91c1c; font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.audit-list { display: grid; gap: 7px; }
.audit-list > div { display: grid; grid-template-columns: 1fr auto; gap: 1px 10px; padding: 7px 0; border-bottom: 1px solid #edf1f6; font-size: .7rem; }
.audit-list > div:last-child { border-bottom: 0; }
.audit-list code { color: #334155; font-size: .68rem; }
.audit-list span { color: var(--muted); }
.audit-list time { grid-column: 2; grid-row: 1 / 3; align-self: center; color: var(--muted); }
.document-admin-list { display: grid; gap: 10px; }
.document-admin-row { padding: 15px; border: 1px solid #e6ebf2; border-radius: 9px; }
.document-state { display: flex; align-items: center; gap: 7px; }
.order-chip { color: var(--muted); font: .66rem var(--mono); }
.document-admin-row h3 { margin: 8px 0 1px; color: var(--primary); font-size: .92rem; }
.document-admin-row p { margin: 0; color: var(--text-light); font-size: .7rem; }
.document-admin-main { min-width: 0; }
.document-admin-actions { display: flex; align-items: center; gap: 15px; margin-top: 11px; }
.document-admin-actions form { margin: 0; }
.document-edit-grid { display: flex; align-items: flex-end; gap: 12px; justify-content: space-between; margin-top: 12px; padding-top: 12px; border-top: 1px dashed #e2e8f0; }
.document-edit-grid form:first-child { display: flex; align-items: flex-end; gap: 8px; flex: 1; }
.document-edit-grid label { display: grid; gap: 3px; flex: 1; min-width: 90px; }
.document-edit-grid input { padding: 6px 8px; font-size: .74rem; }
.inline-error { margin-top: 7px; padding: 7px 9px; border-radius: 6px; color: #a51d1d; background: #fff3f3; font-size: .7rem; }
.danger-link { color: var(--danger); }
.admin-alert { display: grid; gap: 2px; margin-bottom: 18px; padding: 13px 16px; border: 1px solid #fecaca; border-radius: 9px; color: #991b1b; background: #fff5f5; font-size: .78rem; }
.admin-alert small { color: #b45353; }
.action-stack { display: grid; gap: 9px; }
.action-stack form { margin: 0; }
.detail-list { margin: 0; }
.detail-list > div { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid #edf1f6; font-size: .76rem; }
.detail-list > div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--text-light); }
.detail-list dd { min-width: 0; margin: 0; color: var(--primary); overflow-wrap: anywhere; }
.detail-list code { padding: 2px 5px; border-radius: 4px; background: var(--bg); font-size: .7rem; }
.tag-link { display: inline-block; margin: 0 5px 5px 0; padding: 2px 7px; border-radius: 5px; background: var(--accent-wash); font-size: .69rem; }
.inline-meta { color: var(--muted); font-size: .72rem; }
.admin-preview-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 24px; align-items: start; }
.preview-toc { position: sticky; top: 24px; display: grid; gap: 4px; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-size: .73rem; }
.preview-toc strong { margin-bottom: 6px; color: var(--primary); }
.preview-toc a { color: var(--text-light); line-height: 1.5; }
.preview-toc .toc-level-2 { padding-left: 7px; }
.preview-toc .toc-level-3 { padding-left: 14px; }
.preview-toc .toc-level-4 { padding-left: 21px; }
.admin-preview { padding: 42px clamp(28px, 5vw, 68px); border: 1px solid var(--border); border-radius: 11px; background: #fff; }
.generate-panel { margin-bottom: 18px; }
.bulk-link-form { display: grid; grid-template-columns: 190px 120px minmax(280px, 1fr) auto; align-items: end; gap: 14px; }
.bulk-link-form label { display: grid; gap: 4px; }
.bulk-link-form textarea { resize: vertical; }
.bulk-link-form select { width: 100%; padding: 10px 12px; border: 1px solid #dbe3ed; border-radius: 8px; background: #fff; font-size: .86rem; }
.copy-field { display: flex; max-width: 420px; align-items: stretch; gap: 0; }
.copy-field code { flex: 1; padding: 5px 8px; overflow: hidden; border: 1px solid var(--border); border-radius: 6px 0 0 6px; color: #475569; background: #f8fafc; font-size: .65rem; text-overflow: ellipsis; white-space: nowrap; }
.copy-icon { padding: 3px 8px; border: 1px solid var(--border); border-left: 0; border-radius: 0 6px 6px 0; color: var(--accent); background: #fff; font-size: .66rem; }
.qr-preview-panel img { display: block; width: 240px; max-width: 100%; margin: 0 auto; border: 1px solid var(--border); border-radius: 12px; }
.password-panel { max-width: 560px; margin-top: 18px; }
.password-form { grid-template-columns: 1fr 1fr; }
.password-form .button { justify-self: start; }
.admin-scrim { display: none; }

.admin-login-page { min-height: 100vh; display: grid; place-items: center; padding: 30px; background: var(--primary); }
.admin-login-shell { display: grid; grid-template-columns: 1fr 410px; width: min(980px, 100%); overflow: hidden; border-radius: 20px; background: #fff; box-shadow: 0 35px 100px rgba(0, 0, 0, .3); }
.admin-login-intro { position: relative; overflow: hidden; padding: 70px 60px; color: #fff; background: linear-gradient(145deg, #182235, #244775); }
.admin-login-intro::after { position: absolute; width: 350px; height: 350px; right: -170px; bottom: -160px; content: ""; border-radius: 50%; background: rgba(59, 130, 246, .25); }
.large-mark { width: 52px; height: 52px; margin-bottom: 60px; font-size: 1.5rem; }
.admin-login-intro .eyebrow { display: block; color: #93c5fd; }
.admin-login-intro h1 { margin: 18px 0 14px; font-size: 2.35rem; line-height: 1.3; letter-spacing: -.04em; }
.admin-login-intro p { max-width: 370px; margin: 0; color: #b5c6dc; font-size: .87rem; }
.admin-login-card { padding: 56px 42px; }
.admin-login-card h2 { margin: 0; color: var(--primary); font-size: 1.55rem; }
.admin-login-card > p { margin: 4px 0 25px; color: var(--text-light); font-size: .8rem; }
.admin-login-card .flash { margin-bottom: 12px; }

@media (max-width: 1180px) {
  .docs-shell { grid-template-columns: 230px minmax(0, 1fr); }
  .toc-sidebar { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 960px) {
  .landing-grid { grid-template-columns: 1fr; gap: 48px; }
  .landing-copy { text-align: center; }
  .landing-copy > p { margin-inline: auto; }
  .landing-actions, .secure-note { justify-content: center; }
  .landing-visual { width: min(600px, 100%); margin: 0 auto; }
  .admin-sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .admin-page.menu-open .admin-sidebar { transform: none; }
  .admin-page.menu-open .admin-scrim { display: block; position: fixed; z-index: 55; inset: 0; background: rgba(15, 23, 42, .38); }
  .admin-main { width: 100%; margin-left: 0; }
  .admin-menu-toggle { display: block; }
  .admin-topbar { justify-content: flex-start; gap: 13px; }
  .admin-top-user { margin-left: auto; }
  .admin-two-col, .content-admin-layout, .group-admin-layout { grid-template-columns: 1fr; }
  .bulk-link-form { grid-template-columns: 160px 100px 1fr; }
  .bulk-link-form .button { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 820px) {
  :root { --nav-height: 64px; }
  .container { width: min(var(--container), calc(100% - 30px)); }
  .brand-copy small, .nav-user { display: none; }
  .public-nav { gap: 11px; }
  .landing-hero { min-height: auto; }
  .landing-grid { padding-block: 55px 75px; }
  .landing-copy h1 { font-size: clamp(2.35rem, 9vw, 3.8rem); }
  .floating-card { left: 12px; }
  .feature-strip { grid-template-columns: 1fr; gap: 13px; }
  .group-grid { grid-template-columns: 1fr; }
  .docs-shell { display: block; padding-block: 14px 45px; }
  .docs-sidebar {
    position: fixed;
    z-index: 120;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(320px, 88vw);
    max-height: none;
    padding: 22px 18px;
    background: #fff;
    box-shadow: 20px 0 50px rgba(15, 23, 42, .18);
    transform: translateX(-105%);
    transition: transform .22s ease;
  }
  .menu-open .docs-sidebar { transform: none; }
  .sidebar-close { display: block; }
  .sidebar-scrim { display: none; position: fixed; z-index: 110; inset: 0; background: rgba(15, 23, 42, .35); }
  .menu-open .sidebar-scrim { display: block; }
  .sidebar-toggle { display: inline-flex; padding: 5px 9px; border: 1px solid var(--border); border-radius: 7px; color: var(--text); background: #fff; font-size: .75rem; }
  .reading-panel { padding: 31px 22px; }
  .reader-content h1 { font-size: 1.62rem; }
  .reader-content h2 { font-size: 1.34rem; }
  .reader-pagination { grid-template-columns: 1fr; }
  .reader-pagination .next { text-align: left; }
  .search-large { flex-direction: column; }
  .legal-copy { padding: 25px 20px; }
  .access-card { padding: 31px 20px; }
  .contact-qr { flex-direction: column; text-align: center; }
  .admin-content { padding: 22px 18px 50px; }
  .admin-flashes { margin-inline: 18px; }
  .admin-page-head { align-items: flex-start; flex-direction: column; }
  .admin-preview-layout { grid-template-columns: 1fr; }
  .preview-toc { position: static; }
  .admin-login-shell { grid-template-columns: 1fr; }
  .admin-login-intro { padding: 42px 32px; }
  .large-mark { margin-bottom: 26px; }
  .admin-login-intro h1 { font-size: 1.8rem; }
  .admin-login-card { padding: 38px 30px; }
}

@media (max-width: 560px) {
  .brand-copy strong { font-size: .86rem; }
  .brand-mark { width: 34px; height: 34px; }
  .public-nav a { font-size: .8rem; }
  .nav-login { padding: 6px 10px; }
  .landing-actions { flex-direction: column; }
  .landing-actions .button { width: 100%; }
  .secure-note { line-height: 1.5; text-align: center; }
  .visual-layout { grid-template-columns: 105px 1fr; min-height: 300px; }
  .visual-sidebar { padding-inline: 8px; }
  .visual-content { padding: 25px 18px; }
  .visual-content h3 { font-size: 1.2rem; }
  .floating-card { position: relative; left: auto; bottom: auto; width: max-content; margin: -18px auto 0; }
  .auth-card { padding: 32px 22px; }
  .page-heading { padding-block: 42px 35px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { padding: 14px; }
  .stat-card strong { font-size: 1.4rem; }
  .admin-page-head h1 { font-size: 1.45rem; }
  .document-edit-grid { align-items: stretch; flex-direction: column; }
  .document-edit-grid form:first-child { align-items: stretch; flex-direction: column; }
  .document-edit-grid .button { align-self: flex-start; }
  .bulk-link-form { grid-template-columns: 1fr; }
  .bulk-link-form .button { grid-column: auto; width: 100%; }
  .admin-topbar { padding-inline: 15px; }
  .admin-page-head .button { width: 100%; }
  .head-actions { width: 100%; flex-direction: column; }
  .detail-list > div { grid-template-columns: 85px 1fr; }
  .password-form { grid-template-columns: 1fr; }
}

@media print {
  .site-header, .site-footer, .docs-sidebar, .toc-sidebar, .reader-topbar, .reader-pagination, .flash-stack { display: none !important; }
  .reading-panel { border: 0; box-shadow: none; padding: 0; }
  .reader-watermark { display: none; }
  .reader-content { color: #000; }
}
