@font-face {
  font-family: "Inter Variable";
  src:
    local("Inter Variable"),
    local("InterVariable"),
    url("https://rsms.me/inter/font-files/InterVariable.woff2?v=4.1") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Inter Variable";
  src:
    local("Inter Variable Italic"),
    local("InterVariable-Italic"),
    url("https://rsms.me/inter/font-files/InterVariable-Italic.woff2?v=4.1") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #08111f;
  --graphite: #142033;
  --muted: #64748b;
  --line: #dce5ee;
  --panel: rgba(255, 255, 255, 0.9);
  --soft: #f4f7fb;
  --surface: #eef3f4;
  --accent: #0a766b;
  --accent-rgb: 10 118 107;
  --accent-strong: #075e57;
  --accent-2: #0b5268;
  --navy: #08111f;
  --radius: 8px;
  --font-ui: "Inter Variable", "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(244, 247, 251, 0.9), #ffffff 28%, #f4f7fb 100%),
    radial-gradient(circle at 18% 0%, rgba(10, 118, 107, 0.1), transparent 34%),
    radial-gradient(circle at 100% 8%, rgba(11, 82, 104, 0.08), transparent 30%);
  line-height: 1.55;
  text-rendering: geometricPrecision;
}
a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.sidebar {
  position: fixed;
  inset: 16px auto 16px 16px;
  width: 320px;
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(220, 229, 238, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 18px 48px rgba(8, 17, 31, 0.08);
  backdrop-filter: blur(18px);
  color: var(--ink);
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.brand-logo {
  width: 156px;
  height: 56px;
  object-fit: contain;
}
.brand strong {
  display: block;
  font-size: 1rem;
  line-height: 1.25;
  font-weight: 600;
}
.brand small { display: block; color: var(--muted); }
.sidebar h2 {
  margin: 18px 0 7px;
  font-size: 12px;
  font-weight: 760;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
}
.sidebar nav { display: grid; gap: 4px; }
.sidebar a {
  color: var(--ink);
  text-decoration: none;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 640;
  line-height: 1.25;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}
.sidebar a:hover,
.sidebar a.active {
  border-color: rgb(var(--accent-rgb) / 0.22);
  background: rgb(var(--accent-rgb) / 0.1);
  color: var(--accent-strong);
  transform: translateX(2px);
}
.content {
  margin-left: 352px;
  padding: 28px 28px 42px;
  max-width: 1240px;
  overflow-wrap: anywhere;
  transition: opacity 140ms ease, transform 140ms ease;
  outline: none;
}
body.doc-route-loading .content {
  cursor: progress;
  opacity: 0.72;
}
body.doc-route-loading::before {
  content: "";
  position: fixed;
  z-index: 50;
  inset: 0 auto auto 0;
  width: 38%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 1px 8px rgb(var(--accent-rgb) / 0.3);
  animation: doc-route-progress 900ms ease-in-out infinite alternate;
}
.content.doc-route-entering {
  opacity: 0;
  transform: translateY(4px);
}
.doc-route-status {
  position: fixed;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
@keyframes doc-route-progress {
  from { transform: translateX(-45%); }
  to { transform: translateX(220%); }
}
@media (prefers-reduced-motion: reduce) {
  .content { transition: none; }
  body.doc-route-loading::before { animation: none; width: 100%; }
}
.hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(220, 229, 238, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(115deg, rgba(8, 17, 31, 0.96) 0%, rgba(11, 82, 104, 0.94) 58%, rgb(var(--accent-rgb) / 0.32) 100%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: auto, 56px 56px, 56px 56px;
  box-shadow: 0 24px 80px rgba(8, 17, 31, 0.2);
  padding: 30px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  color: white;
}
.hero h1 {
  margin: 14px 0 12px;
  max-width: 820px;
  color: white;
  font-size: clamp(32px, 4.4vw, 56px);
  font-weight: 820;
  line-height: 1;
}
.hero p {
  max-width: 780px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 16px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgb(var(--accent-rgb) / 0.28);
  border-radius: 999px;
  background: rgb(var(--accent-rgb) / 0.1);
  color: var(--accent) !important;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0;
}
.hero-meta {
  display: grid;
  gap: 8px;
  min-width: min(100%, 320px);
  position: relative;
}
.doc-search {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(16px);
  padding: 10px;
  display: grid;
  gap: 5px;
}
.doc-search span {
  font-size: 12px;
  font-weight: 760;
  color: rgba(255, 255, 255, 0.68);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.doc-search input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  padding: 10px 11px;
  font: inherit;
  font-size: 14px;
  font-weight: 560;
  color: white;
  background: rgba(8, 17, 31, 0.38);
}
.doc-search input::placeholder {
  color: rgba(255, 255, 255, 0.48);
}
.doc-search input:focus {
  outline: 2px solid rgb(var(--accent-rgb) / 0.24);
  border-color: rgb(var(--accent-rgb) / 0.62);
}
.doc-search-results {
  display: none;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(8, 17, 31, 0.16);
  max-height: 320px;
  overflow: auto;
}
.doc-search-results.active {
  display: grid;
}
.doc-search-results a,
.doc-search-empty {
  display: grid;
  gap: 3px;
  padding: 10px;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.doc-search-results a:last-child,
.doc-search-empty:last-child {
  border-bottom: 0;
}
.doc-search-results a:hover {
  background: rgb(var(--accent-rgb) / 0.08);
}
.doc-search-results small,
.doc-search-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.doc-body {
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid rgba(220, 229, 238, 0.92);
  border-radius: var(--radius);
  box-shadow: 0 18px 56px rgba(8, 17, 31, 0.08);
  padding: 30px;
}
.doc-body h2 {
  margin-top: 34px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 810;
}
.doc-body h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.doc-body h3 { margin-top: 22px; color: var(--graphite); font-size: 17px; font-weight: 780; }
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: 14px;
  margin: 22px 0;
}
.card {
  border: 1px solid rgba(220, 229, 238, 0.92);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 251, 0.86)),
    #ffffff;
  box-shadow: 0 16px 50px rgba(8, 17, 31, 0.06);
  padding: 18px;
}
.callout {
  margin: 20px 0;
  padding: 16px 18px;
  border: 1px solid rgb(var(--accent-rgb) / 0.24);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: rgb(var(--accent-rgb) / 0.06);
}
.callout strong { color: var(--accent-strong); }
.callout p:last-child { margin-bottom: 0; }
.callout.warning {
  border-color: rgba(180, 83, 9, 0.28);
  border-left-color: #b45309;
  background: rgba(245, 158, 11, 0.08);
}
.callout.warning strong { color: #92400e; }
.card h3 { margin: 0 0 8px; font-size: 17px; font-weight: 780; }
.card p { margin: 0; color: #5d6a7c; }
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 18px 0;
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  overflow-wrap: normal;
  background: white;
  box-shadow: 0 14px 42px rgba(8, 17, 31, 0.05);
}
td, th {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  vertical-align: top;
  font-size: 13px;
  font-weight: 400;
}
th {
  background: rgba(244, 247, 251, 0.92);
  color: var(--graphite);
  font-weight: 760;
}
tr:last-child td {
  border-bottom: 0;
}
tr:nth-child(even) td { background: rgba(244, 247, 251, 0.52); }
pre {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(135deg, rgba(8, 17, 31, 0.98), rgba(11, 82, 104, 0.92)),
    #101827;
  color: #eef6ff;
  box-shadow: 0 18px 50px rgba(8, 17, 31, 0.16);
  padding: 16px;
  border-radius: var(--radius);
  overflow: auto;
  overflow-wrap: normal;
}
.print-watermark,
.print-footer {
  display: none;
}

.doc-hero-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  align-self: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.doc-hero-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
  box-shadow: none;
  backdrop-filter: blur(14px);
  font: inherit;
  font-size: 13px;
  font-weight: 760;
  cursor: pointer;
}

.doc-hero-action:hover {
  border-color: rgb(var(--accent-rgb) / 0.5);
  background: rgb(var(--accent-rgb) / 0.14);
  color: #ffffff;
  transform: translateY(-1px);
}

.doc-hero-action:focus-visible {
  outline: 3px solid rgb(var(--accent-rgb) / 0.24);
  outline-offset: 2px;
}

code {
  font-family: var(--font-mono);
  font-size: 13px;
}
:not(pre) > code {
  border: 1px solid rgba(11, 82, 104, 0.12);
  border-radius: 6px;
  background: rgba(244, 247, 251, 0.9);
  color: var(--graphite);
  padding: 2px 5px;
}
.source-path {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: rgb(var(--accent-rgb) / 0.08);
  border: 1px solid var(--line);
  color: var(--graphite);
}
.doc-link { color: var(--accent); }
.architecture-figure {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background: #ffffff;
  box-shadow: 0 16px 50px rgba(8, 17, 31, 0.06);
  margin: 18px 0;
  overflow-x: auto;
}

.architecture-figure img {
  display: block;
  width: 100%;
  min-width: 760px;
  height: auto;
}

.architecture-figure figcaption {
  margin-top: 12px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.diagram,
.flow-diagram {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(244, 247, 251, 0.86)),
    #f8fafc;
  box-shadow: 0 16px 50px rgba(8, 17, 31, 0.06);
  margin: 18px 0;
  overflow-x: auto;
}
.diagram-title {
  font-weight: 800;
  color: var(--graphite);
  margin-bottom: 12px;
}
.diagram-row,
.flow-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin: 10px 0;
  min-width: min-content;
}
.diagram-node,
.flow-node {
  min-width: 170px;
  border: 1px solid rgba(11, 82, 104, 0.14);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 28px rgba(8, 17, 31, 0.06);
  font-weight: 750;
}
.flow-node {
  min-width: 150px;
}
.diagram-node small,
.flow-node small {
  display: block;
  margin-top: 4px;
  font-weight: 500;
  color: var(--muted);
}
.diagram-arrow,
.flow-arrow {
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 900;
  min-width: 22px;
}
.diagram-node.ui { border-top: 4px solid var(--accent); }
.diagram-node.edge { border-top: 4px solid var(--accent); }
.diagram-node.api { border-top: 4px solid #0b5268; }
.diagram-node.auth { border-top: 4px solid #d9a84f; }
.diagram-node.gov { border-top: 4px solid #64748b; }
.diagram-node.ehr { border-top: 4px solid var(--accent-strong); }
.diagram-node.db { border-top: 4px solid #0b5268; }
.diagram-node.search { border-top: 4px solid #d9a84f; }
.diagram-node.cache { border-top: 4px solid #7f8ea3; }
.diagram-node.term { border-top: 4px solid var(--accent); }
.diagram-node.ext { border-top: 4px solid #0b5268; }
.diagram-node.map { border-top: 4px solid var(--accent-strong); }
.diagram-node.events { border-top: 4px solid #d9a84f; }
@media (max-width: 860px) {
  .sidebar {
    position: static;
    width: auto;
    max-height: 48vh;
    margin: 10px;
  }
  .content {
    margin-left: 0;
    padding: 0 10px 18px;
  }
  .hero {
    flex-direction: column;
    padding: 22px;
  }
  .doc-hero-actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }
  .diagram-row,
  .flow-row {
    flex-direction: column;
  }
  .architecture-figure {
    padding: 12px;
  }
  .architecture-figure img {
    min-width: 640px;
  }
  .diagram-arrow,
  .flow-arrow {
    transform: rotate(90deg);
    min-height: 18px;
  }
}

@media print {
  @page {
    size: auto;
    margin: 12mm 12mm 18mm;
  }

  html,
  body {
    width: auto;
    min-width: 0;
    background: #ffffff !important;
    color: #111827 !important;
    font-size: 10pt;
    line-height: 1.42;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  body::before {
    content: "AMCDR";
    position: fixed;
    inset: 44% auto auto 50%;
    z-index: 0;
    transform: translate(-50%, -50%) rotate(-28deg);
    color: rgba(15, 118, 110, 0.07);
    font-size: 76pt;
    font-weight: 800;
    letter-spacing: 0.18em;
    pointer-events: none;
    white-space: nowrap;
  }

  body::after {
    content: "\00a9 2026 AMCDR. All rights reserved. " attr(data-print-version) ". Printed (" attr(data-print-date) ")";
    position: fixed;
    right: 0;
    bottom: 4mm;
    left: 0;
    z-index: 2;
    color: #475569;
    font-size: 8pt;
    line-height: 1;
    text-align: center;
    pointer-events: none;
  }

  body.print-runtime-ready::before,
  body.print-runtime-ready::after {
    content: none !important;
    display: none !important;
  }

  .print-watermark {
    display: block !important;
    position: fixed;
    inset: 44% auto auto 50%;
    z-index: 0;
    transform: translate(-50%, -50%) rotate(-28deg);
    color: rgba(15, 118, 110, 0.07);
    font-size: 76pt;
    font-weight: 800;
    letter-spacing: 0.18em;
    pointer-events: none;
    white-space: nowrap;
  }

  .print-footer {
    display: block !important;
    position: fixed;
    right: 0;
    bottom: 4mm;
    left: 0;
    z-index: 3;
    color: #475569;
    font-size: 8pt;
    line-height: 1;
    text-align: center;
    pointer-events: none;
  }

  .sidebar,
  .doc-search,
  .doc-search-results,
  button,
  input,
  select,
  textarea {
    display: none !important;
  }

  .content {
    position: relative;
    z-index: 1;
    margin-left: 0 !important;
    max-width: none !important;
    width: 100% !important;
    padding: 0 !important;
  }

  .hero,
  .doc-body,
  .card,
  .architecture-figure,
  .diagram,
  .flow-diagram,
  .source-path {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
    box-shadow: none !important;
  }

  .hero {
    display: block;
    margin: 0 0 10mm;
    padding: 0 0 5mm;
    border-width: 0 0 1px;
    border-radius: 0;
  }

  .hero h1 {
    font-size: 18pt !important;
    line-height: 1.18;
  }

  .hero p,
  .doc-body p,
  .doc-body li {
    color: #1f2937 !important;
  }

  .hero-meta {
    display: block;
    margin-top: 4mm;
    min-width: 0;
  }

  .doc-body {
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
  }

  .doc-body h2 {
    margin-top: 8mm;
    padding-top: 5mm;
    font-size: 13pt !important;
    break-after: avoid;
  }

  .doc-body h3,
  .card h3,
  .diagram-title {
    font-size: 11pt !important;
    break-after: avoid;
  }

  .card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5mm;
  }

  .card,
  .architecture-figure,
  .diagram,
  .flow-diagram,
  table,
  pre {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .architecture-figure img {
    min-width: 0;
  }

  table {
    display: table;
    width: 100%;
    table-layout: fixed;
    overflow: visible;
  }

  td,
  th {
    padding: 4px 5px;
    font-size: 8.5pt !important;
    word-break: break-word;
  }

  pre,
  code {
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 8.5pt !important;
  }

  pre {
    max-width: 100%;
    color: #111827;
    background: #f8fafc !important;
    border: 1px solid #cbd5e1;
  }

  .diagram-row,
  .flow-row {
    flex-wrap: wrap;
    min-width: 0;
  }

  .diagram-node,
  .flow-node {
    min-width: 42mm;
    box-shadow: none;
  }

  a {
    color: var(--accent-strong) !important;
    text-decoration: underline;
  }

  .doc-hero-actions,
  .doc-hero-action {
    display: none !important;
  }
}

/* Static documentation clinical typography guardrails. */
body,
button,
input,
select,
textarea {
  font-family: var(--font-ui);
}

body,
p,
li,
dd,
dt {
  font-size: 14px;
  font-weight: 400;
}

table,
td,
th,
pre,
code {
  font-size: 13px;
  font-weight: 400;
}

label,
.doc-search span,
.sidebar h2 {
  font-size: 12px !important;
  font-weight: 760 !important;
}

.sidebar a {
  font-size: 14px !important;
  font-weight: 640 !important;
}

button,
.doc-link,
.mini-button {
  font-size: 13px;
  font-weight: 500;
}

.hero h1,
.content > h1 {
  font-size: clamp(32px, 4.4vw, 56px);
  font-weight: 820;
}

.doc-body h2,
.doc-body h3,
.card h3,
.diagram-title {
  font-weight: 780 !important;
}

.doc-body h2 {
  font-size: 20px !important;
}

.doc-body h3,
.card h3,
.diagram-title {
  font-size: 17px !important;
}

small,
.brand small,
.eyebrow,
.source-path,
.diagram-node small,
.flow-node small,
.doc-search-results small,
.doc-search-empty {
  font-size: 12px !important;
  font-weight: 400;
}
