/* s4-robot Integration API docs — light theme, responsive sidebar */

:root {
  --bg: #f1f5f9;
  --bg-elevated: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-soft: #eff6ff;
  --swagger-get: #61affe;
  --swagger-post: #49cc90;
  --swagger-put: #fca130;
  --swagger-delete: #f93e3e;
  --swagger-patch: #50e3c2;
  --success: #15803d;
  --error: #dc2626;
  --hl-bg: #e0f2fe;
  --hl-text: #0369a1;
  --hl-border: #bae6fd;
  --radius: 12px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 40px rgba(15, 23, 42, 0.1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.docs-no-scroll {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* Highlight tokens — no backticks */
.hl {
  display: inline;
  padding: 0.12em 0.4em;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 0.88em;
  background: var(--hl-bg);
  color: var(--hl-text);
  border: 1px solid var(--hl-border);
}

.hl--block {
  display: block;
  padding: 0.45rem 0.6rem;
  word-break: break-all;
  font-size: 0.8rem;
}

.docs-strong {
  color: #0f172a;
  font-weight: 700;
}

.docs-p {
  margin: 0 0 0.65rem;
  color: #334155;
}

.docs-p:last-child {
  margin-bottom: 0;
}

.docs-md-h3 {
  margin: 1rem 0 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

.docs-pre {
  margin: 0;
  overflow-x: auto;
  font-size: 0.75rem;
  line-height: 1.5;
  color: #334155;
}

/* Loading */
.docs-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 1rem;
  color: var(--muted);
}

.docs-loading__spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Shell — desktop: sidebar + main in one surface */
.docs-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 1fr;
  background: var(--bg-elevated);
}

@media (min-width: 960px) {
  .docs-shell {
    grid-template-columns: minmax(268px, 300px) minmax(0, 1fr);
    box-shadow: inset 1px 0 0 var(--border);
  }
}

/* Mobile menu */
.docs-menu-btn {
  display: none;
  position: fixed;
  top: 0.65rem;
  left: 0.65rem;
  z-index: 220;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  cursor: pointer;
  padding: 0;
}

.docs-menu-btn__icon {
  display: block;
  width: 20px;
  height: 14px;
  border-top: 2px solid var(--text);
  border-bottom: 2px solid var(--text);
  position: relative;
}

.docs-menu-btn__icon::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 2px;
  background: var(--text);
}

@media (max-width: 959px) {
  .docs-menu-btn {
    display: flex;
  }
}

.docs-backdrop {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(2px);
}

.docs-backdrop[hidden] {
  display: none !important;
}

/* Sidebar */
.docs-sidebar {
  padding: 1.1rem 0.9rem 2rem;
  border-right: 1px solid var(--border);
  background: #f8fafc;
  overflow-y: auto;
}

@media (min-width: 960px) {
  .docs-sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
  }
}

@media (max-width: 959px) {
  .docs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(300px, 88vw);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
    border-right: 1px solid var(--border);
  }

  .docs-sidebar.docs-sidebar--open {
    transform: translateX(0);
  }
}

.docs-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.docs-sidebar-brand__logo {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  background: url("/static/docs/logo.svg") center / contain no-repeat;
}

.docs-sidebar-brand__title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

.docs-sidebar-brand__sub {
  font-size: 0.72rem;
  color: var(--muted);
}

