:root {
  color-scheme: light dark;
  --page: light-dark(#f5f7fb, #111827);
  --surface: light-dark(#ffffff, #182235);
  --text: light-dark(#182033, #e7edf7);
  --muted: light-dark(#556176, #aab6c8);
  --border: light-dark(#d9e0ea, #34425a);
  --accent: light-dark(#175cd3, #8bb8ff);
  --quote: light-dark(#eef4ff, #1c3152);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
}

body {
  margin: 0;
  color: var(--text);
  background: var(--page);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.62;
}

.report {
  width: min(1120px, calc(100% - 32px));
  margin: 32px auto;
  padding: clamp(24px, 5vw, 64px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}

h1,
h2,
h3 {
  line-height: 1.25;
  text-wrap: balance;
}

h1 {
  margin-top: 0;
  font-size: clamp(2rem, 5vw, 3rem);
}

h2 {
  margin-top: 2.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

h3 {
  margin-top: 2rem;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
}

blockquote {
  margin: 1.5rem 0;
  padding: 0.85rem 1rem;
  background: var(--quote);
  border-left: 4px solid var(--accent);
}

blockquote > :first-child {
  margin-top: 0;
}

blockquote > :last-child {
  margin-bottom: 0;
}

code {
  overflow-wrap: anywhere;
}

pre {
  padding: 1rem;
  overflow-x: auto;
  background: var(--page);
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  display: block;
  width: 100%;
  margin: 1.25rem 0 1.75rem;
  overflow-x: auto;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,
td {
  min-width: 110px;
  padding: 0.7rem 0.8rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 650;
  background: var(--page);
}

td:not(:first-child),
th:not(:first-child) {
  white-space: nowrap;
}

.mermaid {
  width: 100%;
  margin: 1.5rem 0 2rem;
  padding: 1rem;
  overflow-x: auto;
  background: #1f2329;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.mermaid svg {
  display: block;
  max-width: none;
  height: auto;
  margin: 0 auto;
  background: #1f2329;
  font-family: Inter, "Segoe UI", Arial, sans-serif !important;
  font-size: 18px !important;
}

.mermaid .cluster rect {
  fill: #27313d !important;
  stroke: #64748b !important;
}

.mermaid .icon-shape,
.mermaid .icon-shape p {
  background: transparent !important;
}

.mermaid .icon-shape .label rect {
  fill: transparent !important;
  stroke: none !important;
  opacity: 0 !important;
}

.mermaid .icon-shape .nodeLabel,
.mermaid .icon-shape .nodeLabel p,
.mermaid .icon-shape .label text,
.mermaid .icon-shape .label span {
  color: #ffffff !important;
  fill: #ffffff !important;
  font-size: 18px !important;
  font-weight: 700 !important;
  line-height: 1.25 !important;
  background: transparent !important;
}

.mermaid .cluster-label .nodeLabel,
.mermaid .cluster-label text,
.mermaid .cluster-label span {
  color: #ffffff !important;
  fill: #ffffff !important;
  font-size: 20px !important;
  font-weight: 800 !important;
}

.mermaid .edgeLabel,
.mermaid .edgeLabel .label,
.mermaid .edgeLabel p,
.mermaid .edgeLabel span {
  color: #ffffff !important;
  fill: #ffffff !important;
  font-size: 16px !important;
  font-weight: 650 !important;
}

.mermaid .edgeLabel {
  padding: 0;
  background: transparent !important;
}

.mermaid .edgeLabel p,
.mermaid .edgeLabel span {
  background: transparent !important;
}

.mermaid .edgeLabel rect {
  fill: transparent !important;
  stroke: none !important;
  opacity: 0 !important;
}

@media (max-width: 640px) {
  .report {
    width: 100%;
    margin: 0;
    padding: 20px;
    border: 0;
    border-radius: 0;
  }
}

@media print {
  :root {
    --page: #ffffff;
    --surface: #ffffff;
    --text: #111827;
    --muted: #4b5563;
    --border: #cbd5e1;
    --accent: #174ea6;
    --quote: #f3f6fb;
  }

  body {
    font-size: 10pt;
  }

  .report {
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
  }

  h2,
  h3 {
    break-after: avoid;
  }

  table,
  blockquote,
  .mermaid {
    break-inside: avoid;
  }

  table {
    display: table;
    overflow: visible;
  }

  .mermaid {
    overflow: visible;
  }

  .mermaid svg {
    max-width: 100%;
  }
}
