/* public/css/hub.css — HUB v2 LAYOUT AND COMPONENTS
 *
 * Loaded by views/hub.ejs and views/console.ejs (and the dev gallery,
 * views/hub/gallery.ejs) AFTER /styles.css, and built ONLY on the :root
 * tokens that file declares: the D18 Hub set (--ink-2, --edge-control,
 * --well, --focus, --mark-sub, the --t-* type roles), plus --void, --card,
 * --bone, --signal, --warn, --danger, the glass edges, the D19 depths (--e1, --e2, --e3, --sunk), --dur
 * and --ease. styles.css points the --font-* faces at Hubot, Mona and
 * Strata Figures inside .hv-app.
 *
 * It NEVER declares a token. The only custom properties declared here are
 * Hub v2's own layout values, named --hv-*. tests/unit/hubV2Assets.test.js
 * fails the build if this file declares anything else, shadows a name
 * src/styles.css declares, uses a var() that does not resolve on a Hub v2
 * page, writes a colour literal (every colour is a token; tints are
 * color-mix() of a token), defines a block class the gallery does not show,
 * or lets an animation escape the reduced-motion block.
 *
 * The design is docs/design/hub-v2/final/strata-hub-v2-final.html (D18).
 *
 * Every class is prefixed hv- so nothing here can collide with the old
 * portal's classes while both ship. Blocks are BEM-ish: .hv-panel,
 * .hv-panel__head, .hv-panel--lit. Open overlays carry [data-open].
 */


/* ══ 0 · Page ══════════════════════════════════════════════════════════ */

.hv-app {
    --hv-row-pad: 0px;
    --hv-cd: 0ms;
    --hv-gut: 16px;

    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    background: var(--frame);
    color: var(--bone);
    font-family: var(--font-body);
    font-size: var(--t-body);
    line-height: var(--lh-3);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
:where(.hv-app) *,
:where(.hv-app) *::before,
:where(.hv-app) *::after { box-sizing: border-box; }
/* Resets under :where() carry no specificity, so a component class wins. */
:where(.hv-app) button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
:where(.hv-app) a { color: inherit; text-decoration: none; }
.hv-app ::selection { background: var(--signal-edge); }
/* `hidden` wins over any component's display (a hidden button stays hidden). */
.hv-app [hidden] { display: none !important; }

/* Focus (D18): a bone ring (ink on Light), 2px out, on every control. */
.hv-app :focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}
/* styles.css sets every heading in expanded caps; the Hub is sentence case. */
:where(.hv-app) :is(h1, h2, h3, h4, h5, h6) { text-transform: none; letter-spacing: 0; }
:where(.hv-app) p { max-width: 72ch; }

/* The icon sprite (views/partials/hub-icons.ejs): Linear, or Bold where
   --hv-ic-bd is switched on (the selected page). */
.hv-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.hv-ic-ln { display: var(--hv-ic-ln, inline); }
.hv-ic-bd { display: var(--hv-ic-bd, none); }
.hv-app [aria-current="page"] > svg { --hv-ic-ln: none; --hv-ic-bd: inline; }

.hv-sr {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* ── Skip link: off-screen until focused ── */
.hv-skip {
    position: absolute;
    left: var(--hv-gut);
    top: -100px;
    z-index: var(--z-modal);
    padding: 8px 12px;
    background: var(--card);
    color: var(--bone);
    font-size: var(--t-small);
}
.hv-skip:focus-visible { top: var(--hv-gut); }

/* ── Main landmark ── */
.hv-main {
    max-width: 1280px;
    margin: 0 auto;
    padding: calc(var(--hv-gut) * 4) var(--hv-gut);
}
.hv-main:focus:not(:focus-visible) { outline: none; }

.hv-title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 800;
    font-stretch: 112%;
    font-size: var(--t-figure);
    letter-spacing: -0.02em;
    line-height: var(--lh-7);
}
.hv-lede {
    margin: 12px 0 0;
    max-width: 40rem;
    color: var(--text-mut);
}

.hv-wrap {
    position: relative;
    z-index: 1;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 28px;
}

/* ══ 1 · Frame: the rail on the frame, the page in a sheet set into it (D18) ══ */

.hv-frame {
    --hv-rail-w: 252px;
    --hv-va-h: 62px;
    position: fixed;
    inset: 0;
    display: grid;
    grid-template-columns: var(--hv-rail-w) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    background: var(--frame);
}
.hv-frame--col { --hv-rail-w: 72px; }
/* The server's view-as banner (partials/viewing-as.ejs) is fixed to the bottom edge; main.js measures it. */
.hv-app[data-viewing-as="true"] .hv-frame { bottom: var(--hv-va-h); }

