/* ═══════════════════════════════════════════════════════════════
   MiroMind · agent workspace
   no topbar · sidebar-driven · pixel avatars
═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #fafafa;
  --bg-soft: #f5f5f6;
  --bg-sunken: #efeff1;
  --surface: #ffffff;
  --surface-rail: #f0f0f2;
  --border: #e8e8eb;
  --border-strong: #d8d8db;
  --border-stronger: #bcbcc0;

  --text: #0e0e10;
  --text-muted: #6b6b70;
  --text-dim: #9a9aa0;

  --accent: #2152ff;
  --accent-soft: #eef2ff;

  --green: #16a34a;
  --yellow: #ca8a04;
  --red: #dc2626;
  --grey: #9a9aa0;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter",
               "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", Menlo, Monaco, Consolas,
               "Liberation Mono", monospace;

  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 12px;

  --rail-w: 52px;
  --sidebar-w: 244px;

  --shadow-sm: 0 1px 2px rgba(15,15,16,0.04);
  --shadow-md: 0 4px 16px rgba(15,15,16,0.06);
  --shadow-lg: 0 16px 56px rgba(15,15,16,0.12);
}

* { box-sizing: border-box; }
*, *::before, *::after { -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01", "tnum";
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
code { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: -0.01em; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
svg { display: inline-block; vertical-align: middle; flex-shrink: 0; }

.muted { color: var(--text-muted); font-weight: 400; }
.dim { color: var(--text-dim); }

/* ═══════════════════════════════════════════════════════════════
   Shell
═══════════════════════════════════════════════════════════════ */
.shell {
  display: grid;
  grid-template-columns: var(--rail-w) var(--sidebar-w) 1fr;
  min-height: 100vh;
  transition: grid-template-columns .2s ease;
}
.shell.rail-collapsed { grid-template-columns: 0 var(--sidebar-w) 1fr; }
.shell.rail-collapsed .org-rail { transform: translateX(-100%); }

/* ═══════════════════════════════════════════════════════════════
   Org rail
═══════════════════════════════════════════════════════════════ */
.org-rail {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--rail-w);
  background: var(--surface-rail);
  border-right: 1px solid var(--border);
  padding: 10px 0;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  z-index: 30;
  transition: transform .2s ease;
  overflow: hidden;
}
.org-pip {
  position: relative;
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  font-family: var(--font-mono);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .15s ease;
}
.org-pip::before {
  content: "";
  position: absolute;
  left: -11px;
  top: 50%; transform: translateY(-50%);
  width: 3px; height: 0;
  background: var(--text);
  border-radius: 0 2px 2px 0;
  transition: height .15s ease;
}
.org-pip:hover { border-color: var(--border-stronger); transform: translateX(1px); }
.org-pip.active {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}
.org-pip.active::before { height: 20px; }
.pip-mark { line-height: 1; }
.pip-dot {
  position: absolute;
  bottom: -1px; right: -1px;
  width: 7px; height: 7px;
  border-radius: 50%;
  border: 1.5px solid var(--surface-rail);
}
.org-rail-divider {
  width: 22px; height: 1px;
  background: var(--border-strong);
  margin: 4px 0;
}
.org-pip-add {
  border-style: dashed;
  color: var(--text-muted);
  font-weight: 400;
}
.org-pip-add:hover { color: var(--text); border-style: solid; }

/* ═══════════════════════════════════════════════════════════════
   Sidebar
═══════════════════════════════════════════════════════════════ */
.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg);
  position: fixed;
  top: 0; bottom: 0;
  left: var(--rail-w);
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  z-index: 20;
  transition: left .2s ease;
}
.shell.rail-collapsed .sidebar { left: 0; }

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 10px 10px;
  border-bottom: 1px solid var(--border);
}

/* org name line above home card */
.sidebar-org-line {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 16px 4px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  font-weight: 500;
  cursor: pointer;
}
.sidebar-org-line:hover { color: var(--text); }
.sidebar-org-glyph {
  width: 16px; height: 16px;
  border-radius: 4px;
  background: var(--text);
  color: var(--surface);
  font-family: var(--font-mono);
  font-size: 9px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-org-name { flex: 1; }
.org-chev { color: var(--text-dim); }

/* nested agent nav (under Agent Team) */
.agent-team-nav {
  display: flex;
  flex-direction: column;
}
.agent-team-row {
  display: grid;
  grid-template-columns: 1fr 28px;
  gap: 4px;
  align-items: center;
}
.agent-team-main {
  min-width: 0;
}
.agent-team-toggle {
  width: 28px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .12s, color .12s, transform .12s;
}
.agent-team-toggle:hover {
  background: var(--bg-soft);
  color: var(--text);
}
.agent-team-toggle svg {
  transition: transform .14s ease;
}
.agent-team-nav.collapsed .agent-team-toggle svg {
  transform: rotate(-90deg);
}
.agent-team-list {
  display: flex;
  flex-direction: column;
}
.agent-team-nav.collapsed .agent-team-list {
  display: none;
}
.nav-item.nav-sub {
  padding-left: 30px;
  font-size: 14px;
}
.nav-item.nav-sub::before {
  left: 18px;
}

/* owner tag — indicates the user owns this agent */
.owned-tag {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.02em;
  padding: 1px 7px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  font-weight: 600;
  text-transform: lowercase;
}

/* Home card — prominent kiki entry at top of sidebar */
.home-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  margin: 12px 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .12s;
  position: relative;
}
.home-card:hover {
  border-color: var(--border-stronger);
  box-shadow: var(--shadow-sm);
}
.home-card.active {
  border-color: var(--text);
  box-shadow: var(--shadow-sm);
}
.home-card-avatar {
  position: relative;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--bg-sunken);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.home-card-avatar svg { display: block; }
.home-card-dot {
  position: absolute;
  bottom: 1px; right: 1px;
  width: 8px; height: 8px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  box-sizing: content-box;
}
.home-card-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 1px;
}
.home-card-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.home-card-status {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-card-kbd {
  align-self: flex-start;
  margin-top: 2px;
}
.org-display {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background .12s, border-color .12s;
  text-align: left;
  min-width: 0;
}
.org-display:hover { background: var(--bg-sunken); }
.org-glyph {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--text);
  color: var(--surface);
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  letter-spacing: 0;
}
.org-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.org-chev { color: var(--text-dim); }

.rail-toggle {
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.rail-toggle:hover { background: var(--bg-sunken); color: var(--text); }

/* Sidebar top row — global search + create */
.sidebar-top {
  padding: 12px 10px 8px;
  display: flex;
  gap: 6px;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
}
.sidebar-search-btn {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: border-color .12s, background .12s;
  letter-spacing: -0.01em;
}
.sidebar-search-btn:hover {
  background: var(--surface);
  border-color: var(--border-strong);
}
.sidebar-search-btn .search-icon { color: var(--text-dim); flex-shrink: 0; }
.sidebar-search-btn .search-text {
  flex: 1;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-search-btn .kbd-sm {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.sidebar-create-btn {
  width: 30px;
  background: var(--text);
  color: var(--surface);
  border: 0;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .12s;
  flex-shrink: 0;
  padding: 0;
}
.sidebar-create-btn:hover { background: #000; }
.sidebar-create-btn svg { stroke: currentColor; }

/* Legacy .sidebar-search kept as alias for old class */
.sidebar-search { display: none; }

/* Command palette overlay */
.cmd-palette {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 12vh;
}
.cmd-palette[hidden] { display: none; }
.cmd-palette-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 17, 22, 0.45);
  backdrop-filter: blur(2px);
}
.cmd-palette-modal {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 48px -8px rgba(15, 17, 22, 0.35), 0 4px 16px -4px rgba(15, 17, 22, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.cmd-palette-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.cmd-palette-input-row svg { color: var(--text-muted); flex-shrink: 0; }
.cmd-palette-input-row input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.015em;
}
.cmd-palette-input-row input::placeholder {
  color: var(--text-dim);
  letter-spacing: -0.01em;
}
.cmd-palette-input-row .kbd-sm {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 6px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
}
.cmd-palette-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 12px;
}
.cmd-section {
  margin-bottom: 4px;
}
.cmd-section[hidden] { display: none; }
.cmd-section-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 8px 12px 6px;
}
.cmd-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  letter-spacing: -0.01em;
  text-align: left;
  transition: background .1s;
}
.cmd-item[hidden] { display: none; }
.cmd-item:hover, .cmd-item.cmd-active {
  background: var(--bg-soft);
}
.cmd-item .cmd-leading {
  flex-shrink: 0;
  color: var(--text-muted);
}
.cmd-item .agent-icon.cmd-leading {
  color: #ffffff;
}
.cmd-item .cmd-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.cmd-item .cmd-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-soft);
  padding: 1.5px 6px;
  border-radius: 4px;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.cmd-item:hover .cmd-id, .cmd-item.cmd-active .cmd-id {
  background: var(--bg-sunken);
}
.cmd-item .cmd-kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1.5px 6px;
  background: var(--bg-sunken);
  border-radius: 4px;
  color: var(--text-dim);
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.cmd-item .cmd-trail-pill {
  font-size: 10.5px;
  padding: 1.5px 7px;
  flex-shrink: 0;
}
.cmd-empty {
  padding: 24px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}
.cmd-empty[hidden] { display: none; }
.cmd-empty span {
  font-family: var(--font-mono);
  background: var(--bg-soft);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text);
}
.cmd-palette-foot {
  display: flex;
  gap: 14px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: -0.01em;
  background: var(--bg-sunken);
}
.cmd-palette-foot .kbd-sm {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-dim);
  margin-right: 5px;
}

.nav-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.nav-section { margin-bottom: 16px; }
.nav-section:last-child { margin-bottom: 0; }
.nav-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  padding: 4px 10px 8px;
  font-weight: 600;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background .12s;
  position: relative;
  letter-spacing: -0.01em;
}
.nav-item:hover { background: var(--bg-sunken); }
.nav-item.active {
  background: var(--bg-sunken);
  font-weight: 600;
}
/* svg nav icons get muted/text color; agent letter-icons stay white */
.nav-item .nav-icon:not(.agent-icon) { color: var(--text-muted); }
.nav-item:hover .nav-icon:not(.agent-icon),
.nav-item.active .nav-icon:not(.agent-icon) { color: var(--text); }
.nav-item .nav-icon.agent-icon { color: #ffffff; }
.nav-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-kbd { opacity: 0; transition: opacity .12s; }
.nav-item:hover .nav-kbd,
.nav-item.active .nav-kbd { opacity: 1; }

.badge {
  font-size: 10px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.nav-item.active .badge { background: var(--bg); }
.badge-red {
  background: #fff0f0;
  border-color: #fecdcd;
  color: var(--red);
}

.kbd, .kbd-sm {
  font-family: var(--font-mono);
  font-size: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding: 0px 5px;
  border-radius: 3px;
  line-height: 1.5;
  letter-spacing: 0;
}
.kbd { font-size: 11px; padding: 1px 6px; }

/* ═════════════ Account (bottom-left) ═════════════ */
.account {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.account-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  flex-shrink: 0;
  object-fit: cover;
}
.account-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 0;
}
.account-name {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-role {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-btn {
  position: relative;
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
  flex-shrink: 0;
}
.account-btn:hover { background: var(--bg-sunken); color: var(--text); }
.account-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════
   Status dots
═══════════════════════════════════════════════════════════════ */
.dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--grey);
  flex-shrink: 0;
}
.dot-green  { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-red    { background: var(--red); }
.dot-blue   { background: var(--accent); }

.pulse { animation: dotPulse 1.6s ease-in-out infinite; }
@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .55; transform: scale(1.3); }
}

/* ═══════════════════════════════════════════════════════════════
   Main
═══════════════════════════════════════════════════════════════ */
.main {
  grid-column: 3;
  padding: 28px 36px 64px;
  min-width: 0;
}

.page { display: none; }
.page.active { display: block; animation: pageIn .18s ease; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.page-title h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.028em;
  margin: 0 0 4px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.title-count {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: -0.01em;
}
.title-tag {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-sunken);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 400;
  letter-spacing: 0;
}
.title-mark {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 3px 9px 3px 8px;
  border-radius: 10px;
  font-weight: 400;
  letter-spacing: 0;
}

.page-sub {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}
.page-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════════
   Buttons
═══════════════════════════════════════════════════════════════ */
.btn-ghost, .btn-mini, .btn-primary-mini {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: all .12s;
  white-space: nowrap;
}
.btn-ghost:hover, .btn-mini:hover {
  background: var(--bg-sunken);
  border-color: var(--border-stronger);
}
.btn-ghost.active-tab {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}
.btn-mini { padding: 3px 9px; font-size: 11px; }
.btn-mini:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-mini:disabled:hover { background: var(--surface); border-color: var(--border); }
.btn-primary-mini {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
  padding: 3px 10px;
  font-size: 11px;
}
.btn-primary-mini:hover { background: #000; }

.icon-btn {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--bg-sunken); color: var(--text); }

/* ═══════════════════════════════════════════════════════════════
   Chips
═══════════════════════════════════════════════════════════════ */
.chip, .chip-dim {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  letter-spacing: -0.01em;
}
.chip code { background: transparent; padding: 0; }
.chip-dim {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0;
}

