/* Hero Vired Reports — v2 component library.
   Shared building blocks for every page on the v2 tokens (hv_v2_page):
   KPI tiles, cards, segmented controls, presets, filters + chips, tables,
   funnel, progress, badges, skeletons, state cards, menus, popovers,
   footnotes, the Ritzz "explain" note, live indicators and action cards.
   Markup lives in templates/macros/*.html (static parts) or is rendered by
   page JS using these same classes.  Behaviour: static/js/components.js. */

/* ── Layout helpers ───────────────────────────────────────────────────── */
.hv-stack { display: flex; flex-direction: column; gap: 20px; }
.hv-stack--sm { gap: 12px; }
.hv-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hv-grid-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 146px), 1fr)); gap: 12px; }
/* Six tiles: one row on wide screens, then 3 + 3, then 2 per row — never 5 + 1. */
.hv-grid-kpi--6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
@media (max-width: 1279.98px) { .hv-grid-kpi--6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .hv-grid-kpi, .hv-grid-kpi--6 { grid-template-columns: 1fr 1fr; gap: 10px; } }
.hv-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 14px; }
.hv-grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.hv-muted { color: var(--hv-text-muted); }
.hv-faint { color: var(--hv-text-faint); }
.hv-ok { color: var(--hv-ok) !important; }
.hv-warn { color: var(--hv-warn) !important; }
.hv-bad { color: var(--hv-bad) !important; }
.hv-mono { font-family: var(--hv-font-mono); }
.hv-hidden { display: none !important; }

