/* =============================================================================
   Homla shell (owner: shell area). Loaded right after homla.css, before the
   other area stylesheets, so every screen can use the DS classes below.

   Part A  Missing Plan tokens (type scale, space, size, motion, z, skeleton).
   Part B  Homla DS components, verbatim from 05-production/ds/homla-ds.css
           sections 3 to 24 (every selector is .h-* or .u-*; nothing legacy).
           Area files may restyle these; they load after this file.
   Part C  App shell + Home, mapped onto index.html / app.js markup.
   ============================================================================= */

/* ------------------------------------------------------------- A. Tokens */
:root {
  --fs-11: 11px; --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-15: 15px; --fs-17: 17px;
  --fs-20: 20px; --fs-24: 24px; --fs-30: 30px; --fs-36: 36px; --fs-48: 48px;
  --lh-tight: 1.1; --lh-snug: 1.3; --lh-body: 1.5;
  --s-0: 0; --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px;
  --s-7: 28px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;
  --side-w: 240px; --top-h: 56px; --aside-w: 340px; --content-max: 1200px;
  --dur-1: 90ms; --dur-2: 160ms; --dur-3: 240ms; --dur-4: 360ms;
  --z-sticky: 10; --z-side: 20; --z-drop: 40; --z-drawer: 60; --z-modal: 70; --z-toast: 80; --z-tip: 90;
  --chart-grid: #E3E0D9; --skel: #EFEDE8; --skel-hi: #F7F6F3;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --chart-grid: #2E2A26; --skel: #1F1C19; --skel-hi: #2A2622; }
}
:root[data-theme="dark"] { --chart-grid: #2E2A26; --skel: #1F1C19; --skel-hi: #2A2622; }

/* Legacy element rules (p, h1-h3, pre, label margins) must not leak into DS
   components. Zero-specificity container + element = ties the legacy element
   rule, and this file loads later, so the DS spacing wins. */
:where([class^="h-"], [class*=" h-"]) :is(h1, h2, h3, h4, p, ul, ol, dl, figure, pre) { margin: 0; }
:where([class^="h-"], [class*=" h-"]) :is(ul, ol)[class] { list-style: none; padding: 0; }

/* ------------------------------------------------- B. DS type helpers */
.h-display { font: 300 var(--fs-36)/var(--lh-tight) var(--font-display); letter-spacing: var(--track-display); }
.h-title   { font: 400 var(--fs-24)/1.2 var(--font-display); letter-spacing: var(--track-title); }
.h-h2      { font: 500 var(--fs-17)/var(--lh-snug) var(--font-sans); letter-spacing: -0.01em; }
.h-h3      { font: 500 var(--fs-15)/var(--lh-snug) var(--font-sans); }
.h-lead    { font-size: var(--fs-15); color: var(--text-2); max-width: 68ch; }
.h-body    { font-size: var(--fs-14); }
.h-small   { font-size: var(--fs-13); }
.h-caption { font-size: var(--fs-12); color: var(--text-2); }
.h-eyebrow { font: 500 var(--fs-11)/1.3 var(--font-mono); letter-spacing: var(--track-mono); text-transform: uppercase; color: var(--text-2); }
.h-mono    { font-family: var(--font-mono); font-size: var(--fs-13); }
.h-muted   { color: var(--text-2); }
.h-num     { font-variant-numeric: tabular-nums; }
.h-strong  { font-weight: 500; color: var(--text); }
.h-link    { color: var(--link); text-decoration: underline; text-underline-offset: 2px; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.h-link--quiet { color: var(--text); text-decoration-color: var(--line-strong); }
.h-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.h-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.h-sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.h-i--12 { width: 12px; height: 12px; } .h-i--20 { width: 20px; height: 20px; } .h-i--24 { width: 24px; height: 24px; } .h-i--32 { width: 32px; height: 32px; stroke-width: 1.25; }

/* ------------------------------------------------- B. DS components (verbatim) */
/* ---------------------------------------------------------------- 3. Layout */
/* Flex/grid helpers */
.h-row { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.h-row--wrap { flex-wrap: wrap; }
.h-row--between { justify-content: space-between; }
.h-row--end { justify-content: flex-end; }
.h-row--top { align-items: flex-start; }
.h-stack { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.h-stack--2 { gap: var(--s-2); } .h-stack--4 { gap: var(--s-4); } .h-stack--6 { gap: var(--s-6); } .h-stack--8 { gap: var(--s-8); }
.h-grow { flex: 1 1 auto; min-width: 0; }
.h-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.h-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.h-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.h-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.h-grid--sm { grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
.h-divider { height: 1px; background: var(--line); border: 0; margin: var(--s-4) 0; }

/* App shell: sidebar 240 + content */
.h-app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.h-main { min-width: 0; display: flex; flex-direction: column; }

/* Sidebar */
.h-side {
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; z-index: var(--z-side);
  display: flex; flex-direction: column; gap: var(--s-5); padding: var(--s-4) var(--s-3) var(--s-3);
  border-right: 1px solid var(--line); background: var(--bg-canvas);
}
.h-side__brand { display: flex; align-items: center; justify-content: space-between; padding: var(--s-1) var(--s-2) 0; }
.h-side__brand img { height: 17px; width: auto; }
.h-side__spacer { flex: 1 1 auto; }
.h-side__foot { display: flex; flex-direction: column; gap: var(--s-2); }

/* Workspace switcher (top of sidebar) */
.h-ws {
  display: flex; align-items: center; gap: var(--s-2); width: 100%; padding: 7px 8px 7px 7px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-surface); color: var(--text);
  text-align: left; transition: border-color var(--dur-2) var(--ease);
}
.h-ws:hover { border-color: var(--line-strong); }
.h-ws[aria-expanded="true"] { border-color: var(--line-control); }
.h-ws__mark { width: 24px; height: 24px; border-radius: var(--r-sm); display: grid; place-items: center; flex: none; background: var(--inverse); color: var(--on-inverse); font: 500 11px/1 var(--font-mono); }
.h-ws__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.h-ws__name { font-weight: 500; font-size: var(--fs-13); line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-ws__meta { font-size: var(--fs-12); color: var(--text-2); line-height: 1.25; }
.h-ws .h-i { color: var(--text-2); }

/* Nav */
.h-nav { display: flex; flex-direction: column; gap: var(--s-4); }
.h-nav__group { display: flex; flex-direction: column; gap: 1px; }
.h-nav__label { font: 500 var(--fs-11)/1.3 var(--font-mono); letter-spacing: var(--track-mono); text-transform: uppercase; color: var(--text-2); padding: 0 var(--s-2) var(--s-1); }
.h-nav__item {
  position: relative; display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 6px var(--s-2);
  border-radius: var(--r-sm); color: var(--text-2); text-decoration: none; font-size: var(--fs-14);
  transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease);
}
.h-nav__item:hover { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.h-nav__item[aria-current="page"], .h-nav__item.is-active { background: var(--bg-surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.h-nav__item[aria-current="page"]::after, .h-nav__item.is-active::after { content: ""; width: 6px; height: 6px; background: var(--brand); margin-left: auto; flex: none; }
.h-nav__item .h-count, .h-nav__item .h-pill { margin-left: auto; }
.h-nav__item[aria-current="page"] .h-count { margin-left: auto; }
.h-nav__item[aria-current="page"]:has(.h-count)::after { margin-left: 8px; }
.h-nav__sub { display: flex; flex-direction: column; gap: 1px; padding-left: 26px; }
.h-nav__sub .h-nav__item { min-height: 28px; font-size: var(--fs-13); }

/* Usage meter block at the bottom of the sidebar */
.h-usage { padding: var(--s-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-surface); display: flex; flex-direction: column; gap: var(--s-2); }
.h-usage__row { display: flex; justify-content: space-between; gap: var(--s-2); font-size: var(--fs-12); color: var(--text-2); }
.h-usage__row b { font-weight: 500; color: var(--text); font-variant-numeric: tabular-nums; }
.hb-side-usage__plan { align-items: flex-start; }
.hb-side-usage__name { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.hb-side-usage__name #side-plan-name { color: var(--text); font-size: var(--fs-14); }
.hb-side-usage__free { color: var(--text-2); font-size: var(--fs-12); line-height: 1.25; }
.hb-side-usage__plan #side-plan-price { display: flex; min-width: 0; flex: 0 0 auto; flex-direction: column; align-items: flex-end; gap: 2px; max-width: 52%; text-align: right; }
.hb-side-usage__plan #side-plan-price .hb-side-usage__free-price { color: var(--text); font-size: var(--fs-14); line-height: 1.2; }
.hb-side-usage__plan #side-plan-price .hb-side-usage__normal-price { color: var(--text-2); font-size: var(--fs-12); line-height: 1.2; white-space: nowrap; }

/* User block */
.h-user { display: flex; align-items: center; gap: 10px; width: 100%; padding: var(--s-2); border: 0; border-radius: var(--r-sm); background: transparent; text-align: left; color: var(--text); }
.h-user:hover { background: var(--bg-hover); }
.h-user__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.h-user__email { font-size: var(--fs-13); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-user__team { font-size: var(--fs-12); color: var(--text-2); }

/* Top bar */
.h-top {
  position: sticky; top: 0; z-index: var(--z-sticky); height: var(--top-h); flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 0 var(--s-7);
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg-canvas) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(8px); -webkit-backdrop-filter: saturate(1.2) blur(8px);
}
.h-top__left, .h-top__right { display: flex; align-items: center; gap: var(--s-2); min-width: 0; }
.h-top__menu { display: none; }
.h-top__brand { display: none; }

/* Cmd+K hint in the top bar */
.h-cmdk-hint {
  display: inline-flex; align-items: center; gap: var(--s-2); height: var(--ctl-h-sm); min-width: 240px; padding: 0 6px 0 10px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-surface); color: var(--text-2); font-size: var(--fs-13);
}
.h-cmdk-hint:hover { border-color: var(--line-strong); color: var(--text); }
.h-cmdk-hint span { flex: 1; text-align: left; }

/* Breadcrumb */
.h-crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--fs-14); color: var(--text-2); }
.h-crumbs a { color: var(--text-2); text-decoration: none; white-space: nowrap; }
.h-crumbs a:hover { color: var(--text); text-decoration: underline; }
.h-crumbs__sep { color: var(--line-strong); }
.h-crumbs [aria-current="page"] { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Page */
.h-page { width: 100%; max-width: var(--content-max); padding: var(--s-8) var(--s-7) var(--s-16); }
.h-page--wide { max-width: none; }
.h-page--narrow { max-width: 760px; }
.h-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; margin-bottom: var(--s-6); }
.h-page-head__title { font: 300 var(--fs-36)/var(--lh-tight) var(--font-display); letter-spacing: var(--track-display); margin: 0 0 var(--s-2); }
.h-page-head__sub { color: var(--text-2); font-size: var(--fs-15); max-width: 68ch; }
.h-page-head__actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.h-page-head .h-back { margin-bottom: var(--s-3); }
.h-toolbar { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-4); }
.h-toolbar .h-search { flex: 1 1 240px; max-width: 360px; }
.h-section { margin-top: var(--s-10); }
.h-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); flex-wrap: wrap; }
.h-section__title { font: 500 var(--fs-17)/var(--lh-snug) var(--font-sans); letter-spacing: -0.01em; }
.h-section__sub { color: var(--text-2); font-size: var(--fs-13); }

/* Two-column detail: main + 340 aside */
.h-split { display: grid; grid-template-columns: minmax(0, 1fr) var(--aside-w); gap: var(--s-6); align-items: start; }
.h-split--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.h-split__aside { display: flex; flex-direction: column; gap: var(--s-4); position: sticky; top: calc(var(--top-h) + var(--s-4)); }

/* Sticky save bar (forms) */
.h-savebar { position: sticky; bottom: 0; z-index: var(--z-sticky); display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); margin-top: var(--s-6); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); box-shadow: var(--shadow-2); }