.docs-intro--sidebar {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.docs-intro__title {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.docs-intro__title .version {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  background: var(--primary-soft);
  color: var(--primary);
  vertical-align: middle;
}

.docs-intro__body {
  font-size: 0.82rem;
  color: #475569;
}

.docs-block {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.docs-block h3 {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.docs-sidebar-base {
  margin-bottom: 1rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.docs-sidebar-base__label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.docs-sidebar-base__copy {
  margin-top: 0.45rem;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.docs-sidebar-auth {
  margin-bottom: 1.25rem;
  padding: 0.75rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.docs-sidebar-auth__label {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.docs-sidebar-auth__hint {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--muted);
}

.docs-sidebar-auth__input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.45rem 0.6rem;
  margin-bottom: 0.45rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 0.78rem;
  font-family: ui-monospace, monospace;
}

.docs-sidebar-auth__save {
  width: 100%;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.docs-sidebar-auth__save:hover:not(:disabled) {
  filter: brightness(1.05);
}

.docs-sidebar-auth__save:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Nav */
.docs-nav__group {
  margin-bottom: 1rem;
}

.docs-nav__label {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 0.35rem;
  margin-bottom: 0.35rem;
}

.docs-nav__link {
  display: block;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  font-size: 0.84rem;
  color: #475569;
  transition: background 0.12s;
}

.docs-nav__link:hover {
  background: var(--primary-soft);
  color: var(--primary);
  text-decoration: none;
}

.docs-nav__link--op {
  font-size: 0.76rem;
  line-height: 1.35;
}

.docs-nav__meth {
  display: inline-block;
  min-width: 2.4rem;
  margin-right: 0.2rem;
  padding: 0.08rem 0.28rem;
  border-radius: 4px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
  color: #fff;
}

.docs-nav__meth--get {
  background: var(--swagger-get);
}

.docs-nav__meth--post {
  background: var(--swagger-post);
  color: #0b1420;
}

.docs-nav__meth--put {
  background: var(--swagger-put);
  color: #1a1208;
}

.docs-nav__meth--patch {
  background: var(--swagger-patch);
  color: #0b1420;
}

.docs-nav__meth--delete {
  background: var(--swagger-delete);
}

/* Main */
.docs-body {
  min-width: 0;
  background: var(--bg);
}

@media (max-width: 959px) {
  .docs-body {
    padding-top: 3.5rem;
  }
}

.docs-main {
  padding: 1.25rem 1rem 3rem;
  max-width: 880px;
}

@media (min-width: 960px) {
  .docs-main {
    padding: 1.75rem 2rem 3rem;
  }
}

.docs-main-base {
  margin-bottom: 1.75rem;
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  scroll-margin-top: 0.75rem;
}

.docs-main-base__label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.docs-main-base__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.docs-main-base__copy {
  padding: 0.45rem 0.9rem;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.docs-main-base__hint {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.5;
}

/* Tag + operation list */
.docs-tag {
  margin-bottom: 2.25rem;
  scroll-margin-top: 1rem;
}

.docs-tag__header {
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.docs-tag__header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.docs-op-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Operation card */
.op {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  border-left: 3px solid #cbd5e1;
}

.op--get {
  border-left-color: var(--swagger-get);
}

.op--post {
  border-left-color: var(--swagger-post);
}

.op--put {
  border-left-color: var(--swagger-put);
}

.op--patch {
  border-left-color: var(--swagger-patch);
}

.op--delete {
  border-left-color: var(--swagger-delete);
}

.op--tint-0 {
  background: linear-gradient(180deg, #fafcff 0%, #fff 100%);
}

.op--tint-1 {
  background: linear-gradient(180deg, #f8fffc 0%, #fff 100%);
}

.op--tint-2 {
  background: linear-gradient(180deg, #faf9ff 0%, #fff 100%);
}

.op__trigger {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.75rem 0.9rem;
  text-align: left;
  cursor: pointer;
  border: none;
  background: rgba(248, 250, 252, 0.9);
  color: inherit;
  font: inherit;
  transition: background 0.12s;
}

.op__trigger:hover {
  background: #f1f5f9;
}

.op__trigger[aria-expanded="true"] {
  border-bottom: 1px solid var(--border);
}

.op__method {
  flex-shrink: 0;
  min-width: 3.1rem;
  padding: 0.28rem 0.4rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

.op__method--get {
  background: var(--swagger-get);
  color: #fff;
}

.op__method--post {
  background: var(--swagger-post);
  color: #0b1420;
}

.op__method--put {
  background: var(--swagger-put);
  color: #1a1208;
}

.op__method--patch {
  background: var(--swagger-patch);
  color: #0b1420;
}

.op__method--delete {
  background: var(--swagger-delete);
  color: #fff;
}

.op__path {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, monospace;
  font-size: 0.86rem;
  font-weight: 600;
  color: #1e293b;
  word-break: break-all;
}

.op__chev {
  margin-left: auto;
  font-size: 0.6rem;
  color: var(--muted);
  transition: transform 0.2s;
}

.op__trigger[aria-expanded="true"] .op__chev {
  transform: rotate(180deg);
}

.op__panel {
  padding: 0 0.9rem 0.9rem;
  display: none;
}

.op__trigger[aria-expanded="true"] + .op__panel {
  display: block;
}

.op__panel-head {
  padding-top: 0.35rem;
}

.op__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.op__desc {
  margin: 0.65rem 0 0.85rem;
  font-size: 0.88rem;
  color: #475569;
}

.op__sub {
  margin: 0.85rem 0 0.4rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.op__table-wrap {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.op__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.op__table th,
.op__table td {
  padding: 0.45rem 0.55rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.op__table th {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
}

.op__table tr:last-child td {
  border-bottom: none;
}

.op__responses {
  margin-top: 0.5rem;
}

.resp-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.45rem 0.85rem;
  align-items: start;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}

.resp-row:last-child {
  border-bottom: none;
}

.resp-row--error .resp-desc {
  font-size: 0.84rem;
}

.resp-errcode {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: #64748b;
}

.resp-code {
  font-weight: 800;
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
}

.resp-code--2 {
  color: var(--success);
}

.resp-code--4 {
  color: var(--error);
}

.resp-desc {
  color: #475569;
}

/* Dark JSON blocks + syntax colors */
.json-panel {
  margin: 0.35rem 0 0;
  padding: 0.75rem 1rem;
  max-height: 360px;
  overflow: auto;
  border-radius: 8px;
  background: #0f172a;
  border: 1px solid #1e293b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  font-size: 0.78rem;
  line-height: 1.55;
  tab-size: 2;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
}

.json-panel--static {
  margin-top: 0.4rem;
}

.json-panel--preview {
  min-height: 72px;
  max-height: 220px;
}

.json-panel--response {
  margin-top: 0.35rem;
}

.json-key {
  color: #7dd3fc;
}

.json-str {
  color: #86efac;
}

.json-num {
  color: #fde047;
}

.json-bool {
  color: #f472b6;
}

.json-null {
  color: #94a3b8;
  font-style: italic;
}

.json-punct {
  color: #cbd5e1;
}

.json-muted {
  color: #64748b;
}

.json-invalid {
  color: #fca5a5;
}

.json-raw {
  color: #e2e8f0;
  white-space: pre-wrap;
}

/* Try */
.op_try {
  margin-top: 1rem;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid #bfdbfe;
  background: var(--primary-soft);
  position: relative;
  z-index: 2;
}

.op_try__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.6rem;
}

.op_try__head strong {
  font-size: 0.85rem;
  color: #1e3a8a;
}

.op_try__hint {
  font-size: 0.75rem;
  color: #64748b;
}

.op_try__query {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
}

.op_try__qrow {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.op_try__qmeta {
  font-weight: 400;
  color: #94a3b8;
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.72rem;
}

.op_try__qinput {
  width: 100%;
  max-width: 28rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #0f172a;
  font-size: 0.82rem;
}

.op_try__qinput:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.25);
}

.op_try__nobody {
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
}

.docs-appendix {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.docs-appendix__title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
  color: var(--text);
}

.docs-error-codes td:last-child {
  color: var(--muted);
  font-size: 0.85rem;
}

.op_try__json {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.55rem;
}

.op_try__lbl {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.op_try__textarea {
  width: 100%;
  min-height: 100px;
  margin: 0;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid #1e293b;
  background: #020617;
  color: #e2e8f0;
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;
  line-height: 1.5;
  resize: vertical;
}

.op_try__textarea:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}

.op_try__textarea:disabled {
  opacity: 0.65;
  background: #f1f5f9;
  color: #64748b;
  border-color: var(--border);
}

.op_try__actions {
  display: flex;
  gap: 0.5rem;
}

.op_try__btn {
  position: relative;
  z-index: 3;
  padding: 0.45rem 1rem;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
}

.op_try__btn:hover {
  filter: brightness(1.06);
}

.op_try__btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.op_try__out {
  margin-top: 0.65rem;
}

.op_try__out-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.op_try__status {
  font-size: 0.78rem;
  margin-bottom: 0.35rem;
}

.op_try__status--ok {
  color: var(--success);
}

.op_try__status--err {
  color: var(--error);
}

.docs-footer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--muted);
}