/* ── Card ─────────────────────────────────────────────────────────────── */
.hv-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hv-card--flush { padding: 0; gap: 0; overflow: hidden; }
.hv-card--flush > .hv-card__head { padding: 16px 20px 10px; }
.hv-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.hv-card__titles { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hv-card__title { color: var(--hv-text); font: 600 15px/1.3 var(--hv-font-sans); margin: 0; display: flex; align-items: center; gap: 8px; }
.hv-card__sub { font: 400 12px var(--hv-font-sans); color: var(--hv-text-muted); }
.hv-card__actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hv-card__foot { font: 400 11px/1.5 var(--hv-font-sans); color: var(--hv-text-muted); }
.hv-section-title { color: var(--hv-text); font: 600 15px var(--hv-font-sans); margin: 0; display: flex; align-items: center; gap: 10px; }
.hv-rise-1 { animation: hv-rise .45s var(--hv-ease) .05s both; }
.hv-rise-2 { animation: hv-rise .45s var(--hv-ease) .1s both; }
.hv-rise-3 { animation: hv-rise .45s var(--hv-ease) .15s both; }
.hv-rise-4 { animation: hv-rise .45s var(--hv-ease) .2s both; }

/* ── KPI tile ─────────────────────────────────────────────────────────── */
.hv-kpi {
  position: relative; background: var(--hv-bg-surface); border: 1px solid var(--hv-border); border-radius: var(--hv-radius-lg);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--hv-shadow-xs); min-width: 0;
  animation: hv-rise .45s var(--hv-ease) both; transition: background .6s var(--hv-ease);
}
.hv-kpi:nth-child(2) { animation-delay: .04s; } .hv-kpi:nth-child(3) { animation-delay: .08s; }
.hv-kpi:nth-child(4) { animation-delay: .12s; } .hv-kpi:nth-child(5) { animation-delay: .16s; }
.hv-kpi:nth-child(6) { animation-delay: .2s; } .hv-kpi:nth-child(n+7) { animation-delay: .24s; }
.hv-kpi__top { display: flex; justify-content: space-between; align-items: center; gap: 6px; min-height: 18px; }
.hv-kpi__label { font: 500 12px/1.3 var(--hv-font-sans); color: var(--hv-text-muted); display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.hv-kpi__value { font: 700 30px/1 var(--hv-font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--hv-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hv-kpi__unit { font: 600 14px var(--hv-font-sans); color: var(--hv-text-muted); margin-left: 4px; letter-spacing: 0; }
.hv-kpi__delta { display: flex; align-items: center; gap: 6px; font: 500 12px var(--hv-font-sans); color: var(--hv-text-muted); flex-wrap: wrap; }
.hv-kpi__delta i { font-size: 10px; }
.hv-kpi__delta.is-up { color: var(--hv-ok); }
.hv-kpi__delta.is-down { color: var(--hv-bad); }
.hv-kpi__prev { color: var(--hv-text-faint); font-weight: 400; }
.hv-kpi--na { background: var(--hv-na-bg); border-style: dashed; border-color: var(--hv-na-border); box-shadow: none; }
.hv-kpi--na .hv-kpi__value { color: var(--hv-na); }
.hv-kpi--na .hv-kpi__unit { display: none; }            /* no "%" next to "—" */
.hv-kpi--flash { background: var(--hv-accent-soft); }
.hv-kpi--sm .hv-kpi__value { font-size: 22px; }
.hv-kpi--sm { padding: 12px 14px; gap: 4px; border-radius: 10px; }
.hv-kpi__reason { font: 400 11px var(--hv-font-sans); color: var(--hv-text-muted); display: flex; align-items: center; gap: 5px; }
.hv-spark { width: 56px; height: 18px; flex: none; }
.hv-spark stop:nth-child(1) { stop-color: var(--hv-sweep-1); }
.hv-spark stop:nth-child(2) { stop-color: var(--hv-sweep-3); }
.hv-spark stop:nth-child(3) { stop-color: var(--hv-sweep-5); }
.hv-spark polyline { fill: none; stroke: var(--hv-accent); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 200; stroke-dashoffset: 200; animation: hv-dash 1s var(--hv-ease) .3s forwards; }

/* "Where this comes from" — lineage ⓘ + popover */
.hv-info {
  width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--hv-border); background: none; color: var(--hv-text-faint);
  cursor: pointer; display: inline-grid; place-items: center; padding: 0; flex: none;
}
.hv-info i { font-size: 8px; }
.hv-info:hover, .hv-info[aria-expanded="true"] { color: var(--hv-accent-text); border-color: var(--hv-accent); }
.hv-popover {
  position: absolute; left: 8px; right: 8px; top: calc(100% - 6px); z-index: 20; background: var(--hv-bg-surface);
  border: 1px solid var(--hv-border); border-radius: 10px; box-shadow: var(--hv-shadow-lg); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px; font: 400 11px/1.5 var(--hv-font-sans); color: var(--hv-text-2);
  animation: hv-scale-in .18s var(--hv-ease) both; transform-origin: top;
}
.hv-popover[hidden] { display: none; }
.hv-popover__title { font: 600 10px var(--hv-font-sans); letter-spacing: .08em; color: var(--hv-text-faint); text-transform: uppercase; }
.hv-popover code, .hv-code { font: 500 10px var(--hv-font-mono); background: var(--hv-bg-sunken); padding: 1px 5px; border-radius: 4px; color: var(--hv-text-2); }

/* ── Segmented control + presets ──────────────────────────────────────── */
.hv-seg { display: inline-flex; border: 1px solid var(--hv-border); border-radius: 6px; overflow: hidden; font: 500 11px var(--hv-font-sans); background: var(--hv-bg-surface); }
.hv-seg__btn { padding: 6px 10px; border: 0; background: none; color: var(--hv-text-muted); cursor: pointer; min-width: 40px; font: inherit; }
@media (pointer: coarse), (max-width: 767.98px) { .hv-seg__btn { min-height: 40px; } }   /* touch target */
.hv-seg__btn + .hv-seg__btn { border-left: 1px solid var(--hv-border); }
.hv-seg__btn:hover { background: var(--hv-bg-surface-2); }
.hv-seg__btn[aria-pressed="true"] { background: var(--hv-accent-soft); color: var(--hv-accent-text); font-weight: 600; }
.hv-seg--lg { border-radius: 8px; font-size: 12px; }
.hv-seg--lg .hv-seg__btn { height: 38px; padding: 0 12px; }

.hv-presets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; font: 500 12px var(--hv-font-sans); }
.hv-preset {
  height: 40px; border-radius: 8px; border: 1px solid var(--hv-border); background: var(--hv-bg-surface); color: var(--hv-text-2);
  font: inherit; cursor: pointer; white-space: nowrap; padding: 0 10px; transition: all .15s var(--hv-ease);
}
.hv-preset:hover { border-color: var(--hv-border-strong); }
.hv-preset[aria-pressed="true"] { background: var(--hv-accent-soft); border-color: var(--hv-accent); color: var(--hv-accent-text); font-weight: 600; }
@media (max-width: 575.98px) { .hv-presets { grid-template-columns: 1fr 1fr; } }
/* ui.month_presets: Current month / Last month (+ extras) — sized to their labels */
.hv-presets--months { display: inline-flex; flex-wrap: wrap; align-items: center; }
.hv-presets--months .hv-preset { height: 36px; padding: 0 14px; }
@media (max-width: 575.98px) {
  .hv-presets--months { display: flex; } .hv-presets--months .hv-preset { flex: 1 1 auto; }
  .hv-page-head__actions > .hv-presets--months { order: 1; flex: 1 1 100%; }   /* own row under the other actions */
}
.hv-preset:disabled { opacity: .55; cursor: not-allowed; }

/* ── Form controls ────────────────────────────────────────────────────── */
.hv-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hv-label { font: 600 11px var(--hv-font-sans); letter-spacing: .05em; color: var(--hv-text-muted); text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.hv-label .hv-kbd { text-transform: none; }
.hv-select, .hv-input {
  height: 40px; border-radius: 8px; border: 1px solid var(--hv-border); background: var(--hv-bg-page); color: var(--hv-text);
  font: 400 13px var(--hv-font-sans); padding: 0 12px; min-width: 0; width: 100%; box-sizing: border-box;
}
.hv-select { appearance: none; -webkit-appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%238A8FA0' stroke-width='1.5' d='M1 1l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.hv-select:hover, .hv-input:hover { border-color: var(--hv-border-strong); }
.hv-select:focus, .hv-input:focus { outline: none; border-color: var(--hv-accent); box-shadow: var(--hv-focus); }
.hv-field__hint { font: 400 11px var(--hv-font-sans); color: var(--hv-text-faint); }
.hv-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.hv-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.hv-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 12px; border-radius: var(--hv-radius-pill);
  background: var(--hv-accent-soft); color: var(--hv-accent-text); font: 600 12px var(--hv-font-sans); white-space: nowrap;
}
.hv-chip__x { width: 20px; height: 20px; border-radius: 50%; border: 0; background: none; color: inherit; cursor: pointer; display: grid; place-items: center; }
.hv-chip__x:hover { background: rgba(0,0,0,.06); }

/* Month stepper: ‹ Sep-26 › */
.hv-stepper {
  display: inline-flex; align-items: center; border: 1px solid var(--hv-border); border-radius: 8px; background: var(--hv-bg-surface);
  overflow: hidden; font: 600 13px var(--hv-font-sans); height: 40px; white-space: nowrap; flex: none;
}
.hv-stepper__btn { width: 40px; height: 40px; border: 0; background: none; color: var(--hv-text-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none !important; }
a.hv-stepper__btn:focus-visible { outline: none; box-shadow: var(--hv-focus); }
.hv-stepper__btn:hover { background: var(--hv-bg-surface-2); }
.hv-stepper__btn[disabled] { opacity: .35; cursor: not-allowed; background: none; }
.hv-stepper__btn i { font-size: 10px; }
.hv-stepper__label { padding: 0 8px; min-width: 58px; text-align: center; color: var(--hv-text); }

/* ── Progress / band badges ───────────────────────────────────────────── */
.hv-bar { height: 6px; border-radius: 3px; background: var(--hv-bg-sunken); overflow: hidden; }
.hv-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--hv-sweep-1), var(--hv-sweep-2), var(--hv-sweep-3)); transform-origin: left; animation: hv-grow-x .7s var(--hv-ease) .2s both; }
.hv-bar > span.is-ok { background: var(--hv-ok); } .hv-bar > span.is-warn { background: var(--hv-warn); } .hv-bar > span.is-bad { background: var(--hv-bad); }
.hv-band { display: inline-flex; align-items: center; gap: 4px; font: 600 10px var(--hv-font-sans); border-radius: var(--hv-radius-pill); padding: 3px 8px; white-space: nowrap; }
.hv-band--ok { color: var(--hv-ok); background: var(--hv-ok-bg); }
.hv-band--warn { color: var(--hv-warn); background: var(--hv-warn-bg); }
.hv-band--bad { color: var(--hv-bad); background: var(--hv-bad-bg); }
.hv-band--na { color: var(--hv-na); background: var(--hv-bg-sunken); }
.hv-person { display: flex; flex-direction: column; gap: 6px; }
.hv-person__row { display: flex; align-items: center; gap: 10px; }
.hv-person__name { font: 600 13px var(--hv-font-sans); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hv-person__pct { font: 700 15px var(--hv-font-sans); font-variant-numeric: tabular-nums; }
.hv-person__sub { font: 400 11px var(--hv-font-sans); color: var(--hv-text-muted); }

/* ── Funnel ───────────────────────────────────────────────────────────── */
.hv-funnel { display: flex; flex-direction: column; gap: 8px; font-variant-numeric: tabular-nums; }
.hv-funnel__row { display: grid; grid-template-columns: minmax(84px, 130px) 1fr 52px; align-items: center; gap: 8px; font: 500 12px var(--hv-font-sans); }
.hv-funnel__label { display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--hv-text-2); }
.hv-funnel__label i { font-size: 10px; color: var(--hv-bad); }
.hv-funnel__bar {
  height: 22px; border-radius: 4px; min-width: 44px; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px;
  font-weight: 600; box-sizing: border-box; transform-origin: left; animation: hv-grow-x .7s var(--hv-ease) both; color: #fff;
}
/* Each stage its own gradient; the value sits on the light tip, so it is set in ink. */
.hv-funnel__bar { color: var(--hv-viz-ink); }
.hv-funnel__row:nth-child(1) .hv-funnel__bar { background: linear-gradient(90deg, var(--hv-grad-1-a), var(--hv-grad-1-b)); }
.hv-funnel__row:nth-child(2) .hv-funnel__bar { background: linear-gradient(90deg, var(--hv-grad-3-a), var(--hv-grad-3-b)); animation-delay: .06s; }
.hv-funnel__row:nth-child(3) .hv-funnel__bar { background: linear-gradient(90deg, var(--hv-grad-2-a), var(--hv-grad-2-b)); animation-delay: .12s; }
.hv-funnel__row:nth-child(4) .hv-funnel__bar { background: linear-gradient(90deg, var(--hv-grad-4-a), var(--hv-grad-4-b)); animation-delay: .18s; }
.hv-funnel__row:nth-child(5) .hv-funnel__bar { background: linear-gradient(90deg, var(--hv-grad-7-a), var(--hv-grad-7-b)); animation-delay: .24s; }
.hv-funnel__row:nth-child(6) .hv-funnel__bar { background: linear-gradient(90deg, var(--hv-grad-5-a), var(--hv-grad-5-b)); animation-delay: .3s; }
.hv-funnel__conv { text-align: right; }

