/* ═══════════════════════════════════════════════════════════════
   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 Org) */
.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 assistant 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-search {
  margin: 12px 10px 4px;
  display: inline-flex; align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  transition: border-color .12s, background .12s;
}
.sidebar-search:hover {
  border-color: var(--border-stronger);
}
.sidebar-search .search-icon { color: var(--text-dim); }
.search-text { flex: 1; text-align: left; }

.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
═══════════════════════════════════════════════════════════════ */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

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

/* assistant: 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
═══════════════════════════════════════════════════════════════ */
.inbox-list { display: flex; flex-direction: column; gap: 6px; }
.inbox-row {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
}
.inbox-row:hover {
  border-color: var(--border-stronger);
  box-shadow: var(--shadow-sm);
}
.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 — list + detail (2-col equal) */
.issues-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  height: calc(100vh - 130px);
  min-height: 560px;
  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, .issues-detail-col {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.issues-list-col .section-tabs {
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.issue-rows {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  gap: 4px;
}
.issue-row.selected {
  border-color: var(--text);
  background: var(--bg-soft);
}
.issues-detail-col .td-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* issue hero — title + meta block at top of detail */
.issue-hero {
  padding: 18px 22px 20px;
  border-bottom: 1px solid var(--border);
}
.issue-hero-top {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px;
}
.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: 18px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.35;
  margin: 6px 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: 16px 22px 4px;
}
.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 {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  flex-shrink: 0;
}

/* activity feed — clean rows, status indicator inline */
.activity-feed {
  display: flex; flex-direction: column;
  margin: 0;
}
.act-item {
  border-top: 1px solid var(--border);
  transition: background .12s;
}
.act-item:last-child { border-bottom: 1px solid var(--border); }
.act-expandable:hover { background: var(--bg-soft); }

.act-head {
  display: grid;
  grid-template-columns: 6px 24px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  background: transparent;
  border: none;
  padding: 12px 22px;
  text-align: left;
  cursor: default;
  font-family: inherit;
  color: var(--text);
}
.act-expandable .act-head { cursor: pointer; }
.act-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--border-stronger);
}
.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: 24px; height: 24px;
  border-radius: 7px;
  display: inline-flex !important;
  align-items: center; justify-content: center;
}
.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: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.act-verb {
  font-size: 12.5px;
  color: var(--text-muted);
  letter-spacing: -0.01em;
}
.act-time {
  font-size: 11px;
  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 22px 14px 64px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-top: -6px;
}

.act-detail {
  display: none;
  margin: 0 22px 16px 64px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  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;
}

.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 assistant's 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);
}

.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 Org 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;
}

/* CEO 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-node::before {
  content: "";
  position: absolute;
  top: -16px; left: 50%;
  width: 1px; height: 16px;
  background: var(--border-strong);
  transform: translateX(-50%);
}

.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;
}

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

.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;
}

.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: none !important;
  background-color: var(--text);
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}
.agent-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0) 60%);
  pointer-events: none;
}

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

/* color families — each agent has a single hue with subtle gradient */
.agent-ceo       { background-image: linear-gradient(135deg, #1e293b, #0f172a); }
.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 chat page (shared, dynamic)
═══════════════════════════════════════════════════════════════ */
.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; }
}
