:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #172033;
  --muted: #5b677a;
  --border: #d9e0ea;
  --accent: #e64e1d;
  --accent-dark: #b01f09;
  --blue: #2563eb;
  --shadow: 0 12px 30px rgba(15, 23, 42, .08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(230, 78, 29, .08), transparent 32rem),
    linear-gradient(180deg, #ffffff 0%, var(--bg) 34rem);
  color: var(--text);
  line-height: 1.45;
}

.site-header {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.header-text {
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.intro {
  max-width: 850px;
  margin-top: 4px;
  margin-bottom: 0;
  font-size: 15px;
  color: var(--muted);
}

.page-menu {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(217, 224, 234, .9);
  border-radius: 999px;
  padding: 4px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
}

.page-menu a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  text-decoration: none;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.page-menu a:hover {
  background: #f1f5f9;
}

.page-menu a.active {
  background: rgba(230, 78, 29, .10);
  color: var(--accent-dark);
}

.side-nav {
  position: sticky;
  top: 70px;
  max-height: calc(100vh - 88px);
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 12px;
}

.side-nav h2 {
  font-size: 13px;
  margin: 0 0 8px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.side-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  border-radius: 10px;
  padding: 6px 9px;
  font-size: 13px;
}

.side-nav a:hover {
  background: #f1f5f9;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-dark);
  background: rgba(230, 78, 29, .08);
  border: 1px solid rgba(230, 78, 29, .20);
  border-radius: 999px;
  padding: 5px 11px;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 12px;
}

h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.05;
  letter-spacing: -.04em;
}

.intro {
  max-width: 850px;
  margin: 6px 0 0;
  font-size: 16px;
  color: var(--muted);
}

.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(246, 248, 251, .85);
  border-top: 1px solid rgba(217, 224, 234, .6);
  border-bottom: 1px solid rgba(217, 224, 234, .9);
}

.toolbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.search {
  flex: 1;
  min-width: 260px;
  max-width: 560px;
}

.search input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 13px;
  font-size: 14px;
  outline: none;
  background: #ffffff;
}

.search input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.actions {
  display: flex;
  gap: 8px;
}

button {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  border-radius: 12px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  border-color: #aeb9c8;
}

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 24px 54px;
}

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.content {
  display: grid;
  gap: 12px;
}

.section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 6px 22px rgba(15, 23, 42, .05);
  overflow: hidden;
  scroll-margin-top: 84px;
}

.section[open] {
  box-shadow: var(--shadow);
}

summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 16px;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.25;
}

summary::-webkit-details-marker {
  display: none;
}

.table-no {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  margin-right: 15px;
  border-radius: 999px;
  background: rgba(230, 78, 29, .1);
  color: var(--accent-dark);
  font-size: 12px;
}

.chevron {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  stroke: var(--muted);
  stroke-width: 2.2;
  fill: none;
  transition: transform .16s ease;
}

details[open] .chevron {
  transform: rotate(180deg);
}

.section-body {
  border-top: 1px solid var(--border);
  padding: 13px 18px 17px;
  color: #263246;
}

p {
  margin: 0 0 10px;
}

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

ul,
ol {
  margin: 6px 0 12px 20px;
  padding: 0;
}

li {
  margin: 3px 0;
}

pre {
  margin: 10px 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #0f172a;
  color: #e2e8f0;
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.4;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: #ffffff;
  min-width: 680px;
}

th,
td {
  padding: 6px 10px;
  border-bottom: 1px solid #e7edf5;
  text-align: left;
  vertical-align: top;
  font-size: 12.5px;
  line-height: 1.3;
}

th {
  background: #f8fafc;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-size: 10.5px;
}

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

tbody tr:hover td {
  background: #fbfdff;
}

code {
  font-family: Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: 12.5px;
  color: #0f172a;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 600;
  font-size: 11.5px;
  line-height: 1.25;
}

.nullable-no {
  background: rgba(230, 78, 29, .1);
  color: var(--accent-dark);
}

.nullable-yes {
  background: #eef2ff;
  color: #3730a3;
}

.hidden {
  display: none;
}

.no-results {
  display: none;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.no-results.visible {
  display: block;
}

.diagram svg {
    background: white;
    display: block;
    margin: 18px auto;
    border: 1px solid #cbd5e1;
    box-shadow: 0 2px 12px rgba(15,23,42,.08);
  }

  .edge {
    fill: none;
    stroke: #94a3b8;
    stroke-width: 1.35;
    stroke-linecap: round;
    stroke-linejoin: round;
    opacity: .42;
    transition: stroke .12s, opacity .12s, stroke-width .12s;
  }

  .node rect {
    fill: #fff;
    stroke: #334155;
    stroke-width: 1.2;
    filter: drop-shadow(0 1px 1px rgba(15,23,42,.10));
  }

  .node text {
    font-weight: 700;
    font-size: 12.5px;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
  }

  .node.main rect {
    fill: #f1f5f9;
    stroke: #0f172a;
    stroke-width: 2;
  }

  .node.dim {
    opacity: .28;
  }

  .node.active rect {
    fill: #eff6ff;
    stroke: #2563eb;
    stroke-width: 2.4;
  }

  .node.related rect {
    fill: #f8fafc;
    stroke: #2563eb;
    stroke-width: 1.8;
  }

  .edge.active {
    stroke: #2563eb;
    stroke-width: 3.2;
    opacity: 1;
  }

  .edge.dim {
    opacity: .08;
  }

summary {
  gap: 10px;
}

summary > span:first-child {
  flex: 1;
}

.diagram-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  padding: 4px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  color: #2563eb;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.diagram-link:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.diagram-link:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

@media (max-width: 920px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .page-menu {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    border-radius: 14px;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .side-nav {
    position: static;
    max-height: none;
  }
}

@media print {
  .toolbar,
  .side-nav,
  .page-menu {
    display: none;
  }

  body {
    background: #fff;
  }

  main,
  .site-header {
    max-width: none;
    padding: 18px;
  }

  .layout {
    display: block;
  }

  .section {
    break-inside: avoid;
    box-shadow: none;
  }

  details {
    page-break-inside: avoid;
  }
}