:root {
  --bg: #020617;
  --surface: #0e1223;
  --surface-raised: #121a2e;
  --surface-subtle: #171f35;
  --text: #f8fafc;
  --muted: #aebbd0;
  --subtle: #74829a;
  --border: #2b3850;
  --border-strong: #415270;
  --accent: #4ade80;
  --accent-strong: #22c55e;
  --accent-ink: #052e16;
  --blue: #7dd3fc;
  --danger: #fda4af;
  --danger-bg: #4c1021;
  --shadow: 0 22px 56px rgb(0 0 0 / 0.28);
  --radius-lg: 18px;
  --radius-md: 12px;
  --header-height: 74px;
  --header-offset: 90px;
  --font-sans: "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: var(--header-offset); }

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 13% -8%, rgb(34 197 94 / 0.18), transparent 27rem),
    radial-gradient(circle at 92% 4%, rgb(14 165 233 / 0.12), transparent 22rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
}

button, input, select { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

button { cursor: pointer; }

a { color: inherit; }

code, pre { font-family: var(--font-mono); }

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  transform: translateY(-160%);
  padding: 10px 14px;
  border-radius: 8px;
  background: #fff;
  color: #111827;
  font-weight: 700;
  transition: transform 160ms ease;
}

.skip-link:focus { transform: translateY(0); }

.site-header {
  position: sticky;
  z-index: 50;
  top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  width: min(90%, 1920px);
  min-height: var(--header-height);
  margin: 0 auto;
  border-bottom: 1px solid rgb(65 82 112 / 0.46);
  background: rgb(2 6 23 / 0.98);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.18);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.brand strong { color: var(--accent); font-weight: 700; }

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgb(74 222 128 / 0.68);
  border-radius: 9px;
  background: rgb(74 222 128 / 0.12);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.08em;
}

.header-meta { display: flex; align-items: center; justify-self: end; gap: 18px; color: var(--muted); font-size: 14px; }
.header-meta a { color: var(--text); text-underline-offset: 4px; }
.header-meta a:hover { color: var(--accent); }

.doc-badge {
  display: inline-flex;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  text-decoration: none;
}
main { width: min(90%, 1920px); margin: 0 auto; }

.view-tabs {
  display: flex;
  width: max-content;
  max-width: 100%;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.2);
}