/* ── Chart gradients for HTML / SVG bars: hvViz.cls(slot) → .hv-vizbg-N ──── */
.hv-vizbg-0 { background: linear-gradient(90deg, var(--hv-grad-0-a), var(--hv-grad-0-b)); }
.hv-vizbg-1 { background: linear-gradient(90deg, var(--hv-grad-1-a), var(--hv-grad-1-b)); }
.hv-vizbg-2 { background: linear-gradient(90deg, var(--hv-grad-2-a), var(--hv-grad-2-b)); }
.hv-vizbg-3 { background: linear-gradient(90deg, var(--hv-grad-3-a), var(--hv-grad-3-b)); }
.hv-vizbg-4 { background: linear-gradient(90deg, var(--hv-grad-4-a), var(--hv-grad-4-b)); }
.hv-vizbg-5 { background: linear-gradient(90deg, var(--hv-grad-5-a), var(--hv-grad-5-b)); }
.hv-vizbg-6 { background: linear-gradient(90deg, var(--hv-grad-6-a), var(--hv-grad-6-b)); }
.hv-vizbg-7 { background: linear-gradient(90deg, var(--hv-grad-7-a), var(--hv-grad-7-b)); }
.hv-vizbg-8 { background: linear-gradient(90deg, var(--hv-grad-8-a), var(--hv-grad-8-b)); }
.hv-vizbg-9 { background: linear-gradient(90deg, var(--hv-grad-9-a), var(--hv-grad-9-b)); }
.hv-vizbg-10 { background: linear-gradient(90deg, var(--hv-grad-10-a), var(--hv-grad-10-b)); }
.hv-vizbg-sweep { background: linear-gradient(90deg, var(--hv-sweep-1), var(--hv-sweep-2), var(--hv-sweep-3), var(--hv-sweep-4), var(--hv-sweep-5)); }

