/* =============================================================================
   Agents area (Agents list, New agent, agent page with Chat / Mailbox / Logs,
   Approvals, Queue, Runners, cloud box, AI account).

   1. Non-colour DS tokens (sizes, space, motion, z) not yet in homla.css.
   2. Homla DS components, copied verbatim from 05-production/ds/homla-ds.css
      (shell parts left out: the sidebar and top bar belong to homla-shell.css).
      Identical copies in other area files are harmless.
   3. Screen-local layout from the agents mockups (the mockups' x- classes,
      renamed agx- so they cannot meet another area's x- classes).
   4. Agents-only overrides on the real markup.
   ============================================================================= */

/* ---------------------------------------------------------------- 1. 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; --success-tint: var(--ok-tint);
}
@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; }

/* ------------------------------------------------- 2. DS components (copy) */

/* 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; }

/* Icon */
.h-i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; display: inline-block; vertical-align: middle; }
.h-i--12 { width: 12px; height: 12px; } .h-i--14 { width: 14px; height: 14px; } .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; }


/* ---------------------------------------------------------------- 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; }


/* 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-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)); }
}


/* -------------------------------------------------------------- 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); }


/* ---------------------------------------------------------- 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; } }

/* ------------------------------------------- 3. Screen layout (mockups) */

/* Flat sections: a title row and a hairline between sections instead of a banded card per block */
.agx-secs { display: flex; flex-direction: column; min-width: 0; }
.agx-sec { padding: var(--s-6) 0; border-top: 1px solid var(--line); min-width: 0; }
.agx-secs > .agx-sec:first-child, .h-stack > .agx-sec:first-child { border-top: 0; padding-top: 0; }
.agx-secs > .agx-sec:last-child { padding-bottom: 0; }
.agx-sec__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-3); min-height: 28px; }
.agx-sec__title { display: flex; align-items: center; gap: 8px; margin: 0; font: 500 var(--fs-15)/var(--lh-snug) var(--font-sans); }
.agx-sec__title .h-i { color: var(--text-2); }
.agx-sec__sub { margin-top: 2px; font-size: var(--fs-13); color: var(--text-2); }
.agx-sec > .h-list > .h-list__item:first-child, .agx-sec .agx-tl > .h-list__item:first-child { border-top: 0; padding-top: 0; }
.agx-secs > .h-details, .agx-secs > .h-stack { margin-top: var(--s-2); }
/* S016-N7: schedules and commands as one-line rows; edit and delete on hover, the editor opens in place */
.h-list__item:hover .h-row-actions, .h-list__item:focus-within .h-row-actions { opacity: 1; }
.agx-srows { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-surface); padding: 0 var(--s-4); }
.agx-srows > .h-list__item { padding: var(--s-3) 0; }
.agx-srow__name { font-weight: 500; color: var(--text); }
.agx-srow__line { font-size: var(--fs-13); color: var(--text-2); }
.agx-srow--open { display: flex; flex-direction: column; align-items: stretch; gap: var(--s-3); padding: var(--s-4) 0; }
.agx-sec .agx-srows > .h-list__item:first-child { padding-top: var(--s-3); }
.agx-sec .agx-srows > .agx-srow--open:first-child { padding-top: var(--s-4); }
.h-card > .h-list--pad > .h-list__item:first-child { border-top: 0; }
/* Agent list on mobile: the ⋯ sits top right of each card, not on its own row */
@media (max-width: 820px) { .agx-agents.h-table--cards tr { position: relative; } .agx-agents.h-table--cards td.is-shrink { position: absolute; top: 10px; right: 8px; width: auto; padding: 0; border: 0; } .agx-agents .h-cell-who { padding-right: 36px; } }
/* New agent: templates two by two */
.h-opts--grid.agx-tpl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 820px) { .h-opts--grid.agx-tpl { grid-template-columns: minmax(0, 1fr); } }
/* Compact tool rows on the Overview */
.agx-tl .h-list__item { padding: 10px 0; }
.agx-tl .h-list__sub { margin: 0; }
/* Agent header: actions centred on the title, not on its baseline */
.h-page-head.agx-ahead { align-items: center; }
/* Small picker for rows (per tool access, per write approval) */
.agx-picker--sm .h-picker__btn { min-height: var(--ctl-h); padding: 3px 8px 3px 4px; gap: 8px; font-size: var(--fs-13); }
.agx-picker--sm .h-picker__btn .h-picker__icon { width: 24px; height: 24px; }
.agx-picker--sm .h-picker__menu { min-width: 260px; }
.agx-picker--end .h-picker__menu { left: auto; right: 0; }
/* Approval arguments: one hairline instead of a box inside the card */
#view-agents .h-approval__args { background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: var(--s-3) 0 0; }
/* Approval in edit mode: label column like the arguments, short textarea */
.agx-edit-grid { display: grid; grid-template-columns: minmax(90px, max-content) minmax(0, 1fr); gap: var(--s-2) var(--s-4); align-items: center; border-top: 1px solid var(--line); padding-top: var(--s-3); }
.agx-edit-grid > .h-field { display: contents; }
.agx-edit-grid .h-label { margin: 0; align-self: start; padding-top: 9px; color: var(--text-2); font-family: var(--font-mono); font-size: 12px; font-weight: 400; }
@media (max-width: 820px) { .agx-edit-grid { grid-template-columns: minmax(0, 1fr); gap: 4px; } }

/* Agent app views: one panel that fills the content width and most of the viewport */
.agx-panel { display: grid; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); min-height: max(560px, calc(100vh - 290px)); overflow: hidden; min-width: 0; }