/* ═══════════════════════════════════════════════════════════════
   Status pills
═══════════════════════════════════════════════════════════════ */
.status-pill {
  display: inline-flex; align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: lowercase;
  letter-spacing: 0.01em;
  font-weight: 500;
}
.status-green { background: #e8f6ee; color: var(--green); }
.status-yellow { background: #fcf2d4; color: var(--yellow); }
.status-red { background: #fde6e6; color: var(--red); }
.status-grey { background: var(--bg-sunken); color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════
   Home
═══════════════════════════════════════════════════════════════ */
/* ───── NEW home layout — chat (left) + kiki info (right), equal width ───── */
.home-layout-v2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  height: calc(100vh - 130px);
  min-height: 560px;
}
.home-chat-col, .home-info-col {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.home-chat-col .home-chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex; flex-direction: column;
  gap: 14px;
}
.home-chat-col .chat-composer { padding: 10px 14px; }

/* info column — identity + tabs */
.home-info-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.home-info-identity {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.home-info-avatar {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: block;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-sunken);
}
.home-info-meta { flex: 1; min-width: 0; }
.home-info-name-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.home-info-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
.personal-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--text);
  color: var(--surface);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.home-info-status {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.home-info-status .dot {
  width: 6px; height: 6px;
  flex-shrink: 0;
}

.home-info-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border);
  margin: 0 -18px -16px;
}
.home-info-stats .ai-stat {
  padding: 12px 14px;
  border-right: 1px solid var(--border);
}
.home-info-stats .ai-stat:last-child { border-right: 0; }

/* tasks panel scrollable, profile panel scrollable */
.home-info-col .info-panel-wrap {
  flex: 1;
  overflow-y: auto;
}
.home-info-col .info-panel { padding: 14px 16px 18px; }
.home-info-col .info-panel .stream-section:last-child { margin-bottom: 8px; }

/* specialty chip */
.specialty-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.specialty-chip {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  letter-spacing: -0.01em;
}

/* legacy home-grid (kept for safety, not used) */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - 130px);
  min-height: 560px;
}

/* Activity stream on left */
.home-stream {
  overflow-y: auto;
  padding-right: 4px;
  min-width: 0;
}
.stream-section {
  margin-bottom: 28px;
}
.stream-section:last-child { margin-bottom: 8px; }
.stream-head {
  display: flex; align-items: baseline; gap: 8px;
  padding: 0 0 8px;
  margin-bottom: 6px;
}
.stream-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-weight: 600;
}
.stream-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}

.stream-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  align-items: center;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}
.stream-row:hover {
  border-color: var(--border-stronger);
  box-shadow: var(--shadow-sm);
}
.stream-tool {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1.5px 7px;
  border-radius: 4px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  color: var(--text-muted);
  letter-spacing: -0.01em;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 5px;
  font-weight: 500;
  flex-shrink: 0;
}
.stream-tool-running::before {
  content: "";
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--green);
  animation: dotPulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
.stream-body { min-width: 0; }
.stream-title {
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.stream-status {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}
.stream-time {
  font-size: 10.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  align-self: flex-start;
}

/* Suggestion cards */
.home-stream .suggest-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  padding: 12px 14px 10px;
  display: block;
}
.home-stream .suggest-card::before { display: none; }
.home-stream .suggest-card .suggest-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 8px;
  padding-left: 10px;
  border-left: 2px solid var(--accent);
}
.home-stream .suggest-card .suggest-actions {
  display: flex; gap: 6px;
  padding-left: 12px;
}

/* Done list */
.done-list {
  display: flex; flex-direction: column;
}
.done-list .done-row {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 12px;
  padding: 7px 12px;
  font-size: 12.5px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.done-list .done-row:last-child { border-bottom: none; }
.done-list .done-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}
.done-list .done-text { color: var(--text); }
.done-via {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
  letter-spacing: -0.01em;
}

/* Right side chat panel */
.home-chat-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: sticky;
  top: 0;
  height: 100%;
  min-width: 0;
}
.home-chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex; flex-direction: column;
  gap: 14px;
}

/* kiki avatar in chat head + messages */
.col-head-pa-avatar {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--bg-sunken);
  object-fit: cover;
}
.msg-avatar.msg-avatar-img {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--bg-sunken);
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 1px;
}
.home-chat-panel .chat-composer { padding: 10px 12px; }

/* tabs */
.home-tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.home-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 8px 0;
  margin-right: 20px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.home-tab:hover { color: var(--text); }
.home-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}
.tab-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 400;
  letter-spacing: 0;
}
.home-tab.active .tab-count { color: var(--text-muted); }

.home-tab-panel { display: none; }
.home-tab-panel.active { display: block; animation: tabIn .15s ease; }
@keyframes tabIn {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}

.task-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 14px;
  margin-bottom: 8px;
  background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
  cursor: pointer;
}
.task-card:hover {
  border-color: var(--border-stronger);
  box-shadow: var(--shadow-sm);
}

.task-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px;
  gap: 12px;
}
.task-name { font-weight: 500; font-size: 13px; letter-spacing: -0.01em; }
.progress {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.task-card-meta {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-bottom: 8px; font-size: 12px;
}

.progress-bar {
  height: 2px;
  background: var(--bg-sunken);
  border-radius: 1px;
  overflow: hidden;
  margin: 4px 0 10px;
}
.progress-bar > div {
  height: 100%;
  background: var(--text);
  border-radius: 1px;
}
.progress-bar > div.animated {
  background: repeating-linear-gradient(
    -45deg,
    var(--text) 0 8px,
    var(--text-dim) 8px 16px
  );
  background-size: 22px 22px;
  animation: stripe 1.4s linear infinite;
}
@keyframes stripe {
  from { background-position: 0 0; }
  to   { background-position: -22px 0; }
}

.task-card-actions { display: flex; gap: 6px; }

.suggest-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 14px 11px 12px;
  margin-bottom: 6px;
  background: var(--surface);
  display: flex;
  align-items: center; gap: 12px;
  transition: opacity .15s, border-color .12s;
}
.suggest-card::before {
  content: "";
  width: 2px; align-self: stretch;
  background: var(--accent);
  border-radius: 1px;
  flex-shrink: 0;
}
.suggest-card:hover { border-color: var(--border-stronger); }
.suggest-text { flex: 1; font-size: 12.5px; color: var(--text); line-height: 1.55; }
.suggest-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* completed list */
.done-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  padding: 8px 10px;
  font-size: 12.5px;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.done-row:last-child { border-bottom: none; }
.done-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.done-text { color: var(--text); }

/* chat */
.home-chat {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px - 80px);
  min-height: 480px;
  position: sticky;
  top: 28px;
}
.chat-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-dim);
  display: flex; justify-content: space-between;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 18px 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* shared meta line: name + time */
.msg-meta {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 5px;
}
.msg-meta-right { justify-content: flex-end; }
.msg-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.msg-time {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.msg-body {
  font-size: 13.5px;
  line-height: 1.62;
  color: var(--text);
}

/* kiki: avatar on left + main content right */
.msg-agent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.msg-avatar.agent-icon-dark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #ffffff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  position: relative;
  overflow: hidden;
}
.msg-avatar.agent-icon-dark::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0) 60%);
  pointer-events: none;
}
.msg-main { flex: 1; min-width: 0; }

/* user: right-aligned bubble */
.msg-me {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.msg-bubble {
  background: var(--bg-sunken);
  border-radius: 14px;
  padding: 9px 14px;
  font-size: 13.5px;
  line-height: 1.6;
  max-width: 86%;
  color: var(--text);
}

.msg-system {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-sunken);
  padding: 4px 10px;
  border-radius: 10px;
  align-self: center;
  display: inline-flex; gap: 6px; align-items: center;
  font-family: var(--font-mono);
}

/* ═══════════ Composer (chat input) ═══════════ */
.chat-composer {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
}
.composer-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13.5px;
  line-height: 1.55;
  resize: none;
  min-height: 44px;
  max-height: 160px;
  font-family: inherit;
  color: var(--text);
  padding: 2px 0;
}
.composer-input::placeholder { color: var(--text-dim); }

.composer-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.composer-tools {
  display: flex; align-items: center; gap: 2px;
}
.composer-tool {
  width: 24px; height: 24px;
  border-radius: 5px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.composer-tool:hover {
  background: var(--bg-sunken);
  color: var(--text);
}
.composer-hint {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  margin-left: 6px;
}

.composer-send {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--text);
  color: var(--surface);
  border: 1px solid var(--text);
  border-radius: 6px;
  padding: 5px 11px 5px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s;
}
.composer-send:hover { background: #000; }
.composer-send-kbd {
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.86);
}

/* ═══════════════════════════════════════════════════════════════
   Inbox — list + thread detail (email-like)
═══════════════════════════════════════════════════════════════ */
.inbox-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin: 4px 0 8px;
  padding-left: 2px;
}
.inbox-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  letter-spacing: -0.01em;
  transition: color .15s, border-color .15s;
  font-family: inherit;
}
.inbox-tab:hover { color: var(--text); }
.inbox-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
  font-weight: 600;
}
.inbox-tab-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: -0.01em;
  font-weight: 500;
  background: var(--bg-soft);
  padding: 1.5px 6px;
  border-radius: 6px;
  min-width: 14px;
  text-align: center;
}
.inbox-tab.active .inbox-tab-count {
  color: var(--text);
  background: var(--bg-sunken);
}

.inbox-tab-content[hidden] { display: none; }

.inbox-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 4px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.inbox-tab-content > .inbox-group-head:first-child { padding-top: 8px; }
.inbox-group-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
  text-transform: none;
  letter-spacing: -0.01em;
}
.inbox-group-hint {
  font-size: 10.5px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: -0.01em;
  color: var(--text-dim);
  margin-left: auto;
}

/* watching update rows — FYI-style, links to issue */
.inbox-row-watching .inbox-row-watching-icon {
  font-size: 13px;
  flex-shrink: 0;
  width: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.inbox-row-watching .inbox-from-name {
  font-weight: 500;
  color: var(--text);
}
.inbox-issue-ref {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-soft);
  padding: 1.5px 6px;
  border-radius: 4px;
  font-weight: 500;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.inbox-row:hover .inbox-issue-ref { background: var(--bg-sunken); color: var(--text-muted); }
.inbox-row-watching .inbox-issue-ref { margin-right: 5px; }
.inbox-row-watching .inbox-row-subject {
  font-weight: 400;
  color: var(--text-muted);
}

.inbox-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  height: calc(100vh - 168px);
  min-height: 560px;
  transition: grid-template-columns .2s ease;
}
.inbox-layout.no-detail { grid-template-columns: 1fr; }
.inbox-layout.no-detail .inbox-detail-col { display: none; }

.inbox-list-col {
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.inbox-detail-col {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
  display: flex; flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.inbox-row {
  display: block;
  padding: 14px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
  position: relative;
}
.inbox-row:hover { background: var(--bg-soft); }
.inbox-row.selected { background: var(--bg-soft); }
.inbox-row-from-line {
  display: flex; align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.inbox-row-from-line .agent-icon {
  flex-shrink: 0;
}
.inbox-from-name {
  font-size: 12.5px;
  color: var(--text);
  letter-spacing: -0.01em;
  flex: 1;
}
.inbox-row-time {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.inbox-row.unread .inbox-from-name { font-weight: 700; }
.inbox-row-time {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.inbox-row-subject {
  font-size: 13.5px;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inbox-row-subject strong { font-weight: 700; }
.inbox-row.unread .inbox-row-subject { font-weight: 500; }
.inbox-row-preview {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* inbox detail */
.inbox-detail-col .td-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.inbox-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 14px 14px 0;
  padding: 16px 18px 14px;
}
.inbox-hero-from-line {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
}
.inbox-hero-from-line .agent-icon { width: 22px; height: 22px; font-size: 11px; border-radius: 7px; }
.inbox-hero-from {
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}
.inbox-hero-subject {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.35;
  margin: 0 0 12px;
}
.inbox-hero-meta {
  display: flex; flex-wrap: wrap; gap: 6px;
}

.inbox-detail-col .activity-feed-head { padding: 18px 18px 8px; }
.inbox-detail-col .activity-feed { margin: 0; }

/* pending action panel (highlighted at end of thread) */
.pending-action {
  margin: 4px 14px 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1.5px solid var(--text);
  border-radius: 10px;
  position: relative;
}
.pending-action::before {
  content: "★";
  position: absolute;
  top: 12px; left: -8px;
  width: 18px; height: 18px;
  background: var(--text);
  color: var(--surface);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
}
.pending-action-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 8px;
}
.pending-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text);
  font-weight: 700;
}
.pending-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}
.pending-body {
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 12px;
}
.pending-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
}

.inbox-detail-col .chat-composer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 8px 14px 14px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════
   Channel — Slack-like threads with agents + people
═══════════════════════════════════════════════════════════════ */
.channel-layout {
  display: grid;
  grid-template-columns: 400px minmax(420px, 1fr);
  gap: 12px;
  height: calc(100vh - 56px);
  min-height: 0;
  min-width: 832px;
}
.channel-layout.has-agent-context {
  grid-template-columns: 400px minmax(420px, 1fr) minmax(340px, 380px);
  min-width: 1184px;
}
.channel-list-col {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.channel-thread-col {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.channel-context-col {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  display: none !important;
}
.channel-layout.has-agent-context .channel-context-col {
  display: flex !important;
  flex-direction: column;
}
.channel-context-col .agent-info-head {
  flex-shrink: 0;
}
.channel-context-col .agent-info-avatar.owner-mini {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
}
.channel-context-empty {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  color: var(--text-muted);
  text-align: left;
}
.channel-context-empty strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 4px;
}
.channel-context-empty span:last-child {
  display: block;
  font-size: 12.5px;
  line-height: 1.45;
}
.channel-flow-context {
  height: auto;
  border-bottom: 1px solid var(--border);
}
.channel-context-tasks {
  overflow-y: auto;
}
.channel-list-col {
  display: flex;
  flex-direction: column;
}
.channel-list-head {
  padding: 13px 12px 11px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-soft);
}
.channel-name {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.channel-meta {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}
.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--green);
  background: #eefaf2;
  border: 1px solid #d7f0df;
  border-radius: 999px;
  padding: 2px 7px;
  flex-shrink: 0;
}
.live-dot::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--green);
}
.channel-thread-list {
  flex: 1;
  min-height: 0;
  padding: 8px;
  overflow-y: auto;
}
.channel-list-section + .channel-list-section {
  margin-top: 8px;
}
.channel-section-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: 14px 1fr 24px;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  padding: 7px 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
  border-radius: 8px;
}
.channel-section-toggle:hover {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.section-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.section-chev {
  font-family: var(--font-mono);
  color: var(--text-dim);
  transform: rotate(0deg);
  transition: transform .12s;
}
.channel-list-section.collapsed .section-chev {
  transform: rotate(-90deg);
}
.section-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  text-transform: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 6px;
}
.section-plus {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 15px;
  line-height: 1;
  border: 1px solid transparent;
}
.section-plus:hover {
  color: var(--text);
  background: var(--bg-sunken);
  border-color: var(--border-strong);
}
.channel-section-items {
  padding-left: 14px;
  padding-top: 5px;
}
.channel-list-section.collapsed .channel-section-items {
  display: none;
}
.thread-row {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: start;
  gap: 10px;
  padding: 12px 11px;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  margin-bottom: 2px;
}
.dm-row {
  grid-template-columns: 34px 1fr;
}
.thread-row:hover { background: var(--bg-soft); }
.thread-row.active {
  background: var(--bg-soft);
  border-color: var(--border-strong);
}
.thread-hash,
.thread-flow-icon {
  width: 34px;
  height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.thread-flow-icon svg { width: 16px; height: 16px; }
.thread-row.active .thread-hash,
.thread-row.active .thread-flow-icon {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
}
.thread-dm-avatar.owner-mini,
.thread-dm-avatar.agent-icon.icon-xs {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  font-size: 14px;
  object-fit: cover;
}
.thread-row-main { min-width: 0; }
.thread-row-kicker {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
  color: var(--text-dim);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}
.thread-row-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-row-preview,
.thread-row-last {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-row-preview {
  display: -webkit-box;
  white-space: normal;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.thread-row-side {
  display: none;
}
.thread-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.thread-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-soft);
  border-radius: 999px;
  padding: 2px 7px;
}
.thread-people {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 9px;
}
.thread-people .owner-mini,
.thread-people .agent-icon {
  width: 23px;
  height: 23px;
  font-size: 11px;
  border-radius: 8px;
  margin-left: -4px;
  box-shadow: 0 0 0 2px var(--surface);
}
.thread-people .agent-icon.icon-xs {
  width: 23px;
  height: 23px;
  font-size: 11px;
  border-radius: 8px;
}
.thread-row.active .thread-people .owner-mini,
.thread-row.active .thread-people .agent-icon {
  box-shadow: 0 0 0 2px var(--bg-soft);
}
.thread-people .owner-mini:first-child,
.thread-people .agent-icon:first-child { margin-left: 0; }
.thread-more {
  margin-left: 5px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.channel-thread-col {
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.channel-thread-head {
  flex-shrink: 0;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.channel-head-main {
  min-width: 0;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: start;
}
.channel-head-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.channel-head-avatar-wrap {
  position: relative;
  display: inline-flex;
  width: 40px;
  height: 40px;
}
.channel-head-avatar-wrap::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px var(--surface);
}
.channel-head-avatar-wrap.presence-away::after {
  background: var(--yellow);
}
.channel-head-avatar-wrap.presence-offline::after {
  background: var(--grey);
}
.channel-head-avatar.owner-mini,
.channel-head-avatar.agent-icon.icon-xs,
.channel-head-flow {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  font-size: 15px;
}
.channel-head-flow svg {
  width: 18px;
  height: 18px;
}
.channel-head-copy {
  min-width: 0;
}
.channel-thread-title {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.channel-thread-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.channel-agent-tasks-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 7px;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.channel-agent-tasks-btn:hover {
  color: var(--text);
  background: var(--bg-soft);
  border-color: var(--border-strong);
}
.channel-detail-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}
.channel-detail-body.tasks-open {
  grid-template-columns: minmax(0, 1fr) 300px;
}
.channel-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(180deg, rgba(0,0,0,0.025), rgba(0,0,0,0)) border-box;
}
.channel-agent-tasks-panel {
  min-width: 0;
  border-left: 1px solid var(--border);
  background: var(--bg-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.channel-agent-tasks-panel[hidden] { display: none; }
.agent-tasks-head {
  height: 46px;
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 650;
}
.agent-tasks-list {
  padding: 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.agent-task-item {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
}
.agent-task-avatar.agent-icon.icon-xs {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 12px;
}
.agent-task-main { min-width: 0; }
.agent-task-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  font-weight: 650;
  color: var(--text);
}
.agent-task-status {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
}
.status-running { color: var(--green); }
.status-waiting { color: var(--yellow); }
.status-ready { color: var(--text-muted); }
.status-done { color: var(--text-dim); }
.agent-task-title {
  margin-top: 4px;
  font-size: 13px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.agent-task-note {
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.4;
}
.channel-msg {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 8px;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
}
.channel-day-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 8px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: -0.01em;
}
.channel-day-divider:first-child { margin-top: 0; }
.channel-day-divider::before,
.channel-day-divider::after {
  content: "";
  height: 1px;
  background: var(--border);
  flex: 1;
}
.channel-day-divider span {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  padding: 2px 8px;
}
.channel-msg-main { min-width: 0; }
.channel-msg:hover { background: var(--bg-soft); }
.channel-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  overflow: hidden;
  align-self: start;
}
.channel-msg-avatar.owner-mini {
  border-radius: 50%;
}
.channel-msg-avatar.agent-icon {
  font-size: 14px;
}
.channel-msg-avatar.agent-icon.icon-xs {
  width: 34px;
  height: 34px;
  font-size: 14px;
  border-radius: 10px;
}
.channel-msg-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.channel-msg-name {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.channel-msg-role {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.channel-msg-time {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  white-space: nowrap;
}
.channel-msg-body {
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  max-width: 760px;
}
.channel-msg-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  min-height: 20px;
}
.channel-reply-toggle {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 600;
  padding: 2px 0;
  cursor: pointer;
}
.channel-msg:hover .channel-reply-toggle,
.channel-reply-toggle:hover {
  color: var(--text);
}
.channel-replies {
  margin-top: 6px;
  padding-left: 10px;
  border-left: 1px solid var(--border-strong);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.channel-replies[hidden] { display: none; }
.channel-reply {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 8px;
}
.channel-reply-avatar {
  width: 24px;
  height: 24px;
  font-size: 11px;
  border-radius: 8px;
  overflow: hidden;
}
.channel-reply-avatar.owner-mini {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}
.channel-reply-avatar.agent-icon.icon-xs {
  width: 24px;
  height: 24px;
  font-size: 11px;
  border-radius: 8px;
}
.channel-reply-meta {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text);
  font-weight: 600;
}
.channel-reply-meta span:last-child {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-weight: 400;
}
.channel-reply-body {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}
.channel-reply-box {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  align-items: end;
}
.channel-reply-input {
  width: 100%;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 9px;
  background: var(--surface);
  outline: none;
  font-size: 13px;
  line-height: 1.4;
}
.channel-reply-input:focus {
  border-color: var(--border-stronger);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.035);
}
.channel-reply-send {
  border: 1px solid var(--text);
  background: var(--text);
  color: var(--surface);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
  cursor: pointer;
}
.channel-reply-send:hover { background: #000; }
.channel-msg-body code {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}
.channel-mention {
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--bg-sunken);
  color: var(--text);
  font-weight: 600;
}
.channel-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
  max-width: 680px;
}
.channel-tool-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 3px 9px 3px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-soft) 72%, var(--surface));
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1;
  box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset;
}
.channel-tool-logo {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  background:
    linear-gradient(145deg, rgba(255,255,255,0.95), rgba(246,246,242,0.78)),
    var(--surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: -0.04em;
  flex-shrink: 0;
}
.channel-tool-name {
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.01em;
}
.channel-tool-action {
  color: var(--text-muted);
  white-space: nowrap;
}
.channel-report {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 8px;
  max-width: 560px;
}
.channel-report-card {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 8px;
  padding: 9px 10px;
}
.channel-report-label {
  display: block;
  color: var(--text-dim);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.channel-report-value {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}
.flow-create-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.flow-create-chat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.flow-create-plan {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  overflow: hidden;
  max-width: 640px;
}
.flow-create-plan div {
  display: grid;
  grid-template-columns: 138px 1fr;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.flow-create-plan div:last-child {
  border-bottom: 0;
}
.flow-create-plan span {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.flow-create-plan strong {
  font-size: 13px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.flow-create-modal[hidden] { display: none; }
.flow-create-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}
.flow-create-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10,10,12,0.28);
}
.flow-create-dialog {
  position: relative;
  width: min(620px, calc(100vw - 48px));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 18px;
}
.flow-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.flow-modal-kicker {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.flow-modal-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.03em;
}
.flow-name-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}
.flow-name-field span {
  font-size: 12px;
  font-weight: 650;
  color: var(--text-muted);
}
.flow-name-field textarea {
  width: 100%;
  min-height: 116px;
  resize: vertical;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 13px 14px;
  outline: none;
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  background: var(--bg);
  color: var(--text);
}
.flow-name-field textarea:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.04);
}
.flow-match-panel {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
  padding: 12px;
}
.flow-match-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 12px;
}
.flow-match-head span:first-child {
  font-weight: 650;
  color: var(--text);
}
.flow-match-head span:last-child {
  color: var(--text-dim);
}
.dm-contact-search {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
.dm-contact-search[hidden] {
  display: none;
}
.dm-contact-search span {
  font-size: 11px;
  font-weight: 650;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.dm-contact-search input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px 11px;
  outline: none;
  font-size: 13px;
  color: var(--text);
}
.dm-contact-search input:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.035);
}
.flow-match-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.flow-match-grid.dm-contact-grid {
  grid-template-columns: 1fr;
}
.flow-match-chip {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}
.flow-match-chip.selected {
  border-color: var(--border-strong);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.flow-match-chip:hover { border-color: var(--border-strong); }
.flow-match-chip .agent-icon,
.flow-match-chip .owner-mini {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.flow-contact-avatar {
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
}
.flow-match-chip strong {
  display: block;
  font-size: 13px;
  letter-spacing: -0.01em;
}
.flow-match-chip small {
  display: block;
  color: var(--text-dim);
  font-size: 11px;
}
.flow-empty-contact {
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  padding: 16px;
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
}
.flow-modal-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.channel-composer {
  position: relative;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 0 16px 16px 62px;
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
}
.mention-menu {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 20;
}
.mention-menu[hidden] { display: none; }
.mention-item {
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 7px;
  padding: 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  cursor: pointer;
}
.mention-item:hover { background: var(--bg-soft); }
.mention-avatar {
  width: 22px;
  height: 22px;
  font-size: 10.5px;
  border-radius: 7px;
  overflow: hidden;
  flex-shrink: 0;
}
.mention-avatar.owner-mini { border-radius: 50%; }
.mention-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.mention-name {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.01em;
}
.mention-desc {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.row-meta {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px; font-size: 11px;
  flex-wrap: wrap;
}
.row-from {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px;
  color: var(--text);
}
.row-from code {
  background: transparent;
  padding: 0;
  font-family: var(--font-mono);
  color: var(--text);
  letter-spacing: -0.01em;
}
.row-title {
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.row-body { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.55; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════════
   Tasks page — 3-column workspace: chat | list | detail
═══════════════════════════════════════════════════════════════ */
.tasks-3col {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  height: calc(100vh - 130px);
  min-height: 560px;
  transition: grid-template-columns .2s ease;
}
.tasks-3col.no-detail { grid-template-columns: 1fr; }
.tasks-3col.no-detail .tasks-detail-col { display: none; }

/* merged container: chat | task/action list, with internal divider */
.tasks-merged {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}
.tasks-merged .tasks-col {
  border: none;
  border-radius: 0;
  background: transparent;
}
.tasks-merged .tasks-chat-col {
  border-right: 1px solid var(--border);
}
.tasks-col {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.col-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.col-head-title {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
}

/* chat column */
.tasks-chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex; flex-direction: column;
  gap: 14px;
}
.tasks-chat-col .chat-composer { padding: 10px 12px; }
.tasks-chat-col .composer-input { min-height: 32px; font-size: 12.5px; }

/* list column */
.tasks-list-col .task-filter-bar {
  padding: 8px 12px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.tasks-list-col .task-rows {
  padding: 0 8px;
  gap: 4px;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex: 1;
}

/* list-panel: each top-tab content (tasks or actions) */
.list-panel { display: none; flex: 1; min-height: 0; flex-direction: column; }
.list-panel.active { display: flex; }
.hidden-panel { display: none !important; }

/* Issues page — scope tabs (top-level: my queue / created / watching / all) */
.issues-scope-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin: 0 0 12px;
  padding-left: 2px;
}
.scope-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  letter-spacing: -0.01em;
  transition: color .15s, border-color .15s;
  font-family: inherit;
}
.scope-tab:hover { color: var(--text); }
.scope-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
  font-weight: 600;
}
.scope-tab-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: -0.01em;
  font-weight: 500;
  background: var(--bg-soft);
  padding: 1.5px 6px;
  border-radius: 6px;
  min-width: 14px;
  text-align: center;
}
.scope-tab.active .scope-tab-count {
  color: var(--text);
  background: var(--bg-sunken);
}

/* Issues page — Jira-like table + detail (default) or create panel */
.issues-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 12px;
  padding: 0 2px;
  flex-wrap: wrap;
}
.issues-search {
  display: flex; align-items: center; gap: 8px;
  flex: 1;
  min-width: 260px;
  max-width: 380px;
  padding: 7px 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color .12s, background .12s;
}
.issues-search:focus-within {
  border-color: var(--border-strong);
  background: var(--surface);
}
.issues-search svg { color: var(--text-muted); flex-shrink: 0; }
.issues-search input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.issues-search input::placeholder { color: var(--text-dim); }
.issues-search .kbd-sm {
  padding: 1px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
}
.issues-filter-group {
  display: flex; gap: 4px;
}
.issues-filter-group .filter-pill {
  font-size: 12.5px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.issues-filter-group .pill-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.issues-filter-group .filter-pill.active-pill .pill-count {
  color: rgba(255, 255, 255, 0.65);
}
.issues-create-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  font-size: 13px;
}
.issues-create-btn svg { stroke: currentColor; }

.issues-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  height: calc(100vh - 184px);
  min-height: 540px;
  transition: grid-template-columns .2s ease;
}
.issues-layout.no-detail { grid-template-columns: 1fr; }
.issues-layout.no-detail .issues-detail-col { display: none; }

.issues-list-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.issues-detail-col {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.issues-detail-view, .issues-create-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.issues-detail-view[hidden], .issues-create-view[hidden] { display: none; }

/* issue-table — Jira-like grid */
.issue-table {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.itab-head, .itab-row {
  display: grid;
  grid-template-columns: 64px 1fr 130px 140px 105px 100px 56px 28px;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
}
.itab-head {
  border-bottom: 1px solid var(--border);
  background: var(--bg-sunken);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  position: sticky;
  top: 0;
  z-index: 1;
}
.itab-body {
  flex: 1;
  overflow-y: auto;
}
.itab-row {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
  text-decoration: none;
  color: inherit;
  font-size: 13px;
}
.itab-row:last-child { border-bottom: 0; }
.itab-row:hover { background: var(--bg-soft); }
.itab-row.selected { background: var(--bg-soft); }

.itab-c-id { min-width: 0; }
.issue-id-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-sunken);
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: -0.01em;
  display: inline-block;
  white-space: nowrap;
}
.itab-row:hover .issue-id-pill { background: var(--surface); }
.itab-c-title {
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.itab-c-reporter, .itab-c-assignee {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.itab-c-reporter { color: var(--text-muted); }
.itab-c-assignee { color: var(--text); font-weight: 500; }
.itab-c-reporter > span:not(.agent-icon),
.itab-c-assignee > span:not(.agent-icon) {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.itab-c-reporter .owner-mini, .itab-c-assignee .owner-mini { width: 18px; height: 18px; flex-shrink: 0; }
.itab-c-reporter .agent-icon, .itab-c-assignee .agent-icon { flex-shrink: 0; }
.itab-c-status .status-pill { font-size: 11px; padding: 2px 8px; }
.itab-c-time {
  font-size: 11.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-align: right;
}

/* visibility cell */
.itab-c-visibility {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  min-width: 0;
}
.itab-c-visibility svg { flex-shrink: 0; }
.vis-public { color: var(--text-muted); }
.vis-public svg { color: var(--text-muted); }
.vis-restricted { color: var(--text); }
.vis-restricted svg { color: var(--text); }
.itab-head .itab-c-visibility { color: var(--text-dim); font-size: 11px; }
.itab-head .itab-c-visibility svg { display: none; }

/* watch button */
.itab-c-watch { display: flex; justify-content: center; }
.itab-watch-btn {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, color .12s;
  flex-shrink: 0;
}
.itab-watch-btn:hover {
  background: var(--bg-sunken);
  color: var(--text);
}
.itab-watch-btn.watching {
  color: var(--text);
}
.itab-watch-btn svg { display: block; }

/* when detail/create panel open, compress table cols */
.issues-layout:not(.no-detail) .itab-head,
.issues-layout:not(.no-detail) .itab-row {
  grid-template-columns: 56px 1fr 100px 110px 85px 80px 28px;
  gap: 8px;
}
.issues-layout:not(.no-detail) .itab-c-time { display: none; }
.issues-layout:not(.no-detail) .itab-c-visibility span { display: none; }
.issues-layout:not(.no-detail) .itab-c-visibility {
  justify-content: center;
}

/* Create issue panel */
.create-body {
  padding: 22px 22px 18px;
  overflow-y: auto;
}
.create-intro {
  margin-bottom: 18px;
}
.create-intro-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin: 0 0 6px;
  color: var(--text);
}
.create-intro-sub {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  margin: 0;
  letter-spacing: -0.01em;
}
.create-section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 18px 0 10px;
}
.create-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.create-section-head .muted {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: -0.01em;
}
.create-templates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.create-template {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: center;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color .12s, background .12s;
  text-align: left;
  font-family: inherit;
}
.create-template:hover {
  border-color: var(--border-strong);
  background: var(--bg-soft);
}
.create-template .agent-icon {
  grid-row: 1 / 3;
  align-self: center;
}
.create-template .ct-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.create-template .ct-hint {
  font-size: 11.5px;
  color: var(--text-dim);
  letter-spacing: -0.01em;
}
.ct-icon-blank {
  background: var(--bg-sunken) !important;
  color: var(--text-muted) !important;
  font-weight: 400;
  border: 1px dashed var(--border-strong);
}
.create-suggestions {
  display: flex; flex-direction: column; gap: 6px;
}
.create-suggestion {
  text-align: left;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  letter-spacing: -0.01em;
  transition: background .12s, color .12s, border-color .12s;
  font-family: inherit;
}
.create-suggestion::before {
  content: "› ";
  color: var(--text-dim);
  margin-right: 4px;
}
.create-suggestion:hover {
  background: var(--bg-soft);
  color: var(--text);
  border-color: var(--border-strong);
}

/* legacy compat — keep issue-row-v2 selectors as aliases for older rules */
.issue-row-v2 {
  text-decoration: none;
  color: inherit;
}
.issues-detail-col .td-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}
.issue-detail-head {
  min-height: 50px;
  gap: 10px;
  background: color-mix(in srgb, var(--surface) 72%, var(--bg-soft));
}
.issue-detail-context {
  gap: 8px;
  min-width: 0;
  flex: 1;
}
.issue-detail-id {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 7px;
}
.issue-detail-head .status-pill {
  font-family: var(--font-sans);
  font-size: 11px;
  padding: 3px 8px;
  white-space: nowrap;
}

/* issue hero — title + meta block */
.issue-hero {
  margin: 16px 20px 0;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--border);
}
.issue-hero-top {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.visibility-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.01em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
}
.visibility-badge.vis-public {
  color: var(--text-muted);
  background: var(--bg-sunken);
  border-color: transparent;
}
.visibility-badge svg { color: currentColor; flex-shrink: 0; }
.watch-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 6px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 11.5px;
  font-family: inherit;
  letter-spacing: -0.01em;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
  flex-shrink: 0;
}
.watch-toggle:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--bg-soft);
}
.watch-toggle.watching {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: 0 1px 0 rgba(255,255,255,0.75) inset, 0 0 0 3px rgba(0,0,0,0.025);
}
.watch-toggle.watching:hover {
  background: var(--surface);
}
.assistant-watch { margin-left: auto; }
.watch-agent-wrap {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.watch-agent-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: block;
  box-shadow: 0 0 0 1px var(--border);
}
.watch-toggle.watching .watch-agent-wrap::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1px solid rgba(22, 163, 74, 0.45);
  animation: watchPulse 1.8s ease-out infinite;
}
.watch-toggle.watching .watch-agent-avatar {
  box-shadow: 0 0 0 1px rgba(22, 163, 74, 0.45), 0 0 0 4px rgba(22, 163, 74, 0.08);
}
@keyframes watchPulse {
  0% { transform: scale(.9); opacity: .72; }
  100% { transform: scale(1.42); opacity: 0; }
}
.watch-toggle .watch-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  padding: 1px 6px;
  background: var(--bg-soft);
  color: var(--text-muted);
  border-radius: 8px;
  margin-left: 2px;
}
.watch-toggle.watching .watch-count {
  background: rgba(22, 163, 74, 0.08);
  color: var(--text-muted);
}
.issue-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-sunken);
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: -0.01em;
}
.issue-hero-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.35;
  margin: 0 0 12px;
  color: var(--text);
}
.issue-hero-meta {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.issue-hero-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--bg-soft);
  border-radius: 14px;
  font-size: 12px;
  color: var(--text);
  letter-spacing: -0.01em;
}
.issue-hero-chip .owner-mini { width: 16px; height: 16px; }
.issue-hero-chip .agent-icon { margin-right: -3px; }

.activity-feed-head {
  display: flex; align-items: baseline; gap: 12px;
  padding: 18px 20px 10px;
}
.activity-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-weight: 600;
}
.activity-count {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}
.issues-detail-col .chat-composer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 8px 14px 14px;
  padding: 10px 14px;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}

/* Team Flow — issue conversation + execution timeline */
.activity-feed {
  display: flex; flex-direction: column;
  gap: 0;
  padding: 0 16px 18px;
  margin: 0;
}
.act-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  position: relative;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
}
.act-rail {
  position: relative;
  display: flex;
  justify-content: center;
  padding-top: 18px;
}
.act-rail::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--border);
  transform: translateX(-50%);
}
.act-item:first-child .act-rail::before { top: 18px; }
.act-item:last-child .act-rail::before { bottom: calc(100% - 18px); }
.act-content {
  padding: 8px 0 12px;
  border-bottom: 1px solid var(--border);
  min-width: 0;
}
.act-item:last-child .act-content { border-bottom: 0; }
.act-triggered .act-content {
  background: rgba(255,255,255,0.42);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 8px 0 12px;
  padding: 8px 0 10px;
}
.act-triggered .act-rail::before {
  bottom: -12px;
}

.act-head {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  gap: 11px;
  align-items: center;
  width: 100%;
  background: transparent;
  border: none;
  padding: 6px 8px;
  border-radius: 8px;
  text-align: left;
  cursor: default;
  font-family: inherit;
  color: var(--text);
}
.act-expandable .act-head { cursor: pointer; }
.act-expandable .act-head:hover,
.act-item.expanded .act-head {
  background: rgba(0,0,0,0.035);
}
.flow-message .act-content {
  border-bottom-color: rgba(0,0,0,0.04);
}
.flow-message-head {
  cursor: default;
}
.flow-message-head:hover {
  background: transparent;
}
.flow-message-body {
  margin: 0 8px 10px 51px;
  font-size: 14px;
  line-height: 1.58;
  color: var(--text);
  max-width: 92%;
}
.flow-message-human .flow-message-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
}
.flow-dot-human {
  background: var(--surface);
  border: 2px solid var(--text);
}
.flow-dot-agent {
  background: var(--yellow);
  box-shadow: 0 0 0 3px rgba(202,138,4,.12);
}
.act-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--border-stronger);
  position: relative;
  z-index: 1;
  border: 2px solid var(--bg-soft);
}
.act-dot-done { background: var(--text); }
.act-dot-active {
  background: var(--yellow);
  box-shadow: 0 0 0 3px rgba(202,138,4,.14);
  animation: pulse 1.6s ease-in-out infinite;
}
.act-dot-pending { background: transparent; border: 1.5px dashed var(--border-stronger); }

.act-avatar {
  width: 32px !important;
  height: 32px !important;
  min-width: 32px;
  border-radius: 9px;
  display: inline-flex !important;
  align-items: center; justify-content: center;
  font-size: 13px;
  object-fit: cover;
}
.act-avatar.owner-mini { border-radius: 50%; }
.act-line {
  display: inline-flex; align-items: baseline; gap: 7px;
  min-width: 0;
  flex-wrap: wrap;
}
.act-name {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.act-verb {
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}
.act-time {
  font-size: 11.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 6px;
}
.act-chev {
  color: var(--text-dim);
  transition: transform .15s;
  margin-left: 2px;
}
.act-item.expanded .act-chev { transform: rotate(180deg); }

.act-brief {
  padding: 0 8px 8px 51px;
  font-size: 13.5px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-top: -1px;
}
.act-origin {
  margin: 0 8px 7px 51px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: -0.01em;
}

.act-detail {
  display: none;
  margin: 2px 8px 10px 51px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.52);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
}
.act-item.expanded .act-detail { display: block; }
.act-detail-section {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 12px;
  padding: 5px 0;
  align-items: start;
  line-height: 1.6;
}
.act-detail-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
  font-weight: 600;
  padding-top: 3px;
}
.act-detail-list {
  display: flex; flex-direction: column;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.act-detail-section code {
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
  margin-right: 4px;
}
.act-detail-list code {
  background: var(--surface);
}
.act-actions {
  display: flex;
  gap: 8px;
  padding-left: 51px;
}
.act-reply-toggle {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-family: inherit;
  padding: 3px 0;
  cursor: pointer;
}
.act-reply-toggle:hover { color: var(--text); }
.act-replies {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 2px 8px 8px 51px;
}
.act-replies[hidden] { display: none; }
.act-reply {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 9px;
  padding: 9px 11px;
  border-radius: 8px;
  background: rgba(255,255,255,0.48);
  border: 1px solid rgba(0,0,0,0.045);
}
.act-reply-avatar {
  width: 26px !important;
  height: 26px !important;
  border-radius: 50% !important;
  font-size: 11px;
}
.act-reply-meta {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 2px;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}
.act-reply-meta span:last-child {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-weight: 400;
}
.act-reply-body {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.48;
}
.act-reply-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  margin: 2px 8px 8px 51px;
}
.act-reply-box[hidden] { display: none; }
.act-reply-input {
  width: 100%;
  resize: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 9px;
  background: var(--surface);
  outline: none;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text);
}
.act-reply-input:focus {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.035);
}
.act-reply-send {
  border: 1px solid var(--text);
  background: var(--text);
  color: var(--surface);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.act-generated-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(202,138,4,0.08);
  border: 1px solid rgba(202,138,4,0.18);
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

.section-tabs {
  display: flex; align-items: center; gap: 4px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* action card (single-tool actions) */
.action-rows {
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  flex: 1;
}
.action-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: border-color .12s, background .12s;
}
.action-card:hover { border-color: var(--border-stronger); }
.action-card.selected {
  border-color: var(--text);
  background: var(--bg-soft);
}
.action-card.selected::before {
  content: "";
  position: absolute;
  left: -1px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--text);
  border-radius: 0 1px 1px 0;
}
.action-card-tool {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  align-self: flex-start;
  margin-top: 2px;
}
.action-card-tool-running {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.action-card-tool-running::before {
  content: "";
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #fff;
  margin-right: 5px;
  margin-bottom: 1px;
  vertical-align: middle;
  animation: dotPulse 1.4s ease-in-out infinite;
}
.action-card-body { min-width: 0; }
.action-card-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 5px;
  color: var(--text);
}
.action-card-progress {
  display: flex; align-items: center; gap: 8px;
}
.action-card-progress .row-progress-bar { flex: 1; }

/* mini-pill variant for tighter columns */
.mini-pill { font-size: 11px; padding: 2px 8px; }

/* task rows in 3-col context: more compact */
.tasks-list-col .task-row {
  padding: 10px 12px;
  gap: 10px;
  border-radius: var(--radius-sm);
}
.tasks-list-col .task-row-title { font-size: 13px; margin-bottom: 3px; }
.tasks-list-col .task-row-meta { font-size: 10.5px; gap: 6px; }
.tasks-list-col .task-row-agents .agent-icon {
  width: 22px; height: 22px; font-size: 10px; border-radius: 7px;
}
.tasks-list-col .task-row-right { gap: 3px; }
.tasks-list-col .owner-mini { width: 14px; height: 14px; }

/* detail column */
.tasks-detail-col .td-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* tabs inside col-head */
.col-head-tabs { padding: 4px 8px 0; gap: 8px; align-items: stretch; min-height: 36px; }
.col-tabs { display: flex; gap: 0; align-items: stretch; flex: 1; }
.col-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 8px 10px 7px;
  margin-bottom: -1px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: color .12s, border-color .12s;
}
.col-tab:hover { color: var(--text); }
.col-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}
.col-tab .td-id {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  padding: 1px 5px;
  background: var(--bg-sunken);
  border-radius: 3px;
}
.col-tab.active .td-id { background: var(--bg-soft); }
.tab-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  font-weight: 400;
}
.col-tab.active .tab-count { color: var(--text-muted); }

.td-panel { display: none; flex: 1; min-height: 0; overflow: hidden; }
.td-panel.active { display: flex; flex-direction: column; }

.td-title-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.td-title-row .td-title { margin-bottom: 0; flex: 1; min-width: 0; }

/* action log inside actions tab */
.action-log {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.action-row {
  display: grid;
  grid-template-columns: 44px auto 1fr;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  align-items: start;
  font-size: 12px;
}
.action-row.running {
  background: var(--accent-soft);
  border-color: #dbe3ff;
}
.action-time {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  padding-top: 2px;
}
.action-tool {
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.action-tool-running {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  position: relative;
}
.action-tool-running::before {
  content: "";
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #fff;
  margin-right: 5px;
  margin-bottom: 1px;
  vertical-align: middle;
  animation: dotPulse 1.4s ease-in-out infinite;
}
.action-info { min-width: 0; }
.action-actor {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}
.action-actor .agent-icon { font-size: 9px; }
.action-detail {
  font-size: 12px;
  color: var(--text);
  line-height: 1.5;
}
.td-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}
.td-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  line-height: 1.4;
}
.td-meta {
  display: flex; flex-direction: column; gap: 6px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.td-meta-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 8px;
  align-items: center;
}
.td-meta-k {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.td-meta-v {
  display: inline-flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.td-meta-sep {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}
.td-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 14px;
  font-weight: 500;
}
.td-timeline {
  display: flex; flex-direction: column;
}
.td-timeline .tl-item {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 10px;
  padding-bottom: 14px;
  position: relative;
}
.td-timeline .tl-item::after {
  content: "";
  position: absolute;
  left: 6px; top: 16px; bottom: -2px;
  width: 1px;
  background: var(--border);
}
.td-timeline .tl-item:last-child::after { display: none; }
.td-timeline .tl-dot {
  width: 7px; height: 7px;
  margin-top: 5px;
}
.tasks-detail-col .chat-composer { padding: 10px 12px; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════
   finance.agent · compact inbox rows + detail column
═══════════════════════════════════════════════════════════════ */
.ws-compact-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex; flex-direction: column;
  gap: 4px;
}

.ws-compact {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: border-color .12s, background .12s;
}
.ws-compact:hover { border-color: var(--border-stronger); }
.ws-compact.selected {
  border-color: var(--text);
  background: var(--bg-soft);
}
.ws-compact.selected::before {
  content: "";
  position: absolute;
  left: -1px; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--text);
  border-radius: 0 1px 1px 0;
}
.ws-compact input[type=checkbox] { margin: 0; accent-color: var(--text); }
.ws-compact-body { min-width: 0; }
.ws-compact-title {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 3px;
  color: var(--text);
}
.ws-compact-meta {
  display: flex; align-items: center; gap: 5px;
  font-size: 10.5px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.ws-compact-meta code {
  background: transparent;
  padding: 0;
  color: var(--text-muted);
}
.ws-compact-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
}

/* detail column */
.ws-detail-col .col-head-title {
  display: inline-flex; align-items: center; gap: 8px;
}
.ws-detail-col .td-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.ws-detail-col .td-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  line-height: 1.4;
}
.ws-detail-col .ws-judgment {
  margin: 0 0 16px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
}

.td-related {
  display: flex; flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.td-related-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 11.5px;
}
.td-related-row > span:first-child {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: -0.01em;
}

.td-actions-bar {
  display: flex;
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* legacy creator block (no longer used in 3-col, kept for ref) */
.task-creator {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  padding: 18px 18px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 18px;
  position: relative;
  overflow: hidden;
}
.task-creator::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 0% 0%, rgba(33,82,255,0.05), transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(245,158,11,0.03), transparent 40%);
  pointer-events: none;
}
.task-creator-avatar.agent-icon {
  width: 36px; height: 36px;
  font-size: 16px;
  border-radius: 8px;
  align-self: flex-start;
  margin-top: 2px;
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.task-creator-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; position: relative; z-index: 1; }
.task-creator-prompt {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 2px;
}
.task-creator-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 13.5px;
  line-height: 1.55;
  resize: none;
  min-height: 40px;
  font-family: inherit;
  color: var(--text);
  padding: 0;
}
.task-creator-input::placeholder { color: var(--text-dim); }

.task-creator-footer {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  margin-top: 4px;
}
.task-creator-examples {
  display: flex; gap: 5px; align-items: center; flex-wrap: wrap;
}
.task-creator-hint {
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  font-size: 11px;
}
.example-chip {
  background: var(--bg-sunken);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 3px 9px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: inherit;
  cursor: pointer;
  transition: all .12s;
  letter-spacing: -0.01em;
}
.example-chip:hover {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

/* filter bar */
.task-filter-bar {
  display: flex; align-items: center; gap: 4px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.filter-pill {
  background: transparent;
  border: none;
  padding: 4px 11px;
  font-size: 12px;
  color: var(--text-muted);
  border-radius: 12px;
  cursor: pointer;
  transition: all .12s;
  font-family: inherit;
  letter-spacing: -0.01em;
}
.filter-pill:hover { background: var(--bg-sunken); color: var(--text); }
.filter-pill.active-pill {
  background: var(--text);
  color: var(--surface);
}
.task-filter-hint {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  display: inline-flex; align-items: center; gap: 5px;
}

/* task rows */
.task-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.task-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  align-items: center;
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s, transform .12s;
}
.task-row:hover {
  border-color: var(--border-stronger);
  box-shadow: var(--shadow-sm);
}
.task-row-done { opacity: 0.5; }
.task-row-done:hover { opacity: 1; }

.task-row.selected {
  border-color: var(--text);
  background: var(--bg-soft);
  box-shadow: var(--shadow-sm);
}
.task-row.selected::before {
  content: "";
  position: absolute;
  left: -1px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--text);
  border-radius: 0 1px 1px 0;
}
.task-row { position: relative; }

/* inline progress for running tasks */
.row-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.row-progress-bar {
  flex: 1;
  height: 3px;
  background: var(--bg-sunken);
  border-radius: 2px;
  overflow: hidden;
}
.row-progress-bar > div {
  height: 100%;
  background: var(--text);
  border-radius: 2px;
}
.row-progress-bar > div.animated {
  background: repeating-linear-gradient(
    -45deg,
    var(--text) 0 6px,
    var(--text-dim) 6px 12px
  );
  background-size: 18px 18px;
  animation: stripe 1.4s linear infinite;
}
.row-progress-text {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* tool chip showing the kiki current action */
.row-tool {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
}
.row-tool-active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: #dbe3ff;
  position: relative;
}
.row-tool-active::before {
  content: "";
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 5px;
  animation: dotPulse 1.4s ease-in-out infinite;
}

/* inline tool calls inside chat messages */
.msg-tool-calls {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 2px 0 6px;
}
.msg-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 11px;
  color: var(--text);
  align-self: flex-start;
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}
.msg-tool code {
  background: transparent;
  padding: 0;
  font-weight: 500;
  color: var(--text);
}
.msg-tool-tick {
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
}
.msg-tool-running {
  background: var(--accent-soft);
  border-color: #dbe3ff;
}
.msg-tool-running code { color: var(--accent); }
.msg-tool-running .msg-tool-tick {
  color: var(--accent);
  animation: dotPulse 1.4s ease-in-out infinite;
}