/* Responsive */
@media (max-width: 1100px) {
  .h-split { grid-template-columns: minmax(0, 1fr); }
  .h-split__aside { position: static; }
  .h-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .h-grid--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .h-app { grid-template-columns: minmax(0, 1fr); }
  /* Sidebar collapses into a top brand row + one horizontal nav bar */
  .h-side { position: sticky; top: 0; height: auto; overflow: visible; flex-direction: column; gap: 0; padding: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .h-side__brand { height: 52px; padding: 0 var(--s-4); }
  .h-side .h-ws { display: none; }
  .h-side .h-nav { flex-direction: row; gap: 0; overflow-x: auto; scrollbar-width: none; padding: 0 var(--s-3) var(--s-2); }
  .h-side .h-nav::-webkit-scrollbar { display: none; }
  .h-side .h-nav__group { flex-direction: row; gap: 2px; flex: none; }
  .h-side .h-nav__group + .h-nav__group { border-left: 1px solid var(--line); margin-left: 6px; padding-left: 6px; }
  .h-side .h-nav__label, .h-side .h-nav__sub, .h-side__spacer, .h-side .h-usage, .h-side .h-user, .h-side__foot { display: none; }
  .h-side .h-nav__item { white-space: nowrap; min-height: 32px; font-size: var(--fs-13); }
  .h-side .h-nav__item .h-i { display: none; }
  .h-side .h-nav__item[aria-current="page"]::after { display: none; }
  .h-side .h-nav__item[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--brand), inset 0 0 0 1px var(--line); }
  .h-side__mobile-actions { display: flex !important; }
  .h-top { position: static; padding: 0 var(--s-4); height: 48px; }
  .h-top .h-cmdk-hint { min-width: 0; }
  .h-top .h-cmdk-hint span, .h-top .h-cmdk-hint .h-kbd { display: none; }
  .h-page { padding: var(--s-6) var(--s-4) var(--s-12); }
  .h-page-head__title { font-size: var(--fs-30); }
  .h-page-head__actions { width: 100%; }
  .h-page-head__actions .h-btn--primary { flex: 1 1 auto; }
  .h-toolbar .h-search { max-width: none; flex-basis: 100%; }
  .h-grid--2, .h-grid--3, .h-split--even { grid-template-columns: minmax(0, 1fr); }
  .h-grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.h-side__mobile-actions { display: none; align-items: center; gap: var(--s-1); }

/* -------------------------------------------------------------- 4. Buttons */
.h-btn {
  --_h: var(--ctl-h);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); height: var(--_h); padding: 0 14px;
  border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-surface); color: var(--text);
  font: 500 var(--fs-13)/1 var(--font-sans); letter-spacing: -0.005em; white-space: nowrap; text-decoration: none;
  transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease), color var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
  user-select: none; position: relative;
}
.h-btn:hover { border-color: var(--line-strong); background: var(--bg-hover); text-decoration: none; }
.h-btn:active { transform: translateY(1px); }
.h-btn .h-i { width: 14px; height: 14px; }
.h-btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.h-btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.h-btn--secondary { /* default look, named for clarity */ }
.h-btn--ghost { background: transparent; border-color: transparent; color: var(--text); }
.h-btn--ghost:hover { background: var(--bg-hover); border-color: transparent; }
.h-btn--danger { background: var(--bg-surface); border-color: var(--line); color: var(--danger); }
.h-btn--danger:hover { background: var(--danger-tint); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.h-btn--danger-solid { background: var(--danger-solid); border-color: var(--danger-solid); color: var(--on-danger); }
.h-btn--danger-solid:hover { background: color-mix(in srgb, var(--danger-solid) 88%, var(--text)); }
.h-btn--sm { --_h: var(--ctl-h-sm); padding: 0 10px; font-size: var(--fs-12); gap: 6px; border-radius: var(--r-sm); }
.h-btn--xs { --_h: 22px; padding: 0 7px; font-size: var(--fs-12); gap: 4px; border-radius: var(--r-sm); }
.h-btn--lg { --_h: var(--ctl-h-lg); padding: 0 18px; font-size: var(--fs-14); }
.h-btn--block { width: 100%; }
.h-btn--icon { width: var(--_h); padding: 0; }
.h-btn--icon.h-btn--sm { width: var(--ctl-h-sm); }
.h-btn:disabled, .h-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.h-btn.is-loading { color: transparent !important; pointer-events: none; }
.h-btn.is-loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid currentColor; border-color: var(--text) var(--text) transparent transparent; animation: h-spin .7s linear infinite; }
.h-btn--primary.is-loading::after { border-color: var(--on-accent) var(--on-accent) transparent transparent; }
.h-btn.is-hover { border-color: var(--line-strong); background: var(--bg-hover); }
.h-btn--primary.is-hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.h-btn.is-focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.h-btn-group { display: inline-flex; }
.h-btn-group .h-btn { border-radius: 0; }
.h-btn-group .h-btn + .h-btn { margin-left: -1px; }
.h-btn-group .h-btn:first-child { border-radius: var(--r-md) 0 0 var(--r-md); }
.h-btn-group .h-btn:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
@keyframes h-spin { to { transform: rotate(360deg); } }

/* Spinner on its own */
.h-spinner { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line-strong); border-top-color: var(--text); animation: h-spin .7s linear infinite; display: inline-block; flex: none; }

/* Back link */
.h-back { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: var(--fs-13); text-decoration: none; }
.h-back:hover { color: var(--text); text-decoration: underline; }

/* Keyboard key */
.h-kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: var(--r-sm); background: var(--bg-canvas); color: var(--text-2); font: 500 11px/1 var(--font-mono); }

/* ------------------------------------------------------- 5. Pills and tags */
.h-pill {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 7px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: var(--bg-sunken); color: var(--text);
  font: 500 var(--fs-11)/1 var(--font-mono); letter-spacing: var(--track-mono); text-transform: uppercase; white-space: nowrap;
}
.h-pill .h-i { width: 12px; height: 12px; }
.h-pill--ok     { background: var(--ok-tint); color: var(--ok); }
.h-pill--warn   { background: var(--warn-tint); color: var(--warn); }
.h-pill--danger { background: var(--danger-tint); color: var(--danger); }
.h-pill--info   { background: var(--info-tint); color: var(--info); }
.h-pill--outline { background: transparent; border-color: var(--line-strong); color: var(--text-2); }
.h-pill--solid  { background: var(--inverse); color: var(--on-inverse); }
.h-pill--scope  { background: transparent; border-color: var(--line-control); color: var(--text); }  /* Read / Write / Personal / Shared */
.h-pill--hot    { background: var(--tint); color: var(--on-tint); }   /* New, Popular: terracotta, use once per view */
.h-pill--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Agent status: sentence case, round dot. Active / Paused / Waiting / Needs you / Error */
.h-status { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px 0 7px; border-radius: var(--r-pill); font-size: var(--fs-12); font-weight: 500; background: var(--bg-sunken); color: var(--text-2); white-space: nowrap; }
.h-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.h-status--on { background: var(--ok-tint); color: var(--ok); }
.h-status--on::before { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }
.h-status--running::before { animation: h-pulse 1.4s var(--ease) infinite; }
.h-status--paused::before { border-radius: 1px; width: 6px; height: 7px; background: none; border-left: 2px solid currentColor; border-right: 2px solid currentColor; }
.h-status--waiting { background: var(--info-tint); color: var(--info); }
.h-status--warn { background: var(--warn-tint); color: var(--warn); }
.h-status--bad { background: var(--danger-tint); color: var(--danger); }
@keyframes h-pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* Agent / skill tags: small, sentence case, quiet */
.h-tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-surface); color: var(--text-2); font-size: var(--fs-12); white-space: nowrap; }
.h-tag--mono { font-family: var(--font-mono); font-size: 11.5px; }
.h-tag--warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); color: var(--warn); background: var(--warn-tint); }
.h-tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* Capability marks, from the Plan access table */
.h-cap { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; font-size: var(--fs-13); color: var(--text); }
.h-cap::before { content: ""; width: 8px; height: 8px; border-radius: 2px; border: 1px solid var(--line-control); flex: none; }
.h-cap--read::before { background: var(--text-2); border-color: var(--text-2); }
.h-cap--write::before { background: var(--text); border-color: var(--text); }
.h-cap--destructive::before { background: var(--danger); border-color: var(--danger); }
.h-cap--none { color: var(--text-2); }

/* Count bubble */
.h-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-pill); background: var(--bg-sunken); color: var(--text); font: 500 11px/1 var(--font-mono); font-variant-numeric: tabular-nums; }
.h-count--strong { background: var(--inverse); color: var(--on-inverse); }

/* Status dot alone */
.h-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-2); display: inline-block; flex: none; }
.h-dot--ok { background: var(--ok); } .h-dot--warn { background: var(--warn); } .h-dot--danger { background: var(--danger); } .h-dot--info { background: var(--info); }

/* --------------------------------------------------------------- 6. Forms */
.h-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.h-field + .h-field { margin-top: var(--s-4); }
:is(.h-grid, .h-stack, .h-row, .h-form-row, .h-approval__edit, .h-split) > .h-field + .h-field { margin-top: 0; }
.h-label { font-size: var(--fs-13); font-weight: 500; color: var(--text); }
.h-label__opt { font-weight: 400; color: var(--text-2); }
.h-hint { font-size: var(--fs-12); color: var(--text-2); }
.h-error-text { font-size: var(--fs-12); color: var(--danger); display: flex; align-items: center; gap: 5px; }
.h-input, .h-select, .h-textarea {
  width: 100%; min-width: 0; height: var(--ctl-h); padding: 0 10px; border: 1px solid var(--line-control); border-radius: var(--r-md);
  background: var(--bg-surface); color: var(--text); font-size: var(--fs-14);
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.h-input::placeholder, .h-textarea::placeholder { color: var(--text-2); opacity: 1; }
.h-input:hover, .h-select:hover, .h-textarea:hover { border-color: var(--text-2); }
.h-input:focus, .h-select:focus, .h-textarea:focus, .h-input.is-focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 12%, transparent); }
.h-input:disabled, .h-select:disabled, .h-textarea:disabled { background: var(--bg-sunken); opacity: .6; cursor: not-allowed; }
.h-input[readonly] { background: var(--bg-sunken); }
.h-input.is-error, .h-input[aria-invalid="true"], .h-textarea[aria-invalid="true"] { border-color: var(--danger); }
.h-input.is-error:focus, .h-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }
.h-input--mono { font-family: var(--font-mono); font-size: var(--fs-13); }
.h-input--sm { height: var(--ctl-h-sm); font-size: var(--fs-13); }
.h-textarea { height: auto; min-height: 88px; padding: 8px 10px; line-height: 1.5; resize: vertical; }
.h-select { appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A8279' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-size: 14px; }
.h-input-group { display: flex; align-items: stretch; min-width: 0; }
.h-input-group > .h-input { border-radius: var(--r-md) 0 0 var(--r-md); }
.h-input-group > .h-btn { border-radius: 0 var(--r-md) var(--r-md) 0; margin-left: -1px; height: var(--ctl-h); border-color: var(--line-control); }
.h-input-affix { display: flex; align-items: center; height: var(--ctl-h); border: 1px solid var(--line-control); border-radius: var(--r-md); background: var(--bg-surface); padding: 0 10px; gap: 8px; min-width: 0; }
.h-input-affix:focus-within { border-color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 12%, transparent); }
.h-input-affix input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; height: 100%; padding: 0; font-size: var(--fs-14); }
.h-input-affix__pre { color: var(--text-2); font-family: var(--font-mono); font-size: var(--fs-13); }
.h-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: var(--s-4); }