/* ── Tables ───────────────────────────────────────────────────────────── */
/* position: relative so absolutely placed children (.hv-sr-only link hints) stay inside the scroll box
   instead of widening the page on phones. */
.hv-table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.hv-table { width: 100%; border-collapse: separate; border-spacing: 0; font: 400 13px var(--hv-font-sans); font-variant-numeric: tabular-nums; color: var(--hv-text); }
.hv-table th {
  background: var(--hv-bg-surface-2); font: 600 11px var(--hv-font-sans); letter-spacing: .05em; color: var(--hv-text-muted);
  text-transform: uppercase; padding: 9px 12px; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--hv-border);
}
.hv-table td { padding: 10px 12px; border-top: 1px solid var(--hv-border); vertical-align: middle; }
.hv-table tbody tr:first-child td { border-top: 0; }
.hv-table th:first-child, .hv-table td:first-child { padding-left: 20px; }
.hv-table th:last-child, .hv-table td:last-child { padding-right: 20px; }
.hv-table .num { text-align: center; }

/* Portal rule (requester, 2026-10-12): every value in every table — any dashboard, any table
   class, cells built by JS with inline styles, and tables added later — is centred
   horizontally and vertically.  !important on purpose: page styles must not undo it.
   Content laid out with flex/grid inside a cell (bar + value, chips, buttons) is centred by
   the rules in each page's stylesheet ("centre in table cells"). */
table th, table td { text-align: center !important; vertical-align: middle !important; }
.hv-table tbody tr:hover td { background: var(--hv-bg-surface-2); }
.hv-table--sticky th:first-child, .hv-table--sticky td:first-child { position: sticky; left: 0; z-index: 1; background: var(--hv-bg-surface); }
.hv-table--sticky th:first-child { background: var(--hv-bg-surface-2); z-index: 2; }
.hv-table--sticky tbody tr:hover td:first-child { background: var(--hv-bg-surface-2); }
/* Totals row: the warn tint over an opaque surface, so a sticky totals row (or sticky
   first cell) never lets rows show through in dark mode, where the tint is translucent. */
