:root { scroll-behavior: smooth; }

.agent-guide-body {
  display: block;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: #1b2a22;
  background:
    radial-gradient(circle at 88% 0%, rgba(84, 149, 112, .11), transparent 30rem),
    linear-gradient(180deg, #f5faf7 0%, #f1f6f3 100%);
  background-attachment: fixed;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.7;
}

/* ---- Sticky document toolbar ---- */
.agent-guide-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto minmax(240px, 1fr);
  align-items: center;
  gap: 24px;
  min-height: 74px;
  padding: 10px 32px;
  border-bottom: 1px solid #c6ddd0;
  background: rgba(250, 253, 251, .96);
  box-shadow: 0 5px 20px rgba(23, 70, 47, .085);
  backdrop-filter: blur(14px);
}
.agent-guide-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.agent-guide-mark {
  display: grid;
  place-items: center;
  flex: 0 0 56px;
  width: 56px;
  height: 38px;
  border: 1px solid #a9d2ba;
  border-radius: 20px;
  background: linear-gradient(135deg, #d9f0e3, #edf8f1);
  color: #185f3f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
  font: 850 11px var(--font-mono);
  letter-spacing: .07em;
}
.agent-guide-brand div { display: grid; gap: 2px; min-width: 0; }
.agent-guide-brand strong { color: #143b29; font-size: 15px; font-weight: 800; }
.agent-guide-brand div span { overflow: hidden; color: #687f72; font: 800 8px var(--font-mono); letter-spacing: .11em; text-overflow: ellipsis; white-space: nowrap; }
.agent-guide-quicksteps { display: flex; align-items: center; gap: 13px; }
.agent-guide-quicksteps > strong { color: #244c39; font-size: 12px; font-weight: 800; white-space: nowrap; }
.agent-guide-quicksteps ol { display: flex; align-items: center; gap: 13px; margin: 0; padding: 0; list-style: none; }
.agent-guide-quicksteps li { display: flex; align-items: center; gap: 6px; color: #405e4e; font-size: 12px; font-weight: 650; white-space: nowrap; }
.agent-guide-quicksteps li > span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid #c0ddcb;
  border-radius: 50%;
  background: #e7f4ec;
  color: #1d6544;
  font: 800 9px var(--font-mono);
}
.agent-guide-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.agent-guide-actions a { min-height: 40px; padding: 9px 15px; font-size: 12.5px; font-weight: 750; text-decoration: none; }

/* ---- Reading layout ---- */
.agent-guide-layout {
  display: grid;
  grid-template-columns: minmax(235px, 255px) minmax(0, 1fr);
  gap: clamp(30px, 4vw, 64px);
  width: min(92%, 1520px);
  margin: 0 auto;
  padding: 42px 0 110px;
}
.agent-guide-toc {
  position: sticky;
  top: 104px;
  align-self: start;
  max-height: calc(100vh - 130px);
  overflow-y: auto;
  padding: 2px 15px 18px 0;
  scrollbar-width: thin;
}
.toc-label { margin: 0 0 12px 11px; color: #6d8477; font: 800 10px var(--font-mono); letter-spacing: .13em; text-transform: uppercase; }
.agent-guide-toc nav { display: grid; gap: 3px; }
.agent-guide-toc a {
  position: relative;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #546c5f;
  font-size: 12.5px;
  font-weight: 620;
  line-height: 1.5;
  text-decoration: none;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.agent-guide-toc a::before { content: ''; position: absolute; left: 0; top: 22%; bottom: 22%; width: 3px; border-radius: 3px; background: transparent; }
.agent-guide-toc a:hover { border-color: #d9e8df; background: #f3f9f5; color: #1d5f40; transform: translateX(2px); }
.agent-guide-toc a.active { border-color: #c9e1d2; background: #e5f3ea; color: #175a3a; font-weight: 750; }
.agent-guide-toc a.active::before { background: #348159; }
.toc-loading { display: block; padding: 9px 11px; color: #829589; font-size: 12px; }
.agent-guide-main { min-width: 0; }
.agent-guide-notice {
  position: relative;
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  padding: 17px 20px 17px 23px;
  overflow: hidden;
  border: 1px solid #bad9c6;
  border-radius: 11px;
  background: linear-gradient(135deg, #e8f6ed, #f4faf6);
  color: #225b3d;
  font-weight: 550;
  line-height: 1.75;
}
.agent-guide-notice::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 4px; background: #34845a; }
.agent-guide-notice strong { flex: 0 0 135px; color: #184d33; font-weight: 800; }
.agent-guide-notice span { min-width: 0; }
.agent-guide-content {
  padding: clamp(38px, 4.4vw, 68px) clamp(32px, 5vw, 76px) 82px;
  border: 1px solid #d1e2d8;
  border-radius: 15px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 10px 34px rgba(20, 64, 41, .075);
}
.guide-loading { display: flex; align-items: center; gap: 11px; color: #64776d; font-size: 14px; }
.guide-loading span { width: 18px; height: 18px; border: 2px solid #d5e1da; border-top-color: #2d6a4f; border-radius: 50%; animation: guideSpin .8s linear infinite; }
@keyframes guideSpin { to { transform: rotate(360deg); } }

/* ---- Markdown typography ---- */
.agent-guide-content h1 { margin: 0 0 21px; color: #102c20; font-size: clamp(35px, 4vw, 49px); font-weight: 780; line-height: 1.1; letter-spacing: -.042em; }
.agent-guide-content h2 {
  scroll-margin-top: 102px;
  margin: 56px 0 17px;
  padding: 17px 0 0;
  border-top: 1px solid #dce9e1;
  color: #163c2b;
  font-size: 27px;
  font-weight: 760;
  line-height: 1.3;
  letter-spacing: -.025em;
}
.agent-guide-content h3 { scroll-margin-top: 102px; margin: 34px 0 13px; color: #2b4b3b; font-size: 18px; font-weight: 760; }
.agent-guide-content p { margin: 11px 0; color: #40584b; font-size: 15.5px; font-weight: 500; line-height: 1.88; }
.agent-guide-content strong { color: #263e32; font-weight: 760; }
.agent-guide-content blockquote {
  position: relative;
  margin: 20px 0 28px;
  padding: 18px 21px 18px 24px;
  border: 1px solid #badbc7;
  border-left: 4px solid #318158;
  border-radius: 0 10px 10px 0;
  background: linear-gradient(135deg, #eaf7ef, #f6fbf8);
  color: #1d5b3d;
}
.agent-guide-content blockquote p { margin: 0; color: inherit; font-weight: 570; }
.agent-guide-content ul,
.agent-guide-content ol { margin: 13px 0 21px; padding-left: 26px; color: #435b4f; font-size: 15px; }
.agent-guide-content li { margin: 8px 0; padding-left: 4px; line-height: 1.82; }
.agent-guide-content li::marker { color: #3d805d; font-weight: 800; }
.agent-guide-content a { color: #246b4b; font-weight: 650; text-decoration: underline; text-decoration-color: #9ac6ac; text-underline-offset: 3px; }
.agent-guide-content code {
  padding: 2px 6px;
  border: 1px solid #cfe6d8;
  border-radius: 5px;
  background: #eaf6ee;
  color: #1b6242;
  font: 650 12.5px var(--font-mono);
}
.agent-guide-content .token-key {
  border-color: #8fc5a4;
  background: #d2ecdc;
  color: #104c30;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .38);
}
.api-route-line {
  display: flex;
  align-items: center;
  margin: 18px 0 22px !important;
  padding: 14px 17px;
  border: 1px solid #b9d8c5;
  border-left: 4px solid #317f57;
  border-radius: 9px;
  background: #f0f8f3;
  box-shadow: 0 2px 8px rgba(22, 70, 44, .04);
}
.agent-guide-content .api-route-token { padding: 0; border: 0; background: transparent; color: #174c32; font-size: 14px; font-weight: 800; }

/* ---- Code examples ---- */
.agent-guide-content pre {
  position: relative;
  overflow: auto;
  margin: 19px 0 25px;
  padding: 23px;
  border: 1px solid #d4e0d9;
  border-radius: 11px;
  background: #f1f5f2;
  color: #20362a;
  box-shadow: inset 0 1px 0 #fff, 0 3px 12px rgba(16, 43, 29, .05);
  line-height: 1.72;
}
.agent-guide-content pre code { padding: 0; border: 0; background: transparent; color: inherit; font-size: 12.5px; white-space: pre; }
.code-copy-button {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 9px;
  border: 1px solid #b8cec0;
  border-radius: 6px;
  background: #e7efea;
  color: #24513a;
  font-size: 10.5px;
  font-weight: 750;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}
.code-copy-button:hover { border-color: #2d6a4f; background: #2d6a4f; color: #fff; }

/* ---- Markdown tables, field depth, required and status tokens ---- */
.md-table-wrap {
  overflow-x: auto;
  margin: 18px 0 28px;
  border: 1px solid #d0e1d7;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(18, 60, 37, .035);
}
.agent-guide-content table { width: 100%; min-width: 720px; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.agent-guide-content th,
.agent-guide-content td { padding: 12px 15px; border-bottom: 1px solid #e4ede7; text-align: left; vertical-align: top; line-height: 1.72; }
.agent-guide-content th {
  border-bottom-color: #c9ddd0;
  background: #edf6f0;
  color: #31503f;
  font-size: 11px;
  font-weight: 820;
  letter-spacing: .065em;
  text-transform: uppercase;
}
.agent-guide-content tr:last-child td { border-bottom: 0; }
.agent-guide-content tbody tr { transition: background .14s ease; }
.agent-guide-content tbody tr:hover { background: #f7fbf8; }
.md-schema-table .md-field-cell > code {
  display: inline-block;
  padding: 3px 7px;
  border: 1px solid #b9dac5;
  border-radius: 6px;
  background: #e0f2e7;
  color: #185d3d;
  font-weight: 750;
  white-space: nowrap;
}
.md-schema-table .md-field-cell.field-level-1 > code {
  border-color: #d2e7da;
  background: #eef8f1;
  color: #397056;
  font-weight: 650;
}
.md-schema-table .md-field-cell.field-level-2 > code {
  border-color: #e0ede5;
  background: #f6faf7;
  color: #597468;
  font-weight: 600;
}
.md-schema-table th:first-child,
.md-schema-table td:first-child { width: 260px; min-width: 260px; white-space: nowrap; }
.md-required-column { width: 88px; min-width: 88px; text-align: center !important; vertical-align: middle !important; }
.md-required-yes {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  padding: 2px 8px;
  border: 1px solid #add8bc;
  border-radius: 999px;
  background: #e1f4e8;
  color: #17603d;
  font-size: 11.5px;
  font-weight: 800;
}
.md-status-table { min-width: 760px !important; }
.md-status-table td:first-child > code { font-weight: 800; }
.md-status-table td:nth-child(3) { min-width: 250px; }
.md-status-label,
.status-token {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  margin: 1px 3px 1px 0;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 750 11px var(--font-mono);
  white-space: nowrap;
}
.status-waiting { border-color: #cbdcbc !important; background: #eef4e8 !important; color: #4e6b38 !important; }
.status-queued { border-color: #a9d9bf !important; background: #e2f5e9 !important; color: #185f3e !important; }
.status-fetching { border-color: #a7d9ca !important; background: #e4f6f0 !important; color: #12634f !important; }
.status-analyzing { border-color: #94c9aa !important; background: #d9eee2 !important; color: #164f37 !important; }
.status-pending { border-color: #cbd9a8 !important; background: #f0f5df !important; color: #586d25 !important; }
.status-running { border-color: #b7d2c2 !important; background: #e9f2ed !important; color: #355f49 !important; }
.status-downloading { border-color: #ddd2a1 !important; background: #f7f3df !important; color: #75641c !important; }
.status-success { border-color: #9ed3b2 !important; background: #dff3e7 !important; color: #165a3b !important; }
.status-failed { border-color: #e7b7b3 !important; background: #fdf0ef !important; color: #a33e38 !important; }
.status-timeout { border-color: #ced6d1 !important; background: #f1f4f2 !important; color: #596760 !important; }
.agent-guide-error { padding: 20px; border: 1px solid #e8bdb9; border-radius: 10px; background: #fff3f2; color: #9f3e37; }

/* ---- Responsive reading experience ---- */
@media (max-width: 1180px) {
  .agent-guide-topbar { grid-template-columns: minmax(220px, 1fr) auto; }
  .agent-guide-quicksteps { grid-column: 1 / -1; grid-row: 2; justify-content: center; padding-bottom: 3px; }
}
@media (max-width: 900px) {
  .agent-guide-layout { grid-template-columns: 1fr; width: auto; padding: 30px 22px 76px; }
  .agent-guide-toc { display: none; }
  .agent-guide-content { padding: 38px 29px 58px; }
}
@media (max-width: 650px) {
  .agent-guide-topbar { display: flex; height: auto; padding: 14px 16px; align-items: flex-start; flex-wrap: wrap; gap: 12px; }
  .agent-guide-brand { flex: 1 1 180px; }
  .agent-guide-brand div span { display: none; }
  .agent-guide-quicksteps { order: 3; width: 100%; align-items: flex-start; flex-direction: column; gap: 8px; }
  .agent-guide-quicksteps ol { width: 100%; justify-content: space-between; gap: 6px; }
  .agent-guide-quicksteps li { white-space: normal; font-size: 11px; }
  .agent-guide-actions { flex: 1 1 190px; }
  .agent-guide-actions a { flex: 1 1 0; text-align: center; }
  .agent-guide-layout { padding-inline: 16px; }
  .agent-guide-notice { display: block; padding: 16px 17px 16px 20px; }
  .agent-guide-notice strong { display: block; margin-bottom: 6px; }
  .agent-guide-content { padding: 31px 19px 48px; border-radius: 11px; }
  .agent-guide-content h1 { font-size: 34px; }
  .agent-guide-content h2 { margin-top: 46px; font-size: 23px; }
  .agent-guide-content h3 { font-size: 17px; }
  .agent-guide-content p, .agent-guide-content ul, .agent-guide-content ol { font-size: 14px; }
  .agent-guide-content pre { padding: 19px; }
  .agent-guide-content th, .agent-guide-content td { padding: 11px 13px; }
}
@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  .guide-loading span { animation: none; }
  .agent-guide-toc a, .agent-guide-content tbody tr { transition: none; }
}
