:root {
  --bg: #f9fafb;
  --panel: #ffffff;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --primary: #f54900;
  --primary-dark: #b23200;
  --primary-soft: #fff5f0;
  --accent: #f54900;
  --accent-hover: #d63d00;
  --success: #16a34a;
  --warning: #ca8a04;
  --danger: #dc2626;
  --code: #0f172a;
  --radius: 8px;
  --shadow: 0 14px 40px rgb(15 23 42 / 7%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  border-right: 1px solid #0f172a;
  background: #0f172a;
  color: #eaf1f8;
  padding: 22px 18px;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-logo {
  display: block;
  width: 112px;
  height: auto;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav,
.service-nav {
  display: grid;
  gap: 4px;
}

.nav a,
.service-nav a,
.service-group summary {
  border-radius: var(--radius);
  color: #cbd5e1;
  padding: 10px 12px;
  font-size: 14px;
}

.nav a:hover,
.nav a.active,
.service-nav a:hover,
.service-nav a.active,
.service-group summary:hover {
  background: rgb(245 73 0 / 18%);
  color: #ffffff;
}

.service-group {
  display: grid;
  gap: 3px;
}

.service-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  list-style: none;
}

.service-group summary::-webkit-details-marker {
  display: none;
}

.service-group summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 150ms ease;
}

.service-group[open] summary::after {
  transform: rotate(45deg);
}

.service-group summary a {
  padding: 0;
}

.service-group summary a:hover,
.service-group summary a.active {
  background: transparent;
}

.service-subnav {
  display: grid;
  gap: 2px;
  margin: 0 0 6px 14px;
  padding-left: 10px;
  border-left: 1px solid rgb(203 213 225 / 22%);
}

.service-subnav a {
  padding: 7px 10px;
  color: #94a3b8;
  font-size: 13px;
}

.service-subnav a:hover,
.service-subnav a.active {
  background: rgb(245 73 0 / 14%);
  color: #ffffff;
}

.nav-section {
  margin-top: 28px;
}

.nav-section > span {
  display: block;
  margin: 0 0 10px 12px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.content {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgb(249 250 251 / 92%);
  padding: 24px 34px;
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
}

h2,
h3 {
  color: var(--ink);
}

.search {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 300px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 11px 12px;
  outline: none;
}

.search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(245 73 0 / 14%);
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 10;
  display: grid;
  width: min(620px, calc(100vw - 44px));
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 24px 70px rgb(15 23 42 / 18%);
  padding: 8px;
}

.search-results[hidden] {
  display: none;
}

.search-result,
.search-empty {
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  padding: 12px;
  text-align: left;
}

.search-result {
  display: grid;
  gap: 6px;
  cursor: pointer;
}

.search-result:hover,
.search-result:focus-visible {
  background: var(--primary-soft);
  outline: none;
}

.search-result strong {
  color: var(--ink);
  font-size: 14px;
}

.search-result code {
  color: var(--primary-dark);
  font-size: 13px;
}

.search-result small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.search-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search-result-meta .method {
  min-width: auto;
  padding: 5px 7px;
  font-size: 11px;
}

.search-empty {
  color: var(--muted);
  font-size: 14px;
}

.main-content {
  width: min(1160px, 100%);
  padding: 34px;
}

.hero {
  border-radius: var(--radius);
  background: linear-gradient(145deg, #f3ffee 0%, #ffffff 48%, #fff8ee 100%);
  box-shadow: var(--shadow);
  padding: 34px;
}

.hero p {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.7;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.card,
.endpoint,
.doc-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.card,
.doc-section {
  padding: 22px;
}

.grid + .doc-section {
  margin-top: 18px;
}

.card h3,
.doc-section h2,
.endpoint h3 {
  margin-top: 0;
}

.card p,
.doc-section p,
.endpoint p,
.empty-state {
  color: var(--muted);
  line-height: 1.65;
}

.product-grid {
  align-items: stretch;
}

.product-narrative {
  margin-top: 18px;
}

.product-narrative p + p {
  margin-top: 10px;
}

.product-card {
  display: grid;
  gap: 8px;
}

.product-card span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.product-card h3 {
  margin-bottom: 0;
}

.module-list,
.flow-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.module-item,
.flow-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 18px;
}

.module-item h3,
.flow-item h3 {
  margin: 0 0 6px;
}

.module-item p,
.flow-item p {
  margin: 0;
}

.module-item small {
  display: block;
  margin-top: 10px;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}

.flow-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
}

.flow-item > span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
}

.flow-item code {
  display: inline-block;
  margin-top: 10px;
  color: var(--primary-dark);
  font-size: 13px;
}

.actor-grid,
.concept-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.actor-item,
.concept-item,
.journey-step {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 16px;
}

.actor-item h3,
.concept-item h3,
.journey-step h3 {
  margin: 0 0 6px;
}

.actor-item p,
.concept-item p,
.journey-step p {
  margin: 0;
}

.journey {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.journey-step {
  position: relative;
}

.journey-step span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 10px;
}

.journey-step h3 {
  font-size: 16px;
}

.journey-step p {
  font-size: 14px;
}

.doc-section a {
  color: var(--primary-dark);
  font-weight: 700;
}

.api-header {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
}

.api-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill,
.method {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  padding: 7px 10px;
}

.pill {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.method {
  min-width: 64px;
  justify-content: center;
  color: #ffffff;
}

.get {
  background: var(--success);
}

.post {
  background: var(--primary);
}

.patch,
.put {
  background: var(--warning);
}

.delete {
  background: var(--danger);
}

.method.event {
  background: #475569;
}

.tag-group {
  margin-top: 28px;
}

.tag-group > h2 {
  margin: 0 0 12px;
  font-size: 22px;
}

.endpoint {
  margin-bottom: 14px;
  overflow: hidden;
}

.endpoint-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 16px;
}

.endpoint-summary code {
  overflow-wrap: anywhere;
}

.endpoint-body {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.subgrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.table-wrap {
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  table-layout: fixed;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
  word-break: normal;
}

th {
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

code,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

code {
  color: var(--primary-dark);
  overflow-wrap: anywhere;
}

pre {
  overflow: auto;
  border-radius: var(--radius);
  background: var(--code);
  color: #e5edf6;
  line-height: 1.6;
  margin: 0;
  padding: 16px;
}

pre code {
  color: #e5edf6;
}

.schema-block {
  display: grid;
  gap: 10px;
}

.status {
  font-weight: 800;
}

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

.status.warn {
  color: var(--warning);
}

.status.error {
  color: var(--danger);
}

.loading,
.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 28px;
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .topbar {
    position: relative;
    display: grid;
  }

  .search {
    min-width: 0;
  }

  .main-content,
  .topbar {
    padding: 22px;
  }

  .grid,
  .subgrid,
  .actor-grid,
  .concept-list,
  .journey {
    grid-template-columns: 1fr;
  }
}
