/* House Health Check (Story 5612). Phone-first, no dead space: the verdict, the filters and the
   run strip are one compact band; everything below is the checks. Pinned chrome -- the shell never
   scrolls, only .hh-body does (100dvh is the load-bearing line). */

:root {
    --hh-ink:    #1e2530;
    --hh-muted:  #667085;
    --hh-line:   #e3e7ee;
    --hh-bg:     #f2f4f8;
    --hh-card:   #ffffff;
    --hh-head:   #1f2a37;
    --hh-ok:     #2f8a4c;
    --hh-watch:  #c58a10;
    --hh-alert:  #c43d3d;
    --hh-info:   #6b7a90;
    --hh-accent: #2a6fb0;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--hh-bg);
    color: var(--hh-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.page-shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
#lwIconBand, .ct-header, .hh-summary, .hh-runs { flex: 0 0 auto; }

.ct-header { display: flex; align-items: center; gap: 8px; background: var(--hh-head); color: #fff; padding: 8px 12px; }
.ct-header h1 { margin: 0; font-size: 16px; font-weight: 800; flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-header button {
    font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
    background: transparent; border: 1px solid rgba(255,255,255,.35); color: #fff;
    border-radius: 999px; padding: 5px 12px; white-space: nowrap;
}
.ct-header .hh-run { background: #fff; color: var(--hh-head); border-color: #fff; }
.ct-header .hh-run:disabled { opacity: .55; cursor: default; }

/* ---- the summary band ----------------------------------------------------------------------- */
.hh-summary {
    display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center;
    background: var(--hh-card); border-bottom: 1px solid var(--hh-line); padding: 8px 12px;
}
.hh-verdict {
    font-weight: 900; font-size: 15px; letter-spacing: .5px; color: #fff;
    border-radius: 10px; padding: 8px 12px; min-width: 76px; text-align: center; background: var(--hh-info);
}
.hh-verdict.v-ok    { background: var(--hh-ok); }
.hh-verdict.v-watch { background: var(--hh-watch); }
.hh-verdict.v-alert { background: var(--hh-alert); }
.hh-verdict.v-running { background: var(--hh-accent); animation: hh-pulse 1.4s ease-in-out infinite; }
@keyframes hh-pulse { 50% { opacity: .65; } }
.hh-meta { min-width: 0; }
.hh-when { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hh-sub  { font-size: 12px; color: var(--hh-muted); line-height: 1.35; }
.hh-sub b { color: var(--hh-ink); }

.hh-chips { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.hh-chip {
    font: inherit; font-size: 12px; font-weight: 700; cursor: pointer;
    border: 1px solid var(--hh-line); background: #fff; color: var(--hh-ink);
    border-radius: 999px; padding: 4px 9px; display: inline-flex; align-items: center; gap: 5px;
}
.hh-chip .d { width: 8px; height: 8px; border-radius: 50%; background: var(--hh-info); }
.hh-chip.c-ok .d    { background: var(--hh-ok); }
.hh-chip.c-watch .d { background: var(--hh-watch); }
.hh-chip.c-alert .d { background: var(--hh-alert); }
.hh-chip.on { background: var(--hh-head); color: #fff; border-color: var(--hh-head); }
.hh-chip.ghost { border-style: dashed; color: var(--hh-muted); }
.hh-chips .sp { flex: 1 1 auto; }

/* ---- the run strip -------------------------------------------------------------------------- */
.hh-runs {
    display: flex; gap: 3px; align-items: flex-end; overflow-x: auto; padding: 6px 12px;
    background: var(--hh-bg); border-bottom: 1px solid var(--hh-line); scrollbar-width: thin; min-height: 34px;
}
.hh-runs:empty { display: none; }
.hh-tick {
    flex: 0 0 auto; width: 14px; height: 22px; border: 0; border-radius: 3px; padding: 0; cursor: pointer;
    background: var(--hh-info); opacity: .55;
}
.hh-tick.t-ok    { background: var(--hh-ok); }
.hh-tick.t-watch { background: var(--hh-watch); }
.hh-tick.t-alert { background: var(--hh-alert); }
.hh-tick.manual  { height: 16px; }
.hh-tick.sel     { opacity: 1; outline: 2px solid var(--hh-head); outline-offset: 1px; }
.hh-runs .lbl { font-size: 11px; color: var(--hh-muted); margin-right: 4px; align-self: center; white-space: nowrap; }

/* ---- the body ------------------------------------------------------------------------------- */
.hh-body { flex: 1 1 auto; overflow-y: auto; padding: 8px 8px 24px; }
.hh-empty { padding: 18px 12px; color: var(--hh-muted); font-size: 14px; }
.hh-err { color: var(--hh-alert); }

.hh-area { background: var(--hh-card); border: 1px solid var(--hh-line); border-left: 4px solid var(--hh-info); border-radius: 12px; margin-bottom: 8px; overflow: hidden; }
.hh-area.w-ok    { border-left-color: var(--hh-ok); }
.hh-area.w-watch { border-left-color: var(--hh-watch); }
.hh-area.w-alert { border-left-color: var(--hh-alert); }
.hh-area-head {
    width: 100%; display: flex; align-items: center; gap: 8px; cursor: pointer;
    font: inherit; text-align: left; background: transparent; border: 0; padding: 9px 10px; color: var(--hh-ink);
}
.hh-area-head .car { width: 14px; color: var(--hh-muted); font-size: 12px; }
.hh-area-head .nm  { font-weight: 800; font-size: 14px; flex: 1 1 auto; }
.hh-area-head .ct  { display: flex; gap: 6px; font-size: 12px; font-weight: 700; color: var(--hh-muted); }
.hh-area-head .ct span { display: inline-flex; align-items: center; gap: 3px; }
.hh-area-head .ct i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.hh-area.closed .hh-area-body { display: none; }
.hh-area-body { border-top: 1px solid var(--hh-line); }

.hh-row { border-bottom: 1px solid var(--hh-line); }
.hh-row:last-child { border-bottom: 0; }
.hh-row-head {
    width: 100%; display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center;
    font: inherit; text-align: left; background: transparent; border: 0; padding: 7px 10px; cursor: pointer; color: var(--hh-ink);
}
.hh-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--hh-info); }
.s-ok    .hh-dot { background: var(--hh-ok); }
.s-watch .hh-dot { background: var(--hh-watch); }
.s-alert .hh-dot { background: var(--hh-alert); }
.s-watch { background: #fffaf0; }
.s-alert { background: #fff5f5; }
.hh-row-main { min-width: 0; }
.hh-name { display: block; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hh-text { display: block; font-size: 12px; color: var(--hh-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hh-row.open .hh-text { white-space: normal; }
.hh-row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.hh-spark { display: block; }
.hh-trend { font-size: 11px; font-weight: 800; white-space: nowrap; color: var(--hh-muted); }
.hh-trend.t-better { color: var(--hh-ok); }
.hh-trend.t-worse  { color: var(--hh-alert); }
.hh-badge { font-size: 10px; font-weight: 800; border-radius: 999px; padding: 1px 6px; background: #eef1f6; color: var(--hh-muted); white-space: nowrap; }
.hh-badge.new { background: #e7f0fb; color: var(--hh-accent); }
.hh-badge.streak { background: #fdf0d8; color: #8a5d00; }
.s-alert .hh-badge.streak { background: #fbe3e3; color: #9b2c2c; }

.hh-detail { display: none; padding: 2px 10px 10px 28px; }
.hh-row.open .hh-detail { display: block; }
.hh-msg { font-size: 13px; line-height: 1.45; border-radius: 8px; padding: 7px 9px; margin: 2px 0 8px; background: #f4f6fa; }
.s-watch .hh-msg { background: #fdf0d8; }
.s-alert .hh-msg { background: #fbe3e3; }
.hh-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 8px; margin: 4px 0 8px; }
.hh-stat { background: #f7f8fb; border-radius: 8px; padding: 5px 7px; min-width: 0; }
.hh-stat .k { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--hh-muted); font-weight: 700; }
.hh-stat .v { font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hh-chart { width: 100%; height: 80px; display: block; margin: 4px 0 0; }
.hh-chart-dates { display: flex; justify-content: space-between; font-size: 11px; color: var(--hh-muted); margin: 1px 0 4px; }
.hh-explain { font-size: 12px; color: var(--hh-muted); line-height: 1.45; margin: 4px 0 6px; }
.hh-hist { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 4px; }
.hh-hist td { padding: 4px 4px; border-top: 1px solid var(--hh-line); vertical-align: top; }
.hh-hist td.st { width: 52px; font-weight: 800; }
.hh-hist td.dt { width: 92px; color: var(--hh-muted); white-space: nowrap; }
.hh-hist .h-ok { color: var(--hh-ok); } .hh-hist .h-watch { color: var(--hh-watch); }
.hh-hist .h-alert { color: var(--hh-alert); } .hh-hist .h-info { color: var(--hh-info); }
.hh-linkbtn {
    font: inherit; font-size: 12px; font-weight: 700; color: var(--hh-accent); background: transparent;
    border: 1px solid var(--hh-line); border-radius: 999px; padding: 4px 10px; cursor: pointer; margin-top: 6px;
}
.hh-flash { animation: hh-flash 1.8s ease-out 1; }
@keyframes hh-flash { 0% { background: #fff3b0; } 100% { background: transparent; } }

@media (min-width: 900px) {
    .hh-body { padding: 10px 16px 24px; }
    .hh-areas { column-count: 2; column-gap: 10px; }
    .hh-area { break-inside: avoid; }
    .hh-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