.hv-table tr.is-total td, .hv-table tfoot td { background: linear-gradient(var(--hv-warn-bg), var(--hv-warn-bg)), var(--hv-bg-surface) !important; color: var(--hv-warn); font-weight: 600; border-top: 1px solid var(--hv-border); }
.hv-table tr.is-sep td { background: var(--hv-accent-soft) !important; color: var(--hv-accent-text); font: 600 11px var(--hv-font-sans); letter-spacing: .05em; text-transform: uppercase; padding-top: 7px; padding-bottom: 7px; }
.hv-table td.is-na { background: var(--hv-na-bg); color: var(--hv-na); text-align: center; }
.hv-table th[data-sort] { cursor: pointer; user-select: none; }
.hv-table th[data-sort]::after { content: '\f0dc'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: 9px; margin-left: 6px; color: var(--hv-text-faint); }
.hv-table th[aria-sort="ascending"]::after { content: '\f0de'; color: var(--hv-accent); }
.hv-table th[aria-sort="descending"]::after { content: '\f0dd'; color: var(--hv-accent); }
.hv-table-hint { display: none; font: 400 11px var(--hv-font-sans); color: var(--hv-text-faint); padding: 8px 20px; }
@media (max-width: 767.98px) { .hv-table-hint { display: block; } }

/* ── Skeletons ────────────────────────────────────────────────────────── */
.hv-skel {
  border-radius: var(--hv-radius-lg); border: 1px solid var(--hv-border);
  background: linear-gradient(90deg, var(--hv-bg-surface) 25%, var(--hv-bg-surface-2) 50%, var(--hv-bg-surface) 75%);
  background-size: 800px 100%; animation: hv-shimmer 1.3s linear infinite;
}
.hv-skel--kpi { height: 104px; }
.hv-skel--block { height: 260px; }
.hv-skel--line { height: 12px; border-radius: 6px; border: 0; }
.hv-skel-note { font: 500 12px var(--hv-font-sans); color: var(--hv-text-muted); text-align: center; }

/* ── Inline state cards (inside content: error / empty / partial / locked) */
.hv-statecard {
  display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; border-radius: var(--hv-radius-lg);
  background: var(--hv-bg-surface); border: 1px solid var(--hv-border); box-shadow: var(--hv-shadow-xs);
  animation: hv-scale-in .25s var(--hv-ease) both;
}
.hv-statecard__icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 16px; background: var(--hv-bg-sunken); color: var(--hv-text-muted); }
.hv-statecard--error { border-color: color-mix(in srgb, var(--hv-bad) 35%, var(--hv-border)); }
.hv-statecard--error .hv-statecard__icon { background: var(--hv-bad-bg); color: var(--hv-bad); }
.hv-statecard--warn .hv-statecard__icon { background: var(--hv-warn-bg); color: var(--hv-warn); }
.hv-statecard--ok .hv-statecard__icon { background: var(--hv-ok-bg); color: var(--hv-ok); }
.hv-statecard--info .hv-statecard__icon { background: var(--hv-info-bg); color: var(--hv-info); }
.hv-statecard__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.hv-statecard__title { font: 600 14px var(--hv-font-sans); color: var(--hv-text); margin: 0; }
.hv-statecard__text { font: 400 13px/1.5 var(--hv-font-sans); color: var(--hv-text-2); margin: 0; }
.hv-statecard__meta { font: 400 11px var(--hv-font-sans); color: var(--hv-text-muted); }
.hv-statecard__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.hv-inline-ok { display: flex; align-items: center; gap: 10px; color: var(--hv-ok); font: 500 13px var(--hv-font-sans); }

/* ── Menus (export etc.) ──────────────────────────────────────────────── */
.hv-menu-wrap { position: relative; display: inline-flex; }
.hv-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; min-width: 240px; background: var(--hv-bg-surface);
  border: 1px solid var(--hv-border); border-radius: 10px; box-shadow: var(--hv-shadow-lg); padding: 6px;
  display: flex; flex-direction: column; gap: 2px; animation: hv-scale-in .18s var(--hv-ease) both; transform-origin: top right;
}
.hv-menu[hidden] { display: none; }
.hv-menu__scope { font: 600 10px var(--hv-font-sans); letter-spacing: .08em; color: var(--hv-text-faint); padding: 6px 10px; text-transform: uppercase; }
.hv-menu__item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; border-radius: 7px; background: none; color: var(--hv-text);
  font: 500 13px var(--hv-font-sans); cursor: pointer; text-align: left; min-height: 40px; width: 100%;
}
.hv-menu__item:hover, .hv-menu__item:focus-visible { background: var(--hv-bg-surface-2); }
.hv-menu__item i { width: 16px; text-align: center; color: var(--hv-accent); }
.hv-menu__item small { margin-left: auto; color: var(--hv-text-faint); font-size: 11px; }
.hv-menu__item[disabled] { opacity: .5; cursor: not-allowed; }