/* Search field */
.h-search { position: relative; display: flex; align-items: center; min-width: 0; }
.h-search .h-i { position: absolute; left: 10px; color: var(--text-2); pointer-events: none; }
.h-search .h-input { padding-left: 32px; padding-right: 36px; }
.h-search .h-kbd { position: absolute; right: 7px; }
.h-search--sunken .h-input { background: var(--bg-sunken); border-color: transparent; }
.h-search--sunken .h-input:focus { background: var(--bg-surface); border-color: var(--text); }

/* Checkbox and radio (native, restyled) */
.h-check, .h-radio { display: inline-flex; align-items: flex-start; gap: 9px; font-size: var(--fs-14); color: var(--text); cursor: pointer; line-height: 1.4; }
.h-check input, .h-radio input {
  appearance: none; -webkit-appearance: none; flex: none; width: 16px; height: 16px; margin: 1px 0 0; border: 1px solid var(--line-control);
  background: var(--bg-surface); display: grid; place-items: center; cursor: pointer; transition: background var(--dur-1) var(--ease), border-color var(--dur-1) var(--ease);
}
.h-check input { border-radius: var(--r-sm); }
.h-radio input { border-radius: 50%; }
.h-check input:hover, .h-radio input:hover { border-color: var(--text); }
.h-check input:checked, .h-check input:indeterminate { background: var(--accent); border-color: var(--accent); }
.h-check input:checked::after { content: ""; width: 9px; height: 5px; border-left: 1.75px solid var(--on-accent); border-bottom: 1.75px solid var(--on-accent); transform: translateY(-1px) rotate(-45deg); }
.h-check input:indeterminate::after { content: ""; width: 8px; height: 1.75px; background: var(--on-accent); }
.h-radio input:checked { border: 5px solid var(--accent); }
.h-check input:disabled, .h-radio input:disabled { opacity: .45; cursor: not-allowed; }
.h-check:has(input:disabled), .h-radio:has(input:disabled) { color: var(--text-2); cursor: not-allowed; }
.h-check__hint { display: block; font-size: var(--fs-12); color: var(--text-2); }

/* Switch: square-ish, like the Plan drawing */
.h-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-14); }
.h-switch input { appearance: none; -webkit-appearance: none; position: relative; width: 32px; height: 18px; margin: 0; flex: none; border-radius: var(--r-sm); border: 1px solid var(--line-control); background: var(--bg-sunken); cursor: pointer; transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease); }
.h-switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 2px; background: var(--text-2); transition: transform var(--dur-2) var(--ease-out), background var(--dur-2) var(--ease); }
.h-switch input:checked { background: var(--accent); border-color: var(--accent); }
.h-switch input:checked::after { transform: translateX(14px); background: var(--on-accent); }
.h-switch input:disabled { opacity: .45; cursor: not-allowed; }
.h-switch:has(input:disabled) { color: var(--text-2); cursor: not-allowed; }
.h-switch--row { display: flex; justify-content: space-between; width: 100%; padding: var(--s-3) 0; border-top: 1px solid var(--line); }

/* Segmented control */
.h-seg { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-canvas); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.h-seg__btn { height: 26px; padding: 0 10px; border: 0; border-radius: 4px; background: transparent; color: var(--text-2); font-size: var(--fs-13); white-space: nowrap; transition: background var(--dur-1) var(--ease), color var(--dur-1) var(--ease); display: inline-flex; align-items: center; gap: 6px; }
.h-seg__btn:hover { color: var(--text); }
.h-seg__btn[aria-pressed="true"], .h-seg__btn[aria-checked="true"], .h-seg__btn.is-on { background: var(--bg-surface); color: var(--text); box-shadow: 0 0 0 1px var(--line-control); }
.h-seg__btn:disabled { opacity: .45; cursor: not-allowed; }
.h-seg--sm .h-seg__btn { height: 22px; padding: 0 8px; font-size: var(--fs-12); }
.h-seg--block { display: flex; } .h-seg--block .h-seg__btn { flex: 1; justify-content: center; }

/* Radio option cards (access level, role, plan, runner) */
.h-opts { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); overflow: hidden; }
.h-opts--grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: var(--s-3); border: 0; background: none; overflow: visible; }
.h-opt { position: relative; display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3) var(--s-4); cursor: pointer; background: var(--bg-surface); transition: background var(--dur-1) var(--ease); }
.h-opts:not(.h-opts--grid) .h-opt + .h-opt { border-top: 1px solid var(--line); }
.h-opts--grid .h-opt { border: 1px solid var(--line); border-radius: var(--r-lg); }
.h-opt:hover { background: var(--bg-hover); }
.h-opt input { appearance: none; -webkit-appearance: none; flex: none; width: 16px; height: 16px; margin: 2px 0 0; border: 1px solid var(--line-control); border-radius: 50%; background: var(--bg-surface); }
.h-opt input:checked { border: 5px solid var(--accent); }
.h-opt:has(input:checked) { background: var(--bg-surface); }
.h-opts--grid .h-opt:has(input:checked) { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.h-opts:not(.h-opts--grid) .h-opt:has(input:checked) { box-shadow: inset 2px 0 0 var(--text); }
.h-opt:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.h-opt__icon { width: 32px; height: 32px; border-radius: var(--r-md); border: 1px solid var(--line); display: grid; place-items: center; flex: none; color: var(--text); background: var(--bg-canvas); }
.h-opt__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.h-opt__label { font-weight: 500; font-size: var(--fs-14); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.h-opt__desc { font-size: var(--fs-13); color: var(--text-2); }

/* Checkbox tree with group ticks (tools by Read / Write / Destructive, roles) */
.h-tree { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); overflow: hidden; }
.h-tree__group + .h-tree__group { border-top: 1px solid var(--line); }
.h-tree__head { display: flex; align-items: center; gap: var(--s-3); padding: 10px var(--s-4); background: var(--bg-canvas); }
.h-tree__head .h-check { font-weight: 500; flex: 1; }
.h-tree__head .h-chev { color: var(--text-2); transition: transform var(--dur-2) var(--ease); }
.h-tree__group[open] > .h-tree__head .h-chev, .h-tree__group.is-open > .h-tree__head .h-chev { transform: rotate(90deg); }
.h-tree__head summary { list-style: none; }
.h-tree__items { display: flex; flex-direction: column; padding: 6px var(--s-4) 10px 42px; gap: 2px; }
.h-tree__item { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); padding: 5px 0; }
.h-tree__item .h-check { font-family: var(--font-mono); font-size: var(--fs-13); }
.h-tree__desc { font-size: var(--fs-12); color: var(--text-2); font-family: var(--font-sans); display: block; }
.h-tree__group--destructive .h-tree__head { background: var(--danger-tint); }
.h-tree__group--destructive .h-tree__head .h-check { color: var(--danger); }

/* Type-ahead combo */
.h-combo { position: relative; min-width: 0; }
.h-combo__list { position: absolute; z-index: var(--z-drop); top: calc(100% + 4px); left: 0; right: 0; max-height: 280px; overflow-y: auto; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-surface); box-shadow: var(--shadow-2); }
.h-combo__list--static { position: static; margin-top: 4px; }
.h-combo__sec { padding: 8px 8px 4px; font: 500 var(--fs-11)/1.3 var(--font-mono); letter-spacing: var(--track-mono); text-transform: uppercase; color: var(--text-2); display: flex; justify-content: space-between; }
.h-combo__opt { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--r-sm); cursor: pointer; font-size: var(--fs-14); }
.h-combo__opt:hover, .h-combo__opt[aria-selected="true"], .h-combo__opt.is-active { background: var(--bg-sunken); }
.h-combo__opt mark { background: none; color: var(--text); font-weight: 600; }
.h-combo__opt small { margin-left: auto; color: var(--text-2); font-size: var(--fs-12); }
.h-combo__empty { padding: 10px 8px; color: var(--text-2); font-size: var(--fs-13); }

/* Chip picker (people, channels, senders) */
.h-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: var(--ctl-h); padding: 4px 6px; border: 1px solid var(--line-control); border-radius: var(--r-md); background: var(--bg-surface); cursor: text; }
.h-chips:focus-within { border-color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 12%, transparent); }
.h-chips input { flex: 1 1 120px; min-width: 80px; border: 0; outline: 0; background: transparent; height: 24px; font-size: var(--fs-14); }
.h-chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 4px 0 8px; border-radius: var(--r-sm); background: var(--bg-sunken); font-size: var(--fs-13); color: var(--text); white-space: nowrap; }
.h-chip__x { display: grid; place-items: center; width: 18px; height: 18px; border: 0; border-radius: 2px; background: transparent; color: var(--text-2); padding: 0; }
.h-chip__x:hover { background: var(--line); color: var(--text); }
.h-chip .h-avatar { margin-left: -4px; }

/* Filter chips (toggle) */
.h-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.h-filter { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--bg-surface); color: var(--text); font-size: var(--fs-13); white-space: nowrap; transition: border-color var(--dur-1) var(--ease); }
.h-filter:hover { border-color: var(--line-strong); }
.h-filter[aria-pressed="true"], .h-filter.is-on { border-color: var(--text); box-shadow: inset 0 0 0 0.5px var(--text); }
.h-filter .h-count { height: 16px; min-width: 16px; font-size: 10.5px; }
.h-filter--add { border-style: dashed; color: var(--text-2); }
.h-filter--clear { border-color: transparent; background: transparent; color: var(--link); text-decoration: underline; text-underline-offset: 2px; }

/* --------------------------------------------------------------- 7. Cards */
.h-card { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); min-width: 0; }
.h-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-5); background: var(--bg-sunken); border-bottom: 1px solid var(--line); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.h-card__title { font: 600 var(--fs-15)/var(--lh-snug) var(--font-sans); color: var(--text); }
.h-card__sub { font-size: var(--fs-13); color: var(--text-2); margin-top: 2px; }
.h-card__body { padding: var(--s-4) var(--s-5); }
.h-card__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: var(--s-3) var(--s-5); border-top: 1px solid var(--line); flex-wrap: wrap; }
.h-card--pad { padding: var(--s-5); }
.h-card--flush .h-card__body { padding: 0; }
.h-card--sunken { background: var(--bg-sunken); border-color: transparent; }
.h-card--link { color: inherit; text-decoration: none; display: block; transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease); }
.h-card--link:hover { border-color: var(--line-strong); box-shadow: var(--shadow-1); text-decoration: none; }
.h-card--danger { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.h-card--danger .h-card__title { color: var(--danger); }
.h-card--selected { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }

/* Home card (one job per card: Connect my agent, Skills, Connector URL) */
.h-home-card { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-5); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); min-width: 0; }
.h-home-card__icon { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-canvas); }
.h-home-card__title { font: 500 var(--fs-15)/1.3 var(--font-sans); }
.h-home-card__text { color: var(--text-2); font-size: var(--fs-13); }
.h-home-card__foot { margin-top: auto; display: flex; gap: var(--s-2); flex-wrap: wrap; }