.hv-sheet {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    margin: 12px 12px 12px 0;
    border: 1px solid var(--sheet-edge);
    background: var(--sheet);
    overflow: hidden;
}
.hv-sbar { flex: none; }
.hv-sbar > :not(:empty) { padding: 12px 28px 0; }
/* The sheet's only scroller: the frame and the rail never move. */
.hv-page { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.hv-page:focus:not(:focus-visible) { outline: none; }

/* ── Rail ── */
.hv-rail {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.hv-rail__head {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 72px;
    padding: 0 10px 0 14px;
}
.hv-ws { display: flex; align-items: center; gap: 11px; min-width: 0; }
.hv-ws__mark {
    display: grid;
    flex: none;
    place-items: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    background: var(--card-flat);
}
.hv-ws__mark svg { width: 22px; height: 22px; }
.hv-ws__t { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.hv-ws__name {
    overflow: hidden;
    font-family: var(--font-display);
    font-weight: 700;
    font-stretch: 105%;
    font-size: var(--t-body);
    white-space: nowrap;
    text-overflow: ellipsis;
}
.hv-ws__sub { margin-top: 2px; color: var(--ink-2); font-size: var(--t-label); white-space: nowrap; }
.hv-lockup {
    display: flex;
    align-items: center;
    font-family: var(--font-mark);
    font-weight: 800;
    font-size: var(--t-body);
    letter-spacing: -0.01em;
    text-transform: uppercase;
    white-space: nowrap;
}
.hv-lockup__sub { margin-left: 9px; padding-left: 9px; border-left: 1px solid var(--edge-control); color: var(--mark-sub); }
.hv-rail__col { display: grid; flex: none; place-items: center; width: 30px; height: 30px; color: var(--ink-2); }
.hv-rail__col:hover { color: var(--bone); }
.hv-rail__col svg { transition: transform calc(var(--dur) * 2) var(--ease); }
.hv-frame--col .hv-rail__col svg { transform: rotate(180deg); }

/* The plan: its name in the heading face, what it covers beneath in ash (D1a), then the trial day */
.hv-planchip { display: flex; flex: none; flex-direction: column; gap: 2px; min-width: 0; padding: 0 18px 14px; }
.hv-planchip__name { font-family: var(--font-display); font-weight: 700; font-stretch: 108%; font-size: var(--t-title); line-height: 1.2; }
.hv-planchip__beta {
    margin-left: 6px;
    padding: 0 4px;
    background: var(--warn);
    color: var(--on-signal);
    font-family: var(--font-body);
    font-size: var(--t-label);
    font-style: normal;
    font-weight: 500;
}
.hv-planchip__desc,
.hv-planchip__trial { overflow: hidden; color: var(--ink-2); font-size: var(--t-label); white-space: nowrap; text-overflow: ellipsis; }
.hv-planchip__trial { margin-top: 4px; color: var(--bone); }

.hv-rail__tools { display: flex; flex: none; gap: 6px; padding: 0 12px 6px; }
.hv-search {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 10px;
    min-width: 0;
    height: 36px;
    padding: 0 10px;
    overflow: hidden;
    border: 1px solid var(--card-edge);
    background: color-mix(in srgb, var(--bone) 4%, transparent);
    color: var(--ink-2);
    font-size: var(--t-small);
}
.hv-search:hover { border-color: var(--edge-hi); color: var(--bone); }
.hv-search svg { flex: none; }
.hv-search > span { white-space: nowrap; }
.hv-search__kbd {
    margin-left: auto;
    padding: 1px 5px;
    border: 1px solid var(--card-edge);
    font-family: var(--font-mono);
    font-size: var(--t-label);
    white-space: nowrap;
}

.hv-icon-btn {
    position: relative;
    display: grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--card-edge);
    color: var(--ink-2);
    transition: border-color calc(var(--dur) * 1.25), color calc(var(--dur) * 1.25);
}
.hv-icon-btn:hover { border-color: var(--edge-hi); color: var(--bone); }
/* Unread is information (decision 8): the bell keeps its dot. */
.hv-icon-btn__dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 7px;
    height: 7px;
    background: var(--signal);
    box-shadow: 0 0 0 2px var(--frame);
}
.hv-icon-btn svg { width: 16px; height: 16px; }

.hv-rail__nav { flex: 1; min-height: 0; padding: 0 8px 12px; overflow: hidden; }
.hv-rail__group { margin-top: 14px; }
.hv-rail__gl { padding: 0 10px 4px; color: var(--text-mut); font-size: var(--t-label); white-space: nowrap; }
.hv-rail__link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 32px;
    padding: 0 10px;
    color: var(--ink-2);
    font-size: var(--t-small);
    font-weight: 500;
    white-space: nowrap;
    transition: background-color calc(var(--dur) * 1.25), color calc(var(--dur) * 1.25);
}
.hv-rail__link svg { flex: none; }
.hv-rail__link:hover { color: var(--bone); }
/* The page you are on is a tab cut from the sheet. */
.hv-rail__link[aria-current="page"] { background: var(--sheet); box-shadow: inset 0 0 0 1px var(--sheet-edge); color: var(--bone); font-weight: 600; }
.hv-rail__count { margin-left: auto; color: var(--ink-2); font-family: var(--font-mono); font-size: var(--t-label); font-weight: 500; }
.hv-rail__link[aria-current="page"] .hv-rail__count { color: var(--bone); }
/* The tab takes the sheet's theme, but its ring sits on the frame. */
.hv-rail .hv-rail__link[aria-current="page"]:focus-visible { outline-color: var(--focus-frame); }
.hv-rail__secs { display: flex; flex-direction: column; margin: 2px 0 6px 18px; border-left: 1px solid var(--line); }
.hv-rail__secs:has(> :only-child) { display: none; }
.hv-rail__sec {
    display: flex;
    align-items: center;
    min-height: 28px;
    padding: 3px 10px 3px 13px;
    color: var(--ink-2);
    font-size: var(--t-label);
    line-height: 1.25;
}
.hv-rail__sec:hover { color: var(--bone); }
.hv-rail__sec[aria-current="true"] { box-shadow: inset 1px 0 0 var(--bone); color: var(--bone); }

.hv-rail__foot { display: flex; flex: none; flex-direction: column; gap: 4px; padding: 8px 12px; border-top: 1px solid var(--line); }
.hv-agent { display: block; padding: 12px 10px 10px; transition: background-color calc(var(--dur) * 1.25); }
.hv-agent__t { display: flex; align-items: center; gap: 9px; }
.hv-agent__t b { font-size: var(--t-body); font-weight: 600; }
.hv-agent__st { margin-left: auto; color: var(--signal-text); font-size: var(--t-label); }
.hv-agent__st--bad { color: var(--danger-lift); }
.hv-agent__d { display: block; margin-top: 4px; overflow: hidden; color: var(--ink-2); font-size: var(--t-label); white-space: nowrap; text-overflow: ellipsis; }
/* The agent's live square: a status, not a marker (decision 8). */
.hv-live { flex: none; width: 6px; height: 6px; background: var(--signal); animation: hv-breathe 3.2s ease-in-out infinite; }
@keyframes hv-breathe { 50% { opacity: 0.35; } }
/* Nothing in the rail scrolls: on a shorter screen the card folds to its first line. */
@media (max-height: 1000px) {
    .hv-agent__d { display: none; }
}

.hv-acct {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 6px;
    border: 1px solid transparent;
    color: var(--ink-2);
    text-align: left;
}
.hv-acct:hover,
.hv-acct[aria-expanded="true"] { border-color: var(--card-edge); }
.hv-acct[aria-expanded="true"] { background: color-mix(in srgb, var(--bone) 3.5%, transparent); }
.hv-acct__name { flex: 1; min-width: 0; overflow: hidden; color: var(--bone); font-size: var(--t-small); line-height: 1.25; white-space: nowrap; text-overflow: ellipsis; }
.hv-acct__sub { display: block; overflow: hidden; color: var(--ink-2); font-size: var(--t-label); text-overflow: ellipsis; }
.hv-acct > svg { flex: none; }

.hv-av {
    display: grid;
    place-items: center;
    flex: none;
    width: 28px;
    height: 28px;
    background: var(--card-hi);
    color: var(--bone);
    font-family: var(--font-display);
    font-size: var(--t-label);
    font-weight: 700;
    font-stretch: 105%;
}
.hv-av--lg { width: 40px; height: 40px; font-size: var(--t-small); }
.hv-av--sig { background: var(--signal-dim); }
.hv-av--btn { width: 36px; height: 36px; }

/* Collapsed: icons, the live square and the avatar; the names are tooltips. */
.hv-frame--col :is(.hv-ws__t, .hv-planchip, .hv-search > span, .hv-search__kbd, .hv-rail__gl, .hv-rail__label,
    .hv-agent__t b, .hv-agent__st, .hv-agent__d, .hv-acct__name, .hv-acct > svg) { display: none; }
