:root {
  --hc-navy: #2c3e50;
  --hc-blue: #18bc9c;
  --hc-blue-dark: #13967d;
  --hc-blue-light: #d1f2eb;
  --hc-ink: #212529;
  --hc-muted: #7b8a8b;
  --hc-rule: #dee2e6;
  --hc-surface: #f8f9fa;
  --hc-warning: #fdebd0;
  --mobile-header-h: 48px;
  --mobile-nav-h: 38px;
  --sticky-offset: 96px;
}

html { scroll-behavior: smooth; }
body { margin: 0; color: var(--hc-ink); background: #fff; font-size: 16px; line-height: 1.55; }
a { color: var(--hc-blue); }
button, input, select { font: inherit; }
.skip-link { position: fixed; z-index: 2000; left: .5rem; top: -4rem; padding: .5rem .75rem; background: #fff; color: var(--hc-navy); border: 2px solid var(--hc-blue); }
.skip-link:focus { top: .5rem; }
.scroll-target { scroll-margin-top: var(--sticky-offset); }

.mobile-header { position: sticky; top: 0; z-index: 1030; height: var(--mobile-header-h); display: flex; align-items: center; justify-content: space-between; padding: 0 .45rem; background: var(--hc-navy); color: #fff; }
.mobile-brand { color: #fff; text-decoration: none; font-size: .98rem; font-weight: 700; }
.header-button { min-height: 36px; padding: .25rem .65rem; color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.65); border-radius: .375rem; font-size: .82rem; font-weight: 700; }
.header-button:hover, .header-button:focus-visible { color: var(--hc-navy); background: #fff; border-color: #fff; }
.mobile-system-nav { position: sticky; top: var(--mobile-header-h); z-index: 1020; height: var(--mobile-nav-h); display: flex; align-items: stretch; overflow-x: auto; overscroll-behavior-inline: contain; scrollbar-width: none; background: #fff; border-bottom: 1px solid var(--hc-rule); white-space: nowrap; }
.mobile-system-nav::-webkit-scrollbar { display: none; }
.mobile-system-link { flex: 0 0 auto; display: inline-flex; align-items: center; height: 100%; padding: 0 .7rem; color: #425466; text-decoration: none; border-bottom: 3px solid transparent; font-size: .78rem; font-weight: 700; }
.mobile-system-link.active { color: var(--hc-blue-dark); background: var(--hc-blue-light); border-bottom-color: var(--hc-blue); }

.mobile-panel { position: fixed; z-index: 1100; inset: 0 0 auto 0; max-height: 85vh; overflow: auto; padding: 1rem; background: #fff; border-bottom: 3px solid var(--hc-blue); }
.mobile-panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: .75rem; color: var(--hc-navy); }
.panel-backdrop { position: fixed; z-index: 1090; inset: 0; background: rgba(16, 29, 43, .45); }

.desktop-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1010; width: 278px; flex-direction: column; background: var(--hc-surface); border-right: 1px solid var(--hc-rule); box-shadow: .125rem 0 .5rem rgba(44, 62, 80, .08); }
.sidebar-brand { padding: 1.1rem 1rem .85rem; background: var(--hc-navy); }
.sidebar-brand a { display: block; color: #fff; text-decoration: none; font-size: 1.12rem; font-weight: 700; }
.sidebar-brand span { display: block; margin-top: .1rem; color: #d8e6f3; font-size: .78rem; }
.review-controls { padding: .8rem; border-bottom: 1px solid var(--hc-rule); }
.form-label { margin-bottom: .2rem; color: #475664; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .035em; }
.search-row { display: flex; gap: .35rem; }
.filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .6rem; }
.reset-filters { padding: .45rem 0 0; color: var(--hc-blue-dark); text-decoration: none; font-size: .78rem; }
.desktop-nav { flex: 1; overflow-y: auto; padding: .6rem 0 1.5rem; }
.nav-system { border-bottom: 1px solid #e6ebef; }
.nav-system-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: .62rem 1rem; color: var(--hc-navy); background: transparent; border: 0; text-align: left; font-size: .9rem; font-weight: 700; }
.nav-system-toggle::after { content: "+"; color: var(--hc-muted); font-size: 1rem; }
.nav-system.open .nav-system-toggle::after { content: "−"; }
.nav-components { display: none; padding: 0 0 .45rem; }
.nav-system.open .nav-components { display: block; }
.nav-component-link { display: block; padding: .32rem 1rem .32rem 1.5rem; color: #536372; text-decoration: none; font-size: .78rem; line-height: 1.3; border-left: 3px solid transparent; }
.nav-component-link:hover, .nav-component-link.active { color: var(--hc-blue-dark); background: var(--hc-blue-light); border-left-color: var(--hc-blue); }

.main-content { width: min(100%, 1120px); margin: 0 auto; padding: 1rem .85rem 5rem; }
.summary-section { padding: .4rem 0 1.1rem; border-bottom: 2px solid var(--hc-navy); }
.eyebrow { margin: 0 0 .1rem; color: var(--hc-blue); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
h1 { margin: 0; color: var(--hc-navy); font-size: clamp(1.55rem, 5.8vw, 2.2rem); line-height: 1.15; }
.summary-counts { display: flex; flex-wrap: wrap; gap: .5rem; margin: .85rem 0; color: #4d5d6b; font-size: .9rem; }
.summary-counts span { padding: .32rem .65rem; background: var(--hc-blue-light); border: 1px solid #a3e4d7; border-radius: 50rem; }
.summary-counts strong { color: var(--hc-navy); font-size: 1.05rem; }
.guidance { max-width: 880px; padding: 1rem; background: var(--hc-surface); border: 1px solid var(--hc-rule); border-left: 5px solid var(--hc-blue); border-radius: .375rem; }
.guidance h2 { margin: 0 0 .3rem; color: var(--hc-navy); font-size: 1rem; }
.guidance p { margin: 0; font-size: .9rem; }
.guidance .review-note { margin-top: .55rem; padding-top: .55rem; border-top: 1px solid var(--hc-rule); }
.results-summary { min-height: 2rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 0 .25rem; color: var(--hc-muted); font-size: .85rem; }
.accordion-actions { display: inline-flex; gap: .35rem; }
.accordion-action { padding: .25rem .55rem; color: var(--hc-blue-dark); background: #fff; border: 1px solid var(--hc-blue); border-radius: .375rem; font-size: .76rem; font-weight: 700; }
.accordion-action:hover, .accordion-action:focus-visible { color: #fff; background: var(--hc-blue); }

details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.accordion-icon { width: .65rem; height: .65rem; flex: 0 0 auto; display: inline-block; margin-left: .65rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .18s ease; }
details[open] > summary .accordion-icon { transform: rotate(225deg) translate(-1px, -1px); }
.accordion-meta { display: inline-flex; align-items: center; flex: 0 0 auto; font-size: .76rem; font-weight: 700; white-space: nowrap; }

.system-section { margin-top: 1.6rem; }
.system-heading { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .7rem .85rem; color: #fff; background: var(--hc-navy); border-radius: .375rem; font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.system-heading:hover, .system-heading:focus-visible { background: #233240; }
.system-panel { padding: 0 .25rem; }
.component-section { margin-top: 1.25rem; }
.component-heading { margin: 0; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .55rem .65rem; color: var(--hc-navy); background: var(--hc-blue-light); border-bottom: 2px solid var(--hc-blue); border-radius: .25rem .25rem 0 0; font-size: 1.12rem; font-weight: 700; line-height: 1.25; }
.component-heading:hover, .component-heading:focus-visible { color: var(--hc-blue-dark); }
.component-panel { padding-top: .7rem; }
.condition-card { margin: 0 0 .7rem; padding: 0; background: #fff; border: 1px solid var(--hc-rule); border-left: 4px solid var(--hc-blue); border-radius: .375rem; box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .075); break-inside: avoid; }
.condition-summary { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem .85rem; }
.condition-summary:hover, .condition-summary:focus-visible { background: var(--hc-surface); }
.condition-summary-text { min-width: 0; display: flex; flex-direction: column; gap: .2rem; }
.condition-title { color: var(--hc-navy); font-size: 1.05rem; font-weight: 700; line-height: 1.28; }
.condition-id { color: #415466; font-family: Consolas, Monaco, monospace; font-size: .76rem; font-weight: 700; }
.condition-details { padding: 0 .85rem .85rem; border-top: 1px solid var(--hc-rule); }
.master-title { margin: 0 0 .7rem; color: #4e5c68; font-size: .86rem; }
.master-title span { color: var(--hc-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .035em; }
.narrative-block { position: relative; margin-top: .65rem; padding: .75rem; background: var(--hc-surface); border: 1px solid var(--hc-rule); border-top: 2px solid #b4bcc2; border-radius: .25rem; }
.narrative-block.primary { border-top-color: var(--hc-blue); }
.narrative-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .42rem; }
.narrative-label { color: var(--hc-navy); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .045em; }
.copy-button { flex: 0 0 auto; padding: .25rem .55rem; color: var(--hc-blue-dark); background: #fff; border: 1px solid var(--hc-blue); border-radius: .375rem; font-size: .76rem; font-weight: 700; }
.copy-button:hover, .copy-button:focus-visible { color: #fff; background: var(--hc-blue); }
.copy-button.copied { color: #17653a; border-color: #5ca579; background: #edf8f1; }
.narrative-text { margin: 0; color: #182532; font-size: 1rem; line-height: 1.62; white-space: pre-wrap; }
.placeholder { padding: .02rem .14rem; background: var(--hc-warning); border-radius: .12rem; }
.condition-meta { display: grid; gap: .3rem; margin-top: .7rem; padding-top: .6rem; border-top: 1px solid var(--hc-rule); color: #4d5d69; font-size: .84rem; }
.condition-meta strong { color: #344450; }
.status-pill { display: inline-block; padding: .15rem .5rem; background: var(--hc-warning); color: #684f00; border: 1px solid #fad7a0; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.editorial-notes:empty::after { content: "None entered"; color: var(--hc-muted); font-style: italic; }
.empty-state { padding: 2.5rem 1rem; text-align: center; border: 1px solid var(--hc-rule); background: var(--hc-surface); }
.empty-state h2 { color: var(--hc-navy); font-size: 1.25rem; }
.back-to-top { position: fixed; z-index: 1000; right: .75rem; bottom: .75rem; width: 42px; height: 42px; color: #fff; background: var(--hc-navy); border: 0; border-radius: 50%; opacity: 0; pointer-events: none; transition: opacity .15s; }
.back-to-top.visible { opacity: .92; pointer-events: auto; }

@media (min-width: 992px) {
  :root { --sticky-offset: 18px; }
  .main-content { width: auto; max-width: 1180px; margin-left: 278px; padding: 1.6rem 2.1rem 5rem; }
  .summary-section { padding-top: 0; }
  .condition-card { padding: 0; }
  .narrative-text { max-width: 86ch; }
}

@media (max-width: 480px) {
  .main-content { padding-inline: .65rem; }
  .guidance { padding: .65rem; }
  .condition-card { padding: 0; }
  .narrative-block { padding: .65rem; }
  .filter-grid { grid-template-columns: 1fr; }
  .results-summary { align-items: flex-start; flex-direction: column; }
  .system-heading { font-size: 1.15rem; }
  .accordion-meta { font-size: .7rem; }
  .condition-summary { padding: .7rem; }
  .condition-details { padding: 0 .7rem .7rem; }
}

@media print {
  @page { margin: .55in; }
  body { color: #000; font-size: 10.5pt; }
  .mobile-header, .mobile-system-nav, .mobile-panel, .panel-backdrop, .desktop-sidebar, .results-summary, .copy-button, .back-to-top, .empty-state { display: none !important; }
  .main-content { width: auto; max-width: none; margin: 0; padding: 0; }
  .summary-section { border-bottom-color: #000; }
  .guidance { background: #fff; border: 1px solid #999; }
  .system-heading { color: #000; background: #fff; border-bottom: 3px solid #000; padding-left: 0; }
  .component-heading { color: #000; border-bottom-color: #555; }
  .condition-card { border: 1px solid #777; border-left: 3px solid #000; page-break-inside: avoid; break-inside: avoid; }
  .narrative-block { background: #fff; border: 1px solid #aaa; }
  .placeholder { background: transparent; padding: 0; }
  .system-section, .component-section { page-break-after: auto; }
  details > summary .accordion-icon, .accordion-actions { display: none !important; }
  details:not([open]) > :not(summary) { display: block !important; }
  .system-panel, .component-panel, .condition-details { display: block !important; }
}
