/* ICD-11 page: code tables by group and the ICD-11 vs DSM-5-TR comparison. Uses the app theme variables. */
.icd-main { max-width: 60rem; }
.icd-jump { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; margin-top: 1rem; font-size: .92rem; }
.icd-jump a { color: var(--accent); }
.icd-section { margin-top: 2.5rem; scroll-margin-top: 5rem; }
.icd-section h2 { margin: 0 0 .9rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line-strong); }
.icd-bullets { margin: 0; padding-left: 1.2rem; line-height: 1.6; }
.icd-bullets li + li { margin-top: .35rem; }
.icd-note, .icd-status { margin: 0 0 .8rem; color: var(--muted); font-size: .9rem; }
.icd-status:empty { display: none; }
.icd-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icd-filter { flex: 1 1 16rem; max-width: 24rem; }
.icd-filter input { width: 100%; padding: .6rem .8rem; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--ink); font: inherit; }
.icd-table-wrap { overflow-x: auto; }
.icd-table { width: 100%; border-collapse: collapse; font-size: .93rem; line-height: 1.45; }
.icd-table th, .icd-table td { padding: .5rem .6rem; border-top: 1px solid var(--line); text-align: left; vertical-align: top; }
.icd-table thead th { border-top: 0; border-bottom: 1px solid var(--line-strong); color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.icd-table td:first-child { width: 6.5rem; font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.icd-compare { min-width: 36rem; }
.icd-compare tbody th { width: 11rem; font-weight: 700; }
.icd-compare td:first-child { width: auto; font-weight: 400; white-space: normal; }
.icd-refs { margin: 0; padding-left: 1.4em; color: var(--muted); font-size: .88rem; line-height: 1.5; }

/* Phones: each comparison row becomes a card with ICD-11 and DSM-5-TR labelled. */
@media (max-width: 40rem) {
  .icd-compare { min-width: 0; }
  .icd-compare thead { display: none; }
  .icd-compare tr, .icd-compare th, .icd-compare td { display: block; width: auto; }
  .icd-compare tr { padding: .4rem 0; border-top: 1px solid var(--line-strong); }
  .icd-compare tbody th, .icd-compare td { padding: .3rem 0; border-top: 0; }
  .icd-compare td::before { display: block; color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
  .icd-compare td:nth-of-type(1)::before { content: "ICD-11"; }
  .icd-compare td:nth-of-type(2)::before { content: "DSM-5-TR"; }
}

/* Disorder pages (public/icd-11/<code>.html) */
.icd-crumbs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; color: var(--muted); font-size: .88rem; }
.icd-crumbs a { color: var(--accent); }
.icd-code-badge { display: inline-block; margin: 0 0 .5rem; padding: .15rem .55rem; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--ink); font-size: .85rem; font-weight: 700; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.icd-section > p { margin: 0 0 .8rem; line-height: 1.6; }
.icd-dx { line-height: 1.6; overflow-wrap: anywhere; }
.icd-dx h3 { margin: 1.6rem 0 .5rem; font-size: 1.1rem; }
.icd-dx h4 { margin: 1.3rem 0 .4rem; font-size: 1rem; }
.icd-dx h5, .icd-dx h6 { margin: 1.1rem 0 .4rem; font-size: .95rem; color: var(--silver); }
.icd-dx p { margin: .5rem 0; }
.icd-dx ul { margin: .4rem 0; padding-left: 1.3rem; }
.icd-dx li { margin: .3rem 0; }
.icd-dx li.icd-marked { list-style: none; margin-left: -.2rem; }
.icd-dx hr { margin: 1.2rem 0; border: 0; border-top: 1px solid var(--line); }
.icd-dx .icd-quote { padding-left: .8rem; border-left: 2px solid var(--line-strong); color: var(--muted); }
.icd-dx .icd-table-wrap { margin: .8rem 0; }
.icd-dx-table { min-width: 40rem; overflow-wrap: normal; }
.icd-dx-table td:first-child { width: auto; min-width: 7rem; font-weight: 400; white-space: normal; }
.icd-sub-list { margin: 0; padding: 0; list-style: none; }
.icd-sub-list > li { padding: .55rem 0; border-top: 1px solid var(--line); }
.icd-sub-code { display: inline-block; min-width: 4.2rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.icd-sub-entry summary { cursor: pointer; }
.icd-sub-entry summary:hover { color: var(--accent); }
.icd-sub-entry[open] summary { margin-bottom: .6rem; }
.icd-sub-entry > p, .icd-sub-entry > .icd-dx { padding-left: 1rem; }
.icd-licence { margin-top: .8rem; color: var(--muted); font-size: .85rem; line-height: 1.5; }
.icd-licence a { color: var(--accent); }

/* Codes tree, arranged like the WHO ICD-11 browser */
.icd-tree-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.icd-tree-button { padding: .55rem .8rem; border: 1px solid var(--line-strong); border-radius: 6px; background: transparent; color: var(--ink); font: inherit; font-size: .88rem; cursor: pointer; }
.icd-tree-button:hover, .icd-tree-button:focus-visible { border-color: var(--accent); color: var(--accent); }
.icd-key { font-weight: 700; }
.icd-key--residual { color: var(--red); }
.icd-key--elsewhere { color: var(--muted); font-weight: 400; font-style: italic; }
.icd-tree, .icd-tree ul { margin: 0; padding: 0; list-style: none; }
.icd-tree ul { padding-left: 1.35rem; }
.icd-tree { font-size: .97rem; line-height: 1.45; }
.icd-node { margin: 0; }
.icd-node > details > summary, .icd-leaf { display: block; padding: .28rem 0 .28rem 1.35rem; text-indent: -1.35rem; }
.icd-leaf { padding-left: 1.35rem; text-indent: 0; }
.icd-node > details > summary { cursor: pointer; list-style: none; }
.icd-node > details > summary::-webkit-details-marker { display: none; }
.icd-node > details > summary::before { content: "\25B7"; display: inline-block; width: 1.35rem; text-indent: 0; color: var(--muted); font-size: .8em; }
.icd-node > details[open] > summary::before { content: "\25BD"; }
.icd-node > details > summary:hover::before { color: var(--accent); }
.icd-top { border-top: 1px solid var(--line); scroll-margin-top: 5rem; }
.icd-top > details > summary, .icd-top.icd-leaf { padding-top: .55rem; padding-bottom: .55rem; font-weight: 600; }
.icd-tree .icd-code { font-weight: 700; font-variant-numeric: tabular-nums; margin-right: .2rem; }
.icd-tree a { color: var(--ink); text-decoration: none; }
.icd-tree a:hover, .icd-tree a:focus-visible { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.icd-residual > .icd-code, .icd-residual > .icd-name, .icd-residual > a,
.icd-residual > details > summary .icd-code, .icd-residual > details > summary .icd-name, .icd-residual > details > summary a { color: var(--red); }
.icd-elsewhere, .icd-elsewhere a, .icd-elsewhere .icd-code { color: var(--muted); }
.icd-elsewhere .icd-code { font-weight: 400; }

/* Links in WHO's text on disorder pages */
.icd-dx a, .icd-section > p a, .icd-bullets a, .icd-sub-list a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; }
.icd-dx a:hover, .icd-section > p a:hover, .icd-bullets a:hover, .icd-sub-list a:hover { text-decoration-color: currentColor; }
.icd-sub-list a { color: var(--ink); }
.icd-sub-list > li { scroll-margin-top: 5rem; }
.icd-dx [id] { scroll-margin-top: 5rem; }
.icd-muted { color: var(--muted); }
.icd-bullets a, .icd-compare a { color: var(--accent); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; }
.icd-compare a:hover { text-decoration-color: currentColor; }

/* Related chapters: one drop-down per chapter */
.icd-chapter > details > summary .icd-name { font-weight: 700; }
#icdRelatedTree > .icd-chapter > details > ul > .icd-node { border-top: 1px solid var(--line); }