/* Page card (Pages list) */
.h-page-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); overflow: hidden; min-width: 0; }
.h-page-card__shot { aspect-ratio: 16 / 10; background: var(--bg-sunken); border-bottom: 1px solid var(--line); display: grid; place-items: center; color: var(--text-2); overflow: hidden; }
.h-page-card__shot img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.h-page-card__body { padding: var(--s-3) var(--s-4); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.h-page-card__name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-page-card__url { font-family: var(--font-mono); font-size: var(--fs-12); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-page-card__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); padding: var(--s-2) var(--s-4) var(--s-3); font-size: var(--fs-12); color: var(--text-2); }

/* Agent card (grid view) */
.h-agent-card { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); min-width: 0; color: inherit; text-decoration: none; }
.h-agent-card:hover { border-color: var(--line-strong); text-decoration: none; }
.h-agent-card__head { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.h-agent-card__name { font-weight: 500; font-size: var(--fs-15); }
.h-agent-card__job { color: var(--text-2); font-size: var(--fs-13); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.h-agent-card__foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); font-size: var(--fs-12); color: var(--text-2); margin-top: auto; }

/* Account tile (connector sign-in accounts) + dashed add tile */
.h-accts { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); }
.h-acct { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); min-width: 0; }
.h-acct__head { display: flex; align-items: flex-start; gap: var(--s-3); min-width: 0; }
.h-acct__name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-acct__meta { font-size: var(--fs-12); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-acct__shares { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: var(--fs-12); color: var(--text-2); }
.h-acct__actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: var(--s-3); border-top: 1px solid var(--line); }
.h-acct--add { align-items: center; justify-content: center; text-align: center; min-height: 160px; border-style: dashed; border-color: var(--line-strong); background: transparent; color: var(--text-2); cursor: pointer; font: inherit; }
.h-acct--add:hover { border-color: var(--text); color: var(--text); background: var(--bg-surface); }
.h-acct--add .h-i { width: 20px; height: 20px; }
.h-acct--error { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }

/* Logo tile + monogram */
.h-logo { --_s: 32px; width: var(--_s); height: var(--_s); flex: none; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--logo-tile); overflow: hidden; }
.h-logo img { width: 62%; height: 62%; object-fit: contain; }
.h-logo--sm { --_s: 22px; border-radius: var(--r-sm); }
.h-logo--sm img { width: 70%; height: 70%; }
.h-logo--lg { --_s: 44px; border-radius: var(--r-lg); }
.h-logo--xl { --_s: 56px; border-radius: var(--r-lg); }
.h-logo--mono { background: var(--bg-sunken); color: var(--text); font: 500 12px/1 var(--font-mono); letter-spacing: 0; text-transform: uppercase; }
.h-logo--mono.h-logo--sm { font-size: 9.5px; }
.h-logo--mono.h-logo--lg { font-size: 15px; }
.h-logos { display: inline-flex; align-items: center; }
.h-logos .h-logo + .h-logo { margin-left: -6px; box-shadow: 0 0 0 2px var(--bg-surface); }
.h-logos__more { margin-left: 6px; font-size: var(--fs-12); color: var(--text-2); }

/* Connector row (list) */
.h-conns { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); overflow: hidden; }
.h-conn { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); min-width: 0; color: inherit; text-decoration: none; transition: background var(--dur-1) var(--ease); }
.h-conns .h-conn + .h-conn { border-top: 1px solid var(--line); }
a.h-conn:hover, .h-conn.is-hover { background: var(--bg-hover); text-decoration: none; }
.h-conn__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.h-conn__name { font-weight: 500; display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.h-conn__desc { font-size: var(--fs-13); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-conn__side { display: flex; align-items: center; gap: var(--s-2); flex: none; }
.h-conns__group { padding: 8px var(--s-4); background: var(--bg-canvas); border-top: 1px solid var(--line); font: 500 var(--fs-11)/1.3 var(--font-mono); letter-spacing: var(--track-mono); text-transform: uppercase; color: var(--text-2); }
.h-conns__group:first-child { border-top: 0; }

/* Key/value list */
.h-kv { display: grid; grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 8px var(--s-5); font-size: var(--fs-13); }
.h-kv dt { color: var(--text-2); }
.h-kv dd { margin: 0; color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.h-kv--stack { grid-template-columns: minmax(0, 1fr); gap: 2px; }
.h-kv--stack dd + dt { margin-top: var(--s-3); }

/* List (activity log, history, members in a card) */
.h-list { display: flex; flex-direction: column; }
.h-list__item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) 0; border-top: 1px solid var(--line); min-width: 0; }
.h-list__item:first-child { border-top: 0; }
.h-list--pad .h-list__item { padding-left: var(--s-5); padding-right: var(--s-5); }
.h-list__main { flex: 1; min-width: 0; }
.h-list__title { font-weight: 500; }
.h-list__sub { font-size: var(--fs-12); color: var(--text-2); }
.h-list__main .h-small { color: var(--text-2); }
.h-log { display: flex; flex-direction: column; }
.h-log__item { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: var(--s-3); padding: 10px 0; border-top: 1px solid var(--line); font-size: var(--fs-13); }
.h-log__item:first-child { border-top: 0; }
.h-log__time { font: 400 var(--fs-11)/1.6 var(--font-mono); letter-spacing: var(--track-mono); color: var(--text-2); text-transform: uppercase; }

/* --------------------------------------------------------------- 8. Table */
.h-table-wrap { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); overflow-x: auto; min-width: 0; }
.h-table { width: 100%; border-collapse: collapse; font-size: var(--fs-13); }
.h-table th { text-align: left; padding: 10px var(--s-4); border-bottom: 1px solid var(--line); font: 500 var(--fs-11)/1.3 var(--font-mono); letter-spacing: var(--track-mono); text-transform: uppercase; color: var(--text-2); white-space: nowrap; background: var(--bg-surface); }
.h-table td { padding: 11px var(--s-4); border-bottom: 1px solid var(--line); vertical-align: middle; color: var(--text); }
.h-table tbody tr:last-child td { border-bottom: 0; }
.h-table tbody tr { transition: background var(--dur-1) var(--ease); }
.h-table tbody tr:hover td { background: var(--bg-hover); }
.h-table--grid td + td, .h-table--grid th + th { border-left: 1px solid var(--line); }
.h-table--dense td { padding: 7px var(--s-3); } .h-table--dense th { padding: 8px var(--s-3); }
.h-table th.is-num, .h-table td.is-num { text-align: right; font-variant-numeric: tabular-nums; }
.h-table td.is-mono { font-family: var(--font-mono); font-size: 12.5px; }
.h-table td.is-shrink, .h-table th.is-shrink { width: 1%; white-space: nowrap; }
.h-table tr.is-selected td { background: var(--tint); }
.h-table tr.is-selected td:first-child { box-shadow: inset 2px 0 0 var(--brand); }
.h-table tr.is-selected .h-muted { color: var(--on-tint); }
.h-table tr.is-error td { background: var(--danger-tint); }
.h-table tr.is-error td:first-child { box-shadow: inset 2px 0 0 var(--danger); }
.h-table tr.is-clickable { cursor: pointer; }
/* Sortable head */
.h-sort { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; cursor: pointer; }
.h-sort:hover { color: var(--text); }
.h-sort .h-i { width: 12px; height: 12px; opacity: .55; }
th[aria-sort="ascending"] .h-sort, th[aria-sort="descending"] .h-sort { color: var(--text); }
th[aria-sort="ascending"] .h-sort .h-i, th[aria-sort="descending"] .h-sort .h-i { opacity: 1; }
th[aria-sort="ascending"] .h-sort .h-i { transform: rotate(180deg); }
/* Row actions: visible on hover/focus on desktop, always on touch */
.h-row-actions { display: flex; justify-content: flex-end; gap: 4px; opacity: .0; transition: opacity var(--dur-1) var(--ease); }
tr:hover .h-row-actions, tr:focus-within .h-row-actions, .h-row-actions.is-visible { opacity: 1; }
@media (hover: none) { .h-row-actions { opacity: 1; } }
.h-cell-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.h-cell-who__name { font-weight: 500; }
.h-cell-who__sub { font-size: var(--fs-12); color: var(--text-2); }
.h-table-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 10px var(--s-4); border-top: 1px solid var(--line); font-size: var(--fs-12); color: var(--text-2); flex-wrap: wrap; }
/* Mobile cards: add .h-table--cards and data-label on each td */
@media (max-width: 820px) {
  .h-table--cards thead { display: none; }
  .h-table--cards, .h-table--cards tbody, .h-table--cards tr, .h-table--cards td { display: block; width: 100%; }
  .h-table--cards tr { padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); }
  .h-table--cards tbody tr:last-child { border-bottom: 0; }
  .h-table--cards td { border: 0 !important; padding: 3px 0; display: flex; justify-content: space-between; gap: var(--s-3); text-align: right; }
  .h-table--cards td::before { content: attr(data-label); font: 500 var(--fs-11)/1.6 var(--font-mono); letter-spacing: var(--track-mono); text-transform: uppercase; color: var(--text-2); text-align: left; flex: none; }
  .h-table--cards td.is-primary { padding-bottom: 6px; text-align: left; }
  .h-table--cards td.is-primary::before { display: none; }
  .h-table--cards td.is-hide-m { display: none; }
  .h-table--cards .h-row-actions { opacity: 1; }
  .h-table--cards tr:hover td { background: none; }
  .h-table--cards tr.is-error { background: var(--danger-tint); box-shadow: inset 2px 0 0 var(--danger); }
  .h-table--cards tr.is-selected { background: var(--tint); box-shadow: inset 2px 0 0 var(--brand); }
  .h-table--cards tr td:first-child { box-shadow: none !important; }
  .h-table--cards td[data-label=""]::before { display: none; }
  .h-table--cards td[data-label=""] { justify-content: flex-end; }
}

/* Pager */
.h-pager { display: flex; align-items: center; gap: 4px; }
.h-pager__info { font-size: var(--fs-12); color: var(--text-2); margin-right: var(--s-2); }

/* --------------------------------------------------- 9. Tabs and stepper */
.h-tabs { display: flex; gap: var(--s-5); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: var(--s-5); }
.h-tabs::-webkit-scrollbar { display: none; }
.h-tab { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0; border: 0; background: none; color: var(--text-2); font-size: var(--fs-14); white-space: nowrap; text-decoration: none; }
.h-tab:hover { color: var(--text); text-decoration: none; }
.h-tab[aria-selected="true"], .h-tab.is-active { color: var(--text); font-weight: 500; }
.h-tab[aria-selected="true"]::after, .h-tab.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--text); }
.h-tab .h-count { font-weight: 500; }
.h-tab[aria-selected="true"] .h-count { background: var(--inverse); color: var(--on-inverse); }
/* Sub-tabs: pill row inside a tab */
.h-subtabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: var(--s-4); }
.h-subtab { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid transparent; border-radius: var(--r-sm); background: none; color: var(--text-2); font-size: var(--fs-13); text-decoration: none; }
.h-subtab:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.h-subtab[aria-selected="true"], .h-subtab.is-active { background: var(--bg-surface); border-color: var(--line); color: var(--text); }
/* OS / client tabs attached to a code block */
.h-ostabs { display: flex; gap: 0; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--r-md) var(--r-md) 0 0; background: var(--bg-canvas); overflow-x: auto; scrollbar-width: none; }
.h-ostab { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 0; border-right: 1px solid var(--line); background: none; color: var(--text-2); font-size: var(--fs-13); white-space: nowrap; }
.h-ostab:hover { color: var(--text); }
.h-ostab[aria-selected="true"] { background: var(--bg-surface); color: var(--text); font-weight: 500; box-shadow: inset 0 -1px 0 var(--bg-surface); }
.h-ostabs + .h-code { border-top-left-radius: 0; border-top-right-radius: 0; }
/* Client tile row (Install: Claude Desktop, Claude Code, Cursor...) */
.h-clients { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: var(--s-2); }
.h-client { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-surface); color: var(--text); font-size: var(--fs-13); font-weight: 500; text-align: left; }
.h-client:hover { border-color: var(--line-strong); }
.h-client[aria-pressed="true"], .h-client.is-on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.h-client img { width: 18px; height: 18px; }

