/* Charts on Home. Cards are the shared .panel; colour carries meaning only, and always with words or a shape. */
.hv{ margin: 0 0 var(--space-4); min-width: 0; }
/* Cards in a row share its height and the last row stretches, so the grid has no holes. */
.hv-grid{ display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: stretch; }
.hv-grid > .hv-card{ flex: 1 1 min(100%, 310px); min-width: 0; }
.panel.hv-card{ display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 14px var(--space-5) var(--space-3); }
.hv-card h3{ margin: 0; font-size: 15px; line-height: 20px; }
.hv-sub{ display: block; margin: 0; font-size: 12.5px; line-height: 17px; color: var(--ink-muted); }
.hv-clip{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hv-msg{ margin: 0; font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.hv-action{ margin: 0; font-size: 13px; line-height: 18px; font-weight: 500; color: var(--ink); }
.hv-go{ margin-top: auto; align-self: flex-start; font-size: 13px; font-weight: 500; }
.hv-skel .skeleton-row{ margin-top: var(--space-3); }

/* Tone: one custom property, read by bars, dots and chips. */
.hv [data-tone="good"]{ --hv-tone: var(--good); --hv-bg: var(--good-bg); }
.hv [data-tone="warn"]{ --hv-tone: var(--warning); --hv-bg: var(--warning-bg); }
.hv [data-tone="bad"]{ --hv-tone: var(--critical); --hv-bg: var(--critical-bg); }
.hv [data-tone="info"]{ --hv-tone: var(--info); --hv-bg: var(--info-bg); }
.hv [data-tone="neutral"], .hv [data-tone="unknown"]{ --hv-tone: var(--edge); --hv-bg: var(--chip); }
.hv [data-tone="s1"]{ --hv-tone: var(--pf-s1); }
.hv [data-tone="s2"]{ --hv-tone: var(--pf-s2); }
.hv [data-tone="s3"]{ --hv-tone: var(--pf-s3); }
.hv [data-tone="s4"]{ --hv-tone: var(--pf-s4); }

/* Chip: a word, a shape and a colour. Circle is fine, triangle needs watching, square needs action, ring is unknown. */
.hv-flag{ flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; border-radius: 999px; background: var(--hv-bg, var(--chip)); color: var(--ink); font-size: 12px; font-weight: 500; line-height: 20px; white-space: nowrap; }
.hv-flag i{ width: 8px; height: 8px; border-radius: 50%; background: var(--hv-tone, var(--edge)); }
.hv-flag[data-tone="warn"] i{ border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.hv-flag[data-tone="bad"] i{ border-radius: 1px; }
.hv-flag[data-tone="unknown"] i{ background: none; border: 2px solid var(--hv-tone); }

.hv-rows, .hv-list, .hv-status, .hv-legend{ list-style: none; margin: 0; padding: 0; }
.hv-rows, .hv-list{ display: flex; flex-direction: column; gap: 5px; }
.hv-line{ display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--space-2); min-width: 0; font-size: 13px; line-height: 20px; }
.hv-label{ flex: 1 1 5em; min-width: 0; overflow-wrap: break-word; color: var(--text); }
.hv-val{ flex: none; margin-left: auto; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }

.hv-rowlink{ display: block; color: inherit; text-decoration: none; border-radius: var(--radius-sm); padding: 0 6px; margin: 0 -6px; }
.hv-rowlink:hover{ background: var(--hover); }
.hv-rowlink:hover .hv-label{ text-decoration: underline; text-underline-offset: 3px; }
.hv-status .hv-rowlink{ flex: 1; display: flex; align-items: center; gap: var(--space-2); }

/* Bars: thin, rounded at the data end, a 2px surface gap between segments. */
.hv-track{ display: flex; gap: 2px; height: 8px; margin: 2px 0; }
.hv-seg{ flex: 0 1 auto; min-width: 3px; background: var(--hv-tone); }
.hv-seg:first-child{ border-radius: 999px 0 0 999px; }
.hv-seg:last-child{ border-radius: 0 4px 4px 0; }
.hv-seg:only-child{ border-radius: 999px 4px 4px 999px; }

/* Limit gauge: the balance against its alert level. */
.hv-gauge{ position: relative; display: block; height: 10px; margin: 3px 0; border-radius: 999px; background: var(--sunken); }
.hv-fill{ display: block; height: 100%; min-width: 4px; border-radius: 999px; background: var(--hv-tone); }
.hv-mark{ position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--ink); box-shadow: 0 0 0 1px var(--surface); }
.hv-unread{ background: repeating-linear-gradient(135deg, var(--sunken) 0 5px, var(--line-2) 5px 7px); }

/* Columns by hour or day. */
.hv-top{ display: block; font-size: 11.5px; line-height: 14px; color: var(--ink-faint); border-bottom: 1px solid var(--line); }
.hv-cols{ display: flex; align-items: stretch; gap: 2px; height: 88px; border-bottom: 1px solid var(--line-2); }
.hv-col{ flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.hv-col:hover{ background: var(--hover); }
.hv-colbar{ flex: none; width: 100%; max-width: 24px; background: var(--hv-tone); }
.hv-colbar:first-child{ border-radius: 4px 4px 0 0; }
.hv-grouped .hv-col{ flex-direction: row; align-items: flex-end; justify-content: center; gap: 2px; padding: 0 3px; }
.hv-grouped .hv-colbar{ flex: 1 1 0; max-width: 18px; border-radius: 4px 4px 0 0; }
.hv-pending{ background: repeating-linear-gradient(135deg, transparent 0 5px, var(--line-2) 5px 6px); }
.hv-ticks{ display: flex; gap: 2px; font-size: 11.5px; line-height: 16px; color: var(--ink-faint); }
.hv-ticks span{ flex: 1 1 0; min-width: 0; white-space: nowrap; }
.hv-grouped + .hv-ticks span{ text-align: center; overflow: hidden; }

.hv-legend{ display: flex; flex-wrap: wrap; gap: 2px var(--space-3); font-size: 12.5px; line-height: 18px; color: var(--ink-muted); }
.hv-legend li{ display: inline-flex; align-items: center; gap: 6px; }
.hv-legend i{ width: 10px; height: 10px; border-radius: 3px; background: var(--hv-tone); }
.hv-legend b{ color: var(--ink); font-weight: 500; }

.hv-status li{ display: flex; align-items: center; gap: var(--space-2); padding: 3px 0; font-size: 13px; line-height: 20px; }
.hv-status li + li{ border-top: 1px solid var(--line); }
.hv-figure{ margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--space-2); color: var(--ink-muted); font-size: 14px; }
.hv-figure b{ font-size: 36px; line-height: 44px; font-weight: 500; color: var(--ink); }

.hv-data summary{ cursor: pointer; font-size: 12.5px; line-height: 24px; color: var(--ink-muted); }
.hv-scroll{ max-height: 180px; overflow: auto; }
.hv-data table{ width: 100%; font-size: 12.5px; }
.hv-data th[scope="row"]{ text-align: left; font-weight: 400; }

@media (max-width: 760px){
  .panel.hv-card{ padding: var(--space-4); }
  .hv-go, .hv-data summary, .hv .link-btn, .hv-list a{ display: inline-flex; align-items: center; min-height: 44px; }
  .hv-rowlink, .hv-status .hv-rowlink{ min-height: 44px; }
}
@media (forced-colors: active){
  .hv-seg, .hv-fill, .hv-colbar, .hv-mark, .hv-flag i, .hv-legend i{ forced-color-adjust: none; }
}