/* Chat: conversation rail + centred 720px reading column + docked composer */
.agx-chat { grid-template-columns: 252px minmax(0, 1fr); }
.agx-chat--solo { grid-template-columns: minmax(0, 1fr); }
.agx-rail { display: flex; flex-direction: column; gap: 2px; padding: var(--s-3); border-right: 1px solid var(--line); background: var(--bg-canvas); min-width: 0; }
.agx-rail .h-eyebrow { padding: var(--s-4) 10px var(--s-2); }
.agx-rail__item { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border-radius: var(--r-md); color: var(--text); text-decoration: none; font-size: var(--fs-13); min-width: 0; }
.agx-rail__item:hover { background: var(--bg-hover); text-decoration: none; }
.agx-rail__item[aria-current="true"] { background: var(--bg-sunken); font-weight: 500; }
.agx-rail__item .h-caption { font-weight: 400; }
.agx-convo { display: flex; flex-direction: column; min-width: 0; }
.agx-convo__bar { display: none; }
.agx-thread { flex: 1; width: 100%; max-width: 768px; margin: 0 auto; padding: var(--s-8) var(--s-6) var(--s-6); display: flex; flex-direction: column; gap: var(--s-6); }
.agx-me { align-self: flex-end; max-width: 80%; padding: 10px 14px; border-radius: var(--r-xl); border-bottom-right-radius: var(--r-sm); background: var(--bg-sunken); color: var(--text); font-size: var(--fs-15); line-height: 1.5; overflow-wrap: anywhere; }
.agx-ai { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 4px var(--s-3); align-items: start; }
.agx-ai > .h-avatar { grid-row: span 2; }
.agx-ai__name { display: flex; align-items: baseline; gap: var(--s-2); min-height: 32px; padding-top: 6px; font-size: var(--fs-13); font-weight: 500; }
.agx-ai__name time { font-weight: 400; font-size: var(--fs-12); color: var(--text-2); }
.agx-ai__body { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.agx-ai__body .h-md { font-size: var(--fs-15); line-height: 1.6; }
.agx-think { display: inline-flex; align-items: center; gap: var(--s-2); font-size: var(--fs-14); color: var(--text-2); }
.agx-think .h-typing { padding: 0; }
.agx-dock { width: 100%; max-width: 768px; margin: 0 auto; padding: 0 var(--s-6) var(--s-5); position: sticky; bottom: 0; background: var(--bg-surface); }
.agx-dock .h-slash { position: static; margin: 0 0 var(--s-2); }
.agx-composer { display: flex; flex-direction: column; gap: var(--s-2); padding: var(--s-3) var(--s-3) var(--s-2) var(--s-4); border: 1px solid var(--line-strong); border-radius: var(--r-xl); background: var(--bg-surface); box-shadow: var(--shadow-1); }
.agx-composer:focus-within { border-color: var(--text); }
.agx-composer textarea { width: 100%; min-height: 48px; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font: 400 var(--fs-15)/1.5 var(--font-sans); padding: 2px 0 0; }
.agx-composer textarea::placeholder { color: var(--text-2); }
.agx-composer__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.agx-hint { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--text-2); }
.agx-paused { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--r-xl); background: var(--bg-canvas); font-size: var(--fs-14); }
.agx-suggest { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--s-2); margin-top: var(--s-2); }

/* Mailbox: address bar, conversation list, reading pane */
.agx-mail { grid-template-columns: 360px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
.agx-mail__top { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--s-2); padding: 8px var(--s-3) 8px var(--s-4); border-bottom: 1px solid var(--line); flex-wrap: wrap; min-width: 0; }
.agx-mail__list { border-right: 1px solid var(--line); min-width: 0; }
.agx-mi { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 2px var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; min-width: 0; }
.agx-mi:hover { background: var(--bg-hover); text-decoration: none; }
.agx-mi[aria-current="true"] { background: var(--bg-sunken); box-shadow: inset 2px 0 0 var(--text); }
.agx-mi > .h-avatar { grid-row: span 4; }
.agx-mi__l1 { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2); min-width: 0; font-size: var(--fs-13); }
.agx-mi__who { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.agx-mi__subj, .agx-mi__prev { font-size: var(--fs-13); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.agx-mi__prev { color: var(--text-2); }
.agx-flag { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); font-weight: 500; color: var(--text); margin-top: 4px; }
.agx-read { width: 100%; max-width: 820px; padding: var(--s-6) var(--s-8) var(--s-8); display: flex; flex-direction: column; min-width: 0; }
.agx-read__subj { font: 400 var(--fs-24)/1.25 var(--font-display); letter-spacing: var(--track-title); }
.agx-em { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: var(--s-3); padding: var(--s-5) 0; border-bottom: 1px solid var(--line); }
.agx-em__head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px var(--s-3); flex-wrap: wrap; font-size: var(--fs-13); }
.agx-em__body { margin-top: var(--s-2); white-space: pre-wrap; font: 400 var(--fs-15)/1.6 var(--font-sans); color: var(--text); overflow-wrap: anywhere; }
.agx-file { display: inline-flex; align-items: center; gap: var(--s-2); margin-top: var(--s-3); padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-surface); color: var(--text); font-size: var(--fs-13); text-decoration: none; }
.agx-file:hover { border-color: var(--line-strong); text-decoration: none; }
.agx-idle { display: grid; place-items: center; padding: var(--s-8); text-align: center; }
.agx-pop { width: min(400px, calc(100vw - 32px)); max-width: none; padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); white-space: normal; }