.hv-frame--col .hv-rail__head { flex-direction: column; justify-content: center; gap: 10px; height: auto; padding: 14px 0 12px; }
.hv-frame--col .hv-rail__tools { flex-direction: column; align-items: center; padding: 0 0 4px; }
.hv-frame--col .hv-search { flex: none; justify-content: center; width: 40px; padding: 0; }
.hv-frame--col .hv-rail__nav { padding: 0 12px 12px; }
.hv-frame--col .hv-rail__group { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.hv-frame--col .hv-rail__group:first-child { border-top: 0; }
.hv-frame--col .hv-rail__link { justify-content: center; padding: 0; }
.hv-frame--col .hv-rail__count { position: absolute; top: 2px; right: 2px; padding: 0 4px; background: var(--bone); color: var(--void); }
.hv-frame--col .hv-agent { display: flex; justify-content: center; padding: 12px 0; }
.hv-frame--col .hv-acct { justify-content: center; padding: 6px 0; }
/* A shorter screen packs the open rail tighter; below what fits, core/frame.js collapses it. */
@media (max-height: 900px) {
    .hv-rail__head { height: 60px; }
    .hv-rail__group { margin-top: 8px; }
    .hv-rail__link { height: 28px; }
    .hv-rail__sec { min-height: 22px; padding-top: 2px; padding-bottom: 2px; }
}

/* ── Phone: a top bar, the sheet full screen and a tab bar (four pages and More) ── */
.hv-mtop,
.hv-tabbar { display: none; }
.hv-mtop {
    grid-column: 1;
    grid-row: 1;
    align-items: center;
    gap: 8px;
    height: 56px;
    padding: 0 12px;
    border-bottom: 1px solid var(--glass-edge);
    background: var(--frame);
}
.hv-mtop .hv-ws { flex: 1; }
.hv-mtop .hv-icon-btn { border-color: transparent; }
.hv-tabbar {
    grid-column: 1;
    grid-row: 3;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    height: 64px;
    border-top: 1px solid var(--glass-edge);
    background: var(--frame);
}
.hv-tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--ink-2);
    font-size: var(--t-label);
}
.hv-tab[aria-current="page"] { color: var(--bone); }
.hv-tab[aria-current="page"]::before { content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 2px; background: var(--bone); }
.hv-tab__count {
    position: absolute;
    top: 8px;
    left: calc(50% + 6px);
    padding: 0 4px;
    background: var(--bone);
    color: var(--void);
    font-family: var(--font-mono);
    font-size: var(--t-label);
}
@media (max-width: 820px) {
    .hv-frame,
    .hv-frame--col { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
    .hv-rail { display: none; }
    .hv-mtop { display: flex; }
    .hv-tabbar:not(:empty) { display: grid; }
    .hv-sheet { grid-column: 1; grid-row: 2; margin: 0; border: 0; }
    .hv-sbar > :not(:empty) { padding: 10px 12px 0; }
}

/* Banners at the top of the sheet: trial, multi-site beta (with the branch picker) */
.hv-tbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    padding: 9px 14px;
    border: 1px solid var(--signal-edge);
    background: color-mix(in srgb, var(--signal) 7%, transparent);
    color: var(--ink-2);
    font-size: var(--t-small);
}
.hv-tbar b { color: var(--bone); font-weight: 600; }
.hv-tbar a { border-bottom: 1px solid var(--card-edge); color: var(--bone); font-size: var(--t-label); }
.hv-tbar > a:first-of-type { margin-left: auto; }
.hv-tbar--beta { border-color: var(--warn-edge); background: color-mix(in srgb, var(--warn) 7%, transparent); }

.hv-brpick {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 36px;
    padding: 0 8px;
    border: 1px solid var(--card-edge);
    color: var(--ink-2);
    font-size: var(--t-small);
}
.hv-tbar .hv-brpick { height: 26px; margin-right: 4px; border-color: var(--warn-edge); }
.hv-brpick select {
    border: 0;
    background: transparent;
    color: var(--bone);
    font: inherit;
    cursor: pointer;
}
.hv-brpick select option { background: var(--card); color: var(--bone); }
.hv-brpick--locked { color: var(--bone); }

/* The Hub's own view-as bar, visible in every theme (decision 2). The security banner is still the
   server partial views/partials/viewing-as.ejs, unchanged. */
.hv-viewas {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 8px 14px;
    background: var(--bone);
    color: var(--void);
    font-size: var(--t-label);
}
.hv-viewas :focus-visible { outline-color: var(--sheet); }
.hv-viewas button,
.hv-viewas a {
    padding: 3px 9px;
    border: 1px solid var(--void);
    font-size: var(--t-label);
}

/* ══ 2 · Pages: a title, then sections that flow ══════════════════════ */

.hv-ph {
    max-width: 1240px;
    margin: 0 auto;
    padding: 30px 28px 8px;
    font-family: var(--font-display);
    font-weight: 800;
    font-stretch: 112%;
    font-size: var(--t-figure);
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.hv-slide { padding: 0 0 56px; }
.hv-slide:first-of-type { padding-top: 28px; }
.hv-ph + .hv-slide { padding-top: 8px; }

/* D20: the freshness line and the page notices under the title; the page dims while offline */
.hv-status { display: grid; gap: 8px; max-width: 1240px; margin: 0 auto; padding: 20px 28px 0; }
.hv-ph + .hv-status { padding-top: 4px; }
.hv-status:empty { display: none; }
.hv-ph + .hv-status + .hv-slide { padding-top: 8px; }
.hv-fresh { margin: 0; color: var(--ink-2); font-size: var(--t-label); }
.hv-fresh--old { color: var(--warn); }
.hv-stale .hv-slide { opacity: 0.82; filter: saturate(0.6); }

/* Section head: the label, the section's line and intro on the left, actions on the right. The sign-in
   pages keep the two-column head. */
.hv-sh {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 48px;
    align-items: end;
    margin-bottom: var(--space-4);
}
.hv-sh--page { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; margin-bottom: 16px; padding-top: 6px; }
.hv-sh__sub { margin-top: 4px; color: var(--ink-2); font-size: var(--t-body); }
.hv-sh__intro { max-width: 40rem; color: var(--ink-2); font-size: var(--t-body); line-height: var(--lh-3); }
.hv-sh--page .hv-sh__intro { margin-top: 4px; font-size: var(--t-small); }
.hv-sh__intro b { color: var(--bone); font-weight: 600; }
.hv-sh__acts { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }

.hv-kick {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink-2);
    font-size: var(--t-label);
    font-weight: 500;
}

.hv-h2 {
    text-transform: none;
    margin: 12px 0 0;
    font-family: var(--font-display);
    font-weight: 800;
    font-stretch: 115%;
    font-size: var(--t-section);
    letter-spacing: -0.02em;
    line-height: var(--lh-7);
    text-wrap: balance;
}
.hv-sh--page .hv-h2 { margin: 0; font-weight: 700; font-stretch: 108%; letter-spacing: -0.005em; line-height: 1.2; }

/* ══ 3 · Grid ══════════════════════════════════════════════════════════ */

.hv-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--hv-gut); }
.hv-s3 { grid-column: span 3; }
.hv-s4 { grid-column: span 4; }
.hv-s5 { grid-column: span 5; }
.hv-s6 { grid-column: span 6; }
.hv-s7 { grid-column: span 7; }
.hv-s8 { grid-column: span 8; }
.hv-s9 { grid-column: span 9; }
.hv-s12 { grid-column: 1 / -1; }
.hv-mt { margin-top: var(--hv-gut); }

/* ══ 4 · Panels and figures ════════════════════════════════════════════ */