.view-tab {
  min-width: 132px;
  min-height: 44px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  touch-action: manipulation;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.view-tab:hover { background: rgb(255 255 255 / 0.04); color: var(--text); }
.view-tab[aria-selected="true"] { border-color: rgb(74 222 128 / 0.42); background: rgb(74 222 128 / 0.12); color: var(--accent); }
.view-tab:focus-visible { outline: 3px solid rgb(125 211 252 / 0.72); outline-offset: 2px; }
.view-panel, .hero { scroll-margin-top: var(--header-offset); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 0.62fr);
  gap: 36px;
  align-items: center;
  padding: clamp(26px, 4vw, 46px) 0 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

h1, h2, p { margin-top: 0; }

h1 {
  max-width: 760px;
  margin-bottom: 8px;
  font-size: clamp(30px, 3.2vw, 46px);
  line-height: 1.16;
  letter-spacing: -0.045em;
}

h2 { margin-bottom: 0; font-size: 21px; letter-spacing: -0.025em; }

.hero-copy { max-width: 610px; margin-bottom: 0; color: var(--muted); font-size: 16px; }

.security-note {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  margin: 0;
  padding: 14px;
  border: 1px solid rgb(74 222 128 / 0.28);
  border-radius: var(--radius-md);
  background: rgb(20 83 45 / 0.16);
  color: #d5e6da;
  font-size: 14px;
}

.security-note svg { flex: 0 0 auto; width: 20px; margin-top: 2px; fill: none; stroke: var(--accent); stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.security-note p { margin: 0; }
.security-note strong { display: block; margin-bottom: 2px; color: var(--accent); }

.workbench {
  display: grid;
  grid-template-columns: 230px minmax(460px, 1.12fr) minmax(390px, 0.88fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgb(18 26 46 / 0.94), rgb(10 15 29 / 0.94));
  box-shadow: var(--shadow);
}

.endpoint-panel, .request-panel, .code-panel { min-width: 0; }

.endpoint-panel {
  display: flex;
  flex-direction: column;
  min-height: 590px;
  padding: 25px 16px 16px;
  border-right: 1px solid var(--border);
  background: rgb(2 6 23 / 0.54);
}

.request-panel { padding: 25px; border-right: 1px solid var(--border); }
.code-panel { display: flex; flex-direction: column; padding: 25px; }

.panel-heading { margin-bottom: 21px; }
.panel-heading .eyebrow { margin-bottom: 6px; }
.request-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }

.endpoint-list { display: grid; gap: 7px; }

.endpoint-button {
  display: grid;
  grid-template-columns: 33px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease;
}

.endpoint-button:hover { border-color: var(--border-strong); background: rgb(255 255 255 / 0.035); color: var(--text); }
.endpoint-button:active { transform: scale(0.985); }
.endpoint-button[aria-pressed="true"] { border-color: rgb(74 222 128 / 0.52); background: rgb(74 222 128 / 0.1); color: var(--text); }

.endpoint-method {
  display: grid;
  width: 33px;
  height: 24px;
  place-items: center;
  border-radius: 5px;
  background: rgb(125 211 252 / 0.12);
  color: var(--blue);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
}

.endpoint-method.post { background: rgb(74 222 128 / 0.13); color: var(--accent); }
.endpoint-method.mqtt { background: rgb(196 181 253 / 0.16); color: #c4b5fd; }
.endpoint-name { display: block; font-size: 14px; font-weight: 600; }
.endpoint-path { display: block; margin-top: 1px; color: var(--subtle); font-family: var(--font-mono); font-size: 10px; overflow-wrap: anywhere; }

.endpoint-footnote { margin-top: auto; padding: 20px 8px 2px; color: var(--subtle); font-size: 12px; }
.endpoint-footnote code { color: var(--muted); font-size: 11px; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgb(74 222 128 / 0.11); }

.method-badge {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  padding: 0 9px;
  border: 1px solid rgb(74 222 128 / 0.36);
  border-radius: 6px;
  background: rgb(74 222 128 / 0.11);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.method-badge.get { border-color: rgb(125 211 252 / 0.4); background: rgb(125 211 252 / 0.1); color: var(--blue); }
.method-badge.mqtt { border-color: rgb(196 181 253 / 0.42); background: rgb(196 181 253 / 0.1); color: #c4b5fd; }

form { display: grid; gap: 18px; }
.field { min-width: 0; }
.field-full { grid-column: 1 / -1; }

.dynamic-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0; padding: 0; border: 0; }

label { display: inline-block; margin-bottom: 7px; color: #d9e2f2; font-size: 13px; font-weight: 600; }
label span { color: var(--accent); }

input, select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: 0;
  background: rgb(2 6 23 / 0.66);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

input::placeholder { color: #66748b; }
input:hover, select:hover { border-color: var(--border-strong); }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgb(125 211 252 / 0.75); outline-offset: 2px; }
input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(125 211 252 / 0.12); }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--danger); }
input[readonly] { border-color: rgb(74 222 128 / 0.34); background: rgb(20 83 45 / 0.12); color: var(--accent); cursor: default; }

.input-with-prefix { display: grid; grid-template-columns: auto 1fr; align-items: stretch; border: 1px solid var(--border); border-radius: 8px; background: rgb(2 6 23 / 0.66); overflow: hidden; transition: border-color 180ms ease, box-shadow 180ms ease; }
.input-with-prefix:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgb(125 211 252 / 0.12); }
.input-with-prefix span { display: grid; place-items: center; padding: 0 10px; border-right: 1px solid var(--border); color: var(--subtle); font-family: var(--font-mono); font-size: 11px; }
.input-with-prefix input { border: 0; border-radius: 0; background: transparent; box-shadow: none; }