/* Stepper "Step 2 of 4" */
.h-stepper { display: flex; flex-direction: column; gap: var(--s-2); }
.h-stepper__top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); font-size: var(--fs-13); color: var(--text-2); }
.h-stepper__top b { color: var(--text); font-weight: 500; }
.h-stepper__bar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.h-stepper__seg { height: 3px; border-radius: 1px; background: var(--line); }
.h-stepper__seg.is-done { background: var(--text); }
.h-stepper__seg.is-current { background: var(--text-2); }

/* Numbered step list (vertical) */
.h-steps { display: flex; flex-direction: column; counter-reset: h-step; }
.h-step { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--s-4); padding-bottom: var(--s-6); counter-increment: h-step; }
.h-step:last-child { padding-bottom: 0; }
.h-step::before { content: counter(h-step); width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line-control); display: grid; place-items: center; font: 500 12px/1 var(--font-mono); background: var(--bg-surface); color: var(--text); position: relative; z-index: 1; }
.h-step::after { content: ""; position: absolute; left: 13.5px; top: 30px; bottom: 2px; width: 1px; background: var(--line); }
.h-step:last-child::after { display: none; }
.h-step.is-done::before { content: ""; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4L18 8'/%3E%3C/svg%3E") center / 14px no-repeat; border-color: var(--accent); }
:root[data-theme="dark"] .h-step.is-done::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230F0E0D' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4L18 8'/%3E%3C/svg%3E"); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .h-step.is-done::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230F0E0D' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4L18 8'/%3E%3C/svg%3E"); } }
.h-step.is-current::before { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.h-step__title { font-weight: 500; font-size: var(--fs-15); line-height: 28px; }
.h-step__body { color: var(--text-2); font-size: var(--fs-13); margin-top: 2px; display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.h-step__body > * { color: var(--text); }
.h-step__body > p { color: var(--text-2); }

/* Setup checklist (Home until done) */
.h-checklist { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); overflow: hidden; }
.h-checklist__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); flex-wrap: wrap; }
.h-checklist__title { font-weight: 500; font-size: var(--fs-15); }
.h-checklist__progress { display: flex; align-items: center; gap: var(--s-3); font-size: var(--fs-13); color: var(--text-2); }
.h-checklist__bar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; width: 120px; }
.h-checklist__bar i { height: 4px; border-radius: 1px; background: var(--line); }
.h-checklist__bar i.is-done { background: var(--ok); }
.h-checklist__item { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-5); border-top: 1px solid var(--line); min-width: 0; }
.h-checklist__mark { width: 20px; height: 20px; border-radius: 50%; border: 1px dashed var(--line-control); flex: none; display: grid; place-items: center; }
.h-checklist__item.is-done .h-checklist__mark { border: 0; background: var(--ok-tint); color: var(--ok); }
.h-checklist__item.is-done .h-checklist__label { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.h-checklist__text { flex: 1; min-width: 0; }
.h-checklist__label { font-weight: 500; }
.h-checklist__desc { font-size: var(--fs-12); color: var(--text-2); }

/* ---------------------------------------------- 10. Code, copy, disclosure */
.h-code { position: relative; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-sunken); min-width: 0; }
.h-code pre { margin: 0; padding: 12px 48px 12px 14px; overflow-x: auto; font: 400 12.5px/1.6 var(--font-mono); color: var(--text); white-space: pre; tab-size: 2; }
.h-code--wrap pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.h-code__copy { position: absolute; top: 6px; right: 6px; }
.h-code__label { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 14px; border-bottom: 1px solid var(--line); font: 500 var(--fs-11)/1.3 var(--font-mono); letter-spacing: var(--track-mono); text-transform: uppercase; color: var(--text-2); }
.h-code__label + pre { padding-right: 14px; }
.h-code .tok-k { color: var(--link); } .h-code .tok-s { color: var(--ok); } .h-code .tok-c { color: var(--text-2); } .h-code .tok-p { color: var(--text-2); }
.h-code--dark { background: #151210; border-color: #151210; }
.h-code--dark pre { color: #F5F3EF; }
.h-code--dark .tok-k { color: #EE9C78; } .h-code--dark .tok-s { color: #8BC59E; } .h-code--dark .tok-c, .h-code--dark .tok-p { color: #CAC2B8; }
.h-code--dark .h-btn { background: #2E2925; border-color: #403A34; color: #F5F3EF; }
code.h-inline { padding: 1px 5px; border-radius: var(--r-sm); background: var(--bg-sunken); font-size: 12.5px; color: var(--text); }
/* Copy field (URL, key) */
.h-copyfield { display: flex; align-items: center; gap: var(--s-2); height: var(--ctl-h); padding: 0 4px 0 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-sunken); min-width: 0; }
.h-copyfield__value { flex: 1; min-width: 0; font: 400 12.5px/1 var(--font-mono); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-copyfield .h-btn { height: 26px; }
.h-copyfield.is-copied { border-color: var(--ok); }
.h-copy-ok { color: var(--ok); display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-12); }

/* Disclosure */
.h-details { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-surface); }
.h-details > summary { display: flex; align-items: center; gap: var(--s-2); padding: 10px var(--s-4); cursor: pointer; list-style: none; font-weight: 500; font-size: var(--fs-14); }
.h-details > summary::-webkit-details-marker { display: none; }
.h-details > summary::before { content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--text-2); border-bottom: 1.5px solid var(--text-2); transform: rotate(-45deg); transition: transform var(--dur-2) var(--ease); margin-right: 4px; flex: none; }
.h-details[open] > summary::before { transform: rotate(45deg) translate(-2px, -1px); }
.h-details > summary .h-muted { font-weight: 400; margin-left: auto; font-size: var(--fs-13); }
.h-details__body { padding: 0 var(--s-4) var(--s-4) 33px; color: var(--text-2); font-size: var(--fs-13); }
.h-details--plain { border: 0; background: none; }
.h-details--plain > summary { padding: 6px 0; font-size: var(--fs-13); color: var(--text-2); }
.h-details--plain .h-details__body { padding: 4px 0 8px 15px; }

/* Inline confirm box (destructive step inside a card) */
.h-confirm { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-3) var(--s-4); border: 1px solid color-mix(in srgb, var(--danger) 40%, transparent); border-radius: var(--r-md); background: var(--danger-tint); }
.h-confirm__text { font-size: var(--fs-13); color: var(--text); }
.h-confirm__text b { color: var(--danger); font-weight: 500; }
.h-confirm__actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

/* --------------------------------------------------- 11. Menus, tooltips */
.h-menu { min-width: 200px; max-width: min(320px, calc(100vw - 32px)); padding: 4px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-surface); box-shadow: var(--shadow-2); z-index: var(--z-drop); }
.h-menu--float { position: absolute; top: calc(100% + 4px); right: 0; }
.h-menu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text); font-size: var(--fs-13); text-align: left; text-decoration: none; white-space: nowrap; }
.h-menu__item:hover, .h-menu__item:focus-visible, .h-menu__item.is-active { background: var(--bg-sunken); text-decoration: none; outline: none; }
.h-menu__item .h-i { color: var(--text-2); }
.h-menu__item .h-kbd, .h-menu__item small { margin-left: auto; }
.h-menu__item small { color: var(--text-2); font-size: var(--fs-12); }
.h-menu__item--danger { color: var(--danger); }
.h-menu__item--danger .h-i { color: var(--danger); }
.h-menu__item--danger:hover { background: var(--danger-tint); }
.h-menu__item[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.h-menu__item[aria-checked="true"]::after { content: ""; margin-left: auto; width: 9px; height: 5px; border-left: 1.75px solid var(--text); border-bottom: 1.75px solid var(--text); transform: translateY(-2px) rotate(-45deg); }
.h-menu__sep { height: 1px; margin: 4px -4px; background: var(--line); }
.h-menu__label { padding: 8px 8px 4px; font: 500 var(--fs-11)/1.3 var(--font-mono); letter-spacing: var(--track-mono); text-transform: uppercase; color: var(--text-2); }
.h-menu__head { padding: 8px; display: flex; flex-direction: column; gap: 1px; }
.h-menu__search { padding: 4px 4px 6px; }

/* Picker: custom select with icon + label + one-line description per option */
.h-picker { position: relative; display: inline-block; min-width: 0; }
.h-picker--block { display: block; }
.h-picker__btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--bg-surface); color: var(--text); font: inherit; font-size: var(--fs-14); text-align: left; cursor: pointer; }
.h-picker__btn:hover { background: var(--bg-hover); }
.h-picker__btn:focus-visible, .h-picker.is-open .h-picker__btn { outline: 2px solid var(--focus, var(--text)); outline-offset: 1px; }
.h-picker__btn > .h-i:last-child { margin-left: auto; color: var(--text-2); }
.h-picker__icon { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: var(--r-sm); background: var(--bg-sunken); color: var(--text); }
.h-picker__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.h-picker__label { font-weight: 500; }
.h-picker__desc { font-size: var(--fs-12); color: var(--text-2); white-space: normal; }
.h-picker__menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; min-width: 260px; max-width: none; display: none; }
.h-picker.is-open .h-picker__menu { display: block; }
.h-picker__opt { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text); font: inherit; font-size: var(--fs-14); text-align: left; cursor: pointer; }
.h-picker__opt:hover, .h-picker__opt:focus-visible { background: var(--bg-sunken); outline: none; }
.h-picker__opt[aria-selected="true"] .h-picker__icon { background: var(--text); color: var(--bg-surface); }
.h-picker__opt[aria-selected="true"]::after { content: ""; margin: 8px 4px 0 auto; flex: none; width: 9px; height: 5px; border-left: 1.75px solid var(--text); border-bottom: 1.75px solid var(--text); transform: rotate(-45deg); }
.h-anchor { position: relative; display: inline-block; }

.h-tip { position: relative; display: inline-flex; }
.h-tip__bubble { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: var(--z-tip); padding: 5px 8px; border-radius: var(--r-sm); background: var(--inverse); color: var(--on-inverse); font-size: var(--fs-12); line-height: 1.35; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity var(--dur-1) var(--ease); }
.h-tip:hover .h-tip__bubble, .h-tip:focus-within .h-tip__bubble, .h-tip__bubble.is-visible { opacity: 1; }

/* -------------------------------------------------- 12. Chart and stats */
.h-chart { position: relative; min-width: 0; }
.h-chart__head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); flex-wrap: wrap; }
.h-chart__plot { position: relative; height: 160px; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: end; gap: 2px; padding-left: 32px; border-bottom: 1px solid var(--line-strong);
  background-image: linear-gradient(var(--chart-grid) 1px, transparent 1px); background-size: 100% 25%; background-position: 0 0; background-origin: content-box; }
.h-chart__y { position: absolute; left: 0; top: 0; bottom: 0; width: 28px; display: flex; flex-direction: column; justify-content: space-between; font: 400 10.5px/1 var(--font-mono); color: var(--text-2); text-align: right; transform: translateY(-5px); }
.h-chart__bar { position: relative; height: var(--v, 0%); min-height: 1px; background: var(--chart-bar); border-radius: 2px 2px 0 0; transition: background var(--dur-1) var(--ease); }
.h-chart__bar::before { content: ""; position: absolute; left: -1px; right: -1px; bottom: 0; height: 160px; } /* hit target taller than the mark */
.h-chart__bar:hover, .h-chart__bar.is-active { background: var(--chart-bar-hover); }
.h-chart__bar.is-zero { background: var(--line); }
.h-chart__tip { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: var(--z-tip); padding: 6px 8px; border-radius: var(--r-sm); background: var(--inverse); color: var(--on-inverse); font-size: var(--fs-12); line-height: 1.35; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity var(--dur-1) var(--ease); }
.h-chart__tip b { font-weight: 500; font-variant-numeric: tabular-nums; }
.h-chart__bar:hover .h-chart__tip, .h-chart__bar.is-active .h-chart__tip { opacity: 1; }
/* Keep edge tooltips inside the plot */
.h-chart__bar:nth-child(-n+5) .h-chart__tip { left: 0; transform: none; }
.h-chart__bar:nth-last-child(-n+5) .h-chart__tip { left: auto; right: 0; transform: none; }
.h-chart__x { display: flex; justify-content: space-between; padding: 6px 0 0 32px; font: 400 10.5px/1 var(--font-mono); color: var(--text-2); }
.h-chart--sm .h-chart__plot { height: 64px; padding-left: 0; background-size: 100% 50%; }
.h-chart--sm .h-chart__x { padding-left: 0; }
.h-chart--sm .h-chart__bar::before { height: 64px; }
/* Sparkline (inline SVG polyline inside) */
.h-spark { width: 96px; height: 28px; color: var(--text-2); }
.h-spark polyline, .h-spark path { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }

/* Stat tiles */
.h-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); overflow: hidden; }
.h-stats .h-stat { border: 0; border-radius: 0; box-shadow: -1px 0 0 var(--line), 0 -1px 0 var(--line); }
.h-stat { display: flex; flex-direction: column; gap: 6px; padding: var(--s-4) var(--s-5); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); min-width: 0; }
.h-stat__label { font: 500 var(--fs-11)/1.3 var(--font-mono); letter-spacing: var(--track-mono); text-transform: uppercase; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.h-stat__value { font: 300 var(--fs-36)/1 var(--font-display); letter-spacing: var(--track-display); font-variant-numeric: tabular-nums; color: var(--text); }
.h-stat__unit { font-size: var(--fs-15); letter-spacing: 0; color: var(--text-2); margin-left: 3px; }
.h-stat__sub { font-size: var(--fs-12); color: var(--text-2); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.h-stat__delta--up { color: var(--ok); } .h-stat__delta--down { color: var(--danger); }
.h-stat--big .h-stat__value { font-size: var(--fs-48); }
.h-stat--mini { padding: var(--s-3) var(--s-4); gap: 2px; }
.h-stat--mini .h-stat__value { font: 500 var(--fs-17)/1.2 var(--font-sans); letter-spacing: -0.01em; }
.h-stat--mini .h-stat__label { font-size: 10.5px; }

/* Meter (usage, limits) */
.h-meter { height: 4px; border-radius: 1px; background: var(--line); overflow: hidden; }
.h-meter__fill { height: 100%; width: var(--v, 0%); background: var(--text); border-radius: 1px; transition: width var(--dur-3) var(--ease-out); }
.h-meter--warn .h-meter__fill { background: var(--warn); }
.h-meter--danger .h-meter__fill { background: var(--danger); }
.h-meter--lg { height: 6px; }

/* ------------------------------------------- 13. Empty, error, markdown */
.h-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-2); padding: var(--s-12) var(--s-6); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: transparent; }
.h-empty--solid { border-style: solid; border-color: var(--line); background: var(--bg-surface); }
.h-empty--bare { border: 0; padding: var(--s-8) var(--s-4); }
.h-empty__icon { width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-surface); color: var(--text); margin-bottom: var(--s-2); }
.h-empty__icon .h-i { width: 20px; height: 20px; }
.h-empty__title { font: 400 var(--fs-20)/1.25 var(--font-display); letter-spacing: var(--track-title); }
.h-empty__text { color: var(--text-2); font-size: var(--fs-14); max-width: 44ch; }
.h-empty__actions { display: flex; gap: var(--s-2); margin-top: var(--s-3); flex-wrap: wrap; justify-content: center; }
.h-empty__help { margin-top: var(--s-5); padding-top: var(--s-4); border-top: 1px solid var(--line); display: flex; gap: var(--s-4); flex-wrap: wrap; justify-content: center; font-size: var(--fs-13); color: var(--text-2); }
.h-empty--sm { padding: var(--s-6) var(--s-4); }
.h-empty--sm .h-empty__title { font: 500 var(--fs-15)/1.3 var(--font-sans); letter-spacing: 0; }

.h-errorcard { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-4) var(--s-5); border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--line)); border-radius: var(--r-lg); background: var(--bg-surface); }
.h-errorcard__icon { color: var(--danger); margin-top: 2px; }
.h-errorcard__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.h-errorcard__title { font-weight: 500; }
.h-errorcard__text { color: var(--text-2); font-size: var(--fs-13); }
.h-errorcard__detail { font: 400 12px/1.5 var(--font-mono); color: var(--danger); overflow-wrap: anywhere; }
.h-errorcard__actions { display: flex; gap: var(--s-2); margin-top: var(--s-2); flex-wrap: wrap; }

.h-md { font-size: var(--fs-14); line-height: 1.6; color: var(--text); overflow-wrap: anywhere; }
.h-md > * + * { margin-top: .75em; }
.h-md h1, .h-md h2, .h-md h3, .h-md h4 { font-family: var(--font-display); line-height: 1.25; margin-top: 1.4em; }
.h-md h1 { font-size: 26px; font-weight: 300; letter-spacing: var(--track-display); }
.h-md h2 { font-size: 20px; font-weight: 400; letter-spacing: var(--track-title); }
.h-md h3 { font-size: 16px; font-weight: 500; }
.h-md h4 { font-size: 14px; font-weight: 500; }
.h-md > :first-child { margin-top: 0; }
.h-md ul, .h-md ol { padding-left: 1.3em; }
.h-md li + li { margin-top: .25em; }
.h-md li::marker { color: var(--text-2); }
.h-md code { padding: 1px 5px; border-radius: var(--r-sm); background: var(--bg-sunken); font-size: 12.5px; }
.h-md pre { padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-sunken); overflow-x: auto; font-size: 12.5px; line-height: 1.6; }
.h-md pre code { padding: 0; background: none; }
.h-md blockquote { margin: 0; padding: 2px 0 2px 14px; border-left: 2px solid var(--line-strong); color: var(--text-2); }
.h-md table { border-collapse: collapse; font-size: var(--fs-13); display: block; overflow-x: auto; }
.h-md th, .h-md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.h-md th { background: var(--bg-canvas); font-weight: 500; }
.h-md hr { margin: 1.5em 0; }
.h-md a { color: var(--link); }
.h-md img { border-radius: var(--r-md); border: 1px solid var(--line); }