.task-row-agents {
  display: flex; align-items: center;
}
.task-row-agents .agent-icon {
  margin-left: -6px;
  border: 1.5px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.task-row-agents .agent-icon:first-child { margin-left: 0; }

.task-row-main { min-width: 0; }
.task-row-title {
  font-weight: 500;
  font-size: 13.5px;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  color: var(--text);
}
.task-row-meta {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.task-row-agent-name {
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}
.task-row-sep { color: var(--text-dim); }
.task-row-owner {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-sans);
}
.owner-mini {
  width: 16px; height: 16px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
}

/* Channel avatar normalization: every avatar is circular; agent and human share sizes per context. */
.thread-people .owner-mini,
.thread-people .agent-icon.icon-xs {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  font-size: 11px;
  object-fit: cover;
}
.channel-participants .owner-mini,
.channel-participants .agent-icon.icon-xs {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  font-size: 12px;
  object-fit: cover;
}
.channel-msg-avatar.owner-mini,
.channel-msg-avatar.agent-icon.icon-xs {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  font-size: 14px;
  object-fit: cover;
}
.channel-reply-avatar.owner-mini,
.channel-reply-avatar.agent-icon.icon-xs {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  font-size: 11px;
  object-fit: cover;
}
.mention-avatar.owner-mini,
.mention-avatar.agent-icon.icon-xs {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  font-size: 11px;
  object-fit: cover;
}

.task-row-right {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px;
}
.task-row-time {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

/* agent-icon size variants */
.agent-icon.icon-sm {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  display: flex !important;
  align-items: center;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════
   Tasks table (legacy, kept for compatibility)
═══════════════════════════════════════════════════════════════ */
.table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.table-head, .table-row {
  display: grid;
  grid-template-columns: 2.4fr 1fr 1.4fr 0.8fr 0.8fr;
  gap: 12px;
  padding: 10px 16px;
  align-items: center;
}
.table-head {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
}
.table-row {
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  cursor: pointer;
  transition: background .1s;
}
.table-row:hover { background: var(--bg-soft); }
.table-row:last-child { border-bottom: 0; }
.table-row code { margin-right: 4px; }
.col-name { font-weight: 500; letter-spacing: -0.01em; }

/* ═══════════════════════════════════════════════════════════════
   Agent Team Map
═══════════════════════════════════════════════════════════════ */
.orgmap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    radial-gradient(circle, #e6e6ea 0.8px, transparent 0.8px) 0 0 / 22px 22px,
    var(--surface);
  padding: 24px 24px 0;
  position: relative;
}

.org-row {
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
  position: relative;
  z-index: 2;
}

/* organization intelligence row */
.org-row-1 { margin-bottom: 0; }

/* trunk from CEO down to row-2 */
.org-trunk {
  width: 1px;
  height: 18px;
  background: var(--border-strong);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.org-trunk::after {
  content: "";
  position: absolute;
  bottom: 0; left: 50%;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  transform: translate(-50%, 50%);
}

/* row-2 horizontal bar */
.org-row-2 {
  margin-top: 14px;
  position: relative;
  padding-top: 16px;
}
.org-row-2::before {
  content: "";
  position: absolute;
  left: 12%; right: 12%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-strong) 8%, var(--border-strong) 92%, transparent);
}
.org-row-2 .org-group::before {
  content: "";
  position: absolute;
  top: -16px; left: 50%;
  width: 1px; height: 16px;
  background: var(--border-strong);
  transform: translateX(-50%);
}
.org-groups {
  align-items: flex-start;
  gap: 14px;
  flex-wrap: nowrap;
  display: grid;
  grid-template-columns: minmax(184px, .66fr) minmax(0, 1.35fr) minmax(0, 1fr);
}
.org-group {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.68);
  padding: 30px 10px 10px;
  min-width: 220px;
  flex: 1;
}
.org-group-functional .org-node {
  width: 148px;
}
.org-group-personal .org-group-nodes {
  height: 100%;
  align-items: center;
}
.org-group-label {
  position: absolute;
  top: 9px;
  left: 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.org-group-nodes {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 1220px) {
  .org-groups {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
  }
  .org-row-2::before,
  .org-row-2 .org-group::before {
    display: none;
  }
  .org-group {
    width: 100%;
    min-width: 0;
  }
  .org-group-nodes {
    justify-content: flex-start;
  }
  .org-group .org-node {
    width: min(168px, calc(50% - 5px));
  }
}

.org-node {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 14px 16px;
  background: var(--surface);
  width: 168px;
  text-align: center;
  transition: all .18s ease;
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
  z-index: 2;
}
.org-node:hover {
  transform: translateY(-2px);
  border-color: var(--text);
  box-shadow: var(--shadow-md);
}
.org-ceo {
  border-color: var(--text);
  width: 200px;
  padding: 28px 14px 18px;
}
.org-personal {
  width: 184px;
  padding: 18px 14px 15px;
  border-color: color-mix(in srgb, var(--text) 20%, var(--border));
  background:
    linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.68)),
    var(--surface);
}

/* visual order: avatar → name → status */
.org-node .node-avatar { order: 1; }
.org-node .node-name   { order: 2; }
.org-node .node-status { order: 3; }
.org-ceo::after {
  content: "org brain";
  position: absolute;
  top: -7px; left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--surface);
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.org-personal::after {
  content: "personal assistant";
  position: absolute;
  top: -7px; left: 50%;
  transform: translateX(-50%);
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 1px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.node-glow {
  position: absolute;
  top: -10px; left: 50%;
  transform: translateX(-50%);
  width: 80px; height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(33,82,255,0.05) 0%, transparent 60%);
  pointer-events: none;
}

.node-avatar {
  width: 48px; height: 48px;
  border-radius: 14px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
}
.org-ceo .node-avatar {
  width: 58px; height: 58px;
  border-radius: 17px;
}
.org-personal .node-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-soft);
}
.node-avatar-img img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.node-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-top: 2px;
}
.org-ceo .node-name { font-size: 14px; }
.node-stats {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  letter-spacing: -0.01em;
}

.node-status {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: -0.01em;
  margin-top: 2px;
}
.node-status.status-busy { background: #fdf6dc; color: var(--yellow); border-color: #f0e0a0; }
.node-status.status-alert { background: #fdeaea; color: var(--red); border-color: #f4b8b8; }
.node-status.status-idle { background: #e8f6ee; color: var(--green); border-color: #b8e0c5; }

.orgmap-footer {
  margin: 22px -24px 0;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  display: flex;
  gap: 32px;
}
.footer-stat { display: flex; flex-direction: column; }
.stat-num {
  font-size: 18px; font-weight: 600; letter-spacing: -0.03em;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-top: 2px;
  font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════════
   Directory
═══════════════════════════════════════════════════════════════ */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 10px;
}
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
  cursor: pointer;
}
.card:hover {
  border-color: var(--border-stronger);
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.card-avatar {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.card-head-info { min-width: 0; flex: 1; }
.card-name { font-weight: 500; font-size: 13px; font-family: var(--font-mono); letter-spacing: -0.01em; margin-bottom: 4px; }
.card { position: relative; }
.card-body { display: flex; flex-direction: column; gap: 5px; }
.metric {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}
.metric-unit {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 4px;
  font-weight: 400;
}
.kv {
  display: flex; justify-content: space-between;
  font-size: 11px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.kv > span:first-child { color: var(--text-muted); }
.card-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-style: dashed;
  color: var(--text-muted);
  background: var(--bg-soft);
  min-height: 148px;
}
.card-add:hover { color: var(--text); }
.card-add-icon { margin-bottom: 6px; }
.card-add-text { font-size: 12px; }

/* ═══════════════════════════════════════════════════════════════
   Workspace (finance.agent)
═══════════════════════════════════════════════════════════════ */
.workspace-split {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  height: calc(100vh - 280px);
  min-height: 540px;
}
.ws-filters {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
  font-size: 12px;
  height: fit-content;
  position: sticky;
  top: 28px;
}
.filter-section { margin-bottom: 16px; }
.filter-section:last-child { margin-bottom: 0; }
.filter-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 8px;
  font-weight: 500;
}
.filter-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 0;
  font-size: 12px;
  cursor: pointer;
}
.filter-opt input { accent-color: var(--text); }
.filter-range input[type=range] { width: 100%; accent-color: var(--text); }
.range-vals {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-muted);
}

.ws-list { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* ───── Grade column ───── */
.ws-grade {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.ws-grade-head {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 4px;
}
.ws-grade-rank { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ws-grade-rank-title {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text);
  letter-spacing: -0.01em;
  font-weight: 500;
}
.ws-grade-rank-next {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}
.ws-grade-rank-next code {
  background: var(--bg-sunken);
  padding: 0 5px;
  border-radius: 3px;
  color: var(--text);
}
.ws-grade-section { display: flex; flex-direction: column; gap: 10px; }
.ws-grade-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 500;
}
.ws-grade .gs-metric { gap: 4px; }
.ws-grade .gs-metric-value { font-size: 15px; }
.ws-improve-tip {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
  padding-left: 10px;
  border-left: 2px solid var(--border-strong);
}

/* ───── Chat column ───── */
.ws-chat {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 80px);
  overflow: hidden;
}
.ws-chat-head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
}
.ws-chat-title {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}
.ws-chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ws-chat .chat-composer { padding: 10px 12px; }
.ws-chat .composer-input { min-height: 32px; font-size: 12.5px; }

/* generalized msg-avatar that works with any color */
.msg-avatar.agent-icon {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  font-size: 12px;
  margin-top: 1px;
  flex-shrink: 0;
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.ws-bulk {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 4px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.bulk-actions { display: flex; gap: 6px; }

.ws-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  display: flex; gap: 12px;
  transition: border-color .12s, box-shadow .12s;
}
.ws-item:hover {
  border-color: var(--border-stronger);
  box-shadow: var(--shadow-sm);
}
.ws-item.urgent { border-left: 2px solid var(--red); }
.ws-item input[type=checkbox] {
  margin-top: 3px;
  accent-color: var(--text);
}
.ws-item-body { flex: 1; min-width: 0; }
.ws-item-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 4px;
  gap: 8px;
}
.ws-item-title { font-weight: 500; font-size: 13.5px; letter-spacing: -0.01em; }
.ws-item-meta {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 10px; font-size: 12px;
}
.ws-judgment {
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 12px;
  font-family: var(--font-mono);
}
.judgment-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px;
  padding: 2px 0;
}
.j-label {
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
  padding-top: 2px;
}
.judgment-row > span:nth-child(2) {
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text);
}
.confidence { color: var(--text); }
.ws-item-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ws-context-link {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  cursor: pointer;
  letter-spacing: -0.01em;
}
.ws-context-link:hover { color: var(--text); }

/* ═══════════════════════════════════════════════════════════════
   Knowledge
═══════════════════════════════════════════════════════════════ */
.kb-list { display: flex; flex-direction: column; gap: 4px; }
.kb-row {
  display: flex; gap: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
  transition: border-color .12s;
}
.kb-row:hover { border-color: var(--border-stronger); }
.kb-icon {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}
.kb-icon-policy { color: var(--text); }
.kb-icon-rule { color: var(--accent); background: var(--accent-soft); border-color: #dbe3ff; }
.kb-icon-memory { color: var(--yellow); background: #fdf5d8; border-color: #f5e3a3; }
.kb-icon-doc { color: var(--text-muted); }

.kb-body { flex: 1; min-width: 0; }
.kb-title { font-weight: 500; font-size: 13px; margin-bottom: 2px; letter-spacing: -0.01em; }
.kb-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; line-height: 1.5; }
.kb-meta {
  display: flex; gap: 6px; flex-wrap: wrap;
  align-items: center;
  font-size: 11px;
}
.kb-actions {
  display: flex; gap: 6px;
  align-items: flex-start;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   Insights
═══════════════════════════════════════════════════════════════ */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.kpi {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
}
.kpi-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 10px;
  font-weight: 500;
}
.kpi-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.035em;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.kpi-unit { font-size: 13px; color: var(--text-muted); margin-left: 3px; font-weight: 400; }
.kpi-delta {
  font-size: 11px;
  font-family: var(--font-mono);
  margin-top: 6px;
  letter-spacing: -0.01em;
}
.delta-up { color: var(--green); }

.charts-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.chart-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
  color: var(--text);
}
.chart-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 16px;
  font-weight: 500;
}
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row {
  display: grid;
  grid-template-columns: 100px 1fr 36px;
  gap: 10px; align-items: center;
}
.bar-label { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); letter-spacing: -0.01em; }
.bar {
  height: 6px;
  background: var(--bg-sunken);
  border-radius: 3px;
  overflow: hidden;
}
.bar > div {
  height: 100%;
  background: var(--text);
  border-radius: 3px;
  transition: width .4s ease;
}
.bar-val {
  font-family: var(--font-mono); font-size: 11px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.spark { width: 100%; height: 120px; color: var(--text); display: block; }
.chart-foot { font-size: 11px; font-family: var(--font-mono); margin-top: 6px; letter-spacing: -0.01em; }

.bot-list { display: flex; flex-direction: column; gap: 12px; font-size: 12px; }
.bot-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; }
.cost-block { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; }
.cost-num {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.035em;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════════════════════════════════════════════
   Owner avatar stack (multi-owner display)
═══════════════════════════════════════════════════════════════ */
.owner-stack {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.owner-stack .owner-av {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--bg-sunken);
  border: 1.5px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
  margin-left: -8px;
  position: relative;
  z-index: 1;
  transition: transform .12s, z-index 0s .12s;
  display: block;
  object-fit: cover;
}
.owner-stack .owner-av:first-child { margin-left: 0; }
.owner-stack .owner-av:hover {
  transform: translateY(-2px) scale(1.2);
  z-index: 10;
  transition: transform .12s, z-index 0s;
}
.owner-names {
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}

/* in directory cards: slightly larger */
.owner-stack-card .owner-av {
  width: 26px;
  height: 26px;
}

/* dedicated owner row on directory cards */
.card .card-owners {
  display: flex;
  align-items: center;
  padding: 10px 0 12px;
  margin: -4px 0 6px;
  border-bottom: 1px solid var(--border);
}

/* in org nodes: centered */
.org-node .owner-stack {
  justify-content: center;
  padding: 2px 0;
}

/* ═══════════════════════════════════════════════════════════════
   Agent grade / tier badge
═══════════════════════════════════════════════════════════════ */
.agent-grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  min-width: 38px;
  padding: 0 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: -0.01em;
  border: 1px solid;
  z-index: 3;
  white-space: nowrap;
}
.agent-grade::before {
  content: "Lv·";
  font-size: 9px;
  font-weight: 500;
  opacity: 0.62;
  margin-right: 1px;
  letter-spacing: 0;
}