/* ── Ritzz "explain this chart" note + insight card ───────────────────── */
.hv-explain {
  display: flex; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--hv-accent-soft); color: var(--hv-text-2);
  font: 400 12px/1.5 var(--hv-font-sans); animation: hv-scale-in .2s var(--hv-ease) both; transform-origin: top;
}
.hv-explain > i { color: var(--hv-accent-text); margin-top: 2px; }
.hv-explain strong { color: var(--hv-accent-text); }
.hv-explain__x { margin-left: auto; border: 0; background: none; color: var(--hv-text-muted); cursor: pointer; align-self: flex-start; }
.hv-insight { position: relative; overflow: hidden; }
.hv-insight::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--hv-gradient-brand); }
.hv-insight__icon { width: 28px; height: 28px; border-radius: 8px; background: var(--hv-gradient-brand); color: #fff; display: grid; place-items: center; font-size: 12px; flex: none; }
.hv-chipbtn {
  height: 28px; padding: 0 9px; border-radius: 6px; border: 1px solid var(--hv-border); background: var(--hv-bg-page);
  color: var(--hv-accent-text); font: 600 11px var(--hv-font-sans); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.hv-chipbtn:hover { border-color: var(--hv-accent); }
.hv-chipbtn[aria-pressed="true"] { background: var(--hv-accent-soft); border-color: var(--hv-accent); }

/* ── Live indicators ──────────────────────────────────────────────────── */
.hv-live { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--hv-radius-pill); font: 600 10px var(--hv-font-sans); letter-spacing: .04em; background: var(--hv-ok-bg); color: var(--hv-ok); }
.hv-live__dot, .hv-livedot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; animation: hv-pulse 2s var(--hv-ease) infinite; }
.hv-livedot { color: var(--hv-ok); }
.hv-live.is-paused { background: var(--hv-bg-sunken); color: var(--hv-text-muted); }
.hv-live.is-paused .hv-live__dot { animation: none; }
.hv-live.is-warn { background: var(--hv-warn-bg); color: var(--hv-warn); }
.hv-live.is-bad { background: var(--hv-bad-bg); color: var(--hv-bad); }
.hv-delta-chip {
  position: absolute; top: 10px; right: 10px; padding: 1px 7px; border-radius: var(--hv-radius-pill); background: var(--hv-ok-bg); color: var(--hv-ok);
  font: 600 11px var(--hv-font-sans); animation: hv-slide-up .3s var(--hv-ease) both; transition: opacity .4s var(--hv-ease);
}

/* ── Needs-attention action cards ─────────────────────────────────────── */
.hv-action {
  position: relative; background: var(--hv-bg-surface); border: 1px solid var(--hv-border); border-radius: var(--hv-radius-lg);
  padding: 14px 16px 14px 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--hv-shadow-xs);
  animation: hv-rise .4s var(--hv-ease) both; transition: opacity .3s var(--hv-ease);
}
.hv-action::before { content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--hv-info); }
.hv-action[data-sev="HIGH"]::before { background: var(--hv-bad); }
.hv-action[data-sev="MEDIUM"]::before { background: var(--hv-warn); }
.hv-action.is-acked { opacity: .75; }
.hv-action__top { display: flex; align-items: center; gap: 8px; }
.hv-action__rule { font: 400 11px var(--hv-font-mono); color: var(--hv-text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hv-action__age { margin-left: auto; font: 500 11px var(--hv-font-sans); color: var(--hv-text-faint); white-space: nowrap; }
.hv-action__age.is-warn { color: var(--hv-warn); } .hv-action__age.is-bad { color: var(--hv-bad); }
.hv-action__text { font: 500 13px/1.45 var(--hv-font-sans); color: var(--hv-text); margin: 0; }
.hv-action__meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font: 500 11px var(--hv-font-sans); color: var(--hv-text-muted); }
.hv-action__owner { display: inline-flex; align-items: center; gap: 6px; }
.hv-action__ini { width: 20px; height: 20px; border-radius: 50%; background: var(--hv-accent-soft); color: var(--hv-accent-text); display: grid; place-items: center; font: 600 9px var(--hv-font-sans); }
.hv-action__status { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--hv-radius-pill); border: 1px solid var(--hv-border); font: 600 10px var(--hv-font-sans); color: var(--hv-text-muted); }
.hv-action__btns { display: flex; gap: 6px; flex-wrap: wrap; }
.hv-action__btns .hv-btn { height: 34px; padding: 0 12px; font-size: 12px; }
[data-hv-actions] > .hv-card__head, #csActions > .hv-card__head { align-items: baseline; }
.hv-actions-ok { padding: 16px 18px; }
/* Daily digest popover on the strip header (static/js/actions.js) */
.hv-digest { width: 300px; padding: 8px; gap: 4px; }
.hv-digest__row { display: flex; align-items: flex-start; gap: 10px; padding: 8px; border-radius: 6px; font: 400 12px var(--hv-font-sans); color: var(--hv-text); cursor: pointer; }
.hv-digest__row:hover { background: var(--hv-bg-surface-2); }
.hv-digest__row input { margin-top: 2px; accent-color: var(--hv-accent); }
.hv-digest__row i { width: 14px; color: var(--hv-accent); margin-top: 2px; }
.hv-digest__row span { display: flex; flex-direction: column; gap: 2px; }
.hv-digest__row small { color: var(--hv-text-muted); font-size: 11px; line-height: 1.4; }
.hv-digest__row.is-off { cursor: default; opacity: .75; }
.hv-digest__to { height: auto; min-height: 52px; padding: 8px 10px; margin: 0 8px 6px 32px; width: calc(100% - 40px); font-size: 12px; resize: vertical; }
.hv-digest__actions { display: flex; justify-content: flex-end; padding: 6px 8px 4px; }
.hv-digest__note { font: 400 11px var(--hv-font-sans); color: var(--hv-text-muted); margin: 6px 8px; }
.hv-btn--ghost { background: var(--hv-bg-page); }
.hv-btn--okline { background: var(--hv-bg-page); color: var(--hv-ok) !important; }
.hv-btn--okline:hover { border-color: var(--hv-ok); }

/* ── Footnotes / caveats ──────────────────────────────────────────────── */
.hv-fn { font: 600 9px var(--hv-font-sans); color: var(--hv-info); vertical-align: super; margin-left: 2px; cursor: help; }
.hv-footnotes { display: flex; flex-direction: column; gap: 4px; font: 400 11px/1.5 var(--hv-font-sans); color: var(--hv-text-muted); margin: 0; padding: 0; list-style: none; }
.hv-footnotes li { display: flex; gap: 6px; }
.hv-footnotes sup { color: var(--hv-info); font-weight: 600; }
.hv-warn-mark { color: var(--hv-warn); font-size: 10px; margin-left: 4px; cursor: help; }

/* ── Chart containers (fixed heights; legends outside scroll areas) ───── */
.hv-chart { position: relative; height: 260px; min-width: 0; }
.hv-chart--sm { height: 220px; }
.hv-chart--lg { height: 320px; }
.hv-chart canvas { max-width: 100%; }
.hv-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font: 500 11px var(--hv-font-sans); color: var(--hv-text-muted); }
.hv-legend__item { display: inline-flex; align-items: center; gap: 6px; }
.hv-legend__sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
@media (max-width: 767.98px) {
  .hv-chart, .hv-chart--lg { height: 220px; }
}