/* ------------------------------------------------------------ 14. Banners */
.h-banner { display: flex; align-items: flex-start; gap: var(--s-3); padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-surface); color: var(--text); font-size: var(--fs-13); min-width: 0; }
.h-banner > .h-i { margin-top: 1px; flex: none; }
.h-banner__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.h-banner__title { font-weight: 500; font-size: var(--fs-14); }
.h-banner__text { color: var(--text); }
.h-banner__actions { display: flex; gap: var(--s-2); align-items: center; flex: none; flex-wrap: wrap; }
.h-banner--info   { background: var(--info-tint);   border-color: color-mix(in srgb, var(--info) 30%, transparent); }
.h-banner--info > .h-i { color: var(--info); }
.h-banner--ok     { background: var(--ok-tint);     border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.h-banner--ok > .h-i { color: var(--ok); }
.h-banner--warn   { background: var(--warn-tint);   border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.h-banner--warn > .h-i { color: var(--warn); }
.h-banner--danger { background: var(--danger-tint); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.h-banner--danger > .h-i { color: var(--danger); }
.h-banner--brand  { background: var(--tint); border-color: color-mix(in srgb, var(--brand) 30%, transparent); }   /* guest invite, once per view */
.h-banner--brand > .h-i { color: var(--on-tint); }
.h-banner--page { border-radius: 0; border-left: 0; border-right: 0; border-top: 0; padding-left: var(--s-7); padding-right: var(--s-7); }  /* full-width under the top bar (MFA) */
.h-banner .h-btn { height: 28px; font-size: var(--fs-12); }
@media (max-width: 820px) { .h-banner { flex-wrap: wrap; } .h-banner__actions { width: 100%; padding-left: 28px; } .h-banner--page { padding-left: var(--s-4); padding-right: var(--s-4); } }

/* ------------------------------------------------- 15. Modal and drawer */
.h-backdrop { position: fixed; inset: 0; z-index: var(--z-modal); background: var(--overlay); display: grid; place-items: center; padding: var(--s-4); animation: h-fade var(--dur-2) var(--ease); }
.h-modal { width: min(560px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--bg-surface); box-shadow: var(--shadow-3); animation: h-rise var(--dur-3) var(--ease-out); min-width: 0; }
.h-modal--sm { width: min(420px, 100%); } .h-modal--lg { width: min(760px, 100%); } .h-modal--xl { width: min(1040px, 100%); }
.h-modal--static { position: relative; animation: none; box-shadow: var(--shadow-2); max-height: none; }
.h-modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); padding: var(--s-5) var(--s-6) var(--s-4); }
.h-modal__title { font: 400 var(--fs-20)/1.25 var(--font-display); letter-spacing: var(--track-title); }
.h-modal__sub { font-size: var(--fs-13); color: var(--text-2); margin-top: 4px; }
.h-modal__body { padding: 0 var(--s-6) var(--s-5); overflow-y: auto; min-height: 0; }
.h-modal__foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-2); padding: var(--s-3) var(--s-6); border-top: 1px solid var(--line); background: var(--bg-canvas); border-radius: 0 0 var(--r-xl) var(--r-xl); flex-wrap: wrap; }
.h-modal__foot--between { justify-content: space-between; }
.h-modal__close { margin: -4px -8px 0 0; }
@media (max-width: 820px) {
  .h-backdrop { place-items: end center; padding: 0; }
  .h-modal { width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0; max-height: 92dvh; }
  .h-modal--static { border-radius: var(--r-xl); }
  .h-modal__head { padding: var(--s-4) var(--s-4) var(--s-3); } .h-modal__body { padding: 0 var(--s-4) var(--s-4); } .h-modal__foot { padding: var(--s-3) var(--s-4); border-radius: 0; }
  .h-modal__foot .h-btn { flex: 1 1 auto; }
}
.h-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: var(--z-drawer); width: min(480px, 100%); display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--bg-surface); box-shadow: var(--shadow-3); animation: h-slide var(--dur-3) var(--ease-out); }
.h-drawer--static { position: relative; height: 560px; box-shadow: var(--shadow-2); animation: none; border: 1px solid var(--line); border-radius: var(--r-lg); width: 100%; max-width: 480px; overflow: hidden; }
.h-drawer__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line); }
.h-drawer__title { font: 400 var(--fs-20)/1.25 var(--font-display); letter-spacing: var(--track-title); display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.h-drawer__body { flex: 1; overflow-y: auto; padding: var(--s-4) var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
.h-drawer__foot { display: flex; gap: var(--s-2); justify-content: flex-end; padding: var(--s-3) var(--s-5); border-top: 1px solid var(--line); background: var(--bg-canvas); flex-wrap: wrap; }
@keyframes h-fade { from { opacity: 0; } }
@keyframes h-rise { from { opacity: 0; transform: translateY(8px) scale(.99); } }
@keyframes h-slide { from { transform: translateX(24px); opacity: 0; } }

/* -------------------------------------------------------------- 16. Toast */
.h-toasts { position: fixed; bottom: var(--s-6); left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: flex; flex-direction: column; align-items: center; gap: var(--s-2); pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.h-toasts--static { position: static; transform: none; align-items: flex-start; width: auto; }
.h-toast { pointer-events: auto; display: inline-flex; align-items: center; gap: 10px; min-height: 40px; max-width: 100%; padding: 8px 8px 8px 14px; border-radius: var(--r-md); background: var(--inverse); color: var(--on-inverse); font-size: var(--fs-13); box-shadow: var(--shadow-3); animation: h-rise var(--dur-3) var(--ease-out); }
.h-toast > .h-i { flex: none; }
.h-toast__text { min-width: 0; }
.h-toast__action { border: 0; background: none; color: inherit; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; padding: 4px 6px; font-size: var(--fs-13); }
.h-toast__x { border: 0; background: none; color: inherit; opacity: .75; padding: 4px; border-radius: var(--r-sm); display: grid; place-items: center; }
.h-toast__x:hover { opacity: 1; }
.h-toast--ok > .h-i { color: #8BC59E; } .h-toast--danger > .h-i { color: #F28E9C; } .h-toast--warn > .h-i { color: #E3B565; }
:root[data-theme="dark"] .h-toast--ok > .h-i { color: #2B6644; } :root[data-theme="dark"] .h-toast--danger > .h-i { color: #A3283C; } :root[data-theme="dark"] .h-toast--warn > .h-i { color: #80520A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .h-toast--ok > .h-i { color: #2B6644; } :root:not([data-theme="light"]) .h-toast--danger > .h-i { color: #A3283C; } :root:not([data-theme="light"]) .h-toast--warn > .h-i { color: #80520A; } }

/* ---------------------------------------------------------- 17. Skeletons */
.h-skel { display: block; border-radius: var(--r-sm); background: linear-gradient(90deg, var(--skel) 0%, var(--skel-hi) 50%, var(--skel) 100%); background-size: 200% 100%; animation: h-shimmer 1.4s linear infinite; }
.h-skel--line { height: 10px; width: 100%; }
.h-skel--line + .h-skel--line { margin-top: 10px; }
.h-skel--title { height: 28px; width: 40%; border-radius: var(--r-sm); }
.h-skel--circle { border-radius: 50%; width: 28px; height: 28px; flex: none; }
.h-skel--tile { width: 32px; height: 32px; border-radius: var(--r-md); flex: none; }
.h-skel--block { height: 120px; border-radius: var(--r-lg); }
.h-skel--btn { width: 96px; height: var(--ctl-h); border-radius: var(--r-md); }
.h-skel--w20 { width: 20%; } .h-skel--w40 { width: 40%; } .h-skel--w60 { width: 60%; } .h-skel--w80 { width: 80%; }
.h-skel-row { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-top: 1px solid var(--line); }
.h-skel-row:first-child { border-top: 0; }
.h-skel-row > .h-stack { flex: 1; gap: 8px; }
@keyframes h-shimmer { to { background-position: -200% 0; } }

/* --------------------------------------------------------- 18. Approval */
.h-approval { display: flex; flex-direction: column; gap: var(--s-4); padding: var(--s-4) var(--s-5); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); max-width: 820px; min-width: 0; }
.h-approval.is-pending { box-shadow: inset 3px 0 0 var(--brand); }
.h-approval__head { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
.h-approval__title { font-size: var(--fs-15); line-height: 1.4; min-width: 0; }
.h-approval__title b { font-weight: 500; }
.h-approval__meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--text-2); font-size: var(--fs-12); margin-top: 3px; }
.h-approval__args { display: grid; grid-template-columns: minmax(90px, max-content) minmax(0, 1fr); gap: 8px var(--s-4); margin: 0; padding: var(--s-3) var(--s-4); border-radius: var(--r-md); background: var(--bg-canvas); border: 1px solid var(--line); font-size: var(--fs-13); }
.h-approval__args dt { color: var(--text-2); font-family: var(--font-mono); font-size: 12px; padding-top: 1px; }
.h-approval__args dd { margin: 0; min-width: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.h-approval__edit { display: flex; flex-direction: column; gap: var(--s-3); }
.h-approval__actions { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.h-approval__note { font-size: var(--fs-12); color: var(--text-2); margin-left: auto; }
.h-approval--decided { padding: var(--s-3) var(--s-4); gap: 0; flex-direction: row; align-items: center; }
@media (max-width: 820px) { .h-approval__args { grid-template-columns: minmax(0, 1fr); gap: 2px; } .h-approval__args dd + dt { margin-top: 8px; } .h-approval__note { margin-left: 0; width: 100%; } }

/* ---------------------------------------------------------------- 19. Run */
.h-runs { display: flex; flex-direction: column; gap: var(--s-2); }
.h-run { padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); min-width: 0; }
.h-run__head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px var(--s-3); font-size: var(--fs-13); color: var(--text-2); }
.h-run__state { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--text); font-size: var(--fs-14); }
.h-run__icon { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-sunken); color: var(--text-2); flex: none; }
.h-run__icon .h-i { width: 12px; height: 12px; stroke-width: 2; }
.h-run--ok .h-run__icon { background: var(--ok-tint); color: var(--ok); }
.h-run--failed .h-run__icon { background: var(--danger-tint); color: var(--danger); }
.h-run--running .h-run__icon { background: var(--info-tint); color: var(--info); }
.h-run--waiting .h-run__icon { background: var(--bg-sunken); color: var(--text-2); }
.h-run--failed { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.h-run__meta { display: inline-flex; align-items: center; gap: 5px; }
.h-run__meta .h-i { width: 13px; height: 13px; }
.h-run__summary { margin-top: var(--s-2); font-size: var(--fs-13); color: var(--text); }
.h-run__err { margin-top: var(--s-2); font-size: var(--fs-13); color: var(--danger); }
.h-run__steps { margin-top: var(--s-2); }
.h-run__steps > summary { font-size: var(--fs-12); color: var(--text-2); cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.h-run__steps > summary::-webkit-details-marker { display: none; }
.h-run__steps > summary::before { content: "+"; font-family: var(--font-mono); width: 12px; }
.h-run__steps[open] > summary::before { content: "\2212"; }
.h-run__steps ul { list-style: none; margin: 6px 0 0; padding: 0 0 0 4px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.h-run__steps li { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding-left: 8px; font-size: var(--fs-12); }
.h-run__steps li code { font-size: 11.5px; }
.h-run__steps li span:last-child { color: var(--text-2); font-family: var(--font-mono); font-size: 11px; }
/* Waterfall bar inside a step */
.h-wf { height: 6px; border-radius: 1px; background: var(--line); position: relative; margin-top: 3px; }
.h-wf i { position: absolute; top: 0; bottom: 0; left: var(--l, 0%); width: var(--w, 10%); background: var(--text-2); border-radius: 1px; }

/* --------------------------------------------------------------- 20. Chat */
.h-chat { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); min-width: 0; overflow: hidden; }
.h-chat__log { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-4); overflow-y: auto; min-height: 0; }
.h-msg { display: flex; gap: var(--s-2); max-width: 88%; min-width: 0; }
.h-msg__col { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.h-msg__meta { font-size: var(--fs-12); color: var(--text-2); }
.h-bubble { padding: 9px 13px; border-radius: var(--r-lg); background: var(--bg-sunken); color: var(--text); font-size: var(--fs-14); line-height: 1.5; overflow-wrap: anywhere; }
.h-bubble > :first-child { margin-top: 0; } .h-bubble > :last-child { margin-bottom: 0; }
.h-msg--me { align-self: flex-end; flex-direction: row-reverse; }
.h-msg--me .h-msg__col { align-items: flex-end; }
.h-msg--me .h-bubble { background: var(--inverse); color: var(--on-inverse); border-bottom-right-radius: var(--r-xs); }
.h-msg--agent .h-bubble { border-bottom-left-radius: var(--r-xs); }
.h-msg--tool .h-bubble { background: transparent; border: 1px dashed var(--line-strong); font-family: var(--font-mono); font-size: 12px; color: var(--text-2); padding: 6px 10px; }
.h-msg--error .h-bubble { background: var(--danger-tint); color: var(--danger); }
.h-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.h-typing i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-2); animation: h-pulse 1.2s var(--ease) infinite; }
.h-typing i:nth-child(2) { animation-delay: .15s; } .h-typing i:nth-child(3) { animation-delay: .3s; }
.h-composer { position: relative; display: flex; align-items: flex-end; gap: var(--s-2); padding: var(--s-2); border-top: 1px solid var(--line); background: var(--bg-surface); }
.h-composer textarea { flex: 1; min-width: 0; min-height: 36px; max-height: 160px; padding: 8px 10px; border: 1px solid var(--line-control); border-radius: var(--r-md); background: var(--bg-surface); resize: none; font-size: var(--fs-14); line-height: 1.4; }
.h-composer textarea:focus { outline: none; border-color: var(--text); }
.h-composer .h-btn { height: 36px; }
.h-composer__hint { position: absolute; left: 12px; bottom: calc(100% + 4px); font-size: var(--fs-12); color: var(--text-2); }
/* Slash command dropdown, opens above the composer */
.h-slash { position: absolute; left: var(--s-2); right: var(--s-2); bottom: calc(100% + 4px); z-index: var(--z-drop); padding: 4px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-surface); box-shadow: var(--shadow-2); max-height: 260px; overflow-y: auto; }
.h-slash--static { position: static; margin: 0 var(--s-2) var(--s-2); }
.h-slash__item { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 2px 12px; padding: 7px 8px; border-radius: var(--r-sm); cursor: pointer; }
.h-slash__item:hover, .h-slash__item[aria-selected="true"] { background: var(--bg-sunken); }
.h-slash__cmd { font-family: var(--font-mono); font-size: var(--fs-13); color: var(--text); }
.h-slash__desc { font-size: var(--fs-12); color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; align-self: center; }

/* -------------------------------------------------------------- 21. Avatar */
.h-avatar { --_s: 28px; width: var(--_s); height: var(--_s); flex: none; border-radius: 50%; display: inline-grid; place-items: center; overflow: hidden; background: var(--bg-sunken); color: var(--text); font: 500 calc(var(--_s) * .38)/1 var(--font-mono); letter-spacing: 0; user-select: none; }
.h-avatar img { width: 100%; height: 100%; object-fit: cover; }
.h-avatar--xs { --_s: 18px; } .h-avatar--sm { --_s: 22px; } .h-avatar--md { --_s: 32px; } .h-avatar--lg { --_s: 40px; } .h-avatar--xl { --_s: 64px; }
.h-avatar--square { border-radius: var(--r-md); }           /* agents use the rounded square */
.h-avatar--emoji { font-family: system-ui, 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif; font-size: calc(var(--_s) * .55); }
.h-avatar--ink { background: var(--inverse); color: var(--on-inverse); }
/* Agent colour backgrounds: soft fills, ink text stays 4.5:1+ on all of them */
.h-avatar--c1 { background: #F6E7DF; color: #151210; } .h-avatar--c2 { background: #E3EDE5; color: #151210; } .h-avatar--c3 { background: #E2EAF1; color: #151210; }
.h-avatar--c4 { background: #F7ECD6; color: #151210; } .h-avatar--c5 { background: #ECE6F2; color: #151210; } .h-avatar--c6 { background: #EFEDE8; color: #151210; }
.h-avatar.is-online { position: relative; overflow: visible; }
.h-avatar.is-online::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 2px var(--bg-surface); }
.h-avatars { display: inline-flex; }
.h-avatars .h-avatar + .h-avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--bg-surface); }