.hv-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    background: var(--card-flat);
    box-shadow: var(--e1);
    transition: border-color calc(var(--dur) * 2) var(--ease), box-shadow calc(var(--dur) * 2) var(--ease), transform calc(var(--dur) * 2) var(--ease);
}
/* D19: a card that opens something lifts 1px to e2 on hover; a card that only informs never moves. */
.hv-app a.hv-panel:hover { border-color: var(--edge-hi); box-shadow: var(--e2); transform: translateY(-1px); }
:is(a.hv-panel, .hv-fig) > .hv-meta::after { content: ' →' / ''; opacity: 0; transition: opacity var(--dur); }
:is(a.hv-panel, .hv-fig):is(:hover, :focus-visible) > .hv-meta::after { opacity: 1; }
.hv-panel--lit::before { content: ''; position: absolute; left: -1px; right: -1px; top: -1px; height: 2px; background: var(--bone); }
.hv-panel--upsell { border-style: dashed; border-color: var(--edge-hi); }
.hv-panel--upsell .hv-panel__title { color: var(--ink-2); }
.hv-panel__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px 0;
}
.hv-panel__title {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    font-stretch: 108%;
    font-size: var(--t-title);
    letter-spacing: -0.005em;
}
.hv-panel__body { flex: 1; padding: 16px 22px 20px; }
.hv-panel__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 22px 16px;
    border-top: 1px solid var(--row-edge);
}

.hv-pad { padding: 20px 22px; }

.hv-meta {
    color: var(--ink-2);
    font-size: var(--t-label);
}
.hv-muted { color: var(--ink-2); }
.hv-small { font-size: var(--t-small); }
.hv-num {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

.hv-stat__v {
    margin-top: 12px;
    font-family: var(--font-display);
    font-weight: 800;
    font-stretch: 112%;
    font-size: var(--t-figure);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
    line-height: 1.05;
}
.hv-stat__unit { margin-left: 4px; color: var(--ink-2); font-size: var(--t-body); letter-spacing: 0; }
.hv-stat__l { margin-top: 4px; color: var(--ink-2); font-size: var(--t-small); }
.hv-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 10px;
    color: var(--ink-2);
    font-family: var(--font-mono);
    font-size: var(--t-label);
}
.hv-delta b { color: var(--bone); font-weight: 500; }
.hv-spark { display: block; width: 100%; height: 34px; margin-top: 12px; }
.hv-hero-v {
    margin-top: 14px;
    color: var(--signal-text);
    font-family: var(--font-display);
    font-weight: 800;
    font-stretch: 112%;
    font-size: var(--t-hero);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.04em;
    line-height: 1;
}

/* ══ 5 · Controls ══════════════════════════════════════════════════════ */

/* Buttons: one green per view; sentence case, no glow, no lift */
.hv-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    font-size: var(--t-small);
    font-weight: 600;
    white-space: nowrap;
    transition: transform var(--dur) var(--ease), border-color calc(var(--dur) * 1.5), background-color calc(var(--dur) * 1.5);
}
.hv-btn--sm { min-height: 32px; padding: 0 11px; }
.hv-btn--xs { min-height: 28px; padding: 0 9px; }
.hv-btn--primary {
    border-color: var(--signal-deep);
    background: var(--signal);
    color: var(--on-signal);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--bone) 40%, transparent);
}
.hv-btn--secondary {
    border-color: var(--edge-hi);
    background: var(--glass-nested);
    color: var(--bone);
}
.hv-btn--secondary:hover { border-color: var(--glass-edge-hi); }
.hv-btn--ghost { color: var(--ink-2); }
.hv-btn--ghost:hover { border-color: var(--card-edge); color: var(--bone); }
.hv-btn:disabled,
.hv-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }
.hv-btn svg { width: 14px; height: 14px; }

.hv-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 2px;
    border-bottom: 1px solid var(--card-edge);
    color: var(--bone);
    font-size: var(--t-small);
    font-weight: 500;
}
.hv-link:hover { border-color: var(--bone); }

/* Segmented control */
.hv-seg { display: inline-flex; border: 1px solid var(--card-edge); background: color-mix(in srgb, var(--void) 40%, transparent); }
.hv-seg button {
    padding: 7px 12px;
    color: var(--ink-2);
    font-size: var(--t-small);
    white-space: nowrap;
}
.hv-seg button:is([aria-pressed="true"], [aria-checked="true"]) {
    background: color-mix(in srgb, var(--bone) 9%, transparent);
    color: var(--bone);
    box-shadow: inset 0 -2px 0 var(--bone);
}

/* Filter chips */
.hv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.hv-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--card-edge);
    color: var(--ink-2);
    font-size: var(--t-small);
    white-space: nowrap;
}
.hv-chip[aria-pressed="true"] {
    border-color: var(--edge-hi);
    background: color-mix(in srgb, var(--bone) 5%, transparent);
    color: var(--bone);
}
.hv-chip__n { color: var(--ink-2); font-family: var(--font-mono); font-size: var(--t-label); }

/* The New client wizard: eight steps in three parts, plan cards, an email beside its tracker */
.hv-drawer.hv-drawer--wide { width: min(980px, 100%); }
.hv-wz-steps { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); margin-top: 14px; }
.hv-wz-g {
    --hv-span: 1;
    grid-column: span var(--hv-span);
    margin: 0 6px 8px 0;
    padding-bottom: 7px;
    overflow: hidden;
    border-bottom: 1px solid var(--line-2);
    color: var(--ink-2);
    font-family: var(--font-mono);
    font-size: var(--t-label);
    text-transform: uppercase;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.hv-wz-step { min-width: 0; margin-right: -1px; padding: 10px 12px; border: 1px solid var(--card-edge); color: var(--ink-2); font-size: var(--t-label); text-align: left; }
.hv-wz-step b { display: flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-weight: 500; }
.hv-wz-step span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hv-wz-step[data-done] { color: var(--bone); }
.hv-wz-step[data-locked] { color: color-mix(in srgb, var(--ink-2) 60%, transparent); }
.hv-wz-step[aria-current="step"] { position: relative; border-color: var(--edge-hi); background: color-mix(in srgb, var(--bone) 4%, transparent); color: var(--bone); }
.hv-wz-plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
.hv-wz-plan { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--card-edge); background: color-mix(in srgb, var(--void) 25%, transparent); text-align: left; }
.hv-wz-plan:hover { border-color: var(--edge-hi); }
.hv-wz-plan[aria-pressed="true"] { border-color: var(--bone); background: color-mix(in srgb, var(--bone) 5%, transparent); }
.hv-wz-plan b { font-family: var(--font-display); font-size: var(--t-title); }
.hv-wz-plan span { color: var(--ink-2); font-size: var(--t-small); }
.hv-wz-plan em { margin-top: 4px; font-style: normal; font-size: var(--t-label); }
.hv-wz-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 720px) {
    .hv-wz-steps { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .hv-wz-g { display: none; }
    .hv-wz-plans,
    .hv-wz-2 { grid-template-columns: 1fr; }
}

/* Status tags: the word carries the meaning, the edge a quiet tone; no marker shapes */
.hv-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 7px;
    border: 1px solid var(--card-edge);
    color: var(--ink-2);
    font-size: var(--t-label);
    font-weight: 500;
    white-space: nowrap;
}
.hv-tag--ok,
.hv-tag--hot,
.hv-tag--br { color: var(--bone); }
.hv-tag--ok { border-color: var(--edge-control); }
.hv-tag--warn { border-color: var(--warn-edge); color: var(--warn); }
.hv-tag--bad { border-color: var(--danger-edge); color: var(--danger-lift); }
.hv-tag--hot { border-color: var(--edge-hi); }
.hv-tag--plain { border-color: var(--line-2); }
.hv-tag svg { width: 12px; height: 12px; }