/* ── Saved views ──────────────────────────────────────────────────────── */
.hv-views { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hv-views__spacer { flex: 1; }
.hv-views__name { width: 190px; height: 34px; border-color: var(--hv-accent); box-shadow: var(--hv-focus); }
.hv-viewchip {
  display: inline-flex; align-items: center; border: 1px solid var(--hv-accent); border-radius: var(--hv-radius-pill);
  background: var(--hv-accent-soft); overflow: hidden; animation: hv-scale-in .2s var(--hv-ease) both;
}
.hv-viewchip a { height: 32px; padding: 0 6px 0 12px; display: inline-flex; align-items: center; gap: 6px; color: var(--hv-accent-text) !important; font: 600 12px var(--hv-font-sans); text-decoration: none !important; }
.hv-viewchip a i { font-size: 9px; }
.hv-viewchip button { height: 32px; width: 28px; border: 0; background: none; color: var(--hv-text-faint); cursor: pointer; }
.hv-viewchip button:hover { color: var(--hv-bad); }

/* ── Keyboard hint shown inside labels (`/` focuses the first filter) ─── */
.hv-label .hv-kbd { font-size: 9px; padding: 0 4px; }

/* ── Design v1.6: Copy link, Compare, drill-through, chart notes ──────── */
.hv-menu__item--sep { border-top: 1px solid var(--hv-border); margin-top: 4px; padding-top: 10px; }
.hv-menu__item--sep i { color: var(--hv-text-muted); }

/* Compare: the prior period under a KPI (components.js hvCompare) */
.hv-compare[aria-pressed="true"] { border-color: var(--hv-accent); background: var(--hv-accent-soft); color: var(--hv-accent-text); }
.hv-kpi__cmp { display: flex; align-items: center; gap: 6px; font: 500 11px var(--hv-font-sans); color: var(--hv-text-muted); animation: hv-fade .25s var(--hv-ease) both; }
.hv-kpi__cmp-tag { font: 600 10px var(--hv-font-sans); color: var(--hv-accent-text); background: var(--hv-accent-soft); border-radius: 4px; padding: 1px 5px; }

/* A KPI whose value opens the drill-through drawer */
.hv-kpi.is-drillable .hv-kpi__value [id$="-value"], .hv-kpi.is-drillable .hv-kpi__value { cursor: pointer; }
.hv-kpi.is-drillable .hv-kpi__value:hover { color: var(--hv-accent-text); }
.hv-kpi.is-drillable .hv-kpi__value:focus-visible { outline: none; box-shadow: var(--hv-focus); border-radius: 6px; }
.hv-kpi [id$="-value"] { display: inline-block; animation: hv-rise .5s var(--hv-ease) both; }   /* KPI value roll-in */

.hv-drill { position: fixed; inset: 0; z-index: 85; }
.hv-drill[hidden] { display: none; }
.hv-drill__overlay { position: absolute; inset: 0; background: var(--hv-bg-overlay); animation: hv-fade .2s var(--hv-ease) both; }
.hv-drill__panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(100%, 440px); box-sizing: border-box;
  background: var(--hv-bg-surface); border-left: 1px solid var(--hv-border); box-shadow: var(--hv-shadow-lg);
  display: flex; flex-direction: column; animation: hv-slide-in-right .28s var(--hv-ease) both;
}
.hv-drill__head { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--hv-border); }
.hv-drill__icon { width: 36px; height: 36px; border-radius: 10px; background: var(--hv-accent-soft); color: var(--hv-accent-text); display: grid; place-items: center; flex: none; }
.hv-drill__titles { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.hv-drill__title { margin: 0; font: 700 15px var(--hv-font-display); color: var(--hv-text); }
.hv-drill__sub { font: 400 12px var(--hv-font-sans); color: var(--hv-text-muted); }
.hv-drill__close { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--hv-border); background: none; color: var(--hv-text-muted); cursor: pointer; flex: none; }
.hv-drill__close:hover { color: var(--hv-text); border-color: var(--hv-border-strong); }
.hv-drill__body { padding: 16px 18px 24px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.hv-drill__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.hv-drill__stat { padding: 10px 12px; border-radius: 10px; background: var(--hv-bg-page); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hv-drill__stat span { font: 500 11px var(--hv-font-sans); color: var(--hv-text-muted); }
.hv-drill__stat strong { font: 700 18px/1.1 var(--hv-font-display); color: var(--hv-text); overflow-wrap: anywhere; }
.hv-drill__list { border: 1px solid var(--hv-border); border-radius: 10px; overflow: hidden; }
.hv-drill__listhead { padding: 8px 12px; background: var(--hv-bg-surface-2); font: 600 10px var(--hv-font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--hv-text-muted); }
.hv-drill__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--hv-border); font: 400 13px var(--hv-font-sans); font-variant-numeric: tabular-nums; }
.hv-drill__row:first-child { border-top: 0; }
.hv-drill__rowtext { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.hv-drill__rowtext span { font-weight: 500; color: var(--hv-text); overflow-wrap: anywhere; }
.hv-drill__rowtext small { font: 400 11px var(--hv-font-sans); color: var(--hv-text-muted); }
.hv-drill__val { font-weight: 600; color: var(--hv-text); white-space: nowrap; }
.hv-drill__val.is-ok { color: var(--hv-ok); }
.hv-drill__val.is-bad { color: var(--hv-bad); }
.hv-drill__empty, .hv-drill__note { margin: 0; font: 400 12px/1.5 var(--hv-font-sans); color: var(--hv-text-muted); }
.hv-drill__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.hv-drill__actions .hv-btn { min-height: 40px; }
body.hv-drill-open { overflow: hidden; }

/* Chart notes: the "Note" button's popover (components.js hvNotes) */
.hv-notepop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: min(300px, calc(100vw - 32px)); box-sizing: border-box;
  background: var(--hv-bg-surface); border: 1px solid var(--hv-border); border-radius: 10px; box-shadow: var(--hv-shadow-lg);
  padding: 12px; display: flex; flex-direction: column; gap: 8px; text-align: left;
  animation: hv-scale-in .18s var(--hv-ease) both; transform-origin: top right;
}
.hv-notepop__title { font: 600 10px var(--hv-font-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--hv-text-faint); }
.hv-notepop__field { display: flex; flex-direction: column; gap: 4px; font: 500 11px var(--hv-font-sans); color: var(--hv-text-muted); margin: 0; }
.hv-notepop__btns { display: flex; justify-content: flex-end; gap: 6px; }
.hv-notepop__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-height: 180px; overflow-y: auto; }
.hv-notepop__list li { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid var(--hv-border); font: 400 12px/1.4 var(--hv-font-sans); color: var(--hv-text-2); }
.hv-notepop__list small { display: block; color: var(--hv-text-faint); font-size: 10px; }
.hv-notepop__del { width: 28px; height: 28px; border: 0; border-radius: 6px; background: none; color: var(--hv-text-faint); cursor: pointer; flex: none; }
.hv-notepop__del:hover { background: var(--hv-bad-bg); color: var(--hv-bad); }
.hv-notepop__hint { font: 400 11px var(--hv-font-sans); color: var(--hv-text-faint); }
@media (pointer: coarse) { .hv-notepop__del { width: 40px; height: 40px; } }
@media print { .hv-compare, [data-hv-note], .hv-notepop, .hv-drill { display: none !important; } }