/* ---------------------------------------------------------------- 22. Cmd+K */
.h-cmdk { width: min(620px, 100%); border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--bg-surface); box-shadow: var(--shadow-3); overflow: hidden; display: flex; flex-direction: column; max-height: min(520px, calc(100dvh - 64px)); }
.h-cmdk-backdrop { position: fixed; inset: 0; z-index: var(--z-modal); background: var(--overlay); display: flex; justify-content: center; align-items: flex-start; padding: 12vh var(--s-4) var(--s-4); }
.h-cmdk__input { display: flex; align-items: center; gap: 10px; padding: 0 var(--s-4); height: 52px; border-bottom: 1px solid var(--line); }
.h-cmdk__input input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: var(--fs-15); height: 100%; }
.h-cmdk__input input::placeholder { color: var(--text-2); }
.h-cmdk__input .h-i { color: var(--text-2); }
.h-cmdk__list { overflow-y: auto; padding: 4px 6px 6px; flex: 1; min-height: 0; }
.h-cmdk__group { padding: 10px 8px 4px; font: 500 var(--fs-11)/1.3 var(--font-mono); letter-spacing: var(--track-mono); text-transform: uppercase; color: var(--text-2); }
.h-cmdk__item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--r-sm); font-size: var(--fs-14); cursor: pointer; min-width: 0; }
.h-cmdk__item > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-cmdk__item .h-i { color: var(--text-2); }
.h-cmdk__item[aria-selected="true"], .h-cmdk__item:hover { background: var(--bg-sunken); }
.h-cmdk__item[aria-selected="true"] { box-shadow: inset 2px 0 0 var(--text); }
.h-cmdk__where { margin-left: auto; font-size: var(--fs-12); color: var(--text-2); flex: none; display: inline-flex; align-items: center; gap: 6px; }
.h-cmdk__foot { display: flex; align-items: center; gap: var(--s-4); padding: 8px var(--s-4); border-top: 1px solid var(--line); background: var(--bg-canvas); font-size: var(--fs-12); color: var(--text-2); flex-wrap: wrap; }
.h-cmdk__foot span { display: inline-flex; align-items: center; gap: 5px; }
.h-cmdk__foot .h-kbd { height: 18px; min-width: 18px; font-size: 10px; }

/* ----------------------------------------------------- 23. Auth & centred */
.h-center { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--s-6) var(--s-4); }
.h-auth { width: min(400px, 100%); display: flex; flex-direction: column; gap: var(--s-5); }
.h-auth__brand img { height: 22px; width: auto; }
.h-auth__title { font: 300 var(--fs-30)/1.1 var(--font-display); letter-spacing: var(--track-display); }
.h-auth__sub { color: var(--text-2); }
.h-auth__or { display: flex; align-items: center; gap: var(--s-3); color: var(--text-2); font-size: var(--fs-12); }
.h-auth__or::before, .h-auth__or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.h-split-auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.h-split-auth__art { background: var(--bg-sunken); border-left: 1px solid var(--line); display: grid; place-items: center; padding: var(--s-10); }
@media (max-width: 820px) { .h-split-auth { grid-template-columns: minmax(0, 1fr); } .h-split-auth__art { display: none; } }
/* 6-digit code */
.h-otp { display: flex; gap: var(--s-2); }
.h-otp input { width: 44px; height: 52px; text-align: center; font: 400 22px/1 var(--font-mono); border: 1px solid var(--line-control); border-radius: var(--r-md); background: var(--bg-surface); }
.h-otp input:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--text) 12%, transparent); }

/* ---------------------------------------------------------- 24. Utilities */
.u-mt-0 { margin-top: 0 !important; } .u-mt-2 { margin-top: var(--s-2); } .u-mt-3 { margin-top: var(--s-3); } .u-mt-4 { margin-top: var(--s-4); } .u-mt-6 { margin-top: var(--s-6); } .u-mt-8 { margin-top: var(--s-8); }
.u-mb-2 { margin-bottom: var(--s-2); } .u-mb-4 { margin-bottom: var(--s-4); } .u-mb-6 { margin-bottom: var(--s-6); }
.u-ml-auto { margin-left: auto; }
.u-w-full { width: 100%; }
.u-hide-m { } @media (max-width: 820px) { .u-hide-m { display: none !important; } }
.u-only-m { display: none !important; } @media (max-width: 820px) { .u-only-m { display: revert !important; } }

/* =============================================================== C. App shell */
/* #app is the .h-app grid (ds/shell.html). */
#app:not(.hide) { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); gap: 0; padding: 0; min-height: 100vh; min-height: 100dvh; }
#app > .h-main { min-width: 0; }
.h-side .h-nav__item { width: 100%; border: 0; background: transparent; text-align: left; font: 400 var(--fs-14)/1.3 var(--font-sans); letter-spacing: 0; cursor: pointer; }
.h-side .h-nav__item.on { background: var(--bg-surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.h-side .h-nav__item.on::after { content: ""; width: 6px; height: 6px; background: var(--brand); margin-left: auto; flex: none; }
.h-side .h-nav__item.on:has(.h-count:not(.hide))::after { margin-left: 8px; }
.h-side .h-nav__item > span:first-of-type { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-side .h-nav__item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.h-nav.hide { display: none !important; }
/* Workspace switcher: static (disabled) when there is one workspace. */
.h-ws-wrap, .h-user-wrap { position: relative; }
.h-ws:disabled { cursor: default; opacity: 1; }
.h-ws:disabled:hover { border-color: var(--line); }
.h-ws:disabled > .h-i { display: none; }
.h-ws { font: 400 var(--fs-13)/1.25 var(--font-sans); min-height: 0; }
.h-ws-menu { left: 0; right: 0; max-width: none; }
.h-ws-menu .h-menu__item { white-space: normal; }
.h-ws-menu .h-menu__item .h-ws__mark { width: 20px; height: 20px; font-size: 10px; }
.h-ws-menu .h-menu__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.h-ws-menu .h-menu__text small { margin: 0; }
.h-user { font: inherit; min-height: 0; }
.h-account-menu { position: absolute; left: 0; right: 0; bottom: calc(100% + 4px); max-width: none; }
.h-account-menu__settings { display: none; }
.h-menu__item { min-height: 0; font-weight: 400; letter-spacing: 0; cursor: pointer; }
.h-menu.hide { display: none; }

/* Top bar */
.h-top { padding: 0 var(--s-7); }
.h-crumbs .h-crumbs__ws { color: var(--text-2); }
.h-cmdk-hint { font-weight: 400; letter-spacing: 0; min-height: 0; cursor: pointer; }
#help-btn.hide { display: none !important; }

/* Main column: .content carries the .h-page rhythm (32 / 28 / 64). */
#main.content { min-height: 0; padding: var(--s-8) var(--s-7) var(--s-16); max-width: none; width: 100%; }

/* Declutter (rule 8): the top-bar crumbs now name where you are and link one
   level up, so the screens' own "← back" links and inline crumbs are dropped.
   Hidden, not removed: their handlers stay bound. */
#main :is(#apps-back, #connect-back, #tut-back, .ag-back, .pg-crumb) { display: none !important; }

/* Toasts (0-global-states): bottom centre, close button, ok/danger icon. */
#toast.h-toast.hide { display: none; }
.h-toast__x { min-height: 0; }

/* Cmd+K palette */
.h-cmdk-backdrop.hide { display: none; }
.h-cmdk__item { border: 0; background: none; width: 100%; text-align: left; color: var(--text); font-weight: 400; min-height: 0; }
.h-cmdk__item .h-avatar, .h-cmdk__item .h-logo { flex: none; }
.h-cmdk__empty { padding: 18px 8px; color: var(--text-2); font-size: var(--fs-13); }
.h-cmdk__input input { width: auto; padding: 0; border: 0; box-shadow: none; color: var(--text); }
.h-cmdk__input input:focus { border: 0; outline: 0; }

/* ------------------------------------------------------------ Phone shell */
@media (max-width: 820px) {
  #app:not(.hide) { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .h-side .h-ws-wrap { display: none; }
  .h-side .h-nav__item { width: auto; }
  .h-side .h-nav__item.on { box-shadow: inset 0 -2px 0 var(--brand), inset 0 0 0 1px var(--line); }
  .h-side .h-nav__item.on::after { display: none; }
  .h-side__mobile-actions { position: relative; }
  .h-side__mobile-actions .h-account-menu { top: calc(100% + 4px); bottom: auto; left: auto; right: 0; min-width: 200px; }
  .h-account-menu__settings { display: flex; }
  .h-top { padding: 0 var(--s-4); }
  #main.content { padding: var(--s-6) var(--s-4) var(--s-12); }
  .h-cmdk-backdrop { padding-top: var(--s-4); }
}

/* ================================================================= Home (2.1) */
#view-home { max-width: none; }
#view-home .h-page-head { margin-bottom: var(--s-6); }
#view-home .h-section:first-of-type { margin-top: 0; }
.h-client { font: 500 var(--fs-13)/1.2 var(--font-sans); letter-spacing: 0; min-height: 0; cursor: pointer; text-align: left; }
.h-client:hover { background: var(--bg-surface); }
.h-logo--mono .h-i { width: 12px; height: 12px; }
.h-copyfield .h-btn, .h-code .h-btn { min-height: 0; }
.h-code__copy { position: absolute; top: 6px; right: 6px; }

/* Guest home (2.2) */
#view-guest-home { max-width: 760px; }
#view-guest-home .h-page-head__title { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; }

/* Boot skeleton (1.1): the "page" skeleton is Home's shape. */
.skel-page .skel-home-card { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); margin-top: var(--s-4); }
.skel-page .skel-home-row { padding: var(--s-3) var(--s-4); border-top: 1px solid var(--line); }
.skel-page .skel-home-row:first-child { border-top: 0; }
.skel-page .skel-home-row > .skel-stack { flex: 1; }
.skel-page .skel-home-btn { width: 72px; flex: none; }
.skel-page .skel-home-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); margin-top: var(--s-2); }
.skel-page .skel-icon { width: 32px; height: 32px; border-radius: var(--r-md); }
@media (max-width: 820px) { .skel-page .skel-home-tiles { grid-template-columns: minmax(0, 1fr); } }
.h-side__brand a { display: block; line-height: 0; }
.h-side__brand img { display: block; }
.h-ws__meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view-guest-home { max-width: 704px; }
/* Before /api/me answers (1.1): keep the switcher and user block's place, show nothing. */
.h-ws { min-height: 46px; }
.h-ws:has(.h-ws__name:empty), .h-user:has(.h-user__email:empty) { visibility: hidden; }
#guest-invites-banner:not(:empty) { display: flex; flex-direction: column; gap: var(--s-4); margin: 0 0 var(--s-6); }
.h-account-menu__ws { display: none; }
@media (max-width: 820px) { .h-account-menu__ws { display: block; } }

/* Two-factor banner (fixed, top centre): Plan floating banner; wraps cleanly on a phone. */
#mfa-banner { background: var(--bg-surface) !important; border: 1px solid var(--line) !important; border-radius: var(--r-lg) !important; box-shadow: var(--shadow-2) !important; color: var(--text) !important; }
@media (max-width: 640px) {
  #mfa-banner { top: auto !important; bottom: 16px; left: 16px !important; right: 16px; transform: none !important; max-width: none !important; flex-wrap: wrap; }
  #mfa-banner #mfa-banner-text { flex: 1 1 calc(100% - 44px) !important; }
  #mfa-banner #mfa-banner-btn { order: 3; }
}