/* in org node: top-right */
.org-node .agent-grade {
  position: absolute;
  top: 8px;
  right: 8px;
}
.org-ceo .agent-grade { top: 10px; right: 10px; }

/* in directory card: top-right */
.card .agent-grade {
  position: absolute;
  top: 12px;
  right: 12px;
}

/* unified tier style — single white outline, letter is the differentiator */
.grade-S,
.grade-A,
.grade-B,
.grade-C,
.grade-D {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

/* keep featured card subtle highlight for top-tier (S) */
.card-featured {
  background: linear-gradient(180deg, #fafafa 0%, var(--surface) 60%);
  border-color: var(--border-strong);
}
.card-featured:hover { border-color: var(--text); }

/* large variant for in-page hero use */
.agent-grade.grade-large {
  height: 56px;
  min-width: 80px;
  padding: 0 16px;
  font-size: 24px;
  border-radius: 14px;
  border-width: 1.5px;
}
.agent-grade.grade-large::before {
  content: "Lv·";
  font-size: 12px;
  font-weight: 500;
  opacity: 0.65;
  margin-right: 4px;
  align-self: flex-start;
  margin-top: 10px;
}

/* ═══════════════════════════════════════════════════════════════
   Agent icon — monochrome gradient + white letter
═══════════════════════════════════════════════════════════════ */
.agent-icon {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-family: var(--font-mono);
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  border: 1px solid rgba(255,255,255,0.16) !important;
  background-color: var(--text);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  isolation: isolate;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 0 -10px 20px rgba(0,0,0,0.18),
    0 0 0 1px rgba(0,0,0,0.04);
}
.agent-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 35% 24%, rgba(255,255,255,0.34), rgba(255,255,255,0) 34%),
    linear-gradient(180deg, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0) 58%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.08) 0 1px, transparent 1px 5px),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.055) 0 1px, transparent 1px 5px);
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: .72;
  z-index: 0;
}
.agent-icon { text-shadow: 0 1px 4px rgba(0,0,0,0.26); }
.agent-icon {
  /* Keep bare text glyphs above the generated core texture. */
  -webkit-text-stroke: .01px rgba(255,255,255,0.01);
}
.agent-icon > * { position: relative; z-index: 1; }

/* node-avatar context (48px / CEO 58px) */
.node-avatar.agent-icon { font-size: 20px; border-radius: 14px; }
.org-ceo .node-avatar.agent-icon { font-size: 24px; border-radius: 17px; }

/* card-avatar context (36px) */
.card-avatar.agent-icon { font-size: 16px; border-radius: 12px; }

/* xs context — sidebar nav (18px square) */
.agent-icon.icon-xs {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
}
.agent-icon.icon-xs::after {
  display: block;
  background:
    radial-gradient(circle at 35% 24%, rgba(255,255,255,0.28), rgba(255,255,255,0) 38%),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.08) 0 1px, transparent 1px 4px);
  opacity: .62;
}

/* color families — each agent has a single hue with subtle gradient */
.agent-ceo       { background-image: linear-gradient(135deg, #1e293b, #0f172a); }
.agent-tanka     { background-image: linear-gradient(135deg, #111827, #334155); }
.agent-monitor   { background-image: linear-gradient(135deg, #0369a1, #0f172a); }
.agent-coding    { background-image: linear-gradient(135deg, #0f766e, #115e59); }
.agent-design    { background-image: linear-gradient(135deg, #be185d, #9d174d); }
.agent-research  { background-image: linear-gradient(135deg, #4338ca, #3730a3); }
.agent-finance   { background-image: linear-gradient(135deg, #10b981, #047857); }
.agent-it        { background-image: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.agent-marketing { background-image: linear-gradient(135deg, #ec4899, #be185d); }
.agent-hr        { background-image: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.agent-legal     { background-image: linear-gradient(135deg, #f59e0b, #b45309); }
.agent-expense   { background-image: linear-gradient(135deg, #06b6d4, #0e7490); }

/* ═══════════════════════════════════════════════════════════════
   Grade strip (agent workspace hero)
═══════════════════════════════════════════════════════════════ */
.grade-strip {
  display: grid;
  grid-template-columns: minmax(220px, auto) 1px 1fr;
  gap: 20px;
  align-items: center;
  padding: 16px 20px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  position: relative;
  overflow: hidden;
}
.grade-strip::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 0% 0%, rgba(245,158,11,0.04), transparent 40%),
    radial-gradient(circle at 100% 100%, rgba(33,82,255,0.03), transparent 40%);
  pointer-events: none;
}

.gs-badge-block {
  display: flex; align-items: center; gap: 14px;
  position: relative;
  z-index: 1;
}
.gs-rank { display: flex; flex-direction: column; gap: 3px; }
.gs-rank-title {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: -0.01em;
}
.gs-rank-num {
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
}
.gs-rank-next {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}
.gs-rank-next code {
  background: var(--bg-sunken);
  padding: 0 5px;
  border-radius: 3px;
  color: var(--text);
  margin: 0 2px;
}

.gs-divider {
  width: 1px; height: 60%;
  background: var(--border);
}

.gs-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  position: relative;
  z-index: 1;
}
.gs-metric { display: flex; flex-direction: column; gap: 6px; }
.gs-metric-head {
  display: flex; align-items: baseline; gap: 6px;
}
.gs-metric-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 500;
  flex: 1;
}
.gs-metric-value {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.gs-metric-unit {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 1px;
}
.gs-metric-delta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: -0.01em;
}

.gs-bar {
  position: relative;
  height: 4px;
  background: var(--bg-sunken);
  border-radius: 2px;
  overflow: visible;
}
.gs-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--text) 0%, #2a2a30 100%);
  border-radius: 2px;
}
.gs-bar-target {
  position: absolute;
  top: -2px;
  width: 2px;
  height: 8px;
  background: #f59e0b;
  border-radius: 1px;
  transform: translateX(-50%);
}
.gs-bar-target::after {
  content: "";
  position: absolute;
  bottom: -6px; left: 50%;
  width: 4px; height: 4px;
  background: #f59e0b;
  border-radius: 50%;
  transform: translateX(-50%);
}

/* ═══════════════════════════════════════════════════════════════
   CMD+K panel
═══════════════════════════════════════════════════════════════ */
.cmdk-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,15,16,0.06);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 90;
  opacity: 0; pointer-events: none;
  transition: opacity .15s;
}
.cmdk-backdrop.open { opacity: 1; pointer-events: auto; }

.cmdk-panel {
  position: fixed;
  top: 80px; left: 50%;
  transform: translate(-50%, -20px);
  width: min(540px, 92vw);
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  z-index: 100;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity .15s, transform .18s cubic-bezier(.2,.8,.2,1);
  box-shadow: var(--shadow-lg);
}
.cmdk-panel.open {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}

.cmdk-panel-input {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.cmdk-panel-input svg { color: var(--text-dim); }
.cmdk-panel-input input {
  flex: 1;
  border: none; outline: none;
  font-size: 14px;
  background: transparent;
}
.cmdk-panel-input input::placeholder { color: var(--text-dim); }

.cmdk-panel-body { flex: 1; overflow-y: auto; padding: 8px; }
.cmdk-section { margin-bottom: 8px; }
.cmdk-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  padding: 6px 10px;
  font-weight: 500;
}
.cmdk-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
}
.cmdk-item:hover { background: var(--bg-sunken); }
.cmdk-item code {
  background: var(--bg-sunken);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
}
.cmdk-item:hover code { background: var(--surface); }
.cmdk-item > span:last-child { margin-left: auto; }

/* ═══════════════════════════════════════════════════════════════
   Task panel
═══════════════════════════════════════════════════════════════ */
.task-backdrop {
  position: fixed; inset: 0;
  background: rgba(15,15,16,0.06);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 90;
  opacity: 0; pointer-events: none;
  transition: opacity .15s;
}
.task-backdrop.open { opacity: 1; pointer-events: auto; }

.task-panel {
  position: fixed;
  top: 12px; right: 12px; bottom: 12px;
  width: 540px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  z-index: 100;
  display: flex; flex-direction: column;
  transform: translateX(calc(100% + 24px));
  transition: transform .22s cubic-bezier(.2,.8,.2,1);
  box-shadow: var(--shadow-lg);
}
.task-panel.open { transform: translateX(0); }

.task-panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.task-panel-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.task-panel-title {
  font-size: 16px; font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.task-panel-meta {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 6px;
}
.meta-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  font-size: 12px;
  align-items: center;
}
.meta-k {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.task-timeline {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
}
.tl-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 14px;
  font-weight: 500;
}

.tl-item {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 12px;
  padding-bottom: 18px;
  position: relative;
}
.tl-item::after {
  content: "";
  position: absolute;
  left: 7px; top: 18px; bottom: -2px;
  width: 1px;
  background: var(--border);
}
.tl-item:last-child::after { display: none; }
.tl-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  z-index: 1;
}
.tl-dot-done { background: var(--text); border-color: var(--text); }
.tl-dot-active {
  background: var(--yellow);
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(202,138,4,.18);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(202,138,4,.18); }
  50%      { box-shadow: 0 0 0 6px rgba(202,138,4,.08); }
}
.tl-dot-pending { background: var(--surface); }

.tl-head { font-size: 12px; font-weight: 500; }
.tl-head code { margin-right: 4px; }
.tl-body { font-size: 12.5px; color: var(--text); margin-top: 2px; line-height: 1.55; }
.tl-time {
  font-size: 10px;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

.task-panel-foot {
  border-top: 1px solid var(--border);
  padding: 12px 18px;
}
.task-panel-foot input {
  width: 100%; border: none; outline: none;
  font-size: 13px; background: transparent;
}

/* ═══════════════════════════════════════════════════════════════
   Single agent page (unified) — chat | info+tabs (2-col equal)
═══════════════════════════════════════════════════════════════ */
.agent-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  height: calc(100vh - 130px);
  min-height: 560px;
}
.agent-chat-col, .agent-info-col {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.agent-chat-col .ap-thread {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex; flex-direction: column;
  gap: 14px;
}
.agent-chat-col .chat-composer { padding: 10px 14px; }

/* info column */
.agent-info-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.agent-info-identity {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
}
.agent-info-avatar.agent-icon {
  width: 40px; height: 40px;
  border-radius: 12px;
  font-size: 16px;
  display: flex !important;
  align-items: center; justify-content: center;
}
.agent-info-meta { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.agent-info-name-row {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.agent-info-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
}
.agent-info-status {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}
.agent-info-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  overflow: hidden;
}
.ai-stat {
  padding: 10px 12px;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 3px;
}
.ai-stat:last-child { border-right: none; }
.ai-stat-num {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
}
.ai-stat-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 600;
}

.info-tabs {
  display: flex; align-items: center; gap: 0;
  border-bottom: 1px solid var(--border);
  padding: 0 14px;
}
.info-tab {
  background: transparent;
  border: none;
  border-bottom: 1.5px solid transparent;
  margin-bottom: -1px;
  padding: 10px 14px 11px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: color .12s, border-color .12s;
  font-family: inherit;
}
.info-tab:hover { color: var(--text); }
.info-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
  font-weight: 600;
}
.info-tab .tab-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
  font-weight: 400;
}
.info-tab.active .tab-count { color: var(--text-muted); }

.info-panel-wrap { flex: 1; overflow-y: auto; }
.info-panel { display: none; }
.info-panel.active { display: block; }

/* tasks sub-section (inbox / long-term) */
.tasks-sub-section { border-bottom: 1px solid var(--border); }
.tasks-sub-section:last-child { border-bottom: none; }
.tasks-sub-head {
  display: flex; align-items: baseline; gap: 10px;
  padding: 12px 18px 6px;
}
.tasks-sub-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-weight: 600;
}
.tasks-sub-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

/* tasks list inside agent info column */
.info-tasks-list {
  display: flex; flex-direction: column;
}

/* long-term recurring tasks */
.long-tasks-list { display: flex; flex-direction: column; }
.long-task-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  cursor: pointer;
  transition: background .12s;
}
.long-task-row:last-child { border-bottom: none; }
.long-task-row:hover { background: var(--bg-soft); }
.long-cadence {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 10px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.long-cadence::before {
  content: "";
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--green);
}
.long-cadence.paused { color: var(--text-muted); }
.long-cadence.paused::before { background: var(--text-dim); }
.long-body { min-width: 0; }
.long-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 3px;
}
.long-meta {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.long-next {
  font-size: 10.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  text-align: right;
}
.info-task-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  cursor: pointer;
  transition: background .12s;
}
.info-task-row:hover { background: var(--bg-soft); }
.info-task-body { min-width: 0; }
.info-task-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 3px;
}
.info-task-meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}
.info-task-meta code {
  background: var(--bg-sunken);
  padding: 0 5px;
  border-radius: 3px;
  font-size: 10.5px;
}
.info-task-time {
  font-size: 10.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

/* profile stack — sections with subtle borders */
.profile-stack {
  padding: 4px 0;
}
.profile-section {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.profile-section:last-child { border-bottom: none; }
.profile-section-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
}
.profile-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  font-weight: 600;
}
.profile-section-head .muted {
  flex: 1;
  font-size: 11px;
  font-family: var(--font-mono);
}
.profile-section .ap-prof-kvs { padding: 0; }
.profile-section .ap-prof-kv { padding: 5px 0; }
.profile-section .ap-rules-list { padding: 0; }
.profile-section .ap-rules-list li { font-size: 12.5px; padding: 6px 0; }
.profile-section .ap-instructions-body {
  margin: 0; padding: 12px 14px; font-size: 12px; line-height: 1.65;
}
.profile-section .ap-tag-row { padding: 0; }
.profile-section .ap-traits { padding: 0; }
.profile-section .ap-trait { font-size: 12.5px; }
.profile-section .ap-skills-grid {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* heatmap (github-style activity) */
.heatmap-wrap {
  overflow-x: auto;
  padding-bottom: 2px;
}
.heatmap-months {
  display: grid;
  grid-template-columns: 24px repeat(53, 11px);
  gap: 2px;
  font-size: 9.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  margin-bottom: 4px;
  padding-left: 0;
}
.heatmap-months > span:first-child { grid-column: 1; }
.heatmap-month-label {
  white-space: nowrap;
}
.heatmap-body {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 4px;
}
.heatmap-dows {
  display: grid;
  grid-template-rows: repeat(7, 11px);
  gap: 2px;
  font-size: 9.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  align-items: center;
}
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(53, 11px);
  grid-template-rows: repeat(7, 11px);
  grid-auto-flow: column;
  gap: 2px;
}
.heatmap-cell {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  background: var(--bg-sunken);
  cursor: default;
}
.heatmap-level-0 { background: var(--bg-sunken); }
.heatmap-level-1 { background: #d6d6da; }
.heatmap-level-2 { background: #9a9aa0; }
.heatmap-level-3 { background: #4a4a50; }
.heatmap-level-4 { background: var(--text); }
.heatmap-cell:hover {
  outline: 1px solid var(--text);
  outline-offset: 1px;
}
.heatmap-legend {
  display: flex; align-items: center; gap: 4px;
  margin-top: 8px;
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  justify-content: flex-end;
}
.heatmap-legend .heatmap-cell { width: 10px; height: 10px; }
.profile-section .ap-skill { padding: 10px 12px; }
.profile-section .ap-skill-desc { font-size: 12px; margin-bottom: 6px; }

/* ═══════════════════════════════════════════════════════════════
   (legacy) Single agent chat page styles
═══════════════════════════════════════════════════════════════ */
.agent-page-h1 {
  display: inline-flex !important;
  align-items: center;
  gap: 10px;
  position: relative;
}

/* owner tag (next to Lv) with hover popover */
.owner-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  cursor: default;
  position: relative;
}
.owner-tag > svg { color: var(--text-muted); }
.owner-tag-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .12s, transform .12s;
}
.owner-tag:hover .owner-tag-pop {
  opacity: 1;
  transform: translateY(0);
}
.owner-tag-pop-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 4px;
  font-size: 12px;
  letter-spacing: -0.01em;
}
.owner-tag-pop-row img {
  width: 22px; height: 22px;
  border-radius: 50%;
  object-fit: cover;
}
.owner-tag-pop-role {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  margin-left: auto;
}
.agent-page-avatar.agent-icon {
  width: 32px; height: 32px;
  font-size: 16px;
  border-radius: 10px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}
.agent-page-name { font-family: var(--font-mono); }

.agent-page-stats {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.agent-page-stats .ap-stat-item {
  padding: 10px 16px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.agent-page-stats .ap-stat-item:last-child { border-right: none; }

/* agent page tabs — refined underline style */
.ap-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.ap-tab {
  background: transparent;
  border: none;
  border-bottom: 1.5px solid transparent;
  margin-bottom: -1px;
  padding: 10px 16px 11px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: color .12s, border-color .12s;
  font-family: inherit;
}
.ap-tab:first-child { padding-left: 4px; }
.ap-tab:hover { color: var(--text); }
.ap-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
  font-weight: 600;
}
.ap-tab .tab-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
  font-weight: 400;
  letter-spacing: 0;
}
.ap-tab.active .tab-count { color: var(--text-muted); }

.ap-tab-panel { display: none; }
.ap-tab-panel.active { display: block; animation: pageIn .15s ease; }

/* section-based design (no nested bordered cards) */
.ap-card {
  background: transparent;
  margin-bottom: 28px;
}
.ap-card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 0 0 12px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.ap-card-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--text-dim);
}
.ap-card-head .muted {
  font-family: var(--font-mono);
  font-size: 11px;
  flex: 1;
  letter-spacing: -0.01em;
}
.ap-instructions-body {
  margin: 0;
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: pre-wrap;
  background: var(--bg-soft);
  border-radius: var(--radius);
}
.ap-instructions-body code {
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.ap-rules-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex; flex-direction: column;
}
.ap-rules-list li {
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  color: var(--text);
}
.ap-rules-list li:last-child { border-bottom: none; }
.ap-rules-list li code {
  background: var(--bg-sunken);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11.5px;
}

/* profile panel — clean sections, no card borders */
.ap-profile-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px 36px;
  margin-bottom: 28px;
}
.ap-profile-grid-2 .ap-card { margin-bottom: 0; }

.ap-prof-kvs {
  display: flex; flex-direction: column;
}
.ap-prof-kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px;
  align-items: baseline;
  padding: 7px 0;
  font-size: 13px;
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--border);
}
.ap-prof-kv:last-child { border-bottom: none; }
.prof-k {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-dim);
  font-weight: 600;
}