/* Branch colour: BY INDEX from the server's order, never by branch name */
.hv-brbar--1 { box-shadow: inset 3px 0 0 var(--bone); }
.hv-brbar--2 { box-shadow: inset 3px 0 0 var(--signal-lift); }
.hv-brbar--3 { box-shadow: inset 3px 0 0 var(--ink-2); }
.hv-brbar--4 { box-shadow: inset 3px 0 0 var(--info); }
.hv-brbar--5 { box-shadow: inset 3px 0 0 var(--warn); }

/* Fields */
.hv-label { display: block; margin-bottom: 6px; color: var(--ink-2); font-size: var(--t-small); }
.hv-field {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--edge-control);
    border-radius: 0;
    background: var(--well);
    color: var(--bone);
    font: inherit;
    transition: border-color calc(var(--dur) * 1.25);
}
.hv-field:hover { border-color: var(--edge-hi); }
.hv-field::placeholder { color: var(--text-mut); opacity: 1; }
textarea.hv-field { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; }
select.hv-field { cursor: pointer; }

/* Code boxes (HUB-D2): one digit per box; public/js/hub/auth/otp.js moves
   focus, handles backspace, and spreads a pasted code across every box.
   One row always: on a narrow panel (390px) the boxes shrink from 44px rather
   than wrap the last digit onto a second line. */
.hv-otp { display: flex; flex-wrap: nowrap; gap: 8px; }
.hv-otp .hv-field { flex: 0 1 44px; min-width: 0; width: 44px; height: 48px; padding: 0; text-align: center; font-family: var(--font-mono); font-size: var(--t-section); }
.hv-field[aria-invalid="true"] { border-color: var(--danger); }
.hv-frow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Switch: a <button role="switch" aria-checked>. Quiet: off is a hollow
   track, on is a bone track with a dark thumb; never green. */
.hv-switch {
    position: relative;
    flex: none;
    width: 36px;
    height: 20px;
    border: 1px solid var(--edge-control);
    background: var(--well);
    transition: background-color calc(var(--dur) * 1.25), border-color calc(var(--dur) * 1.25);
}
.hv-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 12px;
    height: 12px;
    background: var(--ink-2);
    transition: transform calc(var(--dur) * 1.4) var(--ease), background-color calc(var(--dur) * 1.25);
}
.hv-switch[aria-checked="true"] { border-color: var(--bone); background: var(--bone); }
.hv-switch[aria-checked="true"]::after { transform: translateX(16px); background: var(--sheet); }
.hv-switch:disabled { opacity: 0.45; cursor: not-allowed; }

/* ── D19 state layer: every clickable thing tints 6% on hover and 10% on press; the green brightens, a switch rings ── */
.hv-app :is(button, a[href], [role="button"], [role="link"], tr[tabindex], tr[data-href]):not(:disabled, [aria-disabled="true"], .hv-btn--primary, .hv-switch, .hv-link, .hv-skip):hover {
    background-image: linear-gradient(color-mix(in srgb, var(--bone) 6%, transparent) 0 0);
}
.hv-app :is(button, a[href], [role="button"], [role="link"], tr[tabindex], tr[data-href]):not(:disabled, [aria-disabled="true"], .hv-btn--primary, .hv-switch, .hv-link, .hv-skip):active {
    background-image: linear-gradient(color-mix(in srgb, var(--bone) 10%, transparent) 0 0);
}
.hv-app .hv-btn--primary:not(:disabled):hover { filter: brightness(1.07) saturate(1.04); }
.hv-app .hv-btn--primary:not(:disabled):active { filter: brightness(0.95); }
.hv-app .hv-btn:not(:disabled):active { transform: translateY(1px); }
.hv-app .hv-switch:not(:disabled):hover { box-shadow: 0 0 0 4px color-mix(in srgb, var(--bone) 6%, transparent); }
.hv-app .hv-switch:not(:disabled):active { box-shadow: 0 0 0 4px color-mix(in srgb, var(--bone) 10%, transparent); }
/* Wells sit one step below the card. */
:is(.hv-field, .hv-notice, .hv-meter, .hv-code) { box-shadow: var(--sunk); }

/* ══ 6 · Lists, tables, meters ═════════════════════════════════════════ */