/* Logs: Runs | Audit, one row per run, run details in a side panel */
.agx-tools { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; margin-bottom: var(--s-3); }
.agx-tools .h-search { flex: 1 1 220px; max-width: 320px; }
.agx-tools .h-select { width: auto; }
.agx-logs { grid-template-columns: minmax(0, 1fr); align-content: start; }
.agx-logs--open { grid-template-columns: minmax(0, 1fr) 440px; align-content: stretch; }
.agx-rl { list-style: none; margin: 0; padding: 0; min-width: 0; }
.agx-r { display: grid; grid-template-columns: 112px 104px minmax(0, 1fr) 48px 76px; gap: var(--s-3); align-items: center; min-height: 44px; padding: 6px var(--s-4); border-bottom: 1px solid var(--line); font-size: var(--fs-13); color: var(--text); }
.agx-r:not(.agx-r--head):hover { background: var(--bg-hover); cursor: pointer; }
.agx-r[aria-selected="true"] { background: var(--bg-sunken); box-shadow: inset 2px 0 0 var(--text); }
.agx-r--head { min-height: 36px; font: 500 var(--fs-11)/1.3 var(--font-mono); letter-spacing: var(--track-mono); text-transform: uppercase; color: var(--text-2); }
.agx-r > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agx-r__st { display: inline-flex; align-items: center; gap: var(--s-2); font-weight: 500; }
.agx-r__trig { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.agx-r__num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }
.agx-r .h-tag { margin-right: var(--s-2); height: 20px; }
.agx-is-bad { color: var(--danger); }
.agx-is-live .h-dot { animation: h-pulse 1.4s var(--ease) infinite; }
.agx-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); font-size: var(--fs-12); color: var(--text-2); }
.agx-side { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--bg-surface); min-width: 0; }
.agx-side .h-run__steps ul { margin-top: var(--s-2); }
.agx-audit { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: var(--s-3); align-items: center; min-height: 44px; padding: 6px var(--s-4); border-bottom: 1px solid var(--line); font-size: var(--fs-13); }
.agx-audit > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 820px) {
  .agx-panel { min-height: 0; }
  .agx-chat { grid-template-columns: minmax(0, 1fr); }
  .agx-rail { display: none; }
  .agx-convo__bar { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--line); }
  .agx-convo__bar .h-btn--ghost { flex: 1; min-width: 0; justify-content: flex-start; }
  .agx-thread { padding: var(--s-5) var(--s-4) var(--s-4); gap: var(--s-5); }
  .agx-me { max-width: 88%; }
  .agx-ai > .h-avatar { grid-row: auto; }
  .agx-ai__body { grid-column: 1 / -1; }
  .agx-tools .h-search { order: 3; }
  .agx-dock { padding: 0 var(--s-3) var(--s-3); }
  .agx-hint--long { display: none; }
  .agx-mail { grid-template-columns: minmax(0, 1fr); }
  .agx-mail__list { border-right: 0; }
  .agx-mail.is-open .agx-mail__list, .agx-mail:not(.is-open) .agx-read, .agx-mail:not(.is-open) .agx-idle { display: none; }
  .agx-read { padding: var(--s-4); }
  .agx-mail__top .h-anchor:has(.agx-pop) { flex-basis: 100%; text-align: right; }
  .agx-pop { position: static; width: 100%; margin-top: var(--s-2); box-shadow: none; text-align: left; }
  .agx-read__subj { font-size: var(--fs-20); }
  .agx-tools .h-search { max-width: none; flex-basis: 100%; }
  .agx-logs--open { grid-template-columns: minmax(0, 1fr); }
  .agx-logs--open .agx-rl, .agx-logs--open .agx-foot { display: none; }
  .agx-side { border-left: 0; }
  .agx-r { grid-template-columns: minmax(0, 1fr) auto; gap: 2px var(--s-3); padding: 10px var(--s-4); }
  .agx-r__trig, .agx-r__dur, .agx-r--head { display: none; }
  .agx-r__sum { grid-column: 1 / -1; order: 3; color: var(--text-2); }
}

@media (max-width: 820px) { .h-table--cards td.is-shrink { width: 100%; } }


/* ------------------------------------------------- 4. Agents overrides */
/* The legacy `button:hover` paints every button ink; DS buttons whose hover only changes colour keep their own background. */
button:is(.h-sort, .h-tab, .h-ostab, .h-toast__x, .h-link, .h-seg__btn):hover { background: transparent; border-color: transparent; }
button.h-seg__btn:is([aria-pressed="true"], [aria-checked="true"], .is-on):hover { background: var(--bg-surface); }

