/* Hospitalist billing guide — tables of billing codes on the shared library page shell.
   Colours and type come from the site tokens in styles.css, so the light and dark themes follow. */

/* Specialty switch and the PDF button */
.hospitalist-guide .hg-actions {display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin-top: 2rem;}
.hg-switch {display: inline-flex; border: 1px solid var(--border-hairline-2); border-radius: 3px; overflow: hidden;}
.hg-switch a {display: inline-flex; align-items: center; min-height: 48px; padding: .7rem 1.15rem; font-weight: 600; color: var(--text-body); text-decoration: none;}
.hg-switch a + a {border-left: 1px solid var(--border-hairline-2);}
.hg-switch a[aria-current="page"] {background: var(--text-primary); color: var(--bg-page);}
.hg-switch a:not([aria-current]):hover {background: var(--bg-card); color: var(--text-primary);}
/* The switch clips its corners, so the focus ring is drawn inside each half. */
.hospitalist-guide .hg-switch a:focus-visible {outline: 2px solid currentColor; outline-offset: -5px;}

/* Search row, section links, source switch */
.hospitalist-guide .hg-search {grid-template-columns: minmax(0, 1fr) auto;}
.hg-tools {display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .75rem 2rem; margin-top: 1.25rem; font-size: .9rem;}
.hg-jump {display: flex; flex-wrap: wrap; gap: .35rem 1.1rem;}
.hg-jump a {color: var(--text-link); text-decoration: underline; text-underline-offset: .18em;}
.hg-toggle {display: inline-flex; align-items: center; gap: .55rem; color: var(--text-body); cursor: pointer;}
.hg-toggle input {width: 1.05rem; height: 1.05rem; accent-color: var(--text-primary);}
.hospitalist-guide .search-count {margin-bottom: 0;}
/* The count of matching lines means something only once a search is typed. Until then it is kept
   out of sight but in the page, so a screen reader still hears the first count. */
.hospitalist-guide:has(#library-query:placeholder-shown) .search-count {position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;}

/* One section per topic. The site gives every <section> a tall block padding; these are table
   groups, not page bands. A section, a table or the premium block with every row filtered out
   hides itself. */
.hg-section {margin-top: 2.25rem; padding-block: 0; scroll-margin-top: 6rem;}
.hg-section:not(:has([data-search-item]:not([hidden]))),
.hg-table-wrap:not(:has(tbody tr:not([hidden]))),
.hg-block:not(:has(tbody tr:not([hidden]))) {display: none;}
.hg-head {display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem 1.25rem; padding: .6rem .9rem; background: var(--band); border-bottom: 1px solid var(--border-hairline-2);}
.hg-head h2 {margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 1.65rem; line-height: 1.15; letter-spacing: -.01em;}
.hg-head p {margin: 0; font-size: .92rem; color: var(--text-body);}

/* Tables: hairlines only, code first, fee last */
.hg-table-wrap {overflow-x: auto;}
.hg-table {width: 100%; border-collapse: collapse; font-size: .95rem; line-height: 1.45;}
.hg-table thead th {padding: .55rem .9rem; text-align: left; font-size: .7rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); border-bottom: 1px solid var(--border-hairline-2);}
.hg-table tbody th, .hg-table td {padding: .6rem .9rem; vertical-align: top; text-align: left; font-weight: 400; border-bottom: 1px solid var(--border-hairline);}
.hg-table .hg-bill {width: 11.5rem; white-space: nowrap; font-weight: 600; color: var(--text-primary);}
.hg-table .hg-what {width: 34%; color: var(--text-primary);}
/* A table with no note column gives the rest of the row to its second column. */
.hg-table:not(:has(.hg-note)) .hg-what {width: auto;}
.hg-table .hg-note {font-size: .9rem; color: var(--text-body);}
.hg-table .hg-fee {width: 5.5rem; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-primary);}
.hg-grid tbody th {font-weight: 400; color: var(--text-primary);}
.hg-grid td {white-space: nowrap; font-variant-numeric: tabular-nums;}
.hg-code {font-weight: 600; color: var(--text-primary); text-decoration: none;}
a.hg-code:hover, a.hg-code:focus-visible {text-decoration: underline; text-underline-offset: .18em;}

/* Sources stay out of the way until asked for */
.hg-refs {display: none; font-size: .78rem; color: var(--text-muted);}
.hospitalist-guide:has(#hg-pages:checked) .hg-refs {display: inline;}
.hg-refs a {color: var(--text-link); text-decoration: underline; text-underline-offset: .18em;}
/* A browser without :has() cannot run the switch, so it shows the sources and drops the switch. */
@supports not selector(:has(a)) {
  .hg-refs {display: inline;}
  .hg-toggle {display: none;}
}

.hg-notes {margin: .8rem .9rem 0; padding-left: 1.1rem; list-style: disc; font-size: .9rem; color: var(--text-body);}
.hg-notes li {margin-block: .3rem;}
.hg-lead {margin: 1.6rem .9rem .3rem; font-size: .92rem; color: var(--text-body);}
.hg-more {margin: .9rem .9rem 0; font-size: .92rem;}
.hg-more a {color: var(--text-link); text-decoration: underline; text-underline-offset: .18em;}

/* Phones: each row becomes a small block, with the code and its fee on the first line.
   Screen only: a printed page is narrower than this breakpoint and should keep its columns. */
@media screen and (max-width: 760px) {
  .hg-tools {flex-direction: column;}
  .hg-table:not(.hg-grid), .hg-table:not(.hg-grid) tbody {display: block;}
  .hg-table:not(.hg-grid) thead {position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0);}
  .hg-table:not(.hg-grid) tr {display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 1rem; row-gap: .2rem; padding: .7rem .9rem; border-bottom: 1px solid var(--border-hairline);}
  .hg-table:not(.hg-grid) tbody th, .hg-table:not(.hg-grid) td {display: block; width: auto; padding: 0; border: 0;}
  .hg-table:not(.hg-grid) .hg-bill {grid-column: 1; white-space: normal;}
  .hg-table:not(.hg-grid) .hg-fee {grid-column: 2; grid-row: 1;}
  .hg-table:not(.hg-grid) .hg-what, .hg-table:not(.hg-grid) .hg-note {grid-column: 1 / -1; width: auto;}
  .hg-table:not(.hg-grid) td:empty {display: none;}
  .hg-head h2 {font-size: 1.45rem;}
}
@media screen and (max-width: 400px) {
  .hg-switch a {padding-inline: .8rem;}
}

@media print {
  .hospitalist-guide .library-search, .hospitalist-guide .hg-tools, .hospitalist-guide .hg-actions,
  .hospitalist-guide .cta-final {display: none;}
  .hg-table {font-size: .8rem;}
}