.hv-rows > * + * { border-top: 1px solid var(--row-edge); }
.hv-row { display: flex; align-items: center; gap: 14px; padding: calc(13px + var(--hv-row-pad)) 0; }
.hv-row__grow { flex: 1; min-width: 0; }
.hv-row__t { font-weight: 600; }
.hv-row__d { margin-top: 1px; color: var(--ink-2); font-size: var(--t-small); }
.hv-ell { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* A table fits its card: headings and descriptions wrap; times, figures and tags do not. */
.hv-table { width: 100%; border-collapse: collapse; }
.hv-table th {
    padding: 10px 12px;
    border-bottom: 1px solid var(--card-edge);
    background: var(--card);
    color: var(--ink-2);
    font-size: var(--t-label);
    font-weight: 500;
    text-align: left;
}
.hv-table td { padding: 12px; border-bottom: 1px solid var(--row-edge); vertical-align: middle; overflow-wrap: anywhere; }
.hv-table :is(.hv-tag, time) { white-space: nowrap; }
.hv-table .hv-num,
.hv-table .hv-r { text-align: right; white-space: nowrap; }
.hv-table tbody tr[data-href],
.hv-table tbody tr[tabindex] { cursor: pointer; transition: background-color calc(var(--dur) * 1.25); }
.hv-table tbody tr[aria-selected="true"] { background: color-mix(in srgb, var(--bone) 4%, transparent); }

/* Key/value grid (lead fields, plan facts) */
.hv-kv {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    border: 1px solid var(--card-edge);
    background: var(--card-edge);
}
.hv-kv > div { padding: 11px 13px; background: var(--card); }
.hv-kv--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hv-kv__k { color: var(--ink-2); font-size: var(--t-label); }
.hv-kv__v { margin-top: 3px; font-weight: 600; }
.hv-kv__v.hv-num { font-weight: 500; }   /* Geist Mono ships 400 and 500 only */

/* Meter with an 80% (or target) marker; --hv-fill and --hv-mark are the hooks */
.hv-meter {
    --hv-fill: 0%;
    --hv-mark: 80%;
    position: relative;
    height: 6px;
    background: var(--card-edge);
}
.hv-meter__fill { position: absolute; inset: 0 auto 0 0; width: var(--hv-fill); max-width: 100%; background: var(--bone); }
.hv-meter__mark { position: absolute; top: -4px; bottom: -4px; left: var(--hv-mark); width: 2px; background: var(--bone); }
.hv-meter--sig .hv-meter__fill { background: var(--signal); }
.hv-meter--warn .hv-meter__fill { background: var(--warn); }
.hv-meter--bad .hv-meter__fill { background: var(--danger); }

/* Bar chart (hub/core/charts.js): divs, heights on the --hv-fill hook */
.hv-bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.hv-bars--tall { height: 180px; }
.hv-bars--short { height: 64px; }
.hv-bars__col { display: flex; flex: 1; flex-direction: column; justify-content: flex-end; min-width: 0; height: 100%; }
.hv-bars__bar { display: block; height: var(--hv-fill); min-height: 2px; background: color-mix(in srgb, var(--bone) 70%, transparent); }
.hv-bars--signal .hv-bars__bar { background: var(--signal); }
.hv-bars__col:hover .hv-bars__bar { background: var(--bone); }
.hv-bars__lbl { margin-top: 6px; color: var(--text-mut); font-family: var(--font-mono); font-size: var(--t-label); text-align: center; white-space: nowrap; }

/* A row that is a button (a list you pick from): full width, left aligned */
.hv-listrow { width: 100%; padding: 12px 10px; border-left: 2px solid transparent; text-align: left; }
.hv-listrow[aria-current="true"] { border-left-color: var(--bone); background: color-mix(in srgb, var(--bone) 5.5%, transparent); }

/* A search field that does not stretch across a toolbar */
.hv-searchbox { width: min(320px, 100%); }

/* Reports: a column of panels inside a grid cell, an inline form row, the
   meter column in a labelled row, and a copyable one-time link */
.hv-stack { display: flex; flex-direction: column; gap: var(--hv-gut); }
.hv-stack > :last-child { flex: 1; }
.hv-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hv-inline .hv-field { width: auto; flex: 1 1 120px; height: 34px; }
.hv-w40 { flex: 0 0 40%; }
.hv-count { min-width: 3.5em; text-align: right; }
.hv-row--btn { width: 100%; border: 0; border-top: 1px solid var(--row-edge); background: none; color: var(--ink-2); font: inherit; text-align: left; cursor: pointer; }
.hv-row--btn:first-child { border-top: 0; }
.hv-row--btn:hover, .hv-row--btn[aria-pressed="true"] { color: var(--bone); }
.hv-row--btn[aria-pressed="true"] { padding-left: 10px; box-shadow: inset 2px 0 0 var(--bone); }
.hv-code { padding: 8px 10px; border: 1px solid var(--card-edge); color: var(--bone); font-family: var(--font-mono); font-size: var(--t-label); overflow-wrap: anywhere; }
/* The authenticator QR (E-F10): the server's image as sent (src/lib/qr.js), kept sharp and scannable. */
.hv-qr { display: block; width: 180px; height: 180px; margin-top: 12px; border: 1px solid var(--card-edge); image-rendering: pixelated; }

/* Week calendar (Diary): an hour column and seven day columns */
.hv-cal { --hv-top: 0%; display: grid; grid-template-columns: 52px repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--card-edge); border-left: 1px solid var(--card-edge); }
.hv-cal__hd { position: sticky; top: 0; z-index: 4; background: var(--card); padding: 8px; border-right: 1px solid var(--card-edge); border-bottom: 1px solid var(--card-edge); color: var(--ink-2); font-size: var(--t-label); }
.hv-cal__hd--today { color: var(--bone); box-shadow: inset 0 -2px 0 var(--bone); }
.hv-cal__hr { height: 40px; padding: 3px 6px; border-right: 1px solid var(--card-edge); border-bottom: 1px solid var(--card-edge); color: var(--text-mut); font-family: var(--font-mono); font-size: var(--t-label); }
.hv-cal__cell { position: relative; height: 40px; border-right: 1px solid var(--card-edge); border-bottom: 1px solid var(--row-edge); }
.hv-cal__cell--off { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--bone) 2.5%, transparent) 0 6px, transparent 6px 12px); }
.hv-cal__bk {
    position: absolute; left: 3px; right: 3px; top: var(--hv-top); z-index: 2;
    overflow: hidden; padding: 3px 6px; border: 1px solid var(--edge-hi);
    background: color-mix(in srgb, var(--bone) 8%, transparent); color: var(--bone);
    font-size: var(--t-label); text-align: left; white-space: nowrap; text-overflow: ellipsis;
}
.hv-cal__bk:hover { border-color: var(--bone); }
.hv-cal__bk--new { border-color: var(--signal-edge); background: var(--signal-dim); }
.hv-cal__now { position: absolute; left: 0; right: 0; top: var(--hv-top); z-index: 3; border-top: 1px solid var(--signal); }

/* Kanban board: one column per stage */
.hv-board { display: grid; grid-auto-columns: minmax(220px, 1fr); grid-auto-flow: column; gap: 12px; overflow-x: auto; }
.hv-board__col { display: flex; flex-direction: column; min-height: 320px; border: 1px solid var(--card-edge); background: color-mix(in srgb, var(--void) 50%, transparent); }
.hv-board__col[data-over] { border-color: var(--edge-hi); background: color-mix(in srgb, var(--bone) 3%, transparent); }
.hv-board__head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--row-edge); }
.hv-board__cards { display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.hv-board__card { padding: 10px 12px; cursor: grab; }
.hv-board__card:active { cursor: grabbing; }

/* Upsell / locked rows */
.hv-lockrow { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--row-edge); }
.hv-lockrow:first-child { border-top: 0; }

/* ══ 6b · Console: the same frame, always dark (data-theme="console"), denser; nothing scrolls inside a card ══ */

.hv-app--console { --hv-gut: 12px; }
.hv-app--console .hv-page .hv-panel--lit::before { content: none; }
.hv-app--console .hv-panel__head { padding: 20px 20px 0; }
.hv-app--console .hv-panel__body { padding: 12px 20px 20px; }
.hv-app--console .hv-panel__foot { padding: 10px 20px 12px; }
.hv-app--console .hv-pad { padding: 20px; }
.hv-app--console .hv-row { padding-top: 8px; padding-bottom: 8px; }
.hv-app--console .hv-table :is(td, th) { padding-top: 10px; padding-bottom: 10px; }
.hv-app--console .hv-slide { padding-bottom: 40px; }
.hv-app--console .hv-sh--page { margin-bottom: 12px; }

/* ══ 7 · Overlays: scrim, drawer, modal, popover, toast, tooltip, palette ══ */

.hv-scrim {
    position: fixed;
    inset: 0;
    z-index: var(--z-drawer);
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity calc(var(--dur) * 2) var(--ease);
}
.hv-scrim[data-open] { opacity: 1; pointer-events: auto; }

.hv-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: calc(var(--z-drawer) + 1);
    display: flex;
    flex-direction: column;
    width: min(560px, 100%);
    border-left: 1px solid var(--glass-edge);
    background: var(--card);
    box-shadow: var(--e3);
    transform: translateX(102%);
    visibility: hidden;
    transition: transform calc(var(--dur) * 2.6) var(--ease), visibility 0s linear calc(var(--dur) * 2.6);
}
.hv-drawer[data-open] { transform: none; visibility: visible; transition: transform calc(var(--dur) * 2.6) var(--ease); }
.hv-drawer__head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px 22px;
    border-bottom: 1px solid var(--row-edge);
}
.hv-drawer__title,
.hv-modal__title {
    flex: 1;
    text-transform: none;
    margin: 0;
    font-family: var(--font-display);
    font-weight: 800;
    font-stretch: 112%;
    font-size: var(--t-section);
    letter-spacing: -0.015em;
    line-height: var(--lh-5);
}
.hv-drawer__body { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }

.hv-modal {
    position: fixed;
    left: 50%;
    top: 50%;
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    width: min(640px, calc(100% - 32px));
    max-height: calc(100% - 60px);
    border: 1px solid var(--glass-edge-hi);
    background: var(--card);
    box-shadow: var(--e3);
    transform: translate(-50%, -46%);
    opacity: 0;
    visibility: hidden;
    transition: transform calc(var(--dur) * 2.2) var(--ease), opacity calc(var(--dur) * 2) var(--ease), visibility 0s linear calc(var(--dur) * 2.2);
}
.hv-modal[data-open] {
    transform: translate(-50%, -50%);
    opacity: 1;
    visibility: visible;
    transition: transform calc(var(--dur) * 2.2) var(--ease), opacity calc(var(--dur) * 2) var(--ease);
}
.hv-modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 20px 22px 0; }
.hv-modal__body { flex: 1; overflow-y: auto; padding: 16px 22px; }
.hv-modal__foot {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 22px 18px;
    border-top: 1px solid var(--row-edge);
}

.hv-pop {
    position: absolute;
    z-index: var(--z-dropdown);
    display: none;
    min-width: 280px;
    padding: 6px 0;
    border: 1px solid var(--glass-edge-hi);
    background: var(--card);
    box-shadow: var(--e3);
}
.hv-pop[data-open] { display: block; }
.hv-pop__head { padding: 10px 14px; border-bottom: 1px solid var(--row-edge); }
.hv-pop__item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    color: var(--ink-2);
    font-size: var(--t-small);
    text-align: left;
}
.hv-pop__item:hover { color: var(--bone); }
.hv-pop__item svg { width: 16px; height: 16px; }
/* A setting inside a menu: its label, then the control (the account menu's Appearance). */
.hv-pop__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    border-top: 1px solid var(--row-edge);
    color: var(--ink-2);
    font-size: var(--t-small);
}
.hv-pop__row .hv-seg button { padding: 6px 10px; font-size: var(--t-label); }

.hv-toasts {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: calc(var(--z-modal) + 10);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transform: translateX(-50%);
}
.hv-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border: 1px solid var(--glass-edge-hi);
    background: var(--card);
    box-shadow: var(--e3);
    font-size: var(--t-small);
    animation: hv-toast-in calc(var(--dur) * 2.2) var(--ease);
}
.hv-toast--bad { border-color: var(--danger-edge); }
@keyframes hv-toast-in { from { transform: translateY(10px); opacity: 0; } }

.hv-tip {
    position: fixed;
    z-index: calc(var(--z-modal) + 20);
    max-width: 260px;
    padding: 8px 10px;
    border: 1px solid var(--glass-edge-hi);
    background: var(--card);
    box-shadow: var(--e3);
    font-size: var(--t-small);
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--dur);
}
.hv-tip[data-open] { opacity: 1; }
.hv-tip b { font-family: var(--font-mono); font-weight: 500; }

.hv-cmdk {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    background: rgba(0, 0, 0, 0.55);
}
.hv-cmdk[data-open] { display: flex; }
.hv-cmdk__box {
    width: min(620px, calc(100% - 24px));
    border: 1px solid var(--glass-edge-hi);
    background: var(--card);
    box-shadow: var(--e3);
}
.hv-cmdk__input {
    width: 100%;
    height: 54px;
    padding: 0 18px;
    border: 0;
    border-bottom: 1px solid var(--row-edge);
    background: transparent;
    color: var(--bone);
    font: inherit;
    font-size: var(--t-title);
}
.hv-cmdk__res { max-height: 360px; overflow: auto; margin: 0; padding: 6px; list-style: none; }
.hv-cmdk__item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; cursor: pointer; }
.hv-cmdk__item[aria-selected="true"] { background: color-mix(in srgb, var(--bone) 6%, transparent); }
.hv-cmdk__k { margin-left: auto; }

/* The keyboard sheet (core/keys.js) */
.hv-keys { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: var(--t-small); }
.hv-keys dd { margin: 0; color: var(--ink-2); }
.hv-keys kbd { margin-right: 4px; padding: 1px 6px; border: 1px solid var(--card-edge); font-family: var(--font-mono); font-size: var(--t-label); }

/* ══ 8 · States: empty, loading, error; preview badge; build tags ══════ */

.hv-state { padding: 40px 20px; color: var(--ink-2); text-align: center; }
.hv-state__title { margin: 0 0 6px; color: var(--bone); font-weight: 600; }
.hv-state--empty { border: 1px dashed var(--card-edge); }
.hv-state--empty > p { margin-left: auto; margin-right: auto; }
.hv-state--error { border: 1px solid var(--danger-edge); background: var(--danger-dim); text-align: left; }
.hv-state--loading { display: grid; gap: 10px; text-align: left; }
.hv-skel {
    display: block;
    height: 12px;
    background: linear-gradient(90deg, var(--card-hi), var(--card-edge), var(--card-hi));
    background-size: 200% 100%;
    animation: hv-skel 1.4s linear infinite;
}
.hv-skel--short { width: 40%; }
.hv-skel--mid { width: 70%; }
@keyframes hv-skel { to { background-position: -200% 0; } }

.hv-preview-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border: 1px solid var(--warn-edge);
    background: var(--warn-dim);
    color: var(--bone);
    font-size: var(--t-label);
    white-space: nowrap;
}
.hv-preview-badge__by { color: var(--ink-2); }

/* Build tag: Live / F-prompt / Premium build / Layout */
.hv-srcs { display: flex; flex-wrap: wrap; gap: 6px; margin: -10px 0 16px; }
.hv-src {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3px 8px;
    border: 1px dashed var(--card-edge);
    color: var(--bone);
    font-size: var(--t-label);
}
.hv-src__what { color: var(--ink-2); font-size: var(--t-small); }
.hv-src--live { border-color: var(--edge-hi); }
.hv-src--f { border-color: var(--signal-edge); }
.hv-src--p { border-style: solid; border-color: var(--warn); }
.hv-src--ui { border-color: var(--warn-edge); }

/* ══ 9 · Notices, whispers, photo-card matches ═════════════════════════ */

.hv-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid var(--card-edge);
    background: color-mix(in srgb, var(--bone) 2.5%, transparent);
    color: var(--ink-2);
    font-size: var(--t-small);
}
.hv-notice b { color: var(--bone); }
.hv-notice--warn { border-color: var(--warn-edge); }
.hv-notice--ok { border-color: var(--signal-edge); }
.hv-notice--bad { border-color: var(--danger-edge); }
.hv-notice > p { flex: 1; margin: 0; }

/* Transfer whisper: what the salesperson heard before connecting */
.hv-whisper { margin-top: 8px; padding: 10px 12px; border-left: 2px solid var(--signal); background: var(--signal-dim); }
.hv-whisper--missed { border-left-color: var(--warn); background: var(--warn-dim); }

/* Photo-card match: tile + name + km + "listing link". Never a price.
   The tile is an <img> slot on a neutral plate; never a remote URL. */
