:root {
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #1b1f22;
  --muted: #667077;
  --line: #dce2dd;
  --accent: #0b6b63;
  --accent-2: #a6422b;
  --accent-3: #4f6f39;
  --soft: #edf4f1;
  --warn: #fff4df;
  --code: #172026;
  --radius: 8px;
  --shadow: 0 12px 30px rgba(31, 38, 34, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 278px;
  padding: 20px;
  background: #172026;
  color: #fff;
  overflow: auto;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #f7c85f;
  color: #172026;
  font-weight: 800;
  font-size: 13px;
}

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

.brand small {
  color: rgba(255, 255, 255, 0.68);
}

nav {
  display: grid;
  gap: 6px;
  margin-top: 18px;
}

nav a {
  color: rgba(255, 255, 255, 0.78);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
}

nav a:hover,
nav a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.shell {
  margin-left: 278px;
  min-height: 100vh;
  padding: 28px clamp(18px, 3vw, 44px) 60px;
}

.topbar {
  display: flex;
  gap: 24px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 28px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.16;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 24px;
  margin-bottom: 16px;
}

h3 {
  font-size: 17px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0;
}

.search-wrap {
  width: min(420px, 100%);
}

.search-wrap label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 11px 12px;
  color: var(--ink);
  font: inherit;
}

.section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  padding: clamp(18px, 2vw, 26px);
}

.section.hidden {
  display: none;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric,
.item,
.callout {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.metric strong {
  display: block;
  font-size: 26px;
  line-height: 1;
}

.metric span,
.muted {
  color: var(--muted);
}

.callout {
  background: var(--soft);
  border-color: #cfe0da;
}

.warning {
  background: var(--warn);
  border-color: #ead7ac;
}

.pill-row,
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.endpoint-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.endpoint-detail-row > td {
  background: #fbfcfb;
}

.condition-card {
  background: #fbfcfb;
}

.condition-card summary {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.db-domain-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.db-domain {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: #fbfcfb;
}

.db-domain strong {
  display: block;
  margin: 8px 0;
  color: var(--accent);
  font-size: 24px;
  line-height: 1;
}

.db-filters select {
  width: min(320px, 100%);
}

.db-schema-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.db-table-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.db-table-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 14px;
  background: #f3f6f4;
  border-bottom: 1px solid var(--line);
}

.db-table-header .eyebrow {
  margin-bottom: 4px;
}

.db-table-count {
  border: 1px solid #bfd7d0;
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--accent);
  background: #eff8f5;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.db-table-card > .pill-row,
.db-table-card .db-file {
  padding: 10px 14px 0;
}

.db-columns {
  padding: 10px 14px;
}

.db-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  border-top: 1px solid var(--line);
}

.db-column:first-child {
  border-top: 0;
}

.db-column.primary strong {
  color: var(--accent);
}

.db-column strong,
.db-column span {
  display: block;
}

.db-column span {
  color: var(--muted);
  font-size: 12px;
}

.db-column-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.db-column-badges .pill {
  min-height: 22px;
  padding: 1px 7px;
  font-size: 10px;
}

.db-relations {
  margin: 0 14px 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  display: grid;
  gap: 5px;
  font-size: 12px;
}

.db-file {
  margin: 0 0 14px;
}

.compact-table {
  margin-top: 8px;
}

.compact-table table {
  min-width: 560px;
}

.compact-table th,
.compact-table td {
  padding: 8px 10px;
}

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

.code-grid h3 {
  margin: 8px 0;
}

.pill.green {
  color: var(--accent);
  border-color: #b8d9d3;
  background: #f1faf7;
}

.pill.red {
  color: var(--accent-2);
  border-color: #ecc7bd;
  background: #fff5f1;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  background: #f3f6f4;
  color: #3b464b;
  z-index: 1;
}

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

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

code {
  color: var(--accent-2);
  background: #f7ece8;
  border-radius: 5px;
  padding: 2px 5px;
  overflow-wrap: anywhere;
}

pre {
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  background: var(--code);
  color: #eaf0ef;
  overflow: auto;
  font-size: 12px;
}

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-top: 10px;
}

summary {
  cursor: pointer;
  padding: 12px 14px;
  font-weight: 700;
}

details .details-body {
  padding: 0 14px 14px;
}

.flow {
  counter-reset: flow;
  display: grid;
  gap: 10px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.flow li {
  counter-increment: flow;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: start;
}

.flow li::before {
  content: counter(flow);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
}

.subtle-list {
  margin: 8px 0 0;
  padding-left: 18px;
}

.subtle-list li {
  margin: 4px 0;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .shell {
    margin-left: 0;
  }

  .topbar,
  .grid.two,
  .grid.three,
  .code-grid,
  .db-domain-grid,
  .db-schema-grid {
    grid-template-columns: 1fr;
    display: grid;
  }
}

@media (max-width: 620px) {
  h1 {
    font-size: 28px;
  }

  .shell {
    padding-inline: 14px;
  }

  .section {
    padding: 16px;
  }

  .filters select,
  .filters input {
    min-width: 100%;
  }
}
