:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --ink: #17201c;
  --muted: #66726c;
  --line: #dce3df;
  --green: #138a50;
  --green-dark: #0d643b;
  --green-soft: #eaf7f0;
  --blue: #2563a8;
  --blue-soft: #edf5ff;
  --amber: #9a5a00;
  --amber-soft: #fff6e6;
  --red: #b42318;
  --code: #111815;
  --code-line: #2b3731;
  --shadow: 0 8px 24px rgba(23, 32, 28, 0.06);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body { margin: 0; background: var(--bg); color: var(--ink); line-height: 1.65; letter-spacing: 0; }
button, input { font: inherit; letter-spacing: 0; }
a { color: inherit; }
code, pre { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 760; }
.brand img { object-fit: contain; border-radius: 7px; }
.brand small { padding-left: 10px; border-left: 1px solid var(--line); color: var(--muted); font-weight: 500; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.top-actions a { padding: 7px 12px; border-radius: 6px; color: var(--muted); text-decoration: none; font-size: 14px; }
.top-actions a:hover { background: #f0f3f1; color: var(--ink); }
.top-actions .primary-link { background: var(--green); color: #fff; }
.top-actions .primary-link:hover { background: var(--green-dark); color: #fff; }

.layout { display: grid; grid-template-columns: 252px minmax(0, 1fr); max-width: 1440px; min-width: 0; margin: 0 auto; }
.sidebar {
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  overflow-y: auto;
  min-width: 0;
}
.search-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.sidebar input, #model-search {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
.sidebar input:focus, #model-search:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.side-nav { display: grid; gap: 3px; margin-top: 18px; }
.side-nav a { padding: 8px 10px; border-radius: 5px; color: #4d5a54; text-decoration: none; font-size: 14px; }
.side-nav a:hover, .side-nav a.active { background: var(--green-soft); color: var(--green-dark); }
.sidebar-note { position: relative; margin-top: 28px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
.sidebar-note strong { display: block; margin-bottom: 5px; font-size: 12px; color: var(--muted); }
.sidebar-note code { display: block; padding-right: 38px; overflow-wrap: anywhere; font-size: 12px; }
.copy-inline { position: absolute; right: 8px; bottom: 8px; }

main { width: 100%; max-width: 1020px; min-width: 0; padding: 42px 48px 80px; }
.intro { padding: 8px 0 42px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 6px; color: var(--green-dark); font-size: 12px; font-weight: 800; text-transform: uppercase; }
h1 { margin: 0; max-width: 760px; font-size: 42px; line-height: 1.18; letter-spacing: 0; }
h2 { margin: 0; font-size: 27px; line-height: 1.3; letter-spacing: 0; }
.lead { max-width: 760px; margin: 16px 0 24px; color: #44524b; font-size: 17px; }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.quick-grid > div { min-height: 138px; padding: 20px; }
.quick-grid > div + div { border-left: 1px solid var(--line); }
.quick-grid strong { display: block; margin-top: 7px; }
.quick-grid p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.step { color: var(--green); font: 700 12px/1 monospace; }

.doc-section { padding: 44px 0; border-bottom: 1px solid var(--line); }
.section-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 16px; }
.section-heading > div > p:not(.eyebrow) { margin: 6px 0 0; }
.method { flex: 0 0 auto; padding: 4px 8px; border-radius: 4px; font: 800 11px/1.4 monospace; }
.method.post { background: var(--green-soft); color: var(--green-dark); }
.method.get { background: var(--blue-soft); color: var(--blue); }
.method.neutral { background: #ecefed; color: #53615a; }
.endpoint-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: 18px 0; padding: 11px 13px; border: 1px solid var(--line); border-left: 3px solid var(--green); border-radius: 6px; background: var(--surface); }
.endpoint-row code { overflow-wrap: anywhere; color: var(--green-dark); }

button { border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: #3d4a44; cursor: pointer; }
button:hover { border-color: #b7c4bd; background: #f2f5f3; }
[data-copy], [data-copy-target], .copy-inline { min-width: 48px; padding: 4px 8px; font-size: 12px; }
button.copied { border-color: #88cbaa; background: var(--green-soft); color: var(--green-dark); }

.code-shell { margin: 18px 0; overflow: hidden; border: 1px solid var(--code-line); border-radius: 7px; background: var(--code); color: #e7eee9; }
.code-head { display: flex; justify-content: space-between; align-items: center; height: 38px; padding: 0 10px 0 14px; border-bottom: 1px solid var(--code-line); color: #aebbb4; font-size: 12px; }
.code-head button { border-color: #3b4b43; background: transparent; color: #cdd7d1; }
.code-head button:hover { background: #202c26; }
pre { margin: 0; padding: 17px; overflow-x: auto; color: #e7eee9; font-size: 13px; line-height: 1.7; }
code { font-size: 0.92em; }
p code, td code, .callout code { padding: 2px 4px; border-radius: 3px; background: #ebefed; color: #1b4e34; }

.callout { margin: 20px 0 0; padding: 13px 15px; border-radius: 7px; }
.callout strong { display: block; margin-bottom: 2px; }
.callout p { margin: 0; }
.callout.warning { border: 1px solid #f1d3a4; background: var(--amber-soft); color: #6c4100; }
.callout.info { border: 1px solid #bdd8f2; background: var(--blue-soft); color: #234c79; }

.table-wrap { overflow-x: auto; margin-top: 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f0f3f1; color: #46524c; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfb; }

.tabs, .segmented { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 6px; background: #edf1ef; }
.tabs { margin-top: 18px; }
.tab, .segmented button { padding: 5px 10px; border: 0; background: transparent; }
.tab.active, .segmented button.active { background: var(--surface); color: var(--green-dark); box-shadow: 0 1px 4px rgba(23, 32, 28, 0.09); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.sample-block .code-shell { margin-top: 10px; }

details { margin-top: 16px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
summary { padding: 12px 14px; cursor: pointer; font-weight: 650; }
details .code-shell { margin: 0 14px 14px; }
.status-line { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-top: 18px; }
.status-line span { padding: 5px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); font-family: monospace; font-size: 12px; }
.status-line .success { border-color: #97d0b1; color: var(--green-dark); }
.status-line .failure { margin-left: 14px; border-color: #edb7b1; color: var(--red); }

.model-heading { align-items: end; }
.model-controls { display: flex; gap: 8px; align-items: center; }
#model-search { width: 190px; }
.muted { color: var(--muted); font-size: 13px; }
.price-note { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 8px 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); font-size: 13px; }
.price-note span { color: var(--muted); }
.model-name { font-family: monospace; font-weight: 700; }
.model-price { color: var(--green-dark); font-weight: 800; white-space: nowrap; }
.model-description { max-width: 470px; color: var(--muted); }

.checklist { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checklist p { display: grid; grid-template-columns: 28px 1fr; margin: 0; padding: 14px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.checklist p span { grid-row: span 2; color: var(--green); font-family: monospace; }
.checklist p strong { display: block; }
.checklist p { color: var(--muted); font-size: 13px; }
.checklist p strong { color: var(--ink); font-size: 14px; }
.no-results { margin: 40px 0; padding: 30px; border: 1px dashed var(--line); border-radius: 7px; color: var(--muted); text-align: center; }
footer { padding: 32px 0 0; color: var(--muted); font-size: 13px; }
footer a { color: var(--green-dark); }
[hidden] { display: none !important; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; width: 100%; height: auto; padding: 16px 20px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side-nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
  .side-nav a { flex: 0 0 auto; }
  .sidebar-note { display: none; }
  main { max-width: 100%; padding: 34px 24px 70px; }
}

@media (max-width: 640px) {
  .topbar { height: auto; min-height: 60px; padding: 10px 14px; }
  .brand small { display: none; }
  .top-actions a:first-child { display: none; }
  html { scroll-padding-top: 72px; }
  h1 { font-size: 34px; }
  h2 { font-size: 24px; }
  .quick-grid { grid-template-columns: 1fr; }
  .quick-grid > div { min-height: auto; }
  .quick-grid > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .section-heading, .model-heading { align-items: flex-start; }
  .model-heading { display: block; }
  .model-controls { margin-top: 14px; align-items: stretch; }
  #model-search { min-width: 0; width: 100%; }
  .price-note { grid-template-columns: 1fr; }
  .price-note strong:not(:first-child) { margin-top: 7px; }
  .checklist { grid-template-columns: 1fr; }
  .endpoint-row { align-items: flex-start; }
  th, td { padding: 10px; }
}