.field-hint, .field-error { min-height: 18px; margin: 5px 0 0; font-size: 12px; }
.field-hint { color: var(--subtle); }
.field-error { height: 38px; overflow-y: auto; color: var(--danger); line-height: 18px; }
.field-error:empty { visibility: hidden; }
.endpoint-description { padding: 12px 14px; border-left: 2px solid var(--accent); background: rgb(74 222 128 / 0.06); color: var(--muted); font-size: 13px; }
.endpoint-description p { margin: 0; }
.endpoint-description code { color: var(--accent); font-size: 12px; }

.control-builder { padding: 17px; border: 1px solid rgb(74 222 128 / 0.3); border-radius: var(--radius-md); background: linear-gradient(145deg, rgb(20 83 45 / 0.14), rgb(2 6 23 / 0.28)); }
.control-builder-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.control-builder-heading .eyebrow { margin-bottom: 4px; }
.control-builder h3 { margin: 0; font-size: 16px; }
.control-builder h4 { margin: 0 0 7px; color: #d9e2f2; font-size: 13px; }
.control-builder-badge { display: inline-flex; align-items: center; min-height: 25px; padding: 0 8px; border: 1px solid rgb(74 222 128 / 0.35); border-radius: 999px; background: rgb(74 222 128 / 0.1); color: var(--accent); font-family: var(--font-mono); font-size: 11px; font-weight: 700; }
.control-builder-message { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.control-builder-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 15px; }
.control-builder-field { min-width: 0; }
.control-builder-field label { margin-bottom: 6px; }
.control-builder-hint { margin: 0; color: var(--subtle); font-size: 12px; }
.control-builder-warning { margin: 12px 0 0; color: #fde68a; font-size: 12px; }
.control-builder-empty { margin: 14px 0 0; padding: 11px 12px; border: 1px dashed rgb(65 82 112 / 0.88); border-radius: 8px; color: var(--muted); font-size: 12px; }
.channel-actions { margin-top: 17px; padding-top: 16px; border-top: 1px solid rgb(65 82 112 / 0.55); }
.channel-actions .control-builder-hint { margin-bottom: 12px; }
.channel-tools { margin: 14px 0; }
.quick-channel-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 7px; }
.quick-channel-action { min-height: 38px; padding: 0 10px; border: 1px solid var(--border); border-radius: 7px; background: rgb(2 6 23 / 0.5); color: var(--muted); font-size: 12px; font-weight: 700; transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, color 180ms ease; }
.quick-channel-action:hover { border-color: rgb(74 222 128 / 0.52); background: rgb(74 222 128 / 0.1); color: var(--accent); }
.quick-channel-action:active { transform: scale(0.98); }
.channel-grid { display: flex; flex-wrap: wrap; gap: 8px 12px; }
.channel-grid .control-builder-field { display: inline-flex; align-items: center; gap: 6px; min-width: auto; }
.channel-grid .control-builder-field label { margin: 0; white-space: nowrap; }
.channel-grid .control-builder-field select { width: 88px; min-height: 38px; padding: 6px 24px 6px 8px; font-size: 12px; }
.bulk-action-status { min-height: 18px; margin: 10px 0 0; color: var(--accent); font-size: 12px; }
.weekday-selector { display: flex; flex-wrap: wrap; gap: 8px; }
.weekday-toggle { position: relative; display: inline-flex; min-height: 38px; margin: 0; cursor: pointer; }
.weekday-toggle input { position: absolute; width: 1px; min-height: 1px; opacity: 0; }
.weekday-toggle span { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; min-height: 38px; padding: 0 10px; border: 1px solid var(--border); border-radius: 7px; background: rgb(2 6 23 / 0.5); color: var(--muted); font-size: 12px; font-weight: 600; transition: background 180ms ease, border-color 180ms ease, color 180ms ease; }
.weekday-toggle:hover span { border-color: var(--border-strong); color: var(--text); }
.weekday-toggle input:checked + span { border-color: rgb(74 222 128 / 0.56); background: rgb(74 222 128 / 0.12); color: var(--accent); }
.weekday-toggle input:focus-visible + span { outline: 3px solid rgb(125 211 252 / 0.75); outline-offset: 2px; }
.control-command-preview { display: flex; align-items: baseline; flex-wrap: wrap; gap: 9px; margin: 16px 0 0; padding: 11px 12px; border-radius: 8px; background: rgb(2 6 23 / 0.58); color: var(--subtle); font-size: 12px; }
.control-command-preview code { color: var(--accent); font-size: 13px; overflow-wrap: anywhere; }

.request-preview { display: flex; align-items: flex-start; gap: 11px; padding-top: 2px; color: var(--muted); font-size: 12px; }
.preview-label { flex: 0 0 auto; padding-top: 2px; color: var(--subtle); font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.09em; }
.request-preview code { color: #cbd5e1; overflow-wrap: anywhere; }

.run-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding-top: 2px; }
#base-url-field[hidden], #run-actions[hidden] { display: none !important; }
.run-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 15px;
  gap: 8px;
  border: 1px solid rgb(74 222 128 / 0.5);
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 700;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, opacity 180ms ease;
  touch-action: manipulation;
}
.run-button:hover:not(:disabled) { background: #86efac; }
.run-button:active:not(:disabled) { transform: scale(0.98); }
.run-button:disabled { cursor: not-allowed; border-color: var(--border); background: var(--surface-subtle); color: var(--subtle); opacity: 0.72; }
.run-button svg { width: 16px; fill: currentColor; }
.run-button.is-running svg { animation: run-pulse 850ms ease-in-out infinite; }
.run-status { min-height: 20px; margin: 0; color: var(--muted); font-size: 12px; }

.run-result { padding: 15px; border: 1px solid var(--border); border-radius: var(--radius-md); background: rgb(2 6 23 / 0.48); }
.run-result[aria-busy="true"] { border-color: rgb(125 211 252 / 0.5); }
.run-result-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.run-result-heading .eyebrow { margin-bottom: 4px; }
.run-result h3 { margin: 0; font-size: 15px; }
.run-result-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.run-result-badge { display: inline-flex; align-items: center; min-height: 25px; padding: 0 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-family: var(--font-mono); font-size: 11px; font-weight: 700; white-space: nowrap; }
.run-result-badge.success { border-color: rgb(74 222 128 / 0.48); background: rgb(74 222 128 / 0.1); color: var(--accent); }
.run-result-badge.error { border-color: rgb(253 164 175 / 0.48); background: rgb(253 164 175 / 0.1); color: #fecdd3; }
.run-result-badge.loading { border-color: rgb(125 211 252 / 0.48); background: rgb(125 211 252 / 0.1); color: var(--blue); }
.run-result-summary { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.run-result-output { max-height: 300px; margin: 12px 0 0; padding: 12px; overflow: auto; border: 1px solid rgb(43 56 80 / 0.72); border-radius: 8px; background: rgb(2 6 23 / 0.72); color: #d7e3f4; font-size: 12px; line-height: 1.65; }
.run-result-output code { white-space: pre-wrap; overflow-wrap: anywhere; }
.result-copy-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px; padding: 0 9px; border: 1px solid var(--border-strong); border-radius: 7px; background: var(--surface-subtle); color: var(--text); font-size: 12px; font-weight: 700; transition: background 180ms ease, border-color 180ms ease, color 180ms ease, opacity 180ms ease; }
.result-copy-button:hover:not(:disabled) { border-color: rgb(74 222 128 / 0.55); background: rgb(74 222 128 / 0.1); color: var(--accent); }
.result-copy-button:disabled { cursor: not-allowed; opacity: 0.48; }
.result-copy-button svg { width: 14px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.9; }

@keyframes run-pulse {
  50% { opacity: 0.35; }
}

.error-summary { padding: 12px 14px; border: 1px solid rgb(253 164 175 / 0.42); border-radius: 8px; background: var(--danger-bg); color: #ffe4e6; font-size: 13px; }
.error-summary strong { display: block; margin-bottom: 5px; }
.error-summary ul { margin: 0; padding-left: 20px; }
.error-summary a { color: #fecdd3; text-underline-offset: 3px; }

.code-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 19px; }
.copy-button, .text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.copy-button { padding: 0 12px; border: 1px solid rgb(74 222 128 / 0.5); background: var(--accent); color: var(--accent-ink); }
.copy-button:hover { background: #86efac; }
.copy-button:active, .text-button:active { transform: scale(0.98); }
.copy-button svg { width: 16px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.9; }

.language-tabs { display: flex; gap: 5px; padding-bottom: 14px; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: thin; }
.language-tab { flex: 0 0 auto; min-height: 34px; padding: 0 10px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.language-tab:hover { color: var(--text); background: rgb(255 255 255 / 0.04); }
.language-tab[aria-selected="true"] { border-color: var(--border-strong); background: var(--surface-subtle); color: var(--accent); }

.code-output { flex: 1; min-height: 448px; max-height: 560px; margin: 0; padding: 22px 0; overflow: auto; color: #d7e3f4; font-size: 12px; line-height: 1.72; tab-size: 2; }
.code-output code { display: block; min-width: max-content; padding: 0 2px; white-space: pre; }

.code-footer { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding-top: 14px; border-top: 1px solid var(--border); color: var(--subtle); font-size: 12px; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.text-button:hover { color: var(--accent); }

.help-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 24px 0 32px; }
.help-grid article { min-height: 148px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-md); background: rgb(14 18 35 / 0.63); }
.help-index { display: block; margin-bottom: 13px; color: var(--accent); font-family: var(--font-mono); font-size: 12px; font-weight: 700; }
.help-grid h2 { margin-bottom: 8px; font-size: 16px; }
.help-grid p { margin-bottom: 0; color: var(--muted); font-size: 13px; }
.help-grid code { color: var(--text); font-size: 12px; }

.api-docs { padding: 24px 0 84px; }
.docs-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; align-items: start; }
.docs-nav { position: sticky; top: var(--header-offset); display: grid; gap: 4px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-md); background: rgb(14 18 35 / 0.82); }
.docs-nav p { margin: 0 0 7px; color: var(--subtle); font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.1em; }
.docs-nav button { min-height: 35px; padding: 7px 9px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; text-align: left; }
.docs-nav button:hover { background: var(--surface-subtle); color: var(--text); }
.docs-nav button[aria-current="page"] { border-color: rgb(74 222 128 / 0.26); background: rgb(74 222 128 / 0.1); color: var(--accent); }
.docs-nav button:focus-visible { outline: 3px solid rgb(125 211 252 / 0.68); outline-offset: 2px; }
.docs-content { display: grid; min-width: 0; min-height: 560px; align-content: start; gap: 12px; }
.doc-page { animation: doc-page-enter 160ms ease-out; }
.doc-anchor { scroll-margin-top: var(--header-offset); }
.doc-overview { padding: 18px; border: 1px solid rgb(74 222 128 / 0.3); border-radius: var(--radius-md); background: linear-gradient(145deg, rgb(20 83 45 / 0.14), rgb(2 6 23 / 0.34)); }
.doc-page-heading { margin-bottom: 18px; }
.doc-page-heading h2 { margin: 0 0 5px; font-size: 22px; letter-spacing: -0.02em; }
.doc-page-heading > p:last-child { max-width: 820px; margin: 0; color: var(--muted); font-size: 14px; }
.doc-overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.doc-overview-grid > div { min-width: 0; padding: 12px; border: 1px solid rgb(65 82 112 / 0.55); border-radius: 8px; background: rgb(2 6 23 / 0.42); }
.doc-overview-grid span { display: block; margin-bottom: 6px; color: var(--subtle); font-size: 11px; }
.doc-overview-grid code { display: block; color: var(--text); font-size: 12px; overflow-wrap: anywhere; }
.doc-section { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-md); background: rgb(14 18 35 / 0.7); }
.doc-section[open] { border-color: var(--border-strong); background: rgb(14 18 35 / 0.88); }
.doc-section summary { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 72px; padding: 14px 16px; cursor: pointer; list-style: none; }
.doc-section summary::-webkit-details-marker { display: none; }
.doc-section summary:hover { background: rgb(255 255 255 / 0.025); }
.doc-section summary:focus-visible { outline: 3px solid rgb(125 211 252 / 0.75); outline-offset: -3px; }
.doc-summary-main { display: flex; min-width: 0; align-items: center; gap: 12px; }
.doc-summary-main > span:last-child { display: grid; min-width: 0; gap: 3px; }
.doc-summary-main strong { font-size: 16px; }
.doc-summary-main code { color: var(--subtle); font-size: 12px; overflow-wrap: anywhere; }
.doc-method { display: inline-flex; flex: 0 0 48px; align-items: center; justify-content: center; min-height: 28px; padding: 0 7px; border: 1px solid var(--border); border-radius: 6px; font-family: var(--font-mono); font-size: 10px; font-weight: 800; }
.doc-method.post { border-color: rgb(74 222 128 / 0.48); background: rgb(74 222 128 / 0.1); color: var(--accent); }
.doc-method.get { border-color: rgb(125 211 252 / 0.48); background: rgb(125 211 252 / 0.1); color: var(--blue); }
.doc-method.mqtt, .doc-method.command { border-color: rgb(196 181 253 / 0.48); background: rgb(196 181 253 / 0.1); color: #c4b5fd; }
.doc-method.status { border-color: rgb(253 224 71 / 0.4); background: rgb(253 224 71 / 0.08); color: #fde68a; }
.doc-method.error { border-color: rgb(253 164 175 / 0.48); background: rgb(253 164 175 / 0.1); color: #fecdd3; }
.doc-chevron { width: 9px; height: 9px; border-right: 2px solid var(--subtle); border-bottom: 2px solid var(--subtle); transform: rotate(45deg); transition: transform 180ms ease; }
.doc-section[open] .doc-chevron { transform: rotate(225deg); }
.doc-page.doc-section > summary { cursor: default; }
.doc-page.doc-section > summary .doc-chevron { display: none; }
.doc-section-body { display: grid; gap: 14px; padding: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 14px; }
.doc-section-body > * { margin-top: 0; margin-bottom: 0; }
.doc-section-body h3 { margin-top: 7px; color: var(--text); font-size: 14px; }
.doc-section-body p code, .doc-note code, .doc-steps code { color: var(--text); }
.doc-table-wrap { max-width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.doc-table-wrap table { width: 100%; min-width: 600px; border-collapse: collapse; background: rgb(2 6 23 / 0.34); font-size: 13px; }
.doc-table-wrap th, .doc-table-wrap td { padding: 10px 12px; border-bottom: 1px solid rgb(65 82 112 / 0.46); text-align: left; vertical-align: top; }
.doc-table-wrap th { background: var(--surface-subtle); color: #dce5f3; font-size: 12px; white-space: nowrap; }
.doc-table-wrap tbody tr:last-child td { border-bottom: 0; }
.doc-table-wrap td:first-child code { color: var(--accent); }
.doc-code { max-width: 100%; padding: 15px; overflow: auto; border: 1px solid rgb(43 56 80 / 0.72); border-radius: 8px; background: rgb(2 6 23 / 0.72); color: #d7e3f4; font-size: 12px; line-height: 1.65; }
.doc-code code { white-space: pre; }
.doc-callout { padding: 12px 14px; border-left: 3px solid var(--blue); border-radius: 0 8px 8px 0; background: rgb(125 211 252 / 0.07); }
.doc-callout strong { display: block; margin-bottom: 3px; color: var(--text); font-size: 13px; }
.doc-callout p { margin: 0; }
.doc-callout.warning { margin-top: 14px; border-left-color: #fde68a; background: rgb(253 224 71 / 0.06); }
.doc-callout.danger { border-left-color: var(--danger); background: rgb(253 164 175 / 0.07); }
.doc-note { padding: 11px 12px; border: 1px dashed var(--border-strong); border-radius: 8px; color: var(--muted); }
.command-token-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.command-token-grid > div { display: flex; min-width: 0; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--border); border-radius: 7px; background: rgb(2 6 23 / 0.38); }
.command-token-grid code { display: grid; flex: 0 0 28px; width: 28px; height: 28px; place-items: center; border-radius: 6px; background: rgb(74 222 128 / 0.12); color: var(--accent); font-weight: 800; }
.command-token-grid span { font-size: 12px; }
.doc-steps { display: grid; gap: 10px; margin: 0; padding-left: 22px; }
.mqtt-topic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mqtt-topic-grid > div { display: grid; gap: 6px; padding: 13px; border: 1px solid var(--border); border-radius: 8px; background: rgb(2 6 23 / 0.38); }
.mqtt-topic-grid span { color: var(--text); font-weight: 700; }
.mqtt-topic-grid code { color: #c4b5fd; }
.mqtt-topic-grid small { color: var(--subtle); }
.doc-support { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; padding: 12px 14px; border-radius: 8px; background: var(--surface-subtle); }
.doc-support span { color: var(--text); font-weight: 700; }
.doc-support a { color: var(--blue); text-decoration: none; }
.doc-support a:hover { text-decoration: underline; }

.doc-async-page { display: grid; grid-auto-rows: max-content; align-content: start; gap: 0; }
.doc-async-page > .doc-section + .doc-section { margin-top: 12px; }
.async-interface-nav { position: sticky; top: 0; z-index: 6; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding-bottom: 12px; background: var(--bg); }
.async-interface-nav a { display: grid; min-width: 0; gap: 4px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 8px; background: rgb(14 18 35 / 0.7); text-decoration: none; }
.async-interface-nav a:hover { border-color: var(--border-strong); background: var(--surface-raised); }
.async-interface-nav a:focus-visible { outline: 3px solid rgb(125 211 252 / 0.68); outline-offset: 2px; }
.async-interface-nav span { color: var(--accent); font-family: var(--font-mono); font-size: 10px; font-weight: 700; }
.async-interface-nav strong { color: var(--text); font-size: 13px; }
.async-interface-nav code { min-width: 0; overflow: hidden; color: var(--subtle); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.doc-action { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px; border: 1px solid rgb(74 222 128 / 0.28); border-radius: 8px; background: rgb(74 222 128 / 0.07); }
.doc-action strong { display: block; margin-bottom: 4px; color: var(--text); font-size: 14px; }
.doc-action p { margin: 0; color: var(--muted); font-size: 13px; }
.doc-action button { flex: 0 0 auto; min-height: 38px; padding: 0 15px; border: 1px solid rgb(74 222 128 / 0.52); border-radius: 7px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.doc-action button:hover { background: #86efac; }
.doc-action button:active { transform: scale(0.98); }
.doc-action button:focus-visible { outline: 3px solid rgb(125 211 252 / 0.68); outline-offset: 2px; }

body.docs-view-active { height: 100vh; height: 100dvh; overflow: hidden; }
body.docs-view-active .site-header { height: var(--header-height); }
body.docs-view-active main { height: calc(100vh - var(--header-height)); height: calc(100dvh - var(--header-height)); }
body.docs-view-active .api-docs { height: 100%; padding: 24px 0; overflow: hidden; }
body.docs-view-active .docs-layout { height: 100%; min-height: 0; align-items: stretch; }
body.docs-view-active .docs-nav { position: static; height: 100%; align-content: start; overflow: hidden; }
body.docs-view-active .docs-content { height: 100%; min-height: 0; padding: 0 8px 24px 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
body.docs-view-active .doc-page { min-height: 100%; }
body.docs-view-active .doc-async-page { height: max-content; }
body.docs-view-active footer { display: none; }

@keyframes doc-page-enter {
  from { transform: translateY(4px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

footer { display: flex; justify-content: space-between; gap: 24px; width: min(90%, 1920px); margin: 0 auto; padding: 22px 0 28px; border-top: 1px solid rgb(65 82 112 / 0.46); color: var(--subtle); font-size: 12px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 1160px) {
  .workbench { grid-template-columns: 210px minmax(0, 1fr); }
  .code-panel { grid-column: 1 / -1; border-top: 1px solid var(--border); }
  .code-output { min-height: 360px; }
  .docs-layout { grid-template-columns: 180px minmax(0, 1fr); }
  .doc-overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  :root { --header-height: 66px; --header-offset: 82px; }
  .site-header, main, footer { width: min(100% - 32px, 1440px); }
  .site-header { grid-template-columns: auto minmax(0, 1fr); gap: 12px; min-height: 66px; }
  .brand > span:last-child, .header-meta { display: none; }
  .view-tabs { width: 100%; }
  .view-tab { flex: 1 1 50%; min-width: 0; padding: 0 12px; }
  .hero { grid-template-columns: 1fr; gap: 16px; padding: 24px 0 20px; }
  h1 { font-size: clamp(28px, 9vw, 38px); }
  .hero-copy { font-size: 16px; }
  .workbench { display: block; overflow: visible; background: transparent; border: 0; box-shadow: none; }
  .endpoint-panel, .request-panel, .code-panel { margin-bottom: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: linear-gradient(145deg, rgb(18 26 46 / 0.94), rgb(10 15 29 / 0.94)); }
  .endpoint-panel { min-height: 0; padding: 20px 16px 14px; }
  .endpoint-list { display: flex; overflow-x: auto; padding-bottom: 4px; }
  .endpoint-button { flex: 0 0 185px; }
  .endpoint-footnote { display: none; }
  .request-panel, .code-panel { padding: 20px 16px; }
  .dynamic-fields { grid-template-columns: 1fr; }
  .control-builder-fields { grid-template-columns: 1fr; }
  .run-actions { align-items: flex-start; flex-direction: column; gap: 7px; }
  .run-button { width: 100%; }
  .code-output { min-height: 360px; max-height: 470px; font-size: 11px; }
  .help-grid { grid-template-columns: 1fr; padding: 8px 0 52px; }
  .api-docs { padding: 0 0 52px; }
  .docs-layout { display: block; }
  .docs-nav { position: static; display: flex; margin-bottom: 14px; overflow-x: auto; white-space: nowrap; }
  .docs-nav p { display: none; }
  .docs-nav button { flex: 0 0 auto; }
  .doc-section summary { min-height: 68px; padding: 12px; }
  .doc-section-body { padding: 14px; font-size: 16px; }
  .doc-table-wrap table { font-size: 14px; }
  .command-token-grid, .mqtt-topic-grid { grid-template-columns: 1fr; }
  .async-interface-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .async-interface-nav a { min-width: 0; padding: 10px; }
  .async-interface-nav strong { font-size: 12px; }
  .async-interface-nav code { display: none; }
  .doc-action { align-items: stretch; flex-direction: column; gap: 12px; }
  .doc-action button { width: 100%; }
  body.docs-view-active .api-docs { padding: 12px 0; }
  body.docs-view-active .docs-layout { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 12px; }
  body.docs-view-active .docs-nav { width: 100%; height: auto; margin: 0; overflow-x: auto; overflow-y: hidden; }
  body.docs-view-active .docs-content { width: 100%; height: auto; padding: 0 4px 16px 0; }
  footer { display: grid; gap: 5px; padding: 18px 0 24px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