.ap-tag-row {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.ap-tag {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 10px;
  letter-spacing: -0.01em;
  color: var(--text);
  transition: background .12s;
}
.ap-tag:hover { background: var(--surface); border-color: var(--border-stronger); }

.ap-traits {
  display: flex; flex-direction: column;
  gap: 14px;
}
.ap-trait {
  display: grid;
  grid-template-columns: 110px 1fr 70px;
  gap: 14px;
  align-items: center;
  font-size: 13px;
}
.trait-name {
  letter-spacing: -0.01em;
  color: var(--text);
}
.trait-bar {
  height: 3px;
  background: var(--bg-sunken);
  border-radius: 2px;
  overflow: hidden;
}
.trait-bar > div {
  height: 100%;
  background: var(--text);
  border-radius: 2px;
}
.trait-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  letter-spacing: -0.01em;
}

.ap-activity {
  display: flex; flex-direction: column;
}
.ap-act-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.ap-act-row:last-child { border-bottom: none; }
.act-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}
.act-text { color: var(--text); }
.act-tag.muted {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: -0.01em;
}

/* skills panel — refined cards */
.ap-skills-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.ap-skills-head .ap-card-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.ap-skills-sub {
  font-size: 12px;
  margin-top: 4px;
  letter-spacing: -0.01em;
  color: var(--text-muted);
}
.ap-skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.ap-skill {
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: background .12s, border-color .12s, transform .12s;
  cursor: pointer;
}
.ap-skill:hover {
  background: var(--surface);
  border-color: var(--border-stronger);
}
.ap-skill-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}
.ap-skill-name {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}
.ap-skill .status-pill {
  font-size: 9.5px;
  padding: 1px 7px;
}
.ap-skill-desc {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.55;
  margin-bottom: 10px;
}
.ap-skill-meta {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 6px;
}
.ap-skill-meta::before {
  content: "";
  display: inline-block;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--green);
}
.ap-skill-add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px dashed var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  min-height: 110px;
  gap: 8px;
  font-size: 12px;
}
.ap-skill-add:hover {
  color: var(--text);
  border-color: var(--text);
  background: transparent;
}
.ap-skill-add-icon { font-size: 20px; line-height: 1; }

.agent-chat-page {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 230px);
  min-height: 460px;
  overflow: hidden;
}
.agent-chat-page .ap-thread {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.agent-chat-page .chat-composer { padding: 12px 14px; }

/* Org-node hover popover (directory info) */
.node-popover {
  position: fixed;
  width: 220px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-md);
  z-index: 110;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
  transform: translateY(-4px);
}
.node-popover.open {
  opacity: 1;
  transform: translateY(0);
}
.np-metric {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 10px;
  line-height: 1;
}
.np-num { color: var(--text); }
.np-unit {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 5px;
  font-weight: 400;
}
.np-kvs {
  display: flex; flex-direction: column;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.np-kv {
  display: flex; justify-content: space-between;
  letter-spacing: -0.01em;
}
.np-kv > span:first-child { color: var(--text-muted); }

.agent-panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.ap-identity {
  display: flex; align-items: center; gap: 12px;
  min-width: 0;
}
.ap-avatar.agent-icon {
  width: 44px; height: 44px;
  border-radius: 14px;
  font-size: 18px;
  font-weight: 700;
  display: flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ap-info { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ap-name-row {
  display: flex; align-items: center; gap: 8px;
}
.ap-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
}
.ap-owners-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}
.ap-owners-stack {
  display: inline-flex; align-items: center;
}
.ap-owners-stack .owner-mini {
  width: 18px; height: 18px;
  margin-left: -5px;
  border: 1.5px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.ap-owners-stack .owner-mini:first-child { margin-left: 0; }
.ap-owners-text {
  font-family: var(--font-mono);
  letter-spacing: -0.01em;
}

.ap-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
}
.ap-stat-item {
  padding: 12px 14px;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
}
.ap-stat-item:last-child { border-right: none; }
.ap-stat-num {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.025em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.ap-stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  font-weight: 500;
}

.ap-thread {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.agent-panel .chat-composer { padding: 10px 14px; }

/* ═══════════════════════════════════════════════════════════════
   Scrollbars
═══════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--bg-sunken); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
::-webkit-scrollbar-track { background: transparent; }

/* ═══════════════════════════════════════════════════════════════
   Responsive
═══════════════════════════════════════════════════════════════ */

@media (max-width: 1280px) {
  .main { padding: 24px 28px 64px; }
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1280px) {
  .gs-metrics { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .workspace-split { grid-template-columns: 1fr 1fr; }
  .ws-detail-col { display: none; }
}

@media (max-width: 1280px) {
  .tasks-3col,
  .tasks-3col.no-detail { grid-template-columns: 1fr; }
  .tasks-3col .tasks-detail-col { display: none; }
}

@media (max-width: 1024px) {
  .grade-strip { grid-template-columns: 1fr; gap: 14px; padding: 14px 16px; }
  .gs-divider { display: none; }
  .workspace-split { grid-template-columns: 1fr; height: auto; }
  .tasks-chat-col, .ws-detail-col { display: none; }
  .home-grid { grid-template-columns: 1fr; }
  .tasks-3col { grid-template-columns: 1fr; height: auto; }
  .tasks-merged { grid-template-columns: 1fr; border-right: none; }
  .tasks-merged .tasks-chat-col { display: none; }
  .tasks-detail-col { display: none; }
  .home-chat { position: static; height: 480px; min-height: auto; }
  .charts-row { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .workspace-split { grid-template-columns: 1fr; }
  .ws-filters { position: static; }
  .settings-split { grid-template-columns: 1fr; }
  .settings-nav {
    flex-direction: row;
    flex-wrap: wrap;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
  }
  .integration-grid { grid-template-columns: repeat(2, 1fr); }
  .table-head, .table-row { grid-template-columns: 2fr 0.8fr 1.2fr 0.7fr; }
  .col-owner { display: none; }
  .orgmap-footer { flex-wrap: wrap; gap: 24px; }
  .task-panel { width: min(480px, 92vw); }
}

@media (max-width: 720px) {
  :root { --rail-w: 44px; --sidebar-w: 56px; }
  .sidebar-head, .sidebar-search, .nav-label, .nav-text, .nav-kbd, .badge, .account-info, .account-btn { display: none; }
  .nav-item { justify-content: center; padding: 8px 6px; gap: 0; }
  .nav-scroll { padding: 8px 4px; }
  .account { justify-content: center; padding: 8px 4px; }

  .main { padding: 16px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-actions { flex-wrap: wrap; }

  .kpi-row { grid-template-columns: 1fr 1fr; }
  .integration-grid { grid-template-columns: 1fr; }

  .table-head, .table-row { grid-template-columns: 1.6fr 1fr; gap: 8px; }
  .col-agents, .col-owner, .col-time { display: none; }

  .ws-item { flex-direction: column; gap: 8px; }
  .ws-item-head { flex-wrap: wrap; gap: 4px; }
  .judgment-row { grid-template-columns: 1fr; gap: 2px; }

  .task-panel { width: 100vw; right: 0; top: 0; bottom: 0; border-radius: 0; border: none; }
  .cmdk-panel { top: 24px; width: calc(100vw - 16px); }

  .org-row { gap: 8px; }
  .org-node { width: 132px; padding: 12px 8px; }
  .org-ceo { width: 150px; }
  .orgmap { padding: 24px 12px 0; }
}