.hv-matches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.hv-match { display: flex; flex-direction: column; gap: 4px; width: 150px; padding: 6px; border: 1px solid var(--card-edge); }
.hv-match__tile {
    display: grid;
    place-items: center;
    width: 100%;
    height: 70px;
    border: 1px solid var(--card-edge);
    background: linear-gradient(135deg, var(--card-hi), var(--card));
    color: var(--ink-2);
    font-size: var(--t-label);
    object-fit: cover;
}
.hv-match__name { font-size: var(--t-small); font-weight: 600; }
.hv-match__km { color: var(--ink-2); font-family: var(--font-mono); font-size: var(--t-label); }
.hv-match__link { color: var(--bone); font-size: var(--t-label); }

/* ══ 9c · Home: the headline card and the figure grid (D18) ═══════════ */

.hv-hl__t {
    margin: 10px 0 0;
    font-family: var(--font-display);
    font-weight: 800;
    font-stretch: 112%;
    font-size: var(--t-display);
    letter-spacing: -0.025em;
    line-height: 1.05;
    text-wrap: balance;
}
.hv-hl__t small { display: block; margin-bottom: 8px; color: var(--ink-2); font-family: var(--font-body); font-weight: 500; font-stretch: 100%; font-size: var(--t-title); letter-spacing: 0; }
.hv-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; border: 1px solid var(--row-edge); background: var(--row-edge); }
.hv-fig { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; background: var(--card); color: inherit; text-decoration: none; }
.hv-fig__v { font-family: var(--font-display); font-weight: 800; font-stretch: 112%; font-size: var(--t-figure); font-variant-numeric: tabular-nums; letter-spacing: -0.03em; line-height: 1.05; white-space: nowrap; }
/* An incomplete last line spreads across. */
.hv-figs > :last-child:nth-child(3n + 1) { grid-column: 1 / -1; }
.hv-figs > :last-child:nth-child(3n + 2) { grid-column: span 2; }

/* ══ 9d · The layout pass (core/layout.js): a line of cards ends on one edge ══ */

.hv-grid--measure { align-items: start; }
.hv-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--hv-gut); }
.hv-joined { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); border: 1px solid var(--glass-edge); background-color: var(--card); }
.hv-joined > .hv-panel { border: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.hv-joined > .hv-panel + .hv-panel { border-left: 1px solid var(--row-edge); }

/* ══ 9e · Motion: one entrance per card container, never replayed (D18) ══ */

@keyframes hv-rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes hv-fade { from { opacity: 0; } }
.hv-enter .hv-grid > * { animation: hv-rise 160ms var(--ease) both; animation-delay: var(--hv-cd); }
.hv-async--in { animation: hv-fade 160ms var(--ease) both; }

/* ══ 9f · Phones: the lead drawer, labelled rows, swiping boards ══ */

.hv-board-hint { display: none; }

/* ══ 10 · Dev gallery (views/hub/gallery.ejs, never in production) ═════ */

.hv-gallery { padding: calc(var(--hv-gut) * 3) var(--hv-gut) calc(var(--hv-gut) * 6); background: var(--sheet); }
.hv-gallery__item { margin-top: 40px; }
.hv-gallery__h {
    margin: 0 0 14px;
    color: var(--ink-2);
    font-size: var(--t-small);
    font-weight: 500;
}
.hv-gallery__row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
/* Overlays are shown open, in place, inside a stage box */
.hv-gallery__stage {
    position: relative;
    min-height: 220px;
    overflow: hidden;
    border: 1px dashed var(--card-edge);
}
.hv-gallery__stage > .hv-drawer,
.hv-gallery__stage > .hv-modal,
.hv-gallery__stage > .hv-pop,
.hv-gallery__stage > .hv-toasts,
.hv-gallery__stage > .hv-tip,
.hv-gallery__stage > .hv-cmdk,
.hv-gallery__stage > .hv-scrim,
.hv-gallery__stage > .hv-frame { position: absolute; }
.hv-gallery__stage > .hv-tip { left: 20px; top: 20px; }
.hv-gallery__stage > .hv-pop { left: 20px; top: 20px; }
.hv-gallery__stage--tall { min-height: 560px; }

/* ══ 11 · Width: desktop-first, nothing breaks at 390px ═══════════════ */

@media (max-width: 900px) {
    .hv-sh { grid-template-columns: 1fr; gap: 12px; }
    .hv-sh__acts { justify-content: flex-start; }
}
@media (max-width: 720px) {
    .hv-wrap { padding: 0 var(--hv-gut); }
    .hv-grid > * { grid-column: 1 / -1; }
    .hv-frow,
    .hv-kv { grid-template-columns: 1fr; }
    .hv-ph { padding: 22px 16px 4px; }
    .hv-status { padding-right: var(--hv-gut); padding-left: var(--hv-gut); }
    .hv-slide { padding-bottom: 40px; }
    .hv-sh--page { align-items: flex-start; }
    .hv-drawer { width: 100%; }
    /* A head's meta and a foot's note + buttons take their own line rather
       than squeeze the title into a column or push a button out of the panel
       (the operator sign-in's code stage at 390px). */
    .hv-panel__head,
    .hv-panel__foot { flex-wrap: wrap; }
}
@media (max-width: 820px) {
    .hv-lead-detail { display: none; }
    .hv-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .hv-table :is(tbody, tr, td) { display: block; }
    .hv-table tr { padding: 8px 0; border-bottom: 1px solid var(--row-edge); }
    .hv-table td { display: flex; gap: 12px; justify-content: space-between; padding: 4px 0; border: 0; text-align: right; }
    .hv-table td[data-label]::before { content: attr(data-label); color: var(--ink-2); font-size: var(--t-label); text-align: left; }
    .hv-board { scroll-snap-type: x mandatory; grid-auto-columns: 82%; }
    .hv-board__col { scroll-snap-align: start; }
    .hv-board-hint { display: block; margin-bottom: 8px; color: var(--ink-2); font-size: var(--t-small); }
    .hv-grid > .hv-stat { grid-column: span 6; }
    .hv-grid > .hv-stat:nth-child(odd of .hv-stat):nth-last-child(1 of .hv-stat) { grid-column: 1 / -1; }
    .hv-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .hv-figs > :last-child:is(:nth-child(3n + 1), :nth-child(3n + 2)) { grid-column: auto; }
    .hv-figs > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
    .hv-modal { width: 100%; max-height: 100%; height: 100%; }
    .hv-matches { flex-direction: column; }
    .hv-match { width: 100%; }
}

/* ══ 11b · Phones: iOS zooms into a field under 16px and does not zoom back; a thumb needs 44 x 44 ══ */

@media (max-width: 639.98px) {
    .hv-app :is(input:not([type=checkbox], [type=radio]), select, textarea) { font-size: var(--t-touch); }
    .hv-app :is(.hv-field, .hv-btn, .hv-chip, .hv-switch, .hv-search, .hv-acct, .hv-icon-btn, .hv-ws, .hv-av--btn,
        .hv-tab, .hv-skip, .hv-seg button, button.hv-link, a.hv-link, select) {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ══ 12 · Reduced motion: every animation and transition off ══════════ */

@media (prefers-reduced-motion: reduce) {
    .hv-app *,
    .hv-app *::before,
    .hv-app *::after {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