/* Shared: the Agents header and sub-tabs (7.1 / 7.4 / 7.5 / 7.6). The agent page has its own header. */
#view-agents .ag-head { margin-bottom: var(--s-6); }
#view-agents .ag-head .h-page-head__title { margin-bottom: 0; }
#view-agents #agents-subnav { margin-bottom: var(--s-5); }
#view-agents #agents-subnav .h-tab, #view-agents #agents-subnav .h-tab:hover { background: none; }
#view-agents #agents-subnav .h-tab:hover { color: var(--text); }
#view-agents #agents-subnav .h-tab { min-height: 0; border-radius: 0; font-family: var(--font-sans); text-transform: none; letter-spacing: 0; box-shadow: none; }
#view-agents.ag-is-detail > .ag-head, #view-agents.ag-is-detail > #agents-subnav { display: none; }
#view-agents :is(h1, h2, h3, h4, p, dl, figure) { margin: 0; }
/* Agent avatar: the DS rounded square with a soft fill of the agent's own colour, no border. */
.ag-avatar { border: 0; border-radius: var(--r-md); background: color-mix(in srgb, var(--ag) 18%, #FFFFFF); color: #151210; }
#view-agents :is(ul, ol)[class] { list-style: none; padding: 0; margin: 0; }

/* A: list, approvals, queue, runners, cloud box, AI account */
.ag-hmenu { white-space: normal; }
.ag-hmenu .ag-menu-items { display: block; }
.ag-hmenu .h-confirm { margin: 0; border: 0; width: 280px; max-width: 100%; }
.ag-hmenu .ag-menu-items.hide, .ag-hmenu .h-confirm.hide { display: none; }
.agx-agents .h-cell-who__name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ag-row-link { color: var(--text); text-decoration: none; }
.ag-row-link:hover { text-decoration: underline; }
@media (min-width: 821px) { .agx-agents td { height: 55px; } }
.ag-list-wrap { overflow: visible; }
.ag-list-wrap .h-table th { background: transparent; }
.ag-hmenu .h-menu__sep { display: block; }
.ag-minw { min-width: 0; }
/* 7.4 Approvals */
.ag-decided-fold { max-width: 820px; }
.ag-decided-fold .h-approval--decided { justify-content: space-between; gap: var(--s-3); }
.h-run__icon.ag-dec-ok { background: var(--ok-tint); color: var(--ok); }
.h-run__icon.ag-dec-bad { background: var(--danger-tint); color: var(--danger); }
.h-approval .ag-avatar { border-radius: var(--r-md); }
.h-approval__edit.hide, .h-approval__args.hide { display: none; }
.ag-edit-in { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ag-logo-mono { font: 500 10px/1 var(--font-mono); color: var(--text-2); }
.h-approval .ag-kv { display: flex; flex-direction: column; gap: 2px; }
.h-approval .ag-kv i { font-style: normal; color: var(--text-2); }
.h-approval .ag-json { white-space: pre-wrap; font-size: 12px; }
/* 7.5 Queue */
.ag-queue .h-cell-who__sub { max-width: 520px; }
.ag-queue-confirm td { background: none !important; }
@media (max-width: 820px) { .ag-queue .h-cell-who__sub { max-width: none; } }
/* 7.6 Runners, cloud box, AI account */
.ag-box-row { gap: var(--s-4); align-items: center; }
.ag-box-main { min-width: 200px; display: flex; flex-direction: column; gap: 2px; }
.ag-box-ico { color: var(--text-2); }
.ag-box .h-card__head .h-row { gap: var(--s-3); }
.ag-box .h-opts { margin: 0; padding: 0; border: 0; }
.ag-box-actions { gap: var(--s-2); }
@media (min-width: 821px) { .ag-rtable td { height: 60px; } }
.ag-ai-head { align-items: center; }
.ag-ai-head .h-section__title { font-size: var(--fs-15); }
.ag-confirm-wrap .ag-hmenu { width: 300px; }
.ag-addpc .h-details__body { padding-left: var(--s-4); }
.h-backdrop.hide { display: none; }
.h-opt input { padding: 0; min-height: 0; box-sizing: border-box; box-shadow: none; }
fieldset.h-opts { margin: 0; padding: 0; min-width: 0; }
.h-backdrop .h-modal { position: relative; }
.ag-elm .h-steps { margin: 0; padding: 0; list-style: none; }
.ag-elm .h-step__body p { margin: 0; }
.ag-elm-help[hidden], .h-picker[hidden], [data-os-pane][hidden] { display: none; }
@media (max-width: 820px) { .ag-box-actions { width: 100%; } .ag-elm-pickers .h-picker { width: 100% !important; } }
@media (max-width: 820px) { #view-agents .h-table--cards tbody tr:hover td { background: none; } }

/* B: agent page overview, edit, new agent */
#ag-page { max-width: none; }
#ag-page.is-editing, #ag-page.is-new { max-width: 704px; }
#ag-page :is(button, a).h-btn, #ag-page .h-picker__btn, #ag-page .h-picker__opt, #ag-page .h-menu__item { font-family: var(--font-sans); text-transform: none; letter-spacing: normal; }
#ag-page button:is(.h-tab, .h-link, .h-picker__opt, .h-menu__item, .h-btn--ghost):hover { color: var(--text); }
#ag-page button:is(.h-tab, .h-link):hover { background: transparent; border-color: transparent; }
#ag-page button.h-btn--ghost:hover { background: var(--bg-hover); border-color: transparent; }
#ag-page button.h-picker__opt:hover, #ag-page button.h-menu__item:hover { background: var(--bg-sunken); border-color: transparent; }
#ag-page button.h-menu__item--danger:hover { background: var(--danger-tint); color: var(--danger); }
#ag-page button.h-btn:not(.h-btn--primary):not(.h-btn--ghost):hover { background: var(--bg-hover); color: var(--text); border-color: var(--line-strong); }
#ag-page button.h-btn--primary:hover { background: var(--accent-hover); color: var(--on-accent); }

/* Header: avatar, name, actions centred on the title */
#ag-page .ag-detail-head { margin: 0 0 var(--s-6); align-items: center; flex-wrap: nowrap; }
#ag-page .ag-head-id { gap: var(--s-4); min-width: 0; flex: 1 1 auto; }
#ag-page .ag-head-name { min-width: 0; flex: 1 1 auto; }
#ag-page .ag-head-name .h-page-head__title { margin: 0; overflow-wrap: anywhere; }
#ag-page .ag-avatar-col { display: inline-flex; position: static; width: auto; height: auto; margin: 0; flex: none; }
#ag-page #af-avatar-preview { display: inline-flex; }
#ag-page #af-avatar-preview .ag-avatar, #ag-page #af-avatar-preview .ag-avsvg { border-radius: var(--r-lg); overflow: hidden; }
#ag-page .ag-name-input { font-size: 22px; font-weight: 400; height: 44px; max-width: 290px; padding: 0 12px; }
#ag-page .ag-head-actions { flex-wrap: nowrap; }
#ag-page .ag-menu-wrap { position: relative; }
#ag-page .ag-menu { position: absolute; top: calc(100% + 4px); right: 0; z-index: var(--z-drop); min-width: 200px; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-surface); box-shadow: var(--shadow-2); }
#ag-page .ag-menu button.h-menu__item { padding: 7px 8px; border-radius: var(--r-sm); font-size: var(--fs-13); color: var(--text); }
#ag-page .ag-menu button.h-menu__item--danger, #ag-page .ag-menu button.h-menu__item--danger .h-i { color: var(--danger); }

/* Tabs bar: full width on every tab */
#ag-page > .h-tabs { margin-bottom: 0; }
#ag-page > .h-tabs .h-tab { min-height: 0; padding: 0; border-radius: 0; margin: 0; box-shadow: none; font-family: var(--font-sans); text-transform: none; letter-spacing: 0; }
#ag-page > .h-tabs .h-tab:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Overview: main column + 340px side column */
#ag-page .ag-ov.h-split { margin-top: var(--s-6); }
#ag-page.is-editing .ag-ov { display: block; margin-top: 0; }
#ag-page .ag-ov-main { min-width: 0; }
#ag-page .ag-form { display: flex; flex-direction: column; gap: 0; max-width: none; margin: 0; }
#ag-page .ag-ov-main > .agx-sec + .ag-form > .agx-sec:first-child { border-top: 1px solid var(--line); padding-top: var(--s-6); }
#ag-page:not(.is-editing) .ag-form > .agx-sec.ag-e + .agx-sec, #ag-page .ag-form > .agx-sec:first-child { border-top: 0; padding-top: 0; }
#ag-page .ag-ov-main > .agx-sec.ag-waiting + .ag-form > .agx-sec:not(.ag-e) { border-top: 1px solid var(--line); padding-top: var(--s-6); }
#ag-page.is-editing .ag-avatar-edit + .ag-form > .agx-sec:first-child { padding-top: var(--s-6); }
#ag-page .ag-avatar-edit { margin-bottom: var(--s-2); }
#ag-page .agx-sec__head .h-btn--ghost .h-i { color: var(--text-2); }
#ag-page .ag-aside .h-card .h-list__item { padding: 10px 0; }
#ag-page .ag-aside .h-eyebrow { margin: 0; }
#ag-page .ag-aside .h-details > summary { font-size: var(--fs-14); }
#ag-page .ag-aside .h-details__body p { margin: 0; }
#ag-page .ag-aside .h-details__body .h-list__item { padding: 8px 0; }
#ag-page .h-details > summary { color: var(--text); }

/* The job */
#ag-page .ag-md.ag-clamp { max-height: none; -webkit-mask-image: none; mask-image: none; }
#ag-page .ag-md.ag-clamp > :not(p:first-of-type) { display: none; }
#ag-page .ag-md.ag-clamp > p:first-of-type { margin-top: 0; }
#ag-page .ag-md { font-size: var(--fs-14); }
#ag-page .ag-job-foot { gap: var(--s-3); }

/* Tools: one 44px line each in view, a full row with pickers in edit */
#ag-page .ag-svcs { display: flex; flex-direction: column; border: 0; border-radius: 0; overflow: visible; background: none; }
#ag-page .ag-svc-head { padding-left: 0; padding-right: 0; }
#ag-page .ag-svc { border-top: 1px solid var(--line); }
#ag-page .ag-svc:first-child { border-top: 0; }
#ag-page .ag-svc > .h-list__item { border-top: 0; }
#ag-page:not(.is-editing) .ag-svc > .h-list__item { padding: 10px 0; }
#ag-page:not(.is-editing) .ag-svc:first-child > .h-list__item { padding-top: 0; }
#ag-page:not(.is-editing) .ag-svc-head > .ag-logo { --_s: 22px; width: 22px !important; height: 22px !important; border-radius: var(--r-sm); }
#ag-page:not(.is-editing) .ag-svc-head > .ag-logo img { width: 15px; height: 15px; }
#ag-page .ag-svc-head > .ag-logo { flex: none; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--logo-tile); display: grid; place-items: center; }
#ag-page .ag-svc-sum { white-space: nowrap; }
#ag-page .ag-svc-pad { width: 28px; flex: none; }
#ag-page .ag-svc .h-list__title { font-weight: 500; }
#ag-page .ag-svc .h-list__sub .h-i { vertical-align: -2px; }
#ag-page .ag-svc-head > .ag-e { flex: none; }
#ag-page .ag-svc.is-off .ag-svc-head > .ag-logo { opacity: .6; }
#ag-page .ag-svc-none { margin: 0; }
#ag-page .ag-writes { margin: 0 0 var(--s-3) 34px; padding: var(--s-2) var(--s-3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--bg-surface); }
#ag-page .ag-writes-tools { justify-content: space-between; padding: 4px 0 var(--s-2); }
#ag-page .ag-write { display: flex; align-items: center; gap: var(--s-3); min-height: 40px; padding: 4px 0; border-top: 1px solid var(--line); font-size: var(--fs-13); }
#ag-page .ag-writes-tools + .ag-write, #ag-page .ag-writes > .ag-write:first-child { border-top: 0; }
#ag-page .ag-write-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ag-page .ag-gh { margin: 0 0 var(--s-3) 34px; }
#ag-page .ag-gh.ag-e { display: flex; flex-direction: column; gap: var(--s-2); }
#ag-page .ag-gh-repos { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; padding: 4px 0; }
#ag-page .ag-tool-add .h-search { width: 100%; }
#ag-page .agx-picker--sm .h-picker__btn { min-height: var(--ctl-h); padding: 3px 8px 3px 4px; gap: 8px; font-size: var(--fs-13); }
#ag-page .agx-picker--sm .h-picker__btn .h-picker__icon { width: 24px; height: 24px; }
#ag-page .agx-picker--sm .h-picker__btn .h-picker__desc { display: none; }
#ag-page .agx-picker--sm .h-picker__menu { min-width: 260px; }
#ag-page .agx-picker--end .h-picker__menu { left: auto; right: 0; }
#ag-page .h-picker__menu { z-index: var(--z-drop); }

/* Combos (skills, tools, channel, people): the dropdown under its field */
#ag-page .h-combo { position: relative; }
#ag-page .h-chips.ag-skills { display: flex; flex-wrap: wrap; 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); }
#ag-page .h-chips .ag-chips { display: contents; }
#ag-page .h-chips .ag-skill-q { flex: 1 1 160px; min-width: 80px; height: 24px; padding: 0 4px; border: 0; outline: 0; background: transparent; box-shadow: none; font-size: var(--fs-14); }

/* Cloud-box resize: plan choice first, billing consequence immediately below. */
.ag-box-plan-options { gap: 10px; }
.ag-box-plan-option { align-items: flex-start; min-height: 76px; padding: 14px 16px; border-radius: var(--r-lg); transition: border-color .15s ease, background .15s ease, box-shadow .15s ease; }
.ag-box-plan-option.is-current { border-color: var(--line-strong); }
.ag-box-plan-option.is-selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg-surface)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.ag-box-plan-option .h-opt__label { display: flex; align-items: center; gap: 8px; }
.ag-box-current { color: var(--text-2); font-size: var(--fs-11); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.ag-box-plan-price { margin-left: auto; white-space: nowrap; font-size: var(--fs-16); font-weight: 650; color: var(--text); }
.ag-box-plan-price small { margin-left: 3px; color: var(--text-2); font-size: var(--fs-11); font-weight: 450; }
.ag-box-change-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-sunken); }
.ag-box-change-summary > span, .ag-box-change-summary > small { display: flex; flex-direction: column; gap: 3px; }
.ag-box-change-summary > small { grid-column: 1 / -1; color: var(--text-2); }
.ag-box-summary-label { color: var(--text-2); font-size: var(--fs-11); text-transform: uppercase; letter-spacing: .05em; }
@media (max-width: 520px) { .ag-box-change-summary { grid-template-columns: 1fr; } .ag-box-change-summary > small { grid-column: auto; } }
#ag-page .h-chips .ag-chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 4px 0 8px; border: 0; border-radius: var(--r-sm); background: var(--bg-sunken); color: var(--text); font-size: var(--fs-13); }
#ag-page .h-chips .ag-chip button { width: 18px; height: 18px; min-height: 0; padding: 0; border: 0; background: none; color: var(--text-2); font-size: 14px; line-height: 1; }
#ag-page .ag-skill-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); }

/* When it runs: view list, webhook fold, schedule rows */
#ag-page .agx-sec > .h-list > .h-list__item:first-child { padding-top: 0; }
#ag-page .h-list__item > .h-i { color: var(--text-2); }
#ag-page .h-list__item .ag-copy { margin-left: auto; }
#ag-page .agx-srows.is-empty { display: none; }
#ag-page .ag-sched-row, #ag-page .ag-cmd-row { flex-direction: column; align-items: stretch; gap: 0; }
#ag-page .ag-srow-line { display: flex; align-items: center; gap: var(--s-3); min-width: 0; }
#ag-page .ag-sched-editor, #ag-page .ag-cmd-editor { display: none; }
#ag-page .ag-sched-row.is-open > .ag-srow-line, #ag-page .ag-cmd-row.is-open > .ag-srow-line { display: none; }
#ag-page .ag-sched-row.is-open > .ag-sched-editor, #ag-page .ag-cmd-row.is-open > .ag-cmd-editor { display: flex; }
#ag-page .agx-srows > .h-list__item.is-open { padding: var(--s-4) 0; }
#ag-page .h-row-actions { display: flex; gap: 2px; opacity: 0; transition: opacity var(--dur-1) var(--ease); }
#ag-page .h-list__item:hover .h-row-actions, #ag-page .h-list__item:focus-within .h-row-actions { opacity: 1; }
@media (hover: none) { #ag-page .h-row-actions { opacity: 1; } }
#ag-page .ag-sched { gap: var(--s-2); }
#ag-page .ag-sched .ag-sched-preset { width: 190px; }
#ag-page .ag-sched-times { max-width: 140px; }
#ag-page .ag-sched-tz { max-width: 160px; }
#ag-page .ag-sched-cron { max-width: 200px; }
#ag-page .ag-sched-day { width: auto; }
#ag-page .ag-sched-line.h-hint:empty { display: none; }
#ag-page.is-new .agx-srows { border: 0; padding: 0; background: none; }
#ag-page.is-new .agx-srows > .h-list__item { border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-5); background: var(--bg-surface); }
#ag-page.is-new .agx-srows > .h-list__item + .h-list__item { margin-top: var(--s-3); }
#ag-page .ag-hook { margin-top: var(--s-2); }
#ag-page .ag-hook .h-details__body { padding-left: 15px; }
#ag-page .ag-email-senders .h-hint { margin: 4px 0 0; }
#ag-page .ag-email-senders:has(#af-email-follows:only-child) { display: none; }

/* Legacy boxes these rows used to sit in */
#ag-page .ag-scheds { display: flex; flex-direction: column; gap: 0; margin: 0; }
#ag-page .ag-sched-row, #ag-page .ag-cmd-row { border: 0; border-top: 1px solid var(--line); border-radius: 0; padding: var(--s-3) 0; margin: 0; gap: 0; }
#ag-page .agx-srows > .h-list__item:first-child { border-top: 0; }
#ag-page .ag-sched-row .ag-sched { margin: 0; }
#ag-page .ag-sched input, #ag-page .ag-sched select { padding: 0 10px; font-size: var(--fs-14); }
#ag-page .ag-sched-add { margin: var(--s-3) 0 0; }
#ag-page .ag-ch-sub { display: flex; margin: var(--s-2) 0 0; }
#ag-page .ag-ch-sub[hidden] { display: none; }
#ag-page .ag-form .ag-tool-q { border: 1px solid var(--line-control) !important; background: var(--bg-surface); padding: 0 10px 0 32px; height: var(--ctl-h); }
#ag-page .ag-tool-add { display: block; margin-top: var(--s-4); padding: 0; border: 0; background: none; }
#ag-page .ag-cmd-line > input { flex: 1 1 auto; }
#ag-page .ag-cmd-line { gap: var(--s-2); }
/* Commands */
#ag-page .ag-cmd-editor { gap: var(--s-2); }
#ag-page .ag-cmd-name { position: relative; display: inline-flex; align-items: center; flex: 0 0 160px; }
#ag-page .ag-cmd-name .ag-cmd-slash { position: absolute; left: 10px; color: var(--text-2); font-family: var(--font-mono); }
#ag-page .ag-cmd-name .h-input { padding-left: 20px; font-family: var(--font-mono); font-size: var(--fs-13); }
#ag-page .ag-cmd-skill { flex: 0 0 200px; }

#ag-page .ag-copy { width: 28px; height: 28px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-2); }
#ag-page .ag-copy:hover { background: var(--bg-hover); color: var(--text); border: 0; }
#ag-page .h-copyfield .ag-copy { height: 26px; width: 26px; }
#ag-page .h-input-group > .h-copyfield { border-radius: var(--r-md) 0 0 var(--r-md); }
#ag-page .h-input-group > .h-copyfield:only-child { border-radius: var(--r-md); }
#ag-page .ag-hook .h-details > summary { color: var(--text-2); }
/* Talk to it */
#ag-page .ag-first-switch { border-top: 0; }
#ag-page .h-switch--row .h-strong .h-i { color: var(--text-2); vertical-align: -2px; }
#ag-page .ag-ch-line { gap: var(--s-2); }
#ag-page .ag-row-note { display: block; margin-top: 4px; }
#ag-page .h-list__main .h-status { margin-left: 6px; vertical-align: 1px; }
#ag-page .ag-slack-connect .h-steps, #ag-page .ag-ch-steps { margin: 0; padding-left: 1.2em; list-style: decimal; display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-13); color: var(--text-2); }
#ag-page .ag-slack-connect[hidden] { display: none; }

/* Who can talk to it */
#ag-page .ag-access-warn.hide { display: none; }

/* Folds (More settings, Advanced, Settings) */
#ag-page .ag-fold .h-details__body { color: var(--text); font-size: var(--fs-14); padding-left: var(--s-4); }
#ag-page .ag-fold .h-details__body .h-list__item:first-child { padding-top: 0; }
#ag-page .ag-more, #ag-page .ag-advanced { margin-top: var(--s-6); }
#ag-page .ag-more .h-eyebrow, #ag-page .ag-advanced .h-eyebrow { margin: 0 0 4px; }
#ag-page .ag-runner-pick .h-picker__btn > .h-i:first-child { display: none; }

/* Templates (New agent) */
#ag-page .ag-templates .h-opt { width: 100%; text-align: left; border: 1px solid var(--line); border-radius: var(--r-lg); color: var(--text); font: inherit; align-items: center; min-height: 0; }
#ag-page .ag-templates .h-opt:hover { background: var(--bg-hover); }
#ag-page .ag-templates .h-opt.on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
#ag-page .ag-tpl-dot { flex: none; width: 16px; height: 16px; border: 1px solid var(--line-control); border-radius: 50%; background: var(--bg-surface); }
#ag-page .ag-tpl.on .ag-tpl-dot { border: 5px solid var(--accent); }
#ag-page .h-opt__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
#ag-page .h-opt__label { font-weight: 500; }
#ag-page .h-opt__desc { font-size: var(--fs-12); color: var(--text-2); }
#ag-page .ag-templates .ag-avatar { border-radius: var(--r-md); }

/* Avatar editor */
#ag-page .ag-avgen-preview { width: 64px; height: 64px; display: grid; place-items: center; }
#ag-page .ag-avgen-preview > * { width: 64px !important; height: 64px !important; border-radius: var(--r-lg); overflow: hidden; }
#ag-page .ag-avgen-preview .ag-avsvg svg { width: 64px; height: 64px; }
#ag-page .ag-avgen-color input[type=color] { width: 16px; height: 16px; padding: 0; border: 0; border-radius: 50%; background: none; }
#ag-page .ag-emoji-picks { gap: 2px; }
#ag-page .ag-emo { width: var(--ctl-h-sm); height: var(--ctl-h-sm); font-size: 15px; border-radius: var(--r-sm); }
#ag-page .ag-emo.on { border-color: var(--line-strong); background: var(--bg-surface); }
#ag-page .ag-emoji-input { width: 120px; }
#ag-page .ag-upload { cursor: pointer; }

/* Save bar */
#ag-page .ag-savebar { position: sticky; bottom: var(--s-4); z-index: var(--z-sticky); display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-8); padding: var(--s-3) var(--s-4); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--bg-surface); box-shadow: var(--shadow-2); }
#ag-page .ag-savebar #af-error { flex: 0 1 auto; margin: 0; }
#ag-page.ag-saved > .ag-detail-head, #ag-page.ag-saved .ag-ov { display: none; }
#ag-page .h-card__head .h-card__title .h-i { color: var(--text-2); vertical-align: -2px; }
#ag-page .ag-savebar-gap { flex: 1; }
#ag-page .ag-savebar #af-error.hide { display: none; }

/* Page loading and error */
.ag-page-skel .h-card { display: flex; flex-direction: column; }
.ag-page-skel .h-skel--line + .h-skel--line { margin-top: 10px; }
.ag-page-error { max-width: 760px; }

@media (max-width: 820px) {
  #ag-page .ag-detail-head { flex-wrap: wrap; }
  #ag-page .ag-head-actions { width: auto; flex-wrap: wrap; }
  #ag-page .ag-head-id { flex-basis: 100%; }
  #ag-page .ag-head-id .h-page-head__title { font-size: var(--fs-30); }
  #ag-page .ag-svc-head { flex-wrap: wrap; }
  #ag-page .ag-writes, #ag-page .ag-gh { margin-left: 0; }
  #ag-page .ag-sched .ag-sched-preset { width: 100%; }
  #ag-page .ag-sched-times, #ag-page .ag-sched-tz { max-width: none; flex: 1 1 120px; }
  #ag-page .ag-cmd-name, #ag-page .ag-cmd-skill { flex: 1 1 100%; }
  #ag-page .ag-name-input { max-width: none; }
  #ag-page .ag-savebar { bottom: var(--s-2); }
}

/* C: chat, mailbox, logs, run card */
/* The Chat, Mailbox and Logs tabs are app views: one bordered panel across the content width. */
#view-agents .agx-panel.ag-ppanel { margin: var(--s-5) 0 0; }
#view-agents .agx-panel.hide { display: none !important; }
.ag-page.ag-on-chat #ag-chat.agx-panel { display: grid; height: calc(100dvh - var(--ag-chat-top, 260px) - 24px); min-height: 480px; margin-bottom: 0; flex-direction: unset; }
.agx-chat .agx-rail { overflow-y: auto; }
.agx-chat .agx-convo { min-height: 0; }
.agx-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; }
.agx-scroll > .agx-thread { flex: 1 0 auto; }
.agx-chat-empty { margin: auto 0; }
.agx-thread .agx-ai .ag-avatar { grid-row: span 2; }
.agx-ai__body .h-approval { max-width: none; }
.agx-ai__body .h-md > :first-child { margin-top: 0; }
.agx-dock { padding-top: var(--s-2); }
.agx-composer { position: relative; }
.agx-composer .h-slash { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); margin: 0; }
#view-agents .agx-composer textarea { min-height: 48px; max-height: 192px; border: 0; border-radius: 0; box-shadow: none; outline: 0; background: transparent; padding: 2px 0 0; margin: 0; width: 100%; color: var(--text); font: 400 var(--fs-15)/1.5 var(--font-sans); }
.agx-composer .h-slash__item.on { background: var(--bg-sunken); }
#view-agents .agx-convo__bar .h-select { flex: 1 1 auto; text-align: left; text-align-last: left; padding-left: 8px; height: var(--ctl-h-sm); width: auto; min-width: 0; border-color: transparent; background-color: transparent; font-weight: 500; }
.agx-convo__bar .h-select:hover { background-color: var(--bg-hover); }
.agx-rail .h-btn--block { margin-bottom: 0; }
.agx-paused { color: var(--text); }
.agx-paused .h-i { color: var(--text-2); }
/* Logs */
#view-agents .ag-ppanel > .agx-tools { margin-bottom: var(--s-3); }
.agx-logs { min-height: max(480px, calc(100vh - 330px)); }
.agx-logs--empty, .agx-logs--audit { align-content: start; }
.agx-logs--empty { align-content: center; }
.agx-logs__main { min-width: 0; display: flex; flex-direction: column; }
.agx-logs__main > .agx-rl { flex: 0 0 auto; }
.agx-r[hidden] { display: none; }
.agx-r:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.agx-side .h-drawer__body { overflow: visible; }
.agx-side-back { margin: 0 0 var(--s-2) -10px; }
.agx-r__sum .h-tag { vertical-align: middle; }
.agx-tools .h-select.h-input--sm { height: var(--ctl-h-sm); font-size: var(--fs-13); }
#view-agents .ag-ppanel button:is(.h-seg__btn, .h-link):hover { background: transparent; border-color: transparent; }
#view-agents .ag-ppanel button.h-seg__btn:is([aria-pressed="true"], [aria-checked="true"], .is-on):hover { background: var(--bg-surface); }

/* Mailbox */
.agx-mail { min-height: max(560px, calc(100vh - 300px)); }
.agx-mail--solo { grid-template-columns: minmax(0, 1fr); }
.agx-mail__top { position: relative; z-index: 2; }
.agx-mail__top > .h-mono { min-width: 0; }
.agx-mail__list { overflow-y: auto; }
.agx-mi { cursor: pointer; }
.agx-mi__time { flex: none; }
.agx-read { overflow-y: auto; }
.agx-read .h-approval { max-width: none; }
.agx-idle__in { align-items: center; color: var(--text-2); max-width: 640px; width: 100%; }
.agx-idle__in .h-approval { text-align: left; width: 100%; }
.agx-dim { color: var(--text-2); }
.agx-em__main { min-width: 0; }
.agx-em:last-of-type { border-bottom: 0; }
button.agx-file { font: inherit; font-size: var(--fs-13); cursor: pointer; }
.agx-mail-empty { margin: auto 0; grid-column: 1 / -1; }
.agx-pop.hide { display: none !important; }
.agx-pop .h-input-group .h-input { height: var(--ctl-h); }
.agx-skel-row { display: flex; flex-direction: column; gap: 8px; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--line); }
.agx-mail-back { align-self: flex-start; margin: 0 0 var(--s-3) -10px; }
@media (max-width: 820px) {
  .agx-mail { min-height: 0; }
  .agx-mail:not(.is-open) .agx-read { display: none; }
  .agx-mail .agx-idle { display: none; }
  .agx-mail__top { flex-wrap: nowrap; }
  .agx-mail__top > .h-mono { flex: 1 1 auto; }
  .agx-mail__top .h-anchor:has(.agx-pop) { flex: none; flex-basis: auto; }
  .agx-mail__top .agx-pop { position: absolute; top: calc(100% + 4px); right: 0; width: min(400px, calc(100vw - 48px)); margin: 0; box-shadow: var(--shadow-2); }
}
@media (max-width: 820px) {
  .ag-page.ag-on-chat #ag-chat.agx-panel { height: calc(100dvh - var(--ag-chat-top, 200px) - 12px); min-height: 420px; }
  .agx-thread .agx-ai .ag-avatar { grid-row: auto; }
}
