:root{
  --brand-green:#3CAE49;
  --brand-lime:#C2D500;
  --ink:#0b1220;
  --muted:#54657a;
  --bg:#f5f7fb;
  --card:#ffffff;
  --line:#e3e8f2;
  --shadow: 0 10px 30px rgba(15,23,42,.08);
  --radius:16px;
  --gutter: 96px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:"Source Sans 3", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--ink);
  background:var(--bg);
}
a{ color:inherit; text-decoration:none; }
a:hover{ text-decoration:underline; }

.skip-link{ position:absolute; left:-999px; top:auto; width:1px; height:1px; overflow:hidden; }
.skip-link:focus{ left:12px; top:12px; width:auto; height:auto; padding:10px 12px; background:#fff; border-radius:10px; z-index:9999; border:1px solid var(--line); }

.site-header{
  position:sticky; top:0; z-index:100;
  background:#fff;
  color:var(--ink);
  border-bottom: 4px solid var(--brand-green);
  box-shadow: 0 4px 18px rgba(0,0,0,.10);
}
.header-inner{
  max-width: 1300px;
  margin:0 auto;
  padding: 12px 16px;
  display:flex;
  align-items:center;
  gap:14px;
}
.brand-link{ display:flex; align-items:center; }
.brand-logo{ height:44px; width:auto; display:block; }

.header-title{ display:flex; flex-direction:column; line-height:1.1; }
.header-name{ font-weight:700; font-size:18px; }
.header-tag{ font-size:13px; color:var(--muted); }

.header-tools{ margin-left:auto; display:flex; align-items:center; gap:10px; }
.search{
  display:flex; align-items:center; gap:8px;
  background:#fff;
  border: 1px solid var(--line);
  padding: 8px 10px;
  border-radius: 999px;
  box-shadow: 0 8px 20px rgba(15,23,42,.06);
}
.search input{ background:transparent; border:none; outline:none; color:var(--ink); width: 220px; }
.search input::placeholder{ color: var(--muted); }

.shell{
  max-width:1300px;
  margin: 16px auto 28px;
  padding: 0 16px;
  display:grid;
  grid-template-columns: 300px 1fr 360px;
  gap: 14px;
  min-height: calc(100vh - 140px);
}

.panel{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  display:flex;
  flex-direction:column;
  min-height: 0;
}
.panel-head{ padding: 14px 14px 10px; border-bottom: 1px solid var(--line); }
.panel-head h2{ margin:0; font-size:16px; }
.panel-head p{ margin:6px 0 0; }
.panel-body{ padding: 12px 14px 14px; overflow:auto; min-height:0; }

.muted{ color:var(--muted); }
.fineprint{ margin:12px 0 0; font-size:12px; color:var(--muted); }

.doc-head{ display:flex; align-items:flex-start; justify-content:space-between; gap: 12px; }
.doc-head h1{ margin:0; font-size:20px; }
.doc-actions{ display:flex; gap:8px; }

.btn{
  background: var(--brand-green);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 9px 12px;
  font-weight:700;
  cursor:pointer;
}
.btn:hover{ filter: brightness(.97); }
.btn-ghost{ background: transparent; border: 1px solid var(--line); color: var(--ink); }

.toc button{
  width:100%;
  display:block;
  text-align:left;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  cursor:pointer;
  font: inherit;
}
.toc button:hover{
  background: #f3fbf5;
  border-color: rgba(60,174,73,.25);
}
.toc button.active{
  background: rgba(60,174,73,.12);
  border-color: rgba(60,174,73,.35);
}
.toc .toc-cover{
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 10px 26px rgba(15,23,42,.06);
  margin-bottom: 10px;
}
.toc .toc-group{ margin-bottom: 8px; }
.toc .toc-major{ font-weight:700; }
.toc .toc-sublist{ padding-left: 10px; }
.toc .toc-sub{ padding-left: 14px; }
.toc .toc-sub-label{ display:inline-block; min-width: 52px; font-weight:700; color: var(--ink); }


.doc-body{ padding: 14px 14px 18px; }
.block{
  display:grid;
  grid-template-columns: var(--gutter) 1fr;
  gap: 14px;
  padding: 10px 8px;
  border-bottom: 1px dashed rgba(227,232,242,.9);
}
.block:last-child{ border-bottom: none; }
.gutter{
  color: var(--muted);
  font-weight:700;
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}
.content{ min-width:0; }
.major_heading, .major-heading{ /* allow both */ }
.major_heading h3{ margin:0; font-size:18px; }
.major_heading .gutter{ color: var(--brand-green); }

.major_heading, .major-heading{
  padding: 14px 8px 12px;
  border-bottom: 2px solid var(--line);
  background: linear-gradient(180deg, rgba(42,167,165,.08), rgba(42,167,165,.00));
  border-radius: 12px;
  margin-bottom: 6px;
}
.major-heading h3, .heading h3{ margin:0; font-size:16px; }
.subheading h3{ margin:0; font-size:15px; }

.subentry-line{ line-height:1.55; }
.subentry-line strong{ font-weight:800; }
.paragraph p{ margin:0; line-height:1.55; }

.list-item{ display:flex; gap:10px; line-height:1.55; }
.list-item .bullet{ width: 14px; text-align:center; color: var(--brand-green); font-weight:700; }

.level-0{ margin-left: 0; }
.level-1{ margin-left: 0; }
.level-2{ margin-left: 16px; }
.level-3{ margin-left: 28px; }
.level-4{ margin-left: 40px; }
.level-5{ margin-left: 52px; }
.level-6{ margin-left: 64px; }

.chat-body{ display:flex; flex-direction:column; gap: 10px; }
.chat-config label{ display:flex; flex-direction:column; gap:6px; font-size:13px; font-weight:700; }
.chat-config input{
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  outline: none;
}
.chat-config input:focus{ border-color: #b5e7e6; box-shadow: 0 0 0 4px rgba(42,167,165,.15); }
.chat-log{
  background: #fbfcff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  height: 380px;
  overflow:auto;
}
.msg{
  border-radius: 14px;
  padding: 10px 10px;
  margin: 8px 0;
  border: 1px solid var(--line);
}
.msg.user{ background: #eff8ff; }
.msg.ai{ background: #f1fbfb; }
.msg .who{ font-weight:800; font-size:12px; color: var(--muted); margin-bottom: 6px; }
.msg .text{ white-space:pre-wrap; line-height:1.45; }
.chat-form{ display:flex; gap: 10px; }
.chat-form input{
  flex:1;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  outline:none;
}
.chat-form input:focus{ border-color: #b5e7e6; box-shadow: 0 0 0 4px rgba(42,167,165,.12); }

.site-footer{ background: #0a2f50; color:#fff; padding: 18px 0 22px; }
.footer-inner{
  max-width:1300px;
  margin:0 auto;
  padding: 0 16px;
  display:grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 18px;
}
.footer-title{ font-weight:800; margin-bottom: 8px; }
.footer-text{ opacity:.95; line-height:1.45; }
.site-footer a{ color:#fff; opacity:.95; display:block; padding: 6px 0; }
.site-footer a:hover{ opacity:1; text-decoration:underline; }

@media (max-width: 1100px){
  .shell{ grid-template-columns: 280px 1fr; }
  .chat{ grid-column: 1 / -1; }
  .chat-log{ height: 260px; }
}
@media (max-width: 820px){
  .main-nav{ display:none; }
  .search input{ width: 140px; }
  .shell{ grid-template-columns: 1fr; }
  .toc{ order:2; }
  .doc{ order:1; }
  .chat{ order:3; }
}



/* Cover page */
.cover{
  padding: 26px 10px 40px;
  text-align:center;
}
.cover-logo{
  height: 80px;
  width:auto;
  display:block;
  margin: 8px auto 18px;
}
.cover-title{
  margin: 0;
  font-size: 34px;
  letter-spacing: .2px;
}
.cover-subtitle{
  margin: 8px 0 18px;
  color: var(--muted);
  font-size: 16px;
}
.cover-card{
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(15,23,42,.08);
  text-align:left;
}
.cover-card ol{ margin: 10px 0 10px 20px; }


/* Simplified footer */
.site-footer.simple{ padding: 12px 0; }
.footer-inner.simple{ grid-template-columns: 1fr; gap: 0; }
.footer-min{ font-size: 14px; opacity: .92; }
