:root {
  --fg: #1b1f24;
  --muted: #6b7280;
  --border: #e5e7eb;
  --panel: #fafafa;
  --code-bg: #f1f3f5;
  --accent: #2563eb;
  --get: #15803d;
  --post: #2563eb;
  --put: #b45309;
  --patch: #b45309;
  --delete: #dc2626;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--fg);
  font-size: 14px;
  line-height: 1.55;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--code-bg);
  color: var(--fg);
  padding: 0.05rem 0.3rem;
  border-radius: 4px;
  font-size: 0.85em;
}

#app.loading, #app.failed { padding: 3rem; color: var(--muted); }
#app.ready { display: flex; align-items: flex-start; }

/* Sidebar */
.sidebar {
  position: sticky;
  top: 0;
  width: 280px;
  min-width: 280px;
  height: 100vh;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 1rem 0.75rem 3rem;
}
.brand { font-weight: 700; font-size: 1rem; padding: 0.5rem 0.5rem 0.75rem; }
.nav-group {
  margin: 1.25rem 0 0.35rem;
  padding: 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  color: var(--fg);
  text-decoration: none;
  font-size: 0.83rem;
}
.nav-link:hover { background: rgba(0, 0, 0, 0.05); }
.nav-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-sub { padding-left: 1.25rem; font-size: 0.8rem; color: var(--muted); }
.nav-sub:hover { color: var(--fg); }

/* Content */
.content { flex: 1; min-width: 0; padding: 2rem 2.5rem 6rem; max-width: 920px; }
.content h1 { margin: 0 0 0.25rem; font-size: 1.8rem; }
.version { color: var(--muted); font-size: 0.85rem; }
.server { margin: 0.75rem 0; }
.intro-desc { margin-top: 1rem; }
.desc p { margin: 0 0 0.75rem; }
.desc h2 { font-size: 1.05rem; margin: 1.6rem 0 0.5rem; }
.desc ul { margin: 0 0 0.75rem; padding-left: 1.25rem; }
.desc li { margin: 0.15rem 0; }
.desc a, .tag-desc a { color: var(--accent); text-decoration: none; }
.desc a:hover { text-decoration: underline; }
pre.code {
  background: #0f172a;
  color: #e2e8f0;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 0.5rem 0 1rem;
}
pre.code code { background: transparent; color: inherit; padding: 0; font-size: inherit; }
.ex-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0.7rem 0 0.25rem; }
.j-key { color: #7dd3fc; }
.j-str { color: #86efac; }
.j-num { color: #fca5a5; }
.j-bool { color: #c4b5fd; }
.j-null { color: #9ca3af; }

.tag-section { margin-top: 3rem; }
.tag-section h2 { font-size: 1.4rem; border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; }
.tag-desc { color: var(--muted); }

/* Operation card */
.op { border: 1px solid var(--border); border-radius: 10px; margin: 1.25rem 0; overflow: hidden; }
.op-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 1rem; background: var(--panel); border-bottom: 1px solid var(--border); }
.op-path { font-size: 0.9rem; word-break: break-all; }
.op-summary { padding: 0.7rem 1rem 0; font-weight: 600; }
.op-body { padding: 0.75rem 1rem 1rem; }
.op-body h3 { margin: 1.1rem 0 0.4rem; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }

/* Method badges */
.badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.16rem 0.4rem;
  border-radius: 5px;
  color: #fff;
  min-width: 46px;
  text-align: center;
}
.badge.get { background: var(--get); }
.badge.post { background: var(--post); }
.badge.put, .badge.patch { background: var(--patch); }
.badge.delete { background: var(--delete); }

/* Tables */
table { width: 100%; border-collapse: collapse; margin: 0.3rem 0; }
.params td { padding: 0.35rem 0.5rem; border-top: 1px solid var(--border); vertical-align: top; }
.req { color: var(--delete); font-size: 0.7rem; font-weight: 600; }
.muted { color: var(--muted); }

/* Schema property tree */
.props { list-style: none; margin: 0.2rem 0; padding-left: 0; }
.props li { padding: 0.3rem 0; border-top: 1px solid var(--border); }
.props li:first-child { border-top: none; }
.pname { background: transparent; padding: 0; font-weight: 600; }
.ptype { background: var(--code-bg); font-size: 0.8em; color: var(--accent); }
.pdesc { color: var(--muted); margin-top: 0.15rem; }
.indent { margin-left: 0.9rem; padding-left: 0.8rem; border-left: 2px solid var(--border); }
.arr { color: var(--muted); font-size: 0.8rem; }
.enum code { color: var(--fg); }

/* Responses */
.resp { display: flex; align-items: center; gap: 0.5rem; margin: 0.5rem 0 0.2rem; }
.status { font-weight: 700; font-size: 0.78rem; padding: 0.1rem 0.45rem; border-radius: 5px; color: #fff; }
.status.s2 { background: var(--get); }
.status.s3 { background: #6b7280; }
.status.s4 { background: var(--patch); }
.status.s5 { background: var(--delete); }

@media (max-width: 800px) {
  #app.ready { display: block; }
  .sidebar { position: static; width: auto; min-width: 0; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .content { padding: 1.5rem 1rem 4rem; }
  /* Full finger-size tap targets once the nav stacks full-width. */
  .nav-link { min-height: 48px; }
}
