/* Health (admin, read-only): the band, "Needs attention", then each group as a grid of observation cards on washi. */
.health-page main { min-height: 0; }
/* Until the first read settles the attention body and the groups wait unseen at their frame, so they appear once at their size and nothing
   below them is pushed in view. The footer follows the actual content height. */
.js .health-page[data-read="loading"] :is(.h-stage, .h-groups) { visibility: hidden; }
/* The band's three cells always keep their places (the desks' rules that fold empty or unremembered cells do not apply here): while
   reading each shows the wash, and with no observation they stay unseen, so a later file fills them without a jump. */
.health-page .desk-head .ledger, .health-page .desk-head .ledger > div { display: grid !important; }
.health-page[data-read="loading"] .desk-head .ledger dd { color: transparent; min-width: 7em; background: linear-gradient(90deg, #2a1c1214, #2a1c1209) 0 55% / 100% .8em no-repeat; }
.health-page .desk-head .ledger > div.h-idle { visibility: hidden; }
.h-stage { padding: 10px 16px 12px; }
.h-summary { margin: 0; min-height: 21px; font: 13.5px/1.55 var(--sans); color: var(--sumi-2); }
.h-issues { display: grid; gap: 2px; margin: 6px 0 0; padding: 0; list-style: none; }
.h-issues:empty { display: none; }
.h-issues li { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; min-height: 32px; padding: 3px 0; border-top: 1px dotted var(--line); font-size: 12.5px; }
.h-issues a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--sumi); font: 600 13.5px/1.3 var(--serif); text-decoration: none; }
.h-issues a:hover .h-title { text-decoration: underline; text-underline-offset: 3px; }
.h-where { color: var(--muted); font: 600 11.5px/1.4 var(--serif); letter-spacing: .06em; }
.h-issues .h-detail { flex: 1 1 16em; min-width: 0; color: var(--muted); overflow-wrap: anywhere; }
.h-flag { color: var(--shu-dk); font-weight: 500; }
.h-groups > .h-group { margin-top: 12px; }
.h-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; padding: 16px; }
.h-none { margin: 0; padding: 2px 4px; font: 13px/1.6 var(--sans); color: var(--muted); }
/* A card: a slip of paper ruled like a ledger, its state stamped at the corner (seal and word, never colour alone). */
.h-card { display: grid; align-content: start; gap: 9px; min-width: 0; padding: 18px; background: var(--washi-hi); border: 1px solid var(--hair); box-shadow: inset 3px 0 0 var(--hair); }
.h-card[data-state="attention"] { box-shadow: inset 3px 0 0 var(--shu); border-color: #b0381f66; }
.h-card[data-state="unknown"] { box-shadow: inset 3px 0 0 var(--line); }
.h-card:target { outline: 2px solid var(--shu); outline-offset: 2px; }
.h-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.h-card h3 { margin: 0; min-width: 0; font: 600 17px/1.5 var(--serif); letter-spacing: 0; color: var(--sumi); overflow-wrap: anywhere; }
.h-seal { flex: none; display: inline-flex; align-items: center; gap: 6px; font: 600 11.5px/1.3 var(--serif); letter-spacing: .04em; color: var(--sumi-2); white-space: nowrap; }
.h-seal b { display: grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid currentColor; border-radius: 2px; font: 600 12.5px/1 var(--serif); transform: rotate(-4deg); }
.h-seal[data-state="attention"] { color: var(--shu-dk); } .h-seal[data-state="attention"] b { background: var(--shu); border-color: var(--shu); color: var(--on-ink); }
.h-seal[data-state="unknown"] { color: var(--muted); } .h-seal[data-state="unknown"] b { border-style: dashed; }
.h-card .h-detail { margin: 0; font: 14px/1.8 var(--prose); color: var(--sumi-2); overflow-wrap: anywhere; }
.h-meta { margin: 0; font: 12px/1.65 var(--sans); color: var(--muted); }
.h-fields { display: grid; gap: 0; margin: 4px 0 0; }
.h-fields > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: baseline; gap: 4px 12px; padding: 7px 0; border-top: 1px dotted var(--line); min-width: 0; }
.h-fields dt { font: 12px/1.65 var(--sans); letter-spacing: 0; color: var(--muted); }
.h-fields dd { margin: 0 0 0 auto; min-width: 0; font: 500 13px/1.5 var(--numbers); font-variant-numeric: tabular-nums; color: var(--sumi); text-align: right; overflow-wrap: anywhere; }
.h-more > summary, .h-hash > summary { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; color: var(--shu-dk); font: 500 12px/1.3 var(--sans); }
.h-more > .h-fields { margin-top: 0; }
.h-hash { text-align: right; }
.h-hash > summary { color: var(--sumi); }
.h-hash code, .h-full { font: 12px/1.5 var(--numbers); }
.h-show { color: var(--shu-dk); font-size: 11.5px; }
.h-hash[open] .h-show { display: none; }
.h-full { display: block; text-align: left; overflow-wrap: anywhere; word-break: break-all; }
@media (max-width: 560px) {
  /* Phones: the time written takes the band's second row whole, so its words never wrap and the band keeps one height. */
  .health-page .desk-head .ledger > div:nth-child(2) { grid-column: 1 / -1; grid-row: 2; border-top: 1px solid #b0381f2e; box-shadow: none; }
  .health-page .desk-head .ledger > div:nth-child(1) { grid-column: 1; grid-row: 1; }
  .health-page .desk-head .ledger > div:nth-child(3) { grid-column: 2; grid-row: 1; border-top: 0; box-shadow: inset 1px 0 0 #b0381f80, inset 3px 0 0 var(--washi-hi), inset 4px 0 0 #b0381f40; }
  .health-page .desk-head .ledger dd { white-space: nowrap; }
  .h-grid { grid-template-columns: minmax(0, 1fr); padding: 12px 8px; gap: 12px; }
  .h-card { padding: 16px; }
  .h-stage { padding: 8px 12px 10px; }
}
/* Keep labels readable beside long timestamps; expanded hashes get their own line. */
.h-card-head { flex-wrap: wrap; }
.h-card-head h3 { flex: 1 1 12ch; }
.h-lane-detail { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--hair); }
.h-lane-detail .h-card-head h4 { flex: 1 1 12ch; min-width: 0; margin: 0; font: 600 14px/1.5 var(--serif); color: var(--sumi); overflow-wrap: anywhere; }
.h-fields dd { max-width: 100%; }
.h-fields > div:has(.h-hash[open]) dd { grid-column: 1 / -1; width: 100%; }
.h-meta time { font-variant-numeric: tabular-nums; }

/* A completed read with no valid observation must show its reason, not an empty loading frame. */
.health-page[data-read="failed"] .h-attention > .h-stage { display:block !important; }

/* The usability sentence precedes the observation book at either width. */
.health-page .desk-head > :is(.h-summary, .desk-line) { grid-column: 1 / -1; }
.health-page .desk-head > .h-summary { padding: 0 12px; }

/* Keep the state separate from the page description and observation ledger. */
.health-page .desk-head > .h-summary { margin: 4px 12px 12px; padding: 10px 12px; font: 500 16px/1.65 var(--sans); border-left: 2px solid var(--line); }
.health-page .desk-head > .h-summary.h-flag { border-left-color: var(--shu); }
.health-page .desk-head > .desk-line { padding-top: 0; font: 13px/1.65 var(--sans); color: var(--muted); }
.health-operation-links { margin: 12px 0; }
.health-operation-links > summary { min-height: 48px; padding: 8px 16px; display: flex; gap: 10px; align-items: center; cursor: pointer; font: 600 16px/1.5 var(--serif); }
.health-operation-links > summary::before { content: "＋"; color: var(--shu); }
.health-operation-links[open] > summary::before { content: "−"; }
.health-operation-links > p { margin: 8px 16px; font: 13px/1.7 var(--sans); max-width: 65ch; }
.health-operation-links nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 12px 16px 16px; border-top: 1px solid var(--line); }
.health-operation-links a { display: grid; grid-template-columns: 28px minmax(0, 1fr) 12px; align-items: center; gap: 10px; min-height: 72px; padding: 12px 8px; border-bottom: 1px solid var(--line); text-decoration: none; }
.health-operation-links a:nth-child(odd) { border-right: 1px solid var(--line); }
.health-operation-links .desk-seal { grid-row: auto; width: 24px; height: 28px; font-size: 14px; }
.health-operation-links strong { display: block; font: 600 15px/1.5 var(--serif); }
.health-operation-links small { display: block; margin-top: 2px; color: var(--muted); font: 12px/1.6 var(--sans); }
.health-operation-links a:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.health-operation-links .h-route-arrow { color: var(--shu); }
@media(max-width:560px) { .health-operation-links nav { grid-template-columns: minmax(0, 1fr); } .health-operation-links a:nth-child(odd) { border-right: 0; } }

.health-operation-links > summary::before, .health-operation-links[open] > summary::before { position: static; flex: none; width: auto; height: auto; margin: 0; border: 0; transform: none; }

/* A ruled index points to the existing observation books. */
.h-overview { margin: 12px 0; }
.h-overview .window-bar h2 { margin: 0; font: inherit; }
#h-overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 8px 16px; }
.h-index-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto 14px; align-items: center; gap: 10px; min-height: 56px; border-bottom: 1px solid var(--line); padding: 10px 8px; color: var(--sumi); text-decoration: none; }
.h-index-row:nth-child(odd) { border-right: 1px solid var(--line); }
.h-index-row .desk-seal { grid-row: auto; width: 24px; height: 28px; font-size: 14px; }
.h-index-name { font: 600 15px/1.5 var(--serif); }
.h-index-status { font: 12px/1.5 var(--sans); color: var(--muted); }
.h-index-row[data-state="attention"] .h-index-status, .h-index-arrow { color: var(--shu-dk); }
.h-index-row:hover .h-index-name { text-decoration: underline; text-underline-offset: 3px; }
.h-overview-note { margin: 4px 16px 12px; font: 12px/1.65 var(--sans); color: var(--muted); }
.h-price-diagram, .h-funding-diagram { margin: 4px 0; padding-top: 10px; border-top: 1px solid var(--line); }
.h-price-diagram figcaption, .h-funding-diagram figcaption { font: 600 14px/1.6 var(--serif); margin-bottom: 8px; }
.h-observation-rows { margin: 0; }
.h-observation-rows > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; padding: 10px 0; border-bottom: 1px solid var(--hair); }
.h-observation-rows dt { display: flex; align-items: center; gap: 8px; font: 13px/1.5 var(--sans); }
.h-observation-rows dd { margin: 0; text-align: right; min-width: 0; }
.h-observation-rows .desk-seal { grid-row: auto; width: 20px; height: 24px; font-size: 12px; }
.h-observation-rows strong { display: block; font: 500 14px/1.6 var(--numbers); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.h-observation-rows small { display: block; font: 11.5px/1.7 var(--sans); color: var(--muted); }
.h-observation-rows [data-state="attention"] strong { color: var(--shu-dk); }
.h-diagram-note { margin: 8px 0 0; font: 12px/1.7 var(--sans); color: var(--muted); }
.h-weekend-flow { margin: 10px 0 0; padding: 0; list-style: none; }
.h-weekend-flow li { position: relative; padding: 8px 12px; border-left: 2px solid var(--line); margin-top: 14px; background: var(--washi); }
.h-weekend-flow li + li::before { content: "↓"; position: absolute; left: 10px; top: -18px; color: var(--shu); }
.h-weekend-flow strong { display: block; font: 500 13px/1.6 var(--serif); }
.h-weekend-flow small { font: 12px/1.6 var(--sans); color: var(--muted); }
.h-funding-track { position: relative; height: 14px; margin: 18px 0 8px; background: var(--washi-lo); border: 1px solid var(--line); }
.h-funding-fill { display: block; height: 100%; background: var(--muted); }
.h-funding-minimum { position: absolute; top: -5px; bottom: -5px; border-left: 2px solid var(--shu); }
.h-funding-diagram[data-below="true"] .h-funding-fill { background: var(--shu); }
.h-funding-axis { display: flex; justify-content: space-between; font: 11px/1.5 var(--numbers); color: var(--muted); }
@media(max-width:560px) { #h-overview { grid-template-columns: minmax(0, 1fr); padding: 4px 12px; } .h-index-row:nth-child(odd) { border-right: 0; } .h-observation-rows > div { grid-template-columns: minmax(0, 1fr); } .h-observation-rows dd { padding-left: 28px; text-align: left; } }

/* The weekend FX closure: indigo, never vermilion. Context only; the card's attention state, detail and fields are unchanged. */
.health-page .desk-head > .h-weekend { grid-column: 1 / -1; display: flex; gap: 10px; align-items: flex-start; margin: 0 12px 12px; padding: 10px 12px; border-left: 2px solid var(--ai); background: #21365010; font: 14px/1.65 var(--sans); color: var(--sumi-2); overflow-wrap: anywhere; }
.health-page .desk-head > .h-weekend[hidden] { display: none; }
.h-weekend strong { color: var(--ai); font-weight: 600; }
.h-weekend-seal { flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin-top: 2px; background: var(--ai); color: var(--ai-ink); border-radius: 2px; font: 600 12.5px/1 var(--serif); transform: rotate(-4deg); }
.h-weekend-count { display: block; margin-top: 2px; font-weight: 600; color: var(--sumi); } .h-weekend-count > span { white-space: nowrap; }
.health-page .desk-head > .h-summary.h-closed { border-left-color: var(--ai); }
.h-count-closed { font-size: .7em; color: var(--ai); white-space: nowrap; }
.h-seal[data-state="closed"] { color: var(--ai); } .h-seal[data-state="closed"] b { background: var(--ai); border-color: var(--ai); color: var(--ai-ink); }
.h-card[data-closed="weekend"] { box-shadow: inset 3px 0 0 var(--ai); border-color: #21365055; }
.h-index-row[data-state="closed"] .h-index-status, .h-observation-rows [data-state="closed"] strong { color: var(--ai); }
