/* ============================================================
   Avori — company AI workspace
   Page-by-page visual UX rebuild · 2026-07-05
   Chat-first, minimal, ChatGPT-style. One product language.
   ============================================================ */

:root {
  /* surfaces — near-black operational shell */
  --bg: #000000;
  --sidebar: #000000;
  --panel: #0a0a0a;
  --panel-2: #111111;
  --raise: #1a1a1a;
  --bg-input: #000000;

  /* lines */
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --line-3: rgba(255, 255, 255, 0.22);

  /* text */
  --ink-1: #ffffff;
  --ink: #ffffff;
  --ink-2: #cfcfcf;
  --ink-3: #8f8f8f;

  /* theme-aware UI states */
  --chrome: rgba(10, 10, 13, 0.74);
  --chrome-soft: rgba(10, 10, 13, 0.45);
  --hover: rgba(255, 255, 255, 0.065);
  --hover-2: rgba(255, 255, 255, 0.10);
  --press: rgba(255, 255, 255, 0.125);
  --menu: #111111;
  --menu-ink: #ffffff;

  /* brand + accents */
  --brand: #e6ff5c;          /* lime signature */
  --brand-ink: #000000;
  --accent: #7c9cff;         /* interactive blue-violet */
  --accent-soft: rgba(124, 156, 255, 0.14);
  --accent-line: rgba(124, 156, 255, 0.4);

  --green: #4ade9a;
  --green-soft: rgba(74, 222, 154, 0.13);
  --amber: #f2c265;
  --amber-soft: rgba(242, 194, 101, 0.13);
  --red: #ff7a8a;
  --red-soft: rgba(255, 122, 138, 0.13);
  --blue: #7fb2ff;
  --blue-soft: rgba(127, 178, 255, 0.13);
  --purple: #c1a5ff;
  --purple-soft: rgba(193, 165, 255, 0.13);
  --gray-soft: rgba(255, 255, 255, 0.08);

  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.5);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

/* Light mode, opt-in via Account > Appearance; same variable contract, so
   components restyle themselves. Brand lime darkens a step to hold contrast
   on white; status colors shift to their readable-on-light equivalents. */
:root[data-theme="light"] {
  --bg: #ffffff;
  --sidebar: #f7f7f7;
  --panel: #ffffff;
  --panel-2: #f2f2f2;
  --raise: #e8e8e8;
  --bg-input: #ffffff;

  --line: rgba(16, 20, 32, 0.10);
  --line-2: rgba(16, 20, 32, 0.17);
  --line-3: rgba(16, 20, 32, 0.28);

  --ink-1: #000000;
  --ink: #000000;
  --ink-2: #4d4d4d;
  --ink-3: #737373;

  --chrome: rgba(244, 245, 248, 0.88);
  --chrome-soft: rgba(235, 237, 242, 0.78);
  --hover: rgba(20, 26, 40, 0.06);
  --hover-2: rgba(20, 26, 40, 0.095);
  --press: rgba(20, 26, 40, 0.13);
  --menu: #ffffff;
  --menu-ink: #000000;

  --brand: #c8e02e;
  --brand-ink: #000000;
  --accent: #4a6ce0;
  --accent-soft: rgba(74, 108, 224, 0.11);
  --accent-line: rgba(74, 108, 224, 0.38);

  --green: #14834f;
  --green-soft: rgba(20, 131, 79, 0.11);
  --amber: #9a6300;
  --amber-soft: rgba(154, 99, 0, 0.12);
  --red: #c3364c;
  --red-soft: rgba(195, 54, 76, 0.10);
  --blue: #2361ba;
  --blue-soft: rgba(35, 97, 186, 0.10);
  --purple: #7048c4;
  --purple-soft: rgba(112, 72, 196, 0.10);
  --gray-soft: rgba(16, 20, 32, 0.06);

  --shadow: 0 1px 2px rgba(22, 26, 40, 0.08), 0 10px 30px rgba(22, 26, 40, 0.10);
  --shadow-pop: 0 12px 40px rgba(22, 26, 40, 0.18);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 460;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--ink-1); }
code { font-family: var(--mono); font-size: 0.92em; background: var(--gray-soft); padding: 1px 5px; border-radius: 5px; }
::selection { background: rgba(230, 255, 92, 0.25); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); background-clip: padding-box; }

/* ---------- layout ---------- */

#app { height: 100%; }
.layout {
  display: grid;
  grid-template-columns: 264px 1fr;
  height: 100vh;
}
.main { min-width: 0; display: flex; flex-direction: column; min-height: 0; background: var(--bg); }

/* ---------- sidebar ---------- */

.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px 10px 0;
  gap: 2px;
}
.sidebar .ws {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 8px 10px;
  font-weight: 700; font-size: 14px;
}
.sidebar .ws .logo {
  width: 26px; height: 26px; border-radius: 8px;
  background: var(--brand); color: var(--brand-ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; flex: none;
  box-shadow: 0 0 0 1px rgba(230, 255, 92, 0.3), 0 0 18px rgba(230, 255, 92, 0.18);
}
.sidebar .ws .ws-name { color: var(--ink-1); letter-spacing: -0.01em; }
.sidebar .ws .env {
  margin-left: auto;
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid rgba(74, 222, 154, 0.28);
  padding: 2px 7px; border-radius: 99px;
}

/* sidebar quick actions */
.sb-actions { display: flex; flex-direction: column; gap: 3px; padding: 4px 0 6px; }
.sb-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  font-weight: 550; font-size: 13.5px;
  text-align: left;
}
.sb-btn svg { width: 16px; height: 16px; flex: none; opacity: 0.85; }
.sb-btn:hover { background: var(--hover); color: var(--ink-1); }
.sb-btn.newchat {
  background: var(--hover);
  border-color: var(--line-2);
  color: var(--ink-1); font-weight: 650;
}
.sb-btn.newchat:hover { background: var(--hover-2); border-color: var(--line-3); }
.sb-btn.newchat svg { opacity: 1; color: var(--brand); }

/* sidebar inline search */
.sb-search {
  display: none;
  align-items: center; gap: 8px;
  margin: 2px 0 6px;
  background: var(--bg-input);
  border: 1px solid var(--line-2);
  border-radius: 9px;
  padding: 0 10px; height: 36px;
}
.sb-search.open { display: flex; }
.sb-search svg { width: 14px; height: 14px; color: var(--ink-3); flex: none; }
.sb-search input { border: 0; outline: 0; background: transparent; flex: 1; font-size: 13px; min-width: 0; color: var(--ink); }

.nav { padding: 2px 0; overflow-y: auto; }
.nav .section {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3);
  padding: 12px 10px 4px;
}
.nav a.item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: 9px;
  color: var(--ink-2);
  font-weight: 550; font-size: 13.5px;
  text-decoration: none;
  min-height: 34px;
}
.nav a.item svg { width: 16px; height: 16px; flex: none; opacity: 0.8; }
.nav a.item:hover { background: var(--hover); color: var(--ink-1); }
.nav a.item:hover svg { opacity: 1; }
.nav a.item.active {
  background: rgba(230, 255, 92, 0.10);
  color: var(--ink-1);
  box-shadow: inset 0 0 0 1px rgba(230, 255, 92, 0.16);
}
.nav a.item.active svg { color: var(--brand); opacity: 1; }
.nav a.item .count { margin-left: auto; font-size: 11px; color: var(--ink-3); }

/* sidebar sections: agents + recent chats */
.sb-scroll { flex: 1; overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.sb-group { margin-top: 6px; }
.sb-group-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3);
  padding: 12px 10px 4px;
}
.sb-group-title a { font-size: 11px; text-transform: none; letter-spacing: 0; color: var(--ink-3); font-weight: 500; }
.sb-group-title a:hover { color: var(--ink); }
.sb-link {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 9px;
  color: var(--ink-2); font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  white-space: nowrap; overflow: hidden;
}
.sb-link:hover { background: var(--hover); color: var(--ink-1); }
.sb-link.active { background: var(--hover-2); color: var(--ink-1); }
.sb-link .em { flex: none; width: 20px; height: 20px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; background: var(--gray-soft); }
.sb-link .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sb-empty { color: var(--ink-3); font-size: 12px; padding: 6px 10px 4px; line-height: 1.5; }

.sidebar .foot {
  border-top: 1px solid var(--line);
  margin: 4px -10px 0; padding: 10px 12px;
  display: flex; align-items: center; gap: 9px;
}
.sidebar .foot .account-usage {
  margin: 0; padding: 0; width: 40px; height: 40px; border: 0; background: transparent;
  display: inline-grid; place-items: center; border-radius: 50%; flex: none;
}
.sidebar .foot .account-usage:focus-visible { outline: 3px solid var(--accent-line); outline-offset: 2px; }
.usage-avatar-ring {
  --usage-color: var(--accent);
  width: 38px; height: 38px; border-radius: 50%; padding: 3px; position: relative;
  display: inline-grid; place-items: center;
  background: conic-gradient(var(--usage-color) calc(var(--remaining) * 1%), var(--gray-soft) 0);
  box-shadow: 0 0 0 1px var(--line-2);
}
.usage-avatar-ring > span {
  width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center;
  background: var(--panel); color: var(--ink); font-size: 10px; font-weight: 800;
}
.usage-avatar-ring::after {
  content: attr(data-badge); position: absolute; right: -8px; bottom: -5px;
  min-width: 24px; padding: 2px 4px; border-radius: 99px; border: 1px solid var(--line-2);
  background: var(--menu); color: var(--ink-2); font: 700 8px/1.2 var(--mono); text-align: center;
}
.usage-avatar-ring.warn { --usage-color: var(--amber); }
.usage-avatar-ring.danger { --usage-color: var(--red); }
.usage-avatar-ring.byok { --usage-color: var(--green); background: conic-gradient(var(--green) 100%, var(--gray-soft) 0); }
.sr-only { position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex: none;
  border: 1px solid var(--accent-line);
}
.sidebar .foot .who { min-width: 0; flex: 1; }
.sidebar .foot .who .name { color: var(--ink-1); font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .foot .who .role { font-size: 11px; color: var(--ink-3); text-transform: capitalize; }
.sidebar .foot button {
  margin-left: auto;
  border: 1px solid var(--line-2); background: var(--hover);
  border-radius: 8px; padding: 5px 10px; font-size: 12px; color: var(--ink-2); font-weight: 550;
}
.sidebar .foot button:hover { border-color: var(--line-3); color: var(--ink-1); }

/* ---------- topbar ---------- */

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 26px;
  border-bottom: 1px solid var(--line);
  background: var(--chrome);
  backdrop-filter: blur(16px);
  min-height: 58px; flex: none;
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { font-size: 17px; font-weight: 700; margin: 0; white-space: nowrap; letter-spacing: -0.015em; }
.search {
  flex: 1; max-width: 440px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 0 12px; height: 36px;
}
.search:focus-within { border-color: var(--line-3); }
.search svg { width: 14px; height: 14px; color: var(--ink-3); flex: none; }
.search input { border: 0; outline: 0; background: transparent; flex: 1; font-size: 13.5px; min-width: 0; color: var(--ink); }
.search input::placeholder { color: var(--ink-3); }
.topbar .spacer { flex: 1; }

.content { padding: 24px 26px 48px; overflow-y: auto; flex: 1; min-height: 0; min-width: 0; }
.content .inner { max-width: 1120px; margin: 0 auto; }
/* Chat runs edge-to-edge and owns its own scrolling. */
.content.bare { padding: 0; overflow: hidden; display: flex; min-width: 0; max-width: 100%; }
.content.bare > .inner { max-width: none; margin: 0; width: 100%; display: flex; min-height: 0; min-width: 0; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-2);
  background: var(--hover);
  color: var(--ink);
  border-radius: 9px;
  padding: 0 13px; height: 34px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn svg { width: 14px; height: 14px; }
.btn:hover { border-color: var(--line-3); background: var(--hover-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: #eeff7d; border-color: #eeff7d; }
.btn.danger { color: var(--red); border-color: rgba(255, 122, 138, 0.35); background: transparent; }
.btn.danger:hover { background: var(--red-soft); }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ---------- badges / chips ---------- */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  border-radius: 99px; padding: 2px 9px;
  border: 1px solid transparent; white-space: nowrap; min-height: 20px;
}
.badge.neutral { color: var(--ink-2); background: var(--gray-soft); border-color: var(--line); }
.badge.ok, .badge.tier-core, .badge.kind-personal { color: var(--green); background: var(--green-soft); border-color: rgba(74, 222, 154, 0.24); }
.badge.warn { color: var(--amber); background: var(--amber-soft); border-color: rgba(242, 194, 101, 0.24); }
.badge.danger, .badge.kind-system { color: var(--red); background: var(--red-soft); border-color: rgba(255, 122, 138, 0.24); }
.badge.tier-reviewed, .badge.kind-workspace, .badge.reviewed { color: var(--blue); background: var(--blue-soft); border-color: rgba(127, 178, 255, 0.24); }
.badge.tier-unreviewed { color: var(--amber); background: var(--amber-soft); border-color: rgba(242, 194, 101, 0.24); }
.badge.tier-sandboxed { color: var(--purple); background: var(--purple-soft); border-color: rgba(193, 165, 255, 0.24); }
.badge.generic { color: var(--blue); background: var(--blue-soft); }

.badge.live { color: var(--green); background: var(--green-soft); border-color: rgba(74, 222, 154, 0.3); }
.badge.sample { color: var(--ink-3); background: var(--gray-soft); border-color: var(--line); }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--green); box-shadow: 0 0 7px rgba(74, 222, 154, 0.6); }
.dot.warn { background: var(--amber); }
.dot.bad { background: var(--red); }
.dot.off { background: var(--ink-3); }

.tag { font-size: 11px; color: var(--ink-2); background: var(--gray-soft); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }

/* source / scope / role / bucket / category / sharing badges */
.badge.src-system, .badge.scope-system { color: var(--blue); background: var(--blue-soft); }
.badge.src-shared { color: var(--green); background: var(--green-soft); }
.badge.src-main { color: var(--brand); background: rgba(230, 255, 92, 0.1); }
.badge.src-agent-local, .badge.scope-agent-private { color: var(--purple); background: var(--purple-soft); }
.badge.scope-tray-private { color: var(--red); background: var(--red-soft); }
.badge.scope-team-shared { color: var(--green); background: var(--green-soft); }
.badge.scope-restricted { color: var(--ink-2); background: var(--gray-soft); }
.badge.status-needs_review { color: var(--amber); background: var(--amber-soft); }
.badge.status-duplicate { color: var(--ink-2); background: var(--gray-soft); }

.badge.bkt-delete-candidate, .badge.bkt-tray-private, .badge.bkt-credential-backed { color: var(--red); background: var(--red-soft); }
.badge.bkt-archive-candidate, .badge.bkt-stale-review { color: var(--amber); background: var(--amber-soft); }
.badge.bkt-unknown-review, .badge.bkt-trace-log-history, .badge.bkt-agent-private { color: var(--ink-2); background: var(--gray-soft); }
.badge.bkt-system { color: var(--blue); background: var(--blue-soft); }
.badge.bkt-company-shared { color: var(--green); background: var(--green-soft); }
.badge.bkt-role-shared { color: var(--purple); background: var(--purple-soft); }

.badge.cat-public { color: var(--green); background: var(--green-soft); }
.badge.cat-creative { color: var(--purple); background: var(--purple-soft); }
.badge.cat-support { color: var(--blue); background: var(--blue-soft); }
.badge.cat-marketing { color: var(--amber); background: var(--amber-soft); }
.badge.cat-financial, .badge.cat-founder-private { color: var(--red); background: var(--red-soft); }
.badge.cat-credentials { color: #fff; background: rgba(255, 122, 138, 0.4); }
.badge.cat-trace-log { color: var(--ink-2); background: var(--gray-soft); }

.badge.share-approved { color: var(--green); background: var(--green-soft); }
.badge.share-team-shared { color: var(--blue); background: var(--blue-soft); }
.badge.share-admin-review { color: var(--amber); background: var(--amber-soft); }
.badge.share-private { color: var(--ink-2); background: var(--gray-soft); }
.badge.share-archived { color: var(--ink-3); background: var(--gray-soft); }

.badge.role-owner { color: var(--brand); background: rgba(230, 255, 92, 0.1); }
.badge.role-admin { color: var(--blue); background: var(--blue-soft); }
.badge.role-member { color: var(--ink-2); background: var(--gray-soft); }
.badge.role-creative { color: var(--purple); background: var(--purple-soft); }
.badge.role-freelancer { color: var(--amber); background: var(--amber-soft); }

/* ---------- tabs ---------- */

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a {
  padding: 8px 12px; font-size: 13px; font-weight: 550;
  color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink-1); border-bottom-color: var(--brand); font-weight: 650; }

/* ---------- cards / grid ---------- */

.lead { color: var(--ink-2); font-size: 13.5px; line-height: 1.55; margin: 0 0 18px; max-width: 780px; }
.lead strong { color: var(--ink); font-weight: 600; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)); gap: 14px; align-items: stretch; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex; flex-direction: column; gap: 9px;
  min-height: 158px;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.025);
  overflow: hidden;
  transition: border-color 0.14s ease, transform 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}
.card:hover { border-color: var(--line-3); transform: translateY(-1px); background: var(--panel-2); box-shadow: var(--shadow); }
.card .head { display: flex; align-items: flex-start; gap: 10px; }
.card .head .name { font-weight: 700; font-size: 14px; line-height: 1.25; flex: 1; min-width: 0; color: var(--ink); }
.card .tagline {
  color: var(--ink-2); font-size: 12.5px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em;
}
.card .meta { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.card .foot {
  margin-top: auto; display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--ink-3);
  border-top: 1px solid var(--line); padding-top: 10px; min-height: 30px;
}
.card .foot .tags { display: flex; gap: 4px; overflow: hidden; }
.card .foot .right { margin-left: auto; display: flex; gap: 5px; align-items: center; }

.card-kicker {
  font-size: 10.5px;
  font-weight: 760;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.premium-card {
  --h: 210;
  padding: 0;
  gap: 0;
  min-height: 316px;
  height: 316px;
  border-radius: 12px;
  background: var(--panel);
}
.grid > .premium-card { width: 100%; }
.premium-card-banner {
  height: 124px;
  flex: none;
  background-image:
    radial-gradient(115% 145% at 16% 0%, hsl(var(--h) 56% 54% / 0.38), transparent 58%),
    radial-gradient(110% 150% at 88% 16%, hsl(calc(var(--h) + 72) 58% 54% / 0.26), transparent 60%),
    linear-gradient(135deg, hsl(var(--h) 34% 17%), hsl(calc(var(--h) + 28) 28% 11%));
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--line);
}
:root[data-theme="light"] .premium-card-banner {
  background-image:
    radial-gradient(115% 145% at 16% 0%, hsl(var(--h) 74% 64% / 0.34), transparent 58%),
    radial-gradient(110% 150% at 88% 16%, hsl(calc(var(--h) + 72) 74% 70% / 0.28), transparent 60%),
    linear-gradient(135deg, hsl(var(--h) 62% 86%), hsl(calc(var(--h) + 28) 56% 92%));
}
.premium-card-body {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 0;
  flex: 1;
  padding: 0 14px 13px;
}
.premium-card-main {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: -22px;
  min-width: 0;
}
.premium-card-icon {
  width: 50px;
  height: 50px;
  border-radius: 13px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: var(--ink);
  background: var(--raise);
  border: 1px solid var(--line-3);
  box-shadow: 0 11px 22px rgba(0, 0, 0, 0.24);
  font-weight: 780;
  font-size: 18px;
  letter-spacing: 0;
}
.premium-card-icon svg { width: 20px; height: 20px; }
.gradient-picker { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.gradient-swatch {
  height: 48px; padding: 0; overflow: hidden; cursor: pointer; border-radius: 10px;
  border: 2px solid transparent; position: relative;
  background:
    radial-gradient(115% 145% at 16% 0%, hsl(var(--h) 58% 58% / .72), transparent 58%),
    radial-gradient(110% 150% at 88% 16%, hsl(calc(var(--h) + 72) 62% 58% / .5), transparent 60%),
    linear-gradient(135deg, hsl(var(--h) 34% 20%), hsl(calc(var(--h) + 28) 28% 12%));
}
.gradient-swatch:hover { border-color: var(--line-3); transform: translateY(-1px); }
.gradient-swatch.selected { border-color: var(--ink); box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.gradient-swatch span { position: absolute; left: 5px; right: 5px; bottom: 4px; color: #fff; font-size: 9px; font-weight: 700; text-shadow: 0 1px 4px #000; }
@media (max-width: 620px) { .gradient-picker { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.premium-card-copy {
  min-width: 0;
  flex: 1;
  padding-top: 23px;
}
.premium-card-title {
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.2;
  font-weight: 740;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.premium-card-sub {
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.premium-card-desc {
  color: var(--ink-2);
  font-size: 12.3px;
  line-height: 1.42;
  min-height: 34px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.premium-card-badges {
  min-height: 22px;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  flex-wrap: wrap;
  align-content: flex-start;
}
.premium-card-foot {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}
.premium-card-footline {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-3);
  font-size: 11.5px;
}
.premium-card-actions {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 54%;
  overflow: hidden;
  justify-content: flex-end;
}
.premium-card-actions .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.knowledge-document-card .premium-card-foot { flex-direction: column; align-items: stretch; }
.knowledge-document-card .premium-card-footline { flex: none; }
.knowledge-document-card .premium-card-actions { max-width: none; flex-wrap: wrap; overflow: visible; justify-content: flex-start; }
.premium-card-actions .btn.small {
  flex: none;
  white-space: nowrap;
  min-width: max-content;
}

.type-ico {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent;
}
.type-ico svg { width: 14px; height: 14px; }
.type-agent { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.type-skill { background: var(--blue-soft); color: var(--blue); border-color: rgba(127, 178, 255, 0.24); }
.type-app { background: var(--green-soft); color: var(--green); border-color: rgba(74, 222, 154, 0.24); }
.type-knowledge { background: var(--amber-soft); color: var(--amber); border-color: rgba(242, 194, 101, 0.24); }
.type-connector, .type-draft_agent, .type-draft_skill, .type-flow, .type-draft { background: var(--purple-soft); color: var(--purple); border-color: rgba(193, 165, 255, 0.24); }

/* ---------- panels / detail ---------- */

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.panel .sect { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel .sect:last-child { border-bottom: 0; }
.panel h3 { margin: 0 0 10px; font-size: 12.5px; font-weight: 680; color: var(--ink); }

.detail-head { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 18px; }
.detail-head .type-ico { width: 38px; height: 38px; }
.detail-head .type-ico svg { width: 18px; height: 18px; }
.detail-head h2 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.detail-head .sub { color: var(--ink-2); font-size: 13px; margin-top: 3px; }
.detail-head .actions { margin-left: auto; display: flex; gap: 8px; flex: none; }

.kv { display: grid; grid-template-columns: 160px 1fr; gap: 7px 16px; font-size: 13px; }
.kv .k { color: var(--ink-3); }

.list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
  font-size: 13px; min-height: 42px;
}
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; }
.list-row .sub { color: var(--ink-3); font-size: 12px; }

.notice {
  border: 1px solid rgba(242, 194, 101, 0.28);
  background: var(--amber-soft);
  color: var(--amber);
  border-radius: var(--radius);
  padding: 11px 14px; font-size: 13px;
  display: flex; gap: 9px; align-items: flex-start; margin-bottom: 16px;
}
.notice.info { border-color: rgba(127, 178, 255, 0.28); background: var(--blue-soft); color: var(--blue); }
.notice.danger { border-color: rgba(255, 122, 138, 0.28); background: var(--red-soft); color: var(--red); }
.notice svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }

.empty {
  color: var(--ink-3); text-align: center; padding: 52px 20px;
  border: 1px dashed var(--line-2); border-radius: var(--radius-lg); font-size: 13px;
}
/* Action row inside an empty state — beautiful empty states are exits, not dead ends. */
.empty-actions {
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 14px;
}
.empty-actions .btn { text-decoration: none; }

/* ---------- forms ---------- */

.form { display: flex; flex-direction: column; gap: 16px; }
.field label { display: block; font-size: 12px; font-weight: 650; color: var(--ink-2); margin-bottom: 5px; }
.field .hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.field input[type=text], .field input[type=email], .field input[type=password], .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 9px; padding: 8px 11px;
  background: var(--bg-input); color: var(--ink); font-size: 13.5px;
}
.field textarea { min-height: 96px; resize: vertical; font-family: var(--font); }
.field textarea.mono { font-family: var(--mono); font-size: 12.5px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
select option { background: var(--panel); color: var(--ink); }
.checks { display: flex; flex-direction: column; gap: 7px; }
.checks label { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 400; color: var(--ink); }
.form .row { display: flex; gap: 12px; }
.form .row .field { flex: 1; }
.form-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- login ---------- */

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% -10%, rgba(230, 255, 92, 0.06), transparent 34%),
    radial-gradient(circle at 100% 0%, rgba(124, 156, 255, 0.08), transparent 40%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 440px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: 20px;
  box-shadow: var(--shadow-pop);
  padding: 34px;
}
.login-card .logo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.login-card .logo {
  width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: var(--brand-ink);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px;
  box-shadow: 0 0 24px rgba(230, 255, 92, 0.24);
  overflow: hidden;
}
.login-card .logo img { width: 100%; height: 100%; display: block; }
.login-card h1 { font-size: 22px; margin: 0; letter-spacing: -0.02em; }
.login-card .sub { color: var(--ink-2); font-size: 13.5px; margin: 4px 0 22px; line-height: 1.55; }
.login-user {
  display: flex; align-items: center; gap: 11px; width: 100%;
  border: 1px solid var(--line-2);
  background: var(--panel-2);
  border-radius: 12px; padding: 12px 13px; margin-bottom: 9px; text-align: left;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.login-user:hover { border-color: var(--accent-line); background: var(--raise); }
.login-user .name { font-weight: 600; font-size: 14px; color: var(--ink); }
.login-user .role { margin-left: auto; }
.login-card .foot-note { font-size: 11.5px; color: var(--ink-3); margin-top: 16px; line-height: 1.55; }
.login-form { gap: 13px; }
.login-form .btn.primary { margin-top: 4px; padding: 10px 14px; font-size: 13.5px; }
.btn.subtle {
  background: transparent; border-color: transparent; color: var(--ink-3);
  font-size: 12px;
}
.btn.subtle:hover { color: var(--ink); background: transparent; border-color: var(--line-2); }

/* ---------- self-serve signup ---------- */

.signup-page {
  min-height: 100vh;
  padding: 28px clamp(20px, 4vw, 64px) 40px;
  background:
    radial-gradient(circle at 12% 0%, rgba(230, 255, 92, 0.10), transparent 31%),
    radial-gradient(circle at 100% 100%, rgba(124, 156, 255, 0.10), transparent 34%),
    #000000;
  color: #ffffff;
  overflow-x: hidden;
}
.signup-brand {
  width: min(1180px, 100%); margin: 0 auto 26px; display: flex; align-items: center; gap: 10px;
  color: #fff; font-size: 18px; font-weight: 750; letter-spacing: -0.02em;
}
.signup-brand:hover { color: #fff; }
.signup-brand img { width: 34px; height: 34px; border-radius: 10px; }
.signup-brand small {
  margin-left: 2px; padding: 3px 8px; border: 1px solid rgba(255,255,255,.14); border-radius: 999px;
  color: rgba(255,255,255,.66); font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.signup-shell {
  width: min(1180px, 100%); min-height: min(760px, calc(100vh - 112px)); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(430px, .96fr);
  border: 1px solid rgba(255,255,255,.11); border-radius: 28px; overflow: hidden;
  background: #0a0a0a; box-shadow: 0 32px 90px rgba(0,0,0,.42);
}
.signup-story {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(44px, 6vw, 78px);
  background:
    linear-gradient(150deg, rgba(230,255,92,.10), transparent 38%),
    linear-gradient(330deg, rgba(124,156,255,.13), transparent 42%),
    #000000;
  border-right: 1px solid rgba(255,255,255,.09);
}
.signup-story::after {
  content: ""; position: absolute; width: 360px; height: 360px; border-radius: 50%; right: -210px; bottom: 20px;
  border: 1px solid rgba(230,255,92,.16); box-shadow: 0 0 0 46px rgba(230,255,92,.018), 0 0 0 92px rgba(230,255,92,.012);
  pointer-events: none;
}
.signup-story-inner, .signup-story-note { position: relative; z-index: 1; }
.signup-story h1 {
  max-width: 620px; margin: 0; font-size: clamp(43px, 5.2vw, 72px); line-height: 1.02; letter-spacing: -.042em;
  text-wrap: balance;
}
.signup-story-inner > p {
  max-width: 540px; margin: 25px 0 38px; color: rgba(255,255,255,.68); font-size: 17px; line-height: 1.55;
}
.signup-proof { display: grid; gap: 18px; max-width: 520px; }
.signup-proof > div { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; }
.signup-proof > div > span {
  width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%;
  background: #dfff43; color: #000000;
}
.signup-proof svg { width: 14px; height: 14px; }
.signup-proof p { margin: 0; display: grid; gap: 3px; }
.signup-proof strong { font-size: 14px; color: #fff; }
.signup-proof small { color: rgba(255,255,255,.58); font-size: 12.5px; line-height: 1.45; }
.signup-story-note { margin: 48px 0 0; max-width: 410px; color: rgba(255,255,255,.4); font-size: 12px; line-height: 1.5; }
.signup-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(38px, 5vw, 68px); background: #111111; }
.signup-form-head { margin-bottom: 28px; }
.signup-form-head > p { margin: 0 0 9px; color: #dfff43; font-size: 12px; font-weight: 700; }
.signup-form-head h2 { margin: 0; color: #fff; font-size: clamp(28px, 3vw, 38px); line-height: 1.12; letter-spacing: -.035em; }
.signup-form-head span { display: block; margin-top: 10px; color: rgba(255,255,255,.57); font-size: 13px; }
.signup-form { gap: 16px; }
.signup-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.signup-form .field { gap: 7px; }
.signup-form .field label { color: rgba(255,255,255,.78); font-size: 12px; font-weight: 650; }
.signup-form .field input {
  height: 48px; padding: 0 14px; border-color: rgba(255,255,255,.14); border-radius: 11px;
  background: rgba(7,8,11,.54); color: #fff; font-size: 14px;
}
.signup-form .field input::placeholder { color: rgba(255,255,255,.28); }
.signup-form .field input:focus { border-color: rgba(223,255,67,.66); box-shadow: 0 0 0 3px rgba(223,255,67,.09); }
.signup-form .signup-submit.btn.primary {
  width: 100%; min-height: 50px; margin-top: 2px; border-radius: 11px; justify-content: center;
  background: #dfff43; border-color: #dfff43; color: #000000; font-size: 14px; font-weight: 750;
}
.signup-form .signup-submit.btn.primary:hover { background: #e8ff74; border-color: #e8ff74; color: #000000; transform: translateY(-1px); }
.signup-submit span { margin-left: 5px; font-size: 18px; line-height: 1; }
.signup-signin { margin: 23px 0 0; color: rgba(255,255,255,.53); text-align: center; font-size: 12.5px; }
.signup-text-button { padding: 0; border: 0; background: transparent; color: #fff; font-weight: 700; }
.signup-text-button:hover { color: #dfff43; }
.signup-legal { margin: 11px auto 0; max-width: 390px; color: rgba(255,255,255,.33); text-align: center; font-size: 10.5px; line-height: 1.45; }

.beta-checkout-page { position: fixed; inset: 0; height: 100dvh; display: flex; flex-direction: column; overflow-y: auto; }
.beta-checkout-shell {
  width: min(1060px, 100%); margin: auto; display: grid; grid-template-columns: minmax(0, 1fr) 360px;
  border: 1px solid rgba(255,255,255,.11); border-radius: 28px; overflow: hidden;
  background: #0a0a0a; box-shadow: 0 32px 90px rgba(0,0,0,.42);
}
.beta-checkout-main { padding: clamp(38px, 5vw, 66px); }
.checkout-progress { position: relative; width: 116px; display: grid; grid-template-columns: 24px 68px 24px; align-items: center; margin-bottom: 42px; }
.checkout-progress > span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; font-size: 11px; font-weight: 800; }
.checkout-progress .done { background: #dfff43; color: #000000; }
.checkout-progress .done svg { width: 13px; height: 13px; }
.checkout-progress .current { border: 1px solid #dfff43; color: #dfff43; }
.checkout-progress > i { height: 1px; background: rgba(223,255,67,.48); }
.checkout-progress > p { position: absolute; inset: 30px -20px auto; display: flex; justify-content: space-between; margin: 0; color: rgba(255,255,255,.46); font-size: 9px; font-weight: 500; }
.checkout-progress > p b { font-weight: 600; }
.checkout-head { margin-bottom: 27px; }
.checkout-head h1 { margin: 0; max-width: 560px; font-size: clamp(34px, 4vw, 50px); line-height: 1.02; letter-spacing: -.04em; text-wrap: balance; }
.checkout-company-card { display: grid; grid-template-columns: 42px 1fr auto; gap: 13px; align-items: center; padding: 16px; border: 1px solid rgba(255,255,255,.11); border-radius: 14px; background: rgba(7,8,11,.38); }
.checkout-company-card img { width: 42px; height: 42px; border-radius: 12px; }
.checkout-company-card div { display: grid; min-width: 0; }
.checkout-company-card small { color: rgba(255,255,255,.42); font-size: 10px; }
.checkout-company-card strong { color: #fff; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.checkout-company-card span { color: rgba(255,255,255,.57); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.checkout-includes { margin-top: 30px; display: grid; gap: 16px; }
.checkout-includes h2 { margin: 0 0 2px; font-size: 14px; }
.checkout-includes > div { display: grid; grid-template-columns: 25px 1fr; gap: 11px; align-items: start; }
.checkout-includes > div > span { width: 23px; height: 23px; display: grid; place-items: center; border-radius: 50%; background: rgba(223,255,67,.12); color: #dfff43; }
.checkout-includes svg { width: 12px; height: 12px; }
.checkout-includes p { margin: 0; display: grid; gap: 2px; }
.checkout-includes strong { font-size: 12.5px; }
.checkout-includes small { color: rgba(255,255,255,.46); font-size: 11.5px; line-height: 1.4; }
.beta-order-card { align-self: stretch; padding: 34px; background: #111111; border-left: 1px solid rgba(255,255,255,.09); }
.beta-order-top { display: flex; justify-content: space-between; align-items: center; padding-bottom: 26px; border-bottom: 1px solid rgba(255,255,255,.09); }
.beta-order-top span { font-size: 17px; font-weight: 750; }
.beta-order-top small { padding: 4px 9px; border-radius: 999px; background: rgba(223,255,67,.10); color: #dfff43; font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.beta-order-line { display: flex; justify-content: space-between; gap: 18px; padding: 22px 0 0; font-size: 12.5px; }
.beta-order-line.muted { padding-top: 10px; color: rgba(255,255,255,.45); }
.beta-order-total { display: flex; justify-content: space-between; align-items: end; margin-top: 24px; padding: 21px 0; border-top: 1px solid rgba(255,255,255,.09); }
.beta-order-total span { font-weight: 700; }
.beta-order-total strong { font-size: 40px; line-height: .9; letter-spacing: -.04em; }
.beta-order-total sup { font-size: 15px; vertical-align: top; }
.beta-free-note { display: grid; grid-template-columns: 23px 1fr; gap: 10px; padding: 14px; border-radius: 12px; background: rgba(223,255,67,.08); color: #dfff43; }
.beta-free-note > svg { width: 18px; height: 18px; margin-top: 2px; }
.beta-free-note p { margin: 0; display: grid; gap: 2px; }
.beta-free-note strong { color: #fff; font-size: 12px; }
.beta-free-note small { color: rgba(255,255,255,.53); font-size: 10.5px; line-height: 1.4; }
.beta-order-card .checkout-confirm.btn.primary { width: 100%; min-height: 50px; margin-top: 20px; justify-content: center; border-radius: 11px; background: #dfff43; border-color: #dfff43; color: #000000; font-weight: 750; }
.beta-order-card .checkout-confirm.btn.primary:hover { background: #e8ff74; border-color: #e8ff74; color: #000000; }
.checkout-secure { margin: 13px 0 0; color: rgba(255,255,255,.34); text-align: center; font-size: 9.5px; line-height: 1.45; }

@media (max-width: 900px) {
  .signup-page { padding: 20px; }
  .signup-brand { margin-bottom: 18px; }
  .signup-shell { min-height: 0; grid-template-columns: 1fr; }
  .signup-story { padding: 42px 34px; border-right: 0; border-bottom: 1px solid rgba(255,255,255,.09); }
  .signup-story h1 { max-width: 700px; font-size: clamp(40px, 7vw, 58px); }
  .signup-story-inner > p { margin: 20px 0 30px; }
  .signup-story-note { display: none; }
  .signup-panel { padding: 42px 34px 48px; }
  .beta-checkout-shell { grid-template-columns: 1fr; }
  .beta-order-card { border-left: 0; border-top: 1px solid rgba(255,255,255,.09); }
}
@media (max-width: 560px) {
  .signup-page { padding: 16px 12px 24px; }
  .signup-brand { padding-left: 5px; margin-bottom: 14px; }
  .signup-shell { border-radius: 20px; }
  .signup-story { padding: 32px 22px 30px; }
  .signup-story h1 { font-size: clamp(35px, 11.4vw, 47px); line-height: 1.04; letter-spacing: -.034em; }
  .signup-story-inner > p { margin: 18px 0 25px; font-size: 15px; }
  .signup-proof { gap: 15px; }
  .signup-proof small { font-size: 12px; }
  .signup-panel { padding: 32px 22px 38px; }
  .signup-field-row { grid-template-columns: 1fr; gap: 16px; }
  .signup-form-head { margin-bottom: 23px; }
  .beta-checkout-main, .beta-order-card { padding: 30px 22px; }
  .checkout-progress { margin-bottom: 38px; }
  .checkout-head h1 { font-size: 36px; line-height: 1.05; letter-spacing: -.032em; }
  .checkout-company-card { grid-template-columns: 38px minmax(0, 1fr); }
  .checkout-company-card img { width: 38px; height: 38px; }
  .checkout-company-card button { grid-column: 1 / -1; justify-self: start; margin-left: 51px; }
}

/* ============================================================
   CHAT — the product
   ============================================================ */

.chat-surface { display: flex; flex: 1; width: 100%; height: 100%; min-height: 0; min-width: 0; max-width: 100%; }
.chat-wrap { display: flex; flex-direction: column; flex: 1; height: 100%; min-height: 0; min-width: 0; max-width: 100%; }

/* --- agent-centric chat rail (one row per durable agent workspace) --- */
.chat-rail {
  width: 270px; flex: none; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); padding: 14px 10px;
  background: var(--chrome-soft); overflow-y: auto; min-height: 0;
}
.agent-rail-tools { display:flex; align-items:center; gap:7px; margin-bottom:10px; }
.agent-rail-search { flex:1; min-width:0; height:36px; display:flex; align-items:center; gap:8px; padding:0 10px; border:1px solid var(--line-2); border-radius:9px; background:var(--bg-input); color:var(--ink-3); }
.agent-rail-search svg { width:14px; height:14px; flex:none; }
.agent-rail-search input { width:100%; min-width:0; border:0; outline:0; background:transparent; color:var(--ink); font-size:12.5px; }
.rail-add { width:36px; height:36px; flex:none; display:grid; place-items:center; padding:0; border:1px solid var(--line-2); border-radius:9px; background:var(--bg-input); color:var(--ink-2); }
.rail-add:hover { background:var(--hover-2); color:var(--ink-1); }
.rail-add svg { width:15px; height:15px; }
.rail-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--ink-3); padding: 4px 10px 6px;
}
.rail-list { display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.rail-item {
  position: relative; display: flex; align-items: center; gap: 5px;
  min-height: 54px; padding: 7px 7px; border-radius: 10px; cursor: pointer; color: var(--ink-2);
}
.rail-item:hover { background: var(--hover); color: var(--ink); }
.rail-item.active { background: var(--accent-soft); color: var(--ink); }
.rail-item.pinned .lbl { color: var(--ink-1); }
.rail-main { flex: 1; min-width: 0; padding: 0 2px; }
.rail-item .lbl { display: block; font-size: 12.5px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rail-item .sub { display: block; font-size: 11px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.agent-rail-avatar { --agent-hue:220; width:31px; height:31px; flex:none; display:grid; place-items:center; border-radius:10px; background:hsl(var(--agent-hue) 64% 46% / .18); border:1px solid hsl(var(--agent-hue) 64% 52% / .24); font-size:16px; }
.agent-rail-heading { display:flex; align-items:baseline; gap:7px; min-width:0; }
.agent-rail-heading .lbl { flex:1; min-width:0; color:var(--ink-1); font-weight:650; }
.agent-rail-heading time { flex:none; color:var(--ink-3); font-size:9.5px; }
.rail-agent-new { width:25px; height:25px; flex:none; display:grid; place-items:center; padding:0; border:0; border-radius:7px; background:transparent; color:var(--ink-3); opacity:0; }
.rail-agent-new svg { width:14px; height:14px; }
.agent-rail-item:hover .rail-agent-new,.agent-rail-item.active .rail-agent-new,.rail-agent-new:focus-visible { opacity:1; }
.rail-agent-new:hover { background:var(--hover-2); color:var(--ink-1); }
.rail-pin, .rail-more {
  width: 24px; height: 24px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 7px; background: transparent; color: var(--ink-3); padding: 0;
}
.rail-pin svg, .rail-more svg { width: 14px; height: 14px; }
.rail-pin { opacity: 0; }
.rail-pin.on, .rail-item:hover .rail-pin, .rail-item.active .rail-pin { opacity: 1; }
.rail-pin.on { color: var(--brand); }
.rail-pin.spacer { pointer-events: none; opacity: 0; }
.rail-more { opacity: 0; }
.rail-item:hover .rail-more, .rail-item.active .rail-more { opacity: 1; }
.rail-pin:hover, .rail-more:hover { background: var(--hover-2); color: var(--ink-1); }
.chat-row-menu {
  position: absolute; right: 6px; top: 34px; min-width: 188px; z-index: 30;
  background: var(--menu); border: 1px solid var(--line-2);
  border-radius: 12px; padding: 6px; box-shadow: var(--shadow-pop);
}
.chat-row-menu[hidden] { display: none; }
.chat-row-menu button {
  width: 100%; display: flex; align-items: center; gap: 10px;
  border: 0; border-radius: 8px; background: transparent; color: var(--menu-ink);
  padding: 9px 10px; text-align: left; font-size: 13px;
}
.chat-row-menu button:hover { background: var(--hover); }
.chat-row-menu button svg { width: 16px; height: 16px; color: var(--ink-2); }
.chat-row-menu button.danger { color: var(--red); }
.chat-row-menu button.danger svg { color: var(--red); }
.rail-skel { height: 30px; margin: 2px 4px; }
@media (max-width: 1000px) {
  .chat-rail { display: none; }
  .chat-surface.chat-index { flex-direction: column; }
  .chat-surface.chat-index .chat-rail {
    display: flex;
    width: 100%;
    max-height: 42%;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

/* --- loading skeletons (chat shell + rail placeholders) --- */
.skel {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.04));
  background-size: 200% 100%; border-radius: 8px;
  animation: skel-shimmer 1.4s ease-in-out infinite;
}
@keyframes skel-shimmer { to { background-position: -200% 0; } }

/* --- empty / new-chat state --- */
.chat-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: clamp(34px, 8vh, 74px) 24px 36px; min-height: 0; overflow-y: auto;
}
.chat-empty-inner { width: 100%; max-width: 760px; display: flex; flex-direction: column; align-items: center; }
.ce-eyebrow {
  font-size: 12px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 14px;
  display: inline-flex; align-items: center; gap: 8px;
}
.ce-eyebrow .dot { width: 6px; height: 6px; }
.ce-title {
  font-size: 34px; font-weight: 720; letter-spacing: -0.025em;
  color: var(--ink); margin: 0 0 26px; text-align: center;
  background: linear-gradient(180deg, #ffffff, #b3b3b3);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
:root[data-theme="light"] .ce-title {
  background: linear-gradient(180deg, #000000, #555555);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.starter-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.starter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-2); background: var(--hover);
  color: var(--ink-2); border-radius: 99px; padding: 8px 14px; font-size: 12.5px; font-weight: 550;
}
.starter-chip svg { width: 12px; height: 12px; flex: none; }
.starter-chip:hover { border-color: var(--line-3); color: var(--ink-1); background: var(--hover); }

/* --- composer (shared by empty state + docked) --- */
.composer {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: 18px;
  padding: 8px 8px 8px 14px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.composer:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 4px var(--accent-soft); }
.composer.big { box-shadow: var(--shadow-pop); }
.composer-input {
  border: 0; outline: 0; background: transparent; resize: none;
  width: 100%; color: var(--ink); font-size: 15px; line-height: 1.5;
  padding: 8px 4px 0; max-height: 220px; min-height: 26px;
}
.composer-input::placeholder { color: var(--ink-3); }
.composer-tools { display: flex; align-items: center; gap: 8px; }
.composer-tools-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.composer-hint { font-size: 11px; color: var(--ink-3); }
.composer-plan-slot { display: inline-flex; align-items: center; }
.composer-plan-toggle {
  min-height: 34px; padding: 0 11px; border-radius: 999px;
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-2);
  background: var(--hover);
  color: var(--ink-2); font-size: 12px; font-weight: 680;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, color 0.12s ease, transform 0.1s ease;
}
.composer-plan-toggle svg { width: 15px; height: 15px; flex: none; }
.composer-plan-toggle:hover { transform: translateY(-1px); border-color: var(--line-3); color: var(--ink); }
.composer-plan-toggle.on {
  background: color-mix(in srgb, var(--brand) 26%, transparent);
  border-color: color-mix(in srgb, var(--brand) 48%, var(--line-2));
  color: var(--ink);
}
.composer-plan-toggle:disabled {
  opacity: 0.58; cursor: not-allowed; transform: none;
}
.composer-send {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand); color: var(--brand-ink); border: 0;
  transition: transform 0.1s ease, opacity 0.12s ease;
}
.composer-send svg { width: 17px; height: 17px; }
.composer-send:hover { transform: translateY(-1px); }
.composer-send:disabled { background: var(--raise); color: var(--ink-3); cursor: not-allowed; transform: none; }

/* Stage 4 — chat file attachments */
.composer-clip {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--raise); color: var(--ink-2); border: 1px solid var(--line);
  cursor: pointer; transition: transform 0.1s ease, color 0.12s ease;
}
.composer-clip:hover { transform: translateY(-1px); color: var(--ink-1); }
.composer-clip svg { width: 17px; height: 17px; }
.file-input-hidden { display: none; }

/* Model-neutral agent import */
.modal.dialog:has(.agent-import-body) { width: min(920px, calc(100vw - 28px)); max-width: 920px; max-height: min(860px, calc(100vh - 28px)); overflow: hidden; }
.agent-import-body { padding: 18px; overflow-y: auto; overflow-x: hidden; display: grid; gap: 16px; min-width: 0; }
.agent-import-body > .field, .agent-import-body > .field input { width: 100%; min-width: 0; }
#import-review:empty { display: none; }
.import-intro { padding: 16px 18px; border: 1px solid var(--accent-line); border-radius: 16px; background: var(--accent-soft); }
.import-intro strong { display: block; color: var(--ink); font-size: 15px; }
.import-intro p, .import-compat p { margin: 7px 0 0; color: var(--ink-2); line-height: 1.55; }
.import-pickers { display: flex; flex-wrap: wrap; gap: 8px; }
.import-progress { display: flex; justify-content: space-between; gap: 12px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--raise); }
.import-progress[hidden] { display: none; }
.import-progress span { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-compat { padding: 14px 16px; border: 1px solid var(--line-2); border-radius: 15px; background: var(--panel-2); margin-bottom: 10px; }
.import-compat > div { display: flex; align-items: center; gap: 10px; }
.import-compat.active { border-color: var(--accent-line); }
.import-callout { display: flex; gap: 8px; flex-direction: column; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; margin: 8px 0; }
.import-callout span { color: var(--ink-2); }
.import-callout.warn { border-color: color-mix(in srgb, var(--warn, #b8860b) 55%, var(--line)); }
.import-callout.bad { border-color: color-mix(in srgb, var(--danger, #c0392b) 58%, var(--line)); }
.import-summary { display: flex; flex-wrap: wrap; gap: 18px; padding: 12px 2px; color: var(--ink-3); }
.import-summary b { color: var(--ink); font-size: 16px; margin-right: 4px; }
.import-map-list { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.import-map-row { display: grid; grid-template-columns: minmax(180px, 1fr) 22px minmax(170px, .65fr); gap: 10px; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.import-map-row:last-child { border-bottom: 0; }
.import-map-row.blocked { background: color-mix(in srgb, var(--danger, #c0392b) 7%, transparent); }
.import-source { min-width: 0; }
.import-source strong, .import-source span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.import-source strong { color: var(--ink); }
.import-source span, .import-map-row p { color: var(--ink-3); font-size: 11.5px; }
.import-map-row p { grid-column: 1 / -1; margin: -3px 0 0; }
.import-arrow { color: var(--ink-3); text-align: center; }
.import-map-row select { width: 100%; min-height: 36px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); border-radius: 9px; padding: 0 9px; }
.import-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; }
.context-group { display: grid; gap: 7px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.context-group:last-child { border-bottom: 0; }
.context-group > span { color: var(--ink-3); font-size: 12px; }
@media (max-width: 640px) {
  .agent-import-body { padding: 14px; }
  .import-progress, .import-actions { align-items: stretch; flex-direction: column; }
  .import-map-row { grid-template-columns: 1fr; gap: 7px; }
  .import-arrow { display: none; }
  .import-map-row p { margin-top: 0; }
  .import-actions .btn { width: 100%; }
}
.file-chips { display: flex; flex-wrap: wrap; gap: 6px; max-width: 780px; margin: 0 auto 8px; }
.file-chips:empty { display: none; }
.file-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 320px;
  padding: 4px 6px 4px 8px; border-radius: 999px; font-size: 12px;
  background: var(--raise); border: 1px solid var(--line); color: var(--ink-2);
}
.file-chip svg { width: 13px; height: 13px; flex: none; opacity: 0.7; }
.file-chip .fc-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .fc-state { color: var(--ink-3); font-size: 11px; }
.file-chip.warn { border-color: var(--warn, #b8860b); }
.file-chip.warn .fc-state { color: var(--warn, #b8860b); }
.file-chip.bad { border-color: var(--danger, #c0392b); }
.file-chip.bad .fc-state { color: var(--danger, #c0392b); }
.file-chip .fc-x {
  border: 0; background: transparent; color: var(--ink-3); cursor: pointer;
  font-size: 12px; line-height: 1; padding: 2px 3px; border-radius: 6px;
}
.file-chip .fc-x:hover { color: var(--ink-1); background: var(--line); }

.composer-model-slot {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0;
}
.composer-model-wrap {
  display: inline-flex; align-items: center; gap: 7px; min-width: 0;
  border: 1px solid var(--line-2); background: var(--hover);
  border-radius: 99px; padding: 5px 8px;
}
.composer-model-wrap:hover { border-color: var(--line-3); background: var(--hover-2); }
.composer-model-wrap.empty { opacity: 0.86; }
.composer-model-admin {
  font-size: 11px; font-weight: 650; color: var(--accent);
  text-decoration: none; white-space: nowrap;
}
.composer-model-admin:hover { text-decoration: underline; }
.model-loading {
  font: 600 11px var(--mono);
  color: var(--ink-2);
  white-space: nowrap;
}

/* --- agent picker (pill + popover) --- */
.agent-pick { position: relative; }
.agent-pick-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-2); background: var(--hover);
  border-radius: 99px; padding: 5px 11px 5px 6px;
  color: var(--ink); font-size: 12.5px; font-weight: 600; max-width: 260px;
}
.agent-pick-btn:hover { border-color: var(--line-3); background: var(--hover-2); }
.agent-pick-btn .em { width: 22px; height: 22px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.agent-pick-btn .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-pick-btn .caret { width: 13px; height: 13px; opacity: 0.6; flex: none; }
.agent-pick-btn.header { padding: 6px 12px 6px 7px; font-size: 13.5px; font-weight: 650; max-width: 340px; }

.agent-pick-menu {
  position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 40;
  width: 320px; max-height: 340px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: var(--shadow-pop); padding: 6px;
  display: none;
}
.agent-pick-menu.up,
.agent-pick-menu.down { bottom: auto; top: calc(100% + 8px); }
.agent-pick.open .agent-pick-menu { display: block; }
.agent-pick-menu .apm-head { font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); padding: 8px 10px 6px; }
.apm-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 10px; border: 0; background: transparent; text-align: left; color: var(--ink);
}
.apm-item:hover { background: var(--hover); }
.apm-item.active { background: var(--accent-soft); }
.apm-item .em { width: 30px; height: 30px; border-radius: 8px; flex: none; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; background: var(--gray-soft); }
.apm-item .apm-body { flex: 1; min-width: 0; }
.apm-item .apm-name { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.apm-item .apm-role { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.apm-item .apm-check { margin-left: auto; color: var(--accent); opacity: 0; }
.apm-item.active .apm-check { opacity: 1; }
.apm-empty { padding: 14px 12px; color: var(--ink-3); font-size: 12.5px; text-align: center; }

/* --- model picker (custom, because native <option> rows cannot render SVG logos) --- */
.model-pick {
  position: relative;
  display: inline-flex;
  min-width: 0;
}
.model-pick-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid var(--line-2);
  background: var(--hover);
  color: var(--ink);
  border-radius: 99px;
  min-height: 34px;
  padding: 5px 10px 5px 8px;
  font-size: 12.5px;
  font-weight: 650;
  max-width: 280px;
}
.model-pick-btn:hover { border-color: var(--line-3); background: var(--hover-2); }
.model-pick-btn:disabled { opacity: 0.62; cursor: not-allowed; }
.model-pick-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.model-pick-caret {
  width: 13px; height: 13px; flex: none; opacity: 0.65;
  display: inline-flex; align-items: center; justify-content: center;
}
.model-pick-caret svg { width: 13px; height: 13px; }
.model-pick-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 45;
  width: 300px;
  max-height: 330px;
  overflow-y: auto;
  display: none;
  padding: 8px;
  background: var(--menu);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  box-shadow: var(--shadow-pop);
}
.model-pick-menu.down {
  bottom: auto;
  top: calc(100% + 8px);
}
.thread-top .model-pick-menu {
  bottom: auto;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
}
.model-pick.open .model-pick-menu { display: block; }
.model-pick-head {
  padding: 6px 8px 8px;
  color: var(--ink-3);
  font-size: 11px;
  font-weight: 750;
}
.model-menu-item {
  width: 100%;
  min-height: 38px;
  display: grid;
  grid-template-columns: 18px 26px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  padding: 7px 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.model-menu-item:hover { background: var(--hover); }
.model-menu-item.active { background: var(--accent-soft); }
.model-menu-item.stale { color: var(--amber); }
.model-menu-check {
  color: var(--ink);
  width: 18px;
  display: inline-flex;
  justify-content: center;
  opacity: 0.95;
}
.model-menu-check svg { width: 15px; height: 15px; }
.model-menu-icon {
  display: inline-flex;
  width: 26px;
  justify-content: center;
}
.model-menu-icon .model-provider-icon {
  width: 22px;
  height: 22px;
  flex-basis: 22px;
}
.model-menu-icon .model-provider-icon svg {
  width: 20px;
  height: 20px;
}
.model-menu-text { min-width: 0; }
.model-menu-name {
  display: block;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.model-menu-route {
  display: block;
  margin-top: 2px;
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- active thread --- */
.thread { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.thread-top {
  display: flex; align-items: center; gap: 8px 12px;
  /* Wrap at every width: the header now carries plan/canvas/trace pills too,
     and compressing instead of wrapping made pills overlap the agent picker. */
  flex-wrap: wrap;
  padding: 12px 26px; border-bottom: 1px solid var(--line);
  background: var(--chrome); flex: none;
}
.thread-top .grow { flex: 1 1 auto; min-width: 0; }
.topic-history-modal { width:min(620px, calc(100vw - 24px)); }
.topic-search { margin:14px 16px 8px; width:auto; }
.topic-history-list { display:grid; gap:8px; padding:8px 16px 18px; max-height:min(62vh, 620px); overflow:auto; }
.topic-history-row { display:grid; gap:5px; width:100%; padding:13px 14px; text-align:left; color:var(--ink); background:var(--bg-input); border:1px solid var(--line); border-radius:12px; cursor:pointer; }
.topic-history-row:hover,.topic-history-row:focus-visible { border-color:var(--accent); outline:none; }
.topic-history-row strong { font-size:13px; }
.topic-history-row span { color:var(--ink-2); font-size:12px; line-height:1.45; }
.topic-history-row small { color:var(--ink-3); font-size:10.5px; }
.import-drop { display:grid; gap:4px; place-items:center; margin-top:12px; padding:18px; border:1px dashed var(--line-2); border-radius:13px; color:var(--ink-2); background:var(--gray-soft); cursor:pointer; text-align:center; }
.import-drop span { color:var(--ink-3); font-size:11.5px; }
.import-drop.active,.import-drop:focus-visible { border-color:var(--accent); background:var(--accent-soft); outline:none; }
.gateway-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 600; color: var(--ink-2);
  border: 1px solid var(--line); background: var(--gray-soft);
  border-radius: 99px; padding: 4px 10px;
}
.gateway-pill.live { color: var(--green); border-color: rgba(74, 222, 154, 0.28); background: var(--green-soft); }
.gateway-pill.mock { color: var(--blue); border-color: rgba(127, 178, 255, 0.28); background: var(--blue-soft); }
.gateway-pill.bad { color: var(--red); border-color: rgba(255, 122, 138, 0.28); background: var(--red-soft); }
.thread-icon-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  padding: 0;
  justify-content: center;
  position: relative;
}
.thread-icon-btn svg { width: 15px; height: 15px; }
.thread-icon-btn.active {
  color: var(--green);
  border-color: rgba(74, 222, 154, 0.28);
  background: var(--green-soft);
}
.thread-icon-count {
  position: absolute;
  right: -4px;
  top: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.chat-scroll { flex: 1; overflow-y: auto; min-height: 0; }
.chat-msgs {
  max-width: 780px; margin: 0 auto; width: 100%;
  padding: 30px 26px 20px;
  display: flex; flex-direction: column; gap: 22px;
}
.msg { display: flex; gap: 13px; align-items: flex-start; }
.msg-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center; font-size: 15px; font-weight: 700;
}
.msg-avatar.agent { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line); }
.msg-avatar.user { background: var(--brand); color: var(--brand-ink); font-size: 11px; }
.msg-body { min-width: 0; flex: 1; }
.msg .who { font-size: 12px; color: var(--ink-3); margin-bottom: 5px; font-weight: 550; }
.msg .who strong { color: var(--ink-2); font-weight: 650; }
.msg .bubble {
  font-size: 14.5px; line-height: 1.62; color: var(--ink);
  white-space: pre-wrap; word-break: break-word;
}
.msg.agent .bubble { color: var(--ink); }
.msg.user .msg-body { display: flex; flex-direction: column; align-items: flex-end; }
.msg.user .who { text-align: right; }
.msg.user .bubble {
  background: var(--panel-2); border: 1px solid var(--line);
  padding: 11px 15px; border-radius: 16px 16px 4px 16px; max-width: 100%;
}
.msg.system { justify-content: center; }
.msg.system .msg-body { max-width: 560px; }
.msg.system .bubble {
  background: var(--amber-soft); color: var(--amber);
  border: 1px solid rgba(242, 194, 101, 0.28);
  border-radius: 12px; padding: 11px 14px; font-size: 13px;
}
/* Per-message save actions, quiet until you hover the message. */
.msg-actions { display: flex; gap: 8px; margin-top: 6px; opacity: 0; transition: opacity 0.15s; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
.msg-action {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 550; color: var(--ink-3);
  background: none; border: 1px solid var(--line); border-radius: 6px;
  padding: 3px 8px; cursor: pointer; font-family: var(--font);
}
.msg-action:hover { color: var(--ink); border-color: var(--line-3); background: var(--gray-soft); }
.msg-action.primary { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.msg-action.primary:hover { color: var(--ink); border-color: var(--accent); }
.msg-action svg { width: 12px; height: 12px; }
@media (hover: none) { .msg-actions { opacity: 1; } }

.report-body { border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; background: color-mix(in srgb, var(--panel) 92%, var(--accent) 8%); }
.report-label { color: var(--accent); font-size: 10.5px; letter-spacing: .1em; font-weight: 800; margin-bottom: 10px; }
.delivery-files { display: grid; gap: 8px; margin-top: 10px; }
.delivery-file { display: flex; align-items: center; gap: 10px; max-width: 620px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 10px 11px; }
.delivery-file-icon { color: var(--accent); display: inline-flex; }
.delivery-file-icon svg { width: 18px; height: 18px; }
.delivery-file-copy { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.delivery-file-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.delivery-file-copy small { color: var(--ink-3); font-size: 11px; margin-top: 2px; }

/* ============================================================
   THE AI INCOME LAB — funded-product refinement · 2026-07-10
   Shared visual system; behavior and authorization remain unchanged.
   ============================================================ */

@font-face { font-family: "Neue Haas Display"; src: url('/assets/brand/NeueHaasDisplayLight.ttf') format('truetype'); font-weight: 300 500; font-display: swap; }
@font-face { font-family: "Neue Haas Display"; src: url('/assets/brand/NeueHaasDisplayBold.ttf') format('truetype'); font-weight: 600 800; font-display: swap; }
@font-face { font-family: "Neue Haas Display"; src: url('/assets/brand/NeueHaasDisplayBlack.ttf') format('truetype'); font-weight: 850 950; font-display: swap; }

:root {
  --bg: #000000; --sidebar: #000000; --panel: #0a0a0a; --panel-2: #111111; --raise: #1a1a1a; --bg-input: #000000;
  --ink-1: #ffffff; --ink: #ffffff; --ink-2: #cfcfcf; --ink-3: #8f8f8f;
  --line: rgba(255,255,255,.10); --line-2: rgba(255,255,255,.16); --line-3: rgba(255,255,255,.25);
  --brand: #41509d; --brand-ink: #ffffff; --accent: #8995da; --accent-soft: rgba(65,80,157,.20); --accent-line: rgba(137,149,218,.46);
  --chrome: rgba(0,0,0,.90); --chrome-soft: rgba(0,0,0,.72); --menu: #111111; --menu-ink: #ffffff;
  --green: #8fae72; --green-soft: rgba(143,174,114,.13); --amber: #d2ad68; --amber-soft: rgba(210,173,104,.13); --red: #d77d86; --red-soft: rgba(215,125,134,.13); --blue: #89b6e6; --blue-soft: rgba(137,182,230,.13); --purple: #a8a4d6; --purple-soft: rgba(168,164,214,.13);
  --radius: 9px; --radius-lg: 14px; --font: "Neue Haas Display", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root[data-theme="light"] {
  --bg: #ffffff; --sidebar: #f7f7f7; --panel: #ffffff; --panel-2: #f2f2f2; --raise: #e8e8e8; --bg-input: #ffffff;
  --ink-1: #000000; --ink: #000000; --ink-2: #4d4d4d; --ink-3: #737373;
  --line: rgba(0,0,0,.10); --line-2: rgba(0,0,0,.16); --line-3: rgba(0,0,0,.25);
  --brand: #41509d; --brand-ink: #fff; --accent: #41509d; --accent-soft: rgba(65,80,157,.10); --accent-line: rgba(65,80,157,.35);
  --chrome: rgba(255,255,255,.92); --chrome-soft: rgba(255,255,255,.76); --menu: #ffffff; --menu-ink: #000000;
  --green: #527348; --green-soft: rgba(82,115,72,.10); --amber: #8a641d; --amber-soft: rgba(138,100,29,.10); --red: #a74651; --red-soft: rgba(167,70,81,.10); --blue: #3d6791; --blue-soft: rgba(61,103,145,.10); --purple: #655aa0; --purple-soft: rgba(101,90,160,.10);
}

body { font-weight: 400; letter-spacing: -.005em; }
::selection { background: rgba(65,80,157,.24); }
a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.layout { grid-template-columns: 252px 1fr; }
.sidebar { padding: 16px 12px 0; gap: 0; }
.sidebar .ws { height: 82px; padding: 2px 9px 20px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.brand-lockup { display: block; width: 178px; height: 48px; }
.brand-lockup img { width: 178px; height: auto; display: block; }
.brand-lockup .brand-light { display: none; }
:root[data-theme="light"] .brand-lockup .brand-dark { display: none; }
:root[data-theme="light"] .brand-lockup .brand-light { display: block; }
.sb-actions { gap: 5px; padding: 0 0 10px; }
.sb-btn { min-height: 38px; border-radius: 8px; padding: 8px 10px; }
.sb-btn.newchat { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: none; }
.sb-btn.newchat svg { color: #fff; }
.sb-btn.newchat:hover { background: #5262ae; border-color: #5262ae; }
.nav .section, .sb-group-title { font-size: 9.5px; letter-spacing: .095em; font-weight: 700; }
.nav a.item { min-height: 35px; border-radius: 7px; padding: 7px 10px; font-weight: 500; }
.nav a.item.active { background: var(--accent-soft); box-shadow: inset 2px 0 0 var(--accent); }
.nav a.item.active svg { color: var(--accent); }
.sidebar .foot { margin: 8px -2px 0; padding: 12px 8px 14px; border-top: 1px solid var(--line); background: transparent; }
.sidebar .foot .who .name { font-size: 12.5px; }
.sidebar .foot .who .role { font-size: 10.5px; color: var(--ink-3); }
.sidebar .foot button { border: 0; background: transparent; padding: 3px; }

.topbar { min-height: 64px; padding: 13px 28px; border-bottom-color: var(--line); }
.topbar h1 { font-size: 19px; font-weight: 700; letter-spacing: -.025em; }
.content { padding: 28px 30px 54px; }
.content .inner { max-width: 1180px; }
.page-sect { margin-top: 30px; }
.page-sect-head { margin-bottom: 12px; }
.page-sect-head h2 { font-size: 16px; letter-spacing: -.015em; }
.page-note { max-width: 760px; font-size: 13px; line-height: 1.65; }
.page-eyebrow, .tc-eyebrow { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .12em; }

.btn { min-height: 34px; border-radius: 7px; font-weight: 600; box-shadow: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #5262ae; border-color: #5262ae; color: #fff; }
.badge { border-radius: 5px; padding: 2px 6px; font-size: 10.5px; font-weight: 600; text-transform: none; }
.badge.neutral { background: transparent; border-color: var(--line-2); color: var(--ink-3); }
.role-text { color: var(--ink-2); font-size: 12px; }
.admin-person { display: flex; flex-direction: column; gap: 1px; }
.admin-person strong { color: var(--ink); font-size: 13px; }
.admin-person small { color: var(--ink-3); font-size: 10.5px; }

.card, .panel, .rail-card { border-color: var(--line); box-shadow: none; }
.card:hover { border-color: var(--line-3); transform: translateY(-1px); box-shadow: 0 10px 28px rgba(0,0,0,.12); }
.grid { gap: 13px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.premium-card { min-height: 260px; height: 260px; border-radius: 10px; }
.premium-card-banner { height: 78px; background-image: linear-gradient(135deg, rgba(65,80,157,.28), rgba(65,80,157,.06)), radial-gradient(circle at 82% 20%, rgba(137,182,230,.16), transparent 38%); }
:root[data-theme="light"] .premium-card-banner { background-image: linear-gradient(135deg, rgba(65,80,157,.16), rgba(65,80,157,.035)), radial-gradient(circle at 82% 20%, rgba(137,182,230,.22), transparent 38%); }
.premium-card-main { margin-top: -17px; }
.premium-card-icon { width: 40px; height: 40px; border-radius: 10px; box-shadow: 0 6px 18px rgba(0,0,0,.14); font-size: 15px; }
.premium-card-copy { padding-top: 18px; }
.premium-card-body { padding: 0 13px 11px; gap: 7px; }
.premium-card-desc { min-height: 31px; }
.premium-card-foot { min-height: 29px; padding-top: 6px; }
.home-card-grid .premium-card { min-height: 212px; height: 212px; }
.home-card-grid .premium-card-banner { height: 48px; }
.home-card-grid .premium-card-badges { display: none; }
.home-card-grid .premium-card-main { margin-top: -15px; }

.chat-empty-inner { max-width: 900px; }
.ce-title { font-size: clamp(34px, 5vw, 58px); font-weight: 850; letter-spacing: -.052em; margin-bottom: 24px; }
.composer.big { box-shadow: 0 14px 44px rgba(0,0,0,.18); border-color: var(--line-2); }
.home-links { opacity: .82; }
.leverage-card { border-color: var(--line); background: var(--panel); box-shadow: none; }

.workflow-filters { display: inline-block; margin: 0 0 16px; min-width: 220px; }
.workflow-filters summary { font-size: 12px; }
.workflow-filters .count-strip { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.count-chip, .filter-chip { border-radius: 6px; }

.tc-experience-hero { color: #ffffff; background: #000000; border: 1px solid rgba(255,255,255,.10); border-radius: 14px; padding: 30px; }
.tc-experience-hero::after { opacity: .13; background-image: radial-gradient(#8995da 1px,transparent 1px); }
.tc-experience-hero .btn.primary { background: #41509d; border-color: #41509d; color: #fff; }
.tc-app-grid, .int-grid { gap: 10px; }
.tc-app-card, .int-card { border-radius: 9px; box-shadow: none; }
.tc-banner { margin: 14px 0 20px; }
.tc-help-body { padding: 12px 2px 2px; color: var(--ink-2); line-height: 1.55; max-width: 820px; }
.tc-banner-sub { margin-top: 8px; color: var(--ink-3); }
.conn-logo { background: var(--accent-soft) !important; color: var(--accent) !important; border: 1px solid var(--accent-line); }

.library-intro, .ops-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; padding: 28px 30px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); margin-bottom: 16px; }
.library-intro h2, .ops-intro h2 { margin: 6px 0 7px; font-size: clamp(25px,3vw,36px); line-height: 1.05; letter-spacing: -.04em; }
.library-intro p, .ops-intro p { margin: 0; max-width: 670px; color: var(--ink-2); line-height: 1.55; }
.library-count { min-width: 120px; display: flex; flex-direction: column; align-items: flex-end; }
.library-count strong { font-size: 40px; line-height: 1; letter-spacing: -.05em; }
.library-count span { color: var(--ink-3); font-size: 11px; margin-top: 5px; }
.library-jump { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 8px; }
.library-jump a { flex: none; color: var(--ink-2); border: 1px solid var(--line); background: var(--panel); border-radius: 7px; padding: 7px 10px; font-size: 11.5px; }
.health-summary { display: inline-flex; align-items: center; gap: 8px; flex: none; color: var(--ink-2); font-size: 12px; }
.cc-grid { gap: 12px; }
.cc-card { border-radius: 10px; }
.org-summary { gap: 8px; }
.org-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; min-width: 150px; }

.tabs { border-bottom: 1px solid var(--line); gap: 18px; padding: 0 2px; }
.tabs a { border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 10px 1px; background: transparent; }
.tabs a.active { background: transparent; border-bottom-color: var(--accent); color: var(--ink); }
table.data { border-collapse: separate; border-spacing: 0; }
table.data th { color: var(--ink-3); font-size: 9.5px; letter-spacing: .09em; text-transform: uppercase; background: transparent; }
table.data tr:hover td { background: var(--hover); }

@media (max-width: 760px) {
  .sidebar .ws { height: 72px; }
  .brand-lockup, .brand-lockup img { width: 160px; }
  .content { padding: 20px 16px 42px; }
  .topbar { padding: 11px 16px; }
  .library-intro, .ops-intro { align-items: flex-start; flex-direction: column; padding: 21px; gap: 16px; }
  .library-count { align-items: flex-start; }
  .premium-card { height: 242px; min-height: 242px; }
  .home-card-grid .premium-card { height: 198px; min-height: 198px; }
}

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

.run-status-card {
  border: 0; background: transparent;
  border-radius: 13px; overflow: visible; max-width: min(560px, 100%);
}
.agent-readiness {
  display: inline-flex; align-items: center; gap: 6px; min-height: 24px;
  color: var(--ink-3); font-size: 11.5px; white-space: nowrap;
}
.agent-readiness[hidden] { display: none; }
.agent-readiness:not(:empty)::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--amber);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 13%, transparent);
}
.agent-readiness[data-state="ready"] { color: var(--green); }
.agent-readiness[data-state="ready"]::before {
  background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 13%, transparent);
}
.run-status-main {
  width: 100%; border: 0; background: transparent; color: var(--ink);
  display: grid; grid-template-columns: auto minmax(0, 1fr) 3.25rem;
  align-items: center; gap: 10px; padding: 4px 0;
  font-family: var(--font); text-align: left;
}
.avori-working-mark {
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%;
  color: white; background: linear-gradient(135deg, var(--accent), #8d7cff);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 25%, transparent);
  animation: avori-work 1.45s ease-in-out infinite;
}
.avori-working-mark span { animation: avori-spin 2.2s linear infinite; }
@keyframes avori-work { 50% { transform: translateY(-2px); box-shadow: 0 0 0 7px transparent; } }
@keyframes avori-spin { to { transform: rotate(360deg); } }
.run-pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent);
  animation: pulse 1.2s ease-in-out infinite;
}
.run-status-copy { display: block; min-width: 0; }
.run-status-copy .turn-state {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.run-current {
  color: var(--ink-2); font-size: 12.5px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; min-width: 0;
}
.run-caret { color: var(--ink-3); font-size: 18px; line-height: 1; }
.run-status-card.expanded .run-caret { color: var(--ink); }
.turn-steps { display: flex; flex-direction: column; gap: 4px; padding: 0 12px 10px 27px; border-top: 1px solid var(--line); }
.turn-steps[hidden] { display: none; }
.turn-steps:not(:empty) { margin-top: 0; }
.turn-step {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.turn-step .dot {
  width: 6px; height: 6px; border-radius: 50%; flex: none;
  background: var(--accent); animation: pulse 1.2s ease-in-out infinite;
}
.turn-step.done { color: var(--ink-3); }
.turn-step.done .dot { background: var(--green); animation: none; }
.turn-step-more { font-size: 11.5px; color: var(--ink-3); }
.work-note { min-width: 3.25rem; text-align: right; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.work-note-row { display: flex; justify-content: flex-start; margin-top: 6px; }
@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { 50% { opacity: 0.25; } }

/* --- composer dock --- */
.composer-dock {
  flex: none; padding: 14px 26px 20px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), var(--bg) 40%);
}
:root[data-theme="light"] .composer-dock {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), var(--bg) 40%);
}
.composer-dock .composer { max-width: 780px; margin: 0 auto; }
.composer-dock .foot-note { max-width: 780px; margin: 8px auto 0; text-align: center; font-size: 11px; color: var(--ink-3); }

/* gateway strip (banner form, used when unavailable) */
.gateway-strip {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px;
  padding: 9px 26px; color: var(--amber); background: var(--amber-soft);
  border-bottom: 1px solid rgba(242, 194, 101, 0.2);
}
.gateway-strip.mock { color: var(--blue); background: var(--blue-soft); }
.gateway-strip.live { color: var(--green); background: var(--green-soft); }
.gateway-strip.bad { color: var(--red); background: var(--red-soft); }

/* chat agent identity header (compact, tucked) */
.chat-agent:empty { display: none; }
.chat-agent-inner { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-3); }
.chat-agent-emoji { font-size: 15px; }
.chat-agent-inner .t { color: var(--ink-2); }
.chat-agent-inner .s { display: none; }

/* --- Run details (per-turn trace) --- */
.trace-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 11.5px; color: var(--ink-3);
  background: var(--hover); border: 1px solid var(--line); cursor: pointer;
  padding: 4px 10px; margin-top: 9px; border-radius: 99px;
}
.trace-toggle:hover { color: var(--ink); border-color: var(--line-2); }
.trace-toggle .dot { width: 6px; height: 6px; }
.trace-toggle .rd-label { font-weight: 600; }
.trace-toggle .rd-sum { color: var(--ink-3); }
.trace-toggle .rd-caret { transition: transform 0.15s ease; display: inline-block; }
.trace-toggle.open .rd-caret { transform: rotate(90deg); }
.trace-box {
  margin-top: 9px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); padding: 12px 14px; font-size: 11.5px; color: var(--ink-2); max-width: 100%;
}
.trace-box .trace-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.trace-box .tk { color: var(--ink-3); white-space: nowrap; }
.trace-box .tv { color: var(--ink); overflow-wrap: anywhere; }
.trace-box .tv.mono, .trace-box .tk.mono { font-family: var(--mono); font-size: 11px; }
.trace-verify { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.trace-verify.ok { color: var(--green); }
.trace-verify.unknown { color: var(--amber); }
.kfile { font-family: var(--mono); font-size: 11px; color: var(--ink-2); }

/* ---------- tiles (knowledge + organize) ---------- */
.grid.tiles { grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)); gap: 14px; }
.tile {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; display: flex; flex-direction: column; gap: 8px;
  transition: border-color 0.14s ease, transform 0.14s ease, background 0.14s ease;
}
.tile:hover { border-color: var(--line-3); transform: translateY(-1px); background: var(--panel-2); }
.tile-head { display: flex; align-items: center; gap: 9px; }
.tile-head .type-ico { width: 24px; height: 24px; }
.tile-head .type-ico svg { width: 13px; height: 13px; }
.tile-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; color: var(--ink); }
.tile-badges { display: flex; flex-wrap: wrap; gap: 5px; }
.tile-sub { font-size: 11.5px; color: var(--ink-3); }
.tile-loc { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left; }
.tile-reason { font-size: 12px; color: var(--ink-2); line-height: 1.5; }
.tile-foot { margin-top: auto; padding-top: 9px; display: flex; gap: 6px; align-items: center; border-top: 1px solid var(--line); flex-wrap: wrap; }
.tile-foot .right { margin-left: auto; display: flex; gap: 5px; align-items: center; }
.org-results-bar {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  margin: 2px 0 12px; color: var(--ink-3); font-size: 12px;
}
.org-results-bar button:first-of-type { margin-left: auto; }
.org-tiles { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.org-tiles .tile { min-height: 0; gap: 7px; }
.org-tiles .tile-reason {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 36px;
}
.org-tiles .tile-loc { max-width: 100%; }

.conf { font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 99px; border: 1px solid transparent; white-space: nowrap; }
.conf-high { color: var(--green); background: var(--green-soft); }
.conf-medium { color: var(--amber); background: var(--amber-soft); }
.conf-low { color: var(--ink-2); background: var(--gray-soft); }

/* ---------- count strip / org / obt filters ---------- */
.count-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.count-chip {
  border: 1px solid var(--line); border-radius: 12px; padding: 9px 13px;
  font-size: 12px; color: var(--ink-2); background: var(--panel); cursor: pointer;
}
.count-chip:hover { border-color: var(--line-3); }
.count-chip.active { border-color: var(--brand); color: var(--ink-1); }
.count-chip strong { font-size: 17px; color: var(--ink); display: block; }

.org-summary { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.org-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; min-width: 124px; }
.org-stat strong { display: block; font-size: 23px; line-height: 1.1; color: var(--ink); }
.org-stat span { font-size: 11.5px; color: var(--ink-3); }
.org-stat.warn strong { color: var(--amber); }
.org-plan-panel {
  border: 1px solid var(--line); background: var(--panel); border-radius: 12px;
  padding: 14px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 12px;
}
.org-plan-panel p { margin: 3px 0 0; color: var(--ink-3); font-size: 12px; line-height: 1.45; }
.org-plan-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.org-plan-counts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.count-chip.mini { padding: 5px 9px; border-radius: 9px; font-size: 11px; }
.count-chip.mini strong { display: inline; margin-left: 3px; font-size: 12px; }
.org-plan-list { display: flex; flex-direction: column; gap: 7px; }
.org-plan-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 9px;
  border: 1px solid var(--line); background: var(--panel-2); border-radius: 9px; padding: 9px;
}
.org-plan-row strong { display: block; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-plan-rule, .org-plan-rules {
  border: 1px dashed var(--line-3); border-radius: 9px; padding: 9px 10px; color: var(--ink-2); font-size: 12px;
}
.org-plan-rules { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 720px) {
  .org-plan-head, .org-plan-row { display: flex; flex-direction: column; align-items: stretch; }
  .org-plan-counts { justify-content: flex-start; }
}

.obt-filters { display: flex; flex-direction: column; gap: 13px; margin-bottom: 16px; }
.obt-group { display: flex; flex-direction: column; gap: 7px; }
.obt-title { font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); }
.obt-row { display: flex; flex-wrap: wrap; gap: 6px; }
.obt {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: var(--panel); border-radius: 9px;
  padding: 6px 11px; font-size: 12px; color: var(--ink-2); cursor: pointer;
}
.obt:hover { border-color: var(--line-3); }
.obt.active { border-color: var(--brand); color: var(--ink-1); }
.obt strong { color: var(--ink); }
.obt-hint { font-size: 11.5px; color: var(--ink-3); }

/* ---------- modal ---------- */
.modal-scrim {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 60; padding: 24px;
}

.bootstrap-modal { max-width: 680px; }
.bootstrap-progress { height: 5px; border-radius: 999px; overflow: hidden; background: var(--line); margin-bottom: 24px; }
.bootstrap-progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .2s ease; }
.bootstrap-chat { display: grid; gap: 10px; margin-bottom: 20px; }
.bootstrap-bubble { width: fit-content; max-width: 88%; padding: 12px 15px; border-radius: 16px 16px 16px 4px; background: var(--panel-2); color: var(--ink); line-height: 1.45; }
.bootstrap-answer { display: grid; gap: 10px; }
.bootstrap-answer input, .bootstrap-answer textarea { width: 100%; font-size: 15px; }
.bootstrap-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.modal {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px;
  max-width: 760px; width: 100%; max-height: 82vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow-pop); overflow: hidden;
}
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head button { margin-left: auto; }
.modal-body { margin: 0; padding: 16px; overflow: auto; font-size: 12.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word; color: var(--ink-2); }

/* ---------- tables ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-3); font-weight: 700; padding: 9px 11px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data td { padding: 9px 11px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
td.mono, .mono { font-family: var(--mono); font-size: 12px; }

/* ---------- toast ---------- */
#toast-root { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast {
  background: var(--raise); color: var(--ink-1); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 11px 15px; font-size: 13px; max-width: 380px;
  box-shadow: var(--shadow-pop); animation: toast-in 0.16s ease;
}
.toast.error { border-color: rgba(255, 122, 138, 0.5); color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- page structure: sections, notes, segmented control ---------- */

.page-sect { margin-bottom: 28px; }
.page-sect:last-child { margin-bottom: 0; }
.page-sect-head { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.page-sect-head h2 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.02em; color: var(--ink); }
.page-sect-head .sub { font-size: 12px; color: var(--ink-3); }

.page-note { font-size: 12.5px; color: var(--ink-3); margin: 0 0 18px; max-width: 720px; line-height: 1.55; }
.page-foot-note { font-size: 11.5px; color: var(--ink-3); margin-top: 22px; }

.page-tools { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-tools .sub-link { margin-left: auto; font-size: 12px; color: var(--ink-3); }
.page-tools .sub-link:hover { color: var(--ink); }

.seg { display: inline-flex; gap: 2px; background: var(--bg-input); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg-btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; background: transparent; border-radius: 8px;
  padding: 6px 12px; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
.seg-btn:hover { color: var(--ink-1); }
.seg-btn.active { background: var(--raise); color: var(--ink-1); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.18); }
.seg-btn .n { font-size: 10.5px; font-weight: 700; color: var(--ink-3); background: var(--gray-soft); border-radius: 99px; padding: 1px 7px; }
.seg-btn.active .n { color: var(--brand); background: rgba(230, 255, 92, 0.1); }

.quiet-details { margin-top: 20px; font-size: 12px; color: var(--ink-3); }
.quiet-details summary { cursor: pointer; user-select: none; }
.quiet-details summary:hover { color: var(--ink-2); }
.quiet-details .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

/* ---------- card refinements ---------- */

.card .name .card-sub, .card-sub { font-weight: 540; font-size: 11.5px; color: var(--ink-3); }

/* ---------- agent cards ---------- */

.grid.agents { grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)); }
.agent-card {
  min-height: 0;
  gap: 0;
  padding: 0;
  background: var(--panel);
}
.agent-card-banner {
  height: 72px;
  background:
    radial-gradient(120% 150% at 14% 0%, hsl(var(--h) 54% 52% / 0.42), transparent 58%),
    radial-gradient(110% 160% at 88% 12%, hsl(calc(var(--h) + 74) 58% 54% / 0.30), transparent 60%),
    linear-gradient(135deg, hsl(var(--h) 32% 18%), hsl(calc(var(--h) + 28) 28% 12%));
  border-bottom: 1px solid var(--line);
}
:root[data-theme="light"] .agent-card-banner {
  background:
    radial-gradient(120% 150% at 14% 0%, hsl(var(--h) 72% 66% / 0.38), transparent 58%),
    radial-gradient(110% 160% at 88% 12%, hsl(calc(var(--h) + 74) 72% 70% / 0.30), transparent 60%),
    linear-gradient(135deg, hsl(var(--h) 62% 86%), hsl(calc(var(--h) + 28) 56% 91%));
}
.agent-card-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 16px 15px;
}
.agent-card-top { display: flex; align-items: flex-start; gap: 12px; margin-top: -24px; }
.agent-face {
  width: 52px; height: 52px; border-radius: 14px; flex: none;
  display: inline-flex; align-items: center; justify-content: center; font-size: 21px;
  background: var(--raise);
  border: 1px solid var(--line-3);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.24);
}
.agent-id {
  min-width: 0;
  flex: 1;
  padding-top: 26px;
}
.agent-name { font-weight: 720; font-size: 14.5px; color: var(--ink); display: flex; align-items: center; gap: 7px; }
.agent-role {
  font-size: 12px; color: var(--ink-2); margin-top: 3px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.agent-card .foot {
  margin-top: 0;
  padding-top: 11px;
  min-height: 36px;
}
.agent-card .foot .right {
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ---------- team cards + profiles ---------- */

.grid.team { grid-template-columns: repeat(auto-fill, minmax(292px, 1fr)); }
.team-card { min-height: 0; gap: 12px; }
.tm-top { display: flex; align-items: center; gap: 12px; }
.tm-top > .badge { margin-left: auto; flex: none; }
.tm-avatar {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 750; letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--hover-2), var(--hover));
  border: 1px solid var(--line-2); color: var(--ink);
}
.tm-avatar.lg { width: 52px; height: 52px; border-radius: 14px; font-size: 18px; }
.tm-avatar.role-owner {
  background: linear-gradient(135deg, rgba(230, 255, 92, 0.18), rgba(230, 255, 92, 0.05));
  border-color: rgba(230, 255, 92, 0.35); color: var(--brand);
}
.tm-avatar.role-admin {
  background: linear-gradient(135deg, rgba(124, 156, 255, 0.2), rgba(124, 156, 255, 0.06));
  border-color: rgba(124, 156, 255, 0.4); color: var(--blue);
}
.tm-avatar.role-creative {
  background: linear-gradient(135deg, rgba(190, 132, 255, 0.2), rgba(190, 132, 255, 0.06));
  border-color: rgba(190, 132, 255, 0.4); color: var(--purple);
}
.tm-id { min-width: 0; }
.tm-name { font-weight: 650; font-size: 14.5px; color: var(--ink); display: flex; align-items: center; gap: 7px; }
.tm-role { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.tm-foot { font-size: 12px; }
.tm-stats { color: var(--ink-2); }
.tm-active { color: var(--ink-3); font-size: 11.5px; }
.team-card .tm-name,
.team-card .tm-stats strong { font-weight: 720; }
.team-card .foot,
.wf-card .foot {
  align-items: flex-end;
  gap: 8px;
}
.wf-card .wf-meta {
  border: 1px solid var(--line);
  background: var(--gray-soft);
  border-radius: 10px;
  padding: 8px 10px;
  min-height: 36px;
}
.wf-card .wf-skills {
  margin-left: auto;
  justify-content: flex-end;
}
.proj-kinds .tag,
.wf-skills .tag {
  background: var(--panel-2);
}

.activity-list { display: flex; flex-direction: column; gap: 6px; }
.activity-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px;
  font-size: 12px; color: var(--ink-2);
}
.activity-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-row .sub { color: var(--ink-3); white-space: nowrap; }

/* ---------- connector cards ---------- */

.grid.conns { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.conn-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; display: flex; flex-direction: column; gap: 9px;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.conn-card:hover { border-color: var(--line-2); }
.conn-top { display: flex; align-items: center; gap: 11px; }
.conn-logo {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 750;
  --h: 220;
  background: linear-gradient(135deg, hsl(var(--h) 55% 32%), hsl(var(--h) 60% 17%));
  color: hsl(var(--h) 90% 82%);
  border: 1px solid hsl(var(--h) 45% 40% / 0.5);
}
.conn-logo.hue-0 { --h: 8; }
.conn-logo.hue-1 { --h: 42; }
.conn-logo.hue-2 { --h: 76; }
.conn-logo.hue-3 { --h: 110; }
.conn-logo.hue-4 { --h: 152; }
.conn-logo.hue-5 { --h: 188; }
.conn-logo.hue-6 { --h: 222; }
.conn-logo.hue-7 { --h: 258; }
.conn-logo.hue-8 { --h: 296; }
.conn-logo.hue-9 { --h: 330; }
.conn-id { min-width: 0; }
.conn-name { font-weight: 650; font-size: 13.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn-state { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; margin-top: 1px; }
.conn-desc {
  font-size: 12px; color: var(--ink-3); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em;
}
.conn-pending { font-size: 12px; color: var(--amber); display: flex; align-items: center; gap: 8px; }
.conn-foot { display: flex; gap: 6px; align-items: center; min-height: 28px; margin-top: auto; }

/* ---------- markdown in agent replies ---------- */

.bubble.md { white-space: normal; }
.bubble.md p { margin: 0 0 10px; }
.bubble.md p:last-child, .bubble.md > *:last-child { margin-bottom: 0; }
.bubble.md ul, .bubble.md ol { margin: 0 0 10px; padding-left: 22px; }
.bubble.md li { margin: 3px 0; }
.bubble.md h4 { margin: 14px 0 6px; font-size: 14px; font-weight: 700; color: var(--ink); }
.bubble.md p:empty { display: none; }
.bubble.md a { text-decoration: underline; text-underline-offset: 2px; }
.codeblock {
  background: var(--sidebar); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; margin: 0 0 10px;
  overflow-x: auto; font-size: 12.5px; line-height: 1.55;
}
.codeblock code { background: transparent; padding: 0; font-size: inherit; }

/* ---------- responsive ---------- */
.menu-btn { display: none; }
.scrim { display: none; }
/* Chat has one primary left rail: agents. The broader workspace navigation
   remains one click away as an overlay instead of competing beside it. */
@media (min-width: 901px) {
  .layout.chat-focus { grid-template-columns: 1fr; }
  .layout.chat-focus > .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60; width: 280px;
    transform: translateX(-100%); transition: transform 0.2s ease;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.6);
  }
  .layout.chat-focus > .sidebar.open { transform: translateX(0); }
  .layout.chat-focus .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border: 1px solid var(--line-2); border-radius: 9px;
    background: var(--hover); color: var(--ink);
  }
  .layout.chat-focus .menu-btn svg { width: 16px; height: 16px; }
  .layout.chat-focus > .scrim.open {
    display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 55;
  }
}
@media (max-width: 900px) {
  html, body, #app, .layout, .main {
    max-width: 100%;
    overflow-x: hidden;
  }
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60; width: 280px;
    transform: translateX(-100%); transition: transform 0.2s ease;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.6);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border: 1px solid var(--line-2); border-radius: 9px;
    background: var(--hover); color: var(--ink);
  }
  .menu-btn svg { width: 16px; height: 16px; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 55; }
  .content { padding: 18px 16px 40px; }
  .topbar { padding: 10px 16px; }
  .thread-top { padding: 12px 16px; }
  .chat-msgs { padding: 22px 16px 16px; }
  .composer-dock { padding: 12px 16px 18px; }
  .ce-title { font-size: 26px; }
  .kv { grid-template-columns: 120px 1fr; }
  .detail-head { flex-wrap: wrap; }
  .detail-head .actions { margin-left: 0; width: 100%; }
  .agent-card-main { padding-left: 14px; padding-right: 14px; }
  .agent-card .foot { align-items: flex-start; flex-direction: column; }
  .agent-card .foot .right { margin-left: 0; justify-content: flex-start; }
  .wf-card .wf-meta { align-items: flex-start; flex-direction: column; }
  .wf-card .wf-skills { margin-left: 0; justify-content: flex-start; }
}

/* ---------- user-owned automations ---------- */
.auto-list {
  border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  background: var(--panel); overflow: hidden;
}
.auto-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--line);
}
.auto-row:last-child { border-bottom: 0; }
.auto-main { flex: 1; min-width: 0; }
.auto-name {
  font-weight: 600; font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.auto-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.auto-meta { text-align: right; flex: none; }
.auto-next { font-size: 12.5px; font-weight: 600; }
.auto-last { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.auto-last.bad { color: var(--red); }
.auto-failure { color: var(--red); font-size:12px; line-height:1.4; margin-top:6px; max-width:680px; }
.auto-actions { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:5px; margin-top:7px; }
@media (max-width: 700px) {
  .auto-row { align-items:flex-start; flex-wrap:wrap; }
  .auto-meta { width:100%; text-align:left; padding-left:20px; }
  .auto-actions { justify-content:flex-start; }
}

/* ---------- home quick links ---------- */
.home-links {
  display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
  margin-top: 26px;
}
.home-link {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--ink-3);
  font-size: 12px; text-decoration: none;
}
.home-link:hover { color: var(--ink); border-color: var(--line-2); background: var(--hover); }
.home-link svg { width: 13px; height: 13px; }

/* ---------- team notes ---------- */

.note-chip {
  display: inline-flex; align-items: center; gap: 7px;
  margin-bottom: 14px; padding: 6px 14px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--panel); color: var(--ink-1);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.note-chip svg { width: 14px; height: 14px; color: var(--accent, #c6f24e); }
.note-chip:hover { border-color: var(--ink-3); }

.notes-list { max-height: 60vh; overflow-y: auto; padding: 6px 14px; }
.note-row {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 4px; border-bottom: 1px solid var(--line-1);
}
.note-row:last-child { border-bottom: none; }
.note-row.unread .note-body { color: var(--ink-1); }
.note-row .tm-avatar { width: 28px; height: 28px; font-size: 11px; flex: none; }
.note-meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 2px; font-size: 12.5px; }
.note-body { font-size: 13px; color: var(--ink-2); line-height: 1.45; overflow-wrap: anywhere; }

/* ---------- workflows (Team Workflow layer) ---------- */

.type-flow { background: var(--purple-soft); color: var(--purple); }
.wf-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin-top: 8px; min-height: 20px;
}
.wf-skills { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.tag.tag-missing { opacity: 0.55; border-style: dashed; }
.wf-list { margin: 4px 0 0 18px; padding: 0; display: grid; gap: 6px; }
.wf-list li { line-height: 1.45; }

/* Home work grid */
.home-grid {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 26px;
  align-items: start;
}
.home-workflows { margin-top: 0; text-align: left; min-width: 0; }
.hw-head {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3); margin-bottom: 8px;
}
.hw-head a { color: var(--ink-3); text-decoration: none; text-transform: none; letter-spacing: 0; }
.hw-head a:hover { color: var(--ink); }
.hw-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 6px;
  border: 1px solid var(--line-2); border-radius: 10px;
  text-decoration: none; color: var(--ink-1); background: var(--panel);
}
.hw-row:hover { border-color: var(--line-3); background: var(--panel-2); }
.hw-ic {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--purple-soft); color: var(--purple);
}
.hw-ic svg { width: 14px; height: 14px; }
.hw-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.hw-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hw-sub { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hw-go { color: var(--ink-3); display: inline-flex; }
.hw-go svg { width: 14px; height: 14px; }

.home-leverage {
  width: 100%;
  margin-top: 24px;
  text-align: left;
}
.leverage-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent, #c6f24e) 12%, transparent), transparent 34%),
    var(--panel);
  box-shadow: 0 18px 50px rgba(0,0,0,0.20);
  padding: 16px;
}
.leverage-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.leverage-head span,
.leverage-subhead {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  font-weight: 700;
}
.leverage-head strong {
  display: block;
  margin-top: 2px;
  font-size: 18px;
  letter-spacing: 0;
  color: var(--ink);
}
.leverage-head a {
  color: var(--ink-3);
  text-decoration: none;
  font-size: 12px;
}
.leverage-head a:hover { color: var(--ink); }
.leverage-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.leverage-metric {
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--panel-2);
  padding: 10px;
  min-width: 0;
}
.leverage-metric strong {
  display: block;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
  letter-spacing: 0;
}
.leverage-metric span,
.leverage-metric em,
.leverage-row em,
.leverage-person em {
  display: block;
  color: var(--ink-3);
  font-size: 11.5px;
  font-style: normal;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.leverage-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(180px, 0.8fr);
  gap: 14px;
  margin-top: 14px;
}
.leverage-row,
.leverage-person {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line-1);
  color: var(--ink);
  text-decoration: none;
}
.leverage-row:first-of-type,
.leverage-person:first-of-type { margin-top: 6px; }
.leverage-row span,
.leverage-person span {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.leverage-row svg { width: 14px; height: 14px; }
.leverage-row strong,
.leverage-person strong {
  min-width: 0;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hw-row:hover .hw-go { color: var(--ink); }

/* ---------- house dialogs (prompt/confirm replacements) ---------- */

.modal.dialog { max-width: 440px; }
.dialog-body { padding: 14px 16px; font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.dialog-label { display: block; font-size: 12px; font-weight: 650; color: var(--ink-2); margin-bottom: 6px; }
.dialog-input {
  width: 100%;
  border: 1px solid var(--line-2);
  border-radius: 9px; padding: 8px 11px;
  background: var(--bg-input); color: var(--ink); font-size: 13.5px;
}
.dialog-input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.dialog-actions { padding: 0 16px 14px; justify-content: flex-end; }

/* ---------- chat privacy disclosure ---------- */

.composer-privacy {
  font-size: 11px; color: var(--ink-3);
  text-align: center; margin-top: 7px; line-height: 1.5;
}

/* ---------- onboarding card (second brain v1) ---------- */

.onboard-card {
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--accent-line);
  border-radius: 16px;
  padding: 20px 22px;
  margin: 0 0 26px;
  box-shadow: var(--shadow-pop);
}
.onboard-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 8px; }
.onboard-body p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.6; color: var(--ink-2); }
.onboard-list { margin: 4px 0 6px; display: flex; flex-direction: column; gap: 5px; }
.onboard-item { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--ink-2); }
.onboard-item a { color: var(--accent); text-decoration: none; }
.onboard-item a:hover { text-decoration: underline; }
.onboard-check {
  flex: none; width: 16px; height: 16px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; border: 1px solid var(--line-2); color: var(--ink-3);
}
.onboard-check.done { background: var(--green-soft); color: var(--green); border-color: transparent; }

/* ---------- global search (Ctrl+K) ---------- */

.gs-modal { width: min(620px, 92vw); }
.gs-head > svg { width: 16px; height: 16px; flex: none; color: var(--ink-3); }
.gs-row svg { width: 14px; height: 14px; }
.gs-head input {
  flex: 1; min-width: 0; border: none; background: transparent; outline: none;
  color: var(--ink-1); font-size: 14.5px; font-family: var(--font);
}
.gs-results { max-height: 62vh; }
.gs-group-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3); padding: 12px 2px 4px;
}
.gs-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: none; border: none; border-bottom: 1px solid var(--line);
  padding: 9px 2px; text-align: left; cursor: pointer; color: var(--ink-1);
  font-family: var(--font); font-size: 13px;
}
.gs-row:hover { background: var(--gray-soft); }
.gs-row .grow { min-width: 0; }
.gs-row .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-row .type-ico { flex: none; }

/* ---------- workflow run modal: expected output ---------- */

.wf-expected {
  background: var(--gray-soft); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; margin-bottom: 12px;
  font-size: 12.5px; line-height: 1.55; color: var(--ink-2);
}

/* ---------- personal agent label in the picker ---------- */

.apm-plabel { color: var(--ink-3); font-weight: 400; }

/* ============================================================
   Hyperagent-inspired upgrade pass · 2026-07-08
   Agent control panels, right rails, integrations grid,
   projects/library, designed empty states.
   ============================================================ */

/* ---------- designed empty states (icon circle + one clear action) ---------- */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 72px 24px;
  border: 1px dashed var(--line-2); border-radius: var(--radius-lg);
}
.empty-state .es-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: var(--gray-soft); border: 1px solid var(--line-2);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2); margin-bottom: 18px;
}
.empty-state .es-icon svg { width: 26px; height: 26px; }
.empty-state .es-title { font-size: 17px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.empty-state .es-sub { font-size: 13px; color: var(--ink-3); max-width: 460px; margin: 8px 0 0; line-height: 1.6; }
.empty-state .es-actions { display: flex; gap: 8px; margin-top: 20px; flex-wrap: wrap; justify-content: center; }

/* ---------- detail layout: main column + right control rail ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 296px; gap: 20px; align-items: start; }
/* Grid items must never take min-content width from no-wrap children
   (e.g. the tab bar) — the tab bar scrolls instead. */
.detail-grid > * { min-width: 0; }
.detail-rail { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; }
.rail-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px;
}
.rail-card h4 {
  margin: 0 0 10px; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3);
}
.rail-row {
  display: flex; align-items: center; gap: 9px;
  font-size: 12.5px; color: var(--ink-2); padding: 4px 0; min-height: 26px;
}
.rail-row svg { width: 14px; height: 14px; flex: none; color: var(--ink-3); }
.rail-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-row strong { color: var(--ink); font-weight: 600; }
.rail-row .mono { font-size: 11px; }
.rail-row a { color: var(--ink-2); }
.rail-row a:hover { color: var(--ink-1); }
.rail-count { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--ink-3); background: var(--gray-soft); border-radius: 99px; padding: 1px 8px; }
.rail-actions { display: flex; flex-direction: column; gap: 7px; }
.rail-actions .btn { width: 100%; justify-content: center; }

/* ---------- agent hero (cover band + icon + identity + stats) ---------- */
.agent-hero { margin-bottom: 18px; }
.agent-cover {
  height: 92px; border-radius: 16px 16px 0 0;
  --h: 220;
  background:
    radial-gradient(120% 180% at 15% 0%, hsl(var(--h) 40% 26% / 0.55), transparent 55%),
    radial-gradient(110% 190% at 85% 10%, hsl(calc(var(--h) + 70) 45% 24% / 0.45), transparent 58%),
    linear-gradient(180deg, #111111, #0a0a0a);
  border: 1px solid var(--line); border-bottom: 0;
}
.agent-hero-body {
  background: var(--panel); border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 16px 16px; padding: 0 22px 18px;
}
.agent-hero-top { display: flex; align-items: flex-end; gap: 16px; margin-top: -30px; flex-wrap: wrap; }
.agent-hero-face {
  width: 68px; height: 68px; border-radius: 16px; flex: none;
  display: inline-flex; align-items: center; justify-content: center; font-size: 34px;
  background: var(--raise); border: 1px solid var(--line-3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.agent-hero-id { min-width: 0; flex: 1; padding-bottom: 2px; }
.agent-hero-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.agent-hero-name h2 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }
.agent-hero-actions { display: flex; gap: 8px; flex: none; padding-bottom: 4px; }
.agent-hero-tagline { color: var(--ink-2); font-size: 13.5px; margin-top: 10px; max-width: 720px; line-height: 1.6; }
.agent-stats { display: flex; gap: 34px; margin-top: 16px; flex-wrap: wrap; }
.agent-stat .k { font-size: 11px; color: var(--ink-3); font-weight: 600; letter-spacing: 0.02em; }
.agent-stat .v { font-size: 13.5px; color: var(--ink); font-weight: 600; margin-top: 2px; display: flex; align-items: center; gap: 6px; }

/* ---------- tab bar (buttons, agent detail) ---------- */
.tabbar {
  display: flex; gap: 2px; border-bottom: 1px solid var(--line);
  margin-bottom: 18px; overflow-x: auto; scrollbar-width: none;
}
.tabbar::-webkit-scrollbar { display: none; }
.tabbar button {
  display: inline-flex; align-items: center; gap: 7px;
  border: 0; background: transparent; padding: 9px 13px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabbar button svg { width: 14px; height: 14px; opacity: 0.8; }
.tabbar button:hover { color: var(--ink-1); }
.tabbar button.active { color: var(--ink-1); border-bottom-color: var(--brand); }
.tabbar button .n { font-size: 10.5px; font-weight: 700; color: var(--ink-3); background: var(--gray-soft); border-radius: 99px; padding: 1px 7px; }
.tab-pane[hidden] { display: none; }

/* ---------- integrations (ownership-first grid) ---------- */
.int-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.int-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 15px; display: flex; flex-direction: column; gap: 10px; min-height: 128px;
  transition: border-color 0.14s ease;
}
.int-card:hover { border-color: var(--line-2); }
.int-top { display: flex; align-items: center; gap: 11px; }
.int-top .conn-logo { width: 34px; height: 34px; border-radius: 9px; font-size: 14px; }
.int-top .conn-logo img { width: 23px; height: 23px; object-fit: contain; display: block; }
.int-id { min-width: 0; flex: 1; }
.int-name { font-weight: 650; font-size: 13.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.int-sub { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.int-type {
  flex: none; font-size: 9.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--ink-2); background: var(--gray-soft);
  border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 7px;
}
.int-foot { margin-top: auto; display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 10px; }
.int-foot .right { margin-left: auto; }

/* ---------- tool connections (per-user integrations) ---------- */
.tc-experience-hero { display:grid; grid-template-columns:minmax(0,1.6fr) minmax(220px,.72fr); gap:18px; margin:0 0 16px; padding:28px; border-radius:20px; color:#ffffff; background:#000000; position:relative; overflow:hidden; }
.tc-experience-hero::after { content:""; position:absolute; inset:0; pointer-events:none; opacity:.24; background-image:radial-gradient(#89B6E6 1px,transparent 1px); background-size:18px 18px; mask-image:linear-gradient(90deg,transparent,black); }
.tc-hero-copy,.tc-health-card { position:relative; z-index:1; }
.tc-eyebrow,.tc-health-title { font-size:10px; font-weight:800; letter-spacing:.13em; color:#C7E630; }
.tc-hero-copy h2 { margin:8px 0; max-width:560px; color:#ffffff; font-size:clamp(26px,3vw,39px); line-height:1; letter-spacing:-.04em; }
.tc-hero-copy p { max-width:570px; margin:0; color:rgba(238,239,232,.72); line-height:1.55; }
.tc-hero-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:18px; }
.tc-experience-hero .btn { border-color:rgba(255,255,255,.25); color:#ffffff; background:transparent; }
.tc-experience-hero .btn.primary { color:#000000; border-color:#41509D; background:#C7E630; }
.tc-health-card { align-self:stretch; display:flex; flex-direction:column; gap:9px; padding:17px; border:1px solid rgba(238,239,232,.16); border-radius:14px; background:rgba(238,239,232,.06); }
.tc-health-card strong { font-size:28px; letter-spacing:-.04em; }
.tc-health-stats { display:flex; gap:10px; color:rgba(238,239,232,.7); font-size:12px; }
.tc-health-note { margin-top:auto; color:rgba(238,239,232,.56); font-size:11px; }
.tc-pulse { display:inline-block; width:7px; height:7px; margin-right:6px; border-radius:99px; background:#C7E630; box-shadow:0 0 0 4px rgba(199,230,48,.15); }
.tc-catalog-callout { display:flex; align-items:center; gap:13px; margin:0 0 18px; padding:14px 16px; border:1px solid var(--line); border-radius:14px; background:var(--panel); }
.tc-catalog-callout strong { font-size:13px; }
.tc-catalog-callout p { margin:3px 0 0; font-size:12px; color:var(--ink-3); line-height:1.5; }
.tc-catalog-mark { display:grid; place-items:center; width:31px; height:31px; flex:0 0 31px; color:#41509D; background:rgba(65,80,157,.12); border-radius:10px; }
.tc-app-catalog { margin:0 0 18px; padding:20px; border:1px solid var(--line); border-radius:18px; background:var(--panel); scroll-margin-top:72px; }
.tc-catalog-head { display:flex; justify-content:space-between; align-items:flex-end; gap:18px; margin-bottom:15px; }
.tc-catalog-head h2 { margin:4px 0; font-size:20px; letter-spacing:-.025em; }.tc-catalog-head p { margin:0; max-width:600px; color:var(--ink-3); font-size:12px; line-height:1.5; }
.tc-app-search { display:flex; gap:7px; flex:0 1 330px; }.tc-app-search input { min-width:0; width:100%; }
.tc-app-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:9px; }
.tc-app-card { display:grid; grid-template-columns:38px minmax(0,1fr) auto; align-items:center; gap:10px; padding:11px; border:1px solid var(--line); border-radius:12px; background:var(--panel-2); transition:transform .14s ease,border-color .14s ease; }
.tc-app-card:hover { transform:translateY(-1px); border-color:rgba(65,80,157,.38); }
.tc-app-logo { display:grid; place-items:center; width:38px; height:38px; border:1px solid var(--line); border-radius:10px; overflow:hidden; color:#41509D; background:#fff; font-weight:800; }.tc-app-logo img { width:25px; height:25px; object-fit:contain; }
.tc-app-main { min-width:0; display:flex; flex-direction:column; }.tc-app-main strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12.5px; }.tc-app-main span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--ink-3); font-size:10.5px; margin-top:2px; }
.tc-catalog-empty { display:flex; align-items:center; gap:12px; padding:16px; border:1px dashed var(--line-2); border-radius:12px; background:var(--panel-2); }.tc-catalog-empty>span { color:#41509D; font-size:20px; }.tc-catalog-empty p { margin:3px 0 0; color:var(--ink-3); font-size:11.5px; }
.tc-key-setup { display:grid; grid-template-columns:minmax(0,1fr) minmax(190px,320px) auto; align-items:center; gap:10px; margin-bottom:12px; padding:14px; border:1px solid rgba(65,80,157,.3); border-radius:12px; background:rgba(65,80,157,.08); }.tc-key-setup strong { font-size:12.5px; }.tc-key-setup p { margin:3px 0 0; color:var(--ink-3); font-size:11px; line-height:1.4; }
@media (max-width:680px) { .tc-experience-hero { grid-template-columns:1fr; padding:21px; } .tc-health-card { min-height:132px; } }
@media (max-width:680px) { .tc-catalog-head { align-items:stretch; flex-direction:column; }.tc-app-search { flex-basis:auto; width:100%; }.tc-app-grid { grid-template-columns:1fr; } }
@media (max-width:680px) { .tc-key-setup { grid-template-columns:1fr; }.tc-key-setup .btn { width:100%; justify-content:center; } }
.agent-connection-hub { padding:18px; border:1px solid rgba(65,80,157,.26); border-radius:16px; background:linear-gradient(135deg,rgba(65,80,157,.09),transparent 58%); }
.ach-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; margin-bottom:13px; }
.ach-head h3 { margin:4px 0 0; }
.ach-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.ach-card { display:grid; grid-template-columns:34px minmax(0,1fr); gap:10px; align-items:start; padding:13px; border:1px solid var(--line); border-radius:12px; background:var(--panel); }
.ach-card .badge,.ach-card .btn { grid-column:2; justify-self:start; margin-top:1px; }
.ach-route-actions { display:flex; gap:6px; flex-wrap:wrap; margin-top:8px; }.ach-route-actions .btn { grid-column:auto; }.btn.disabled { pointer-events:none; opacity:.55; }
.ach-route-status { display:flex; gap:7px; flex-wrap:wrap; margin-top:8px; }.ach-route-status>span { display:inline-flex; align-items:center; gap:5px; color:var(--ink-2); font-size:10.5px; }.ach-route-status .badge { grid-column:auto; margin:0; }
.ach-icon { display:grid; place-items:center; width:32px; height:32px; color:#41509D; background:rgba(65,80,157,.12); border-radius:9px; font-size:15px; }
.ach-card strong { font-size:12.5px; }.ach-card p,.ach-note { margin:4px 0 0; color:var(--ink-3); font-size:11.5px; line-height:1.48; }
.ach-note { margin-top:12px; }
@media (max-width:680px) { .ach-grid { grid-template-columns:1fr; } }
.chat-connect-card { max-width:620px; display:grid; grid-template-columns:42px minmax(0,1fr) auto; align-items:center; gap:12px; margin-top:9px; padding:14px; border:1px solid rgba(65,80,157,.3); border-radius:14px; background:linear-gradient(135deg,rgba(65,80,157,.11),var(--panel)); box-shadow:0 9px 24px rgba(39,39,39,.08); }
.chat-connect-logo { display:grid; place-items:center; width:42px; height:42px; border-radius:12px; color:#ffffff; background:#41509D; font-size:18px; }
.chat-connect-logo img { display:block; width:28px; height:28px; object-fit:contain; border-radius:6px; }
.chat-connect-copy { min-width:0; display:flex; flex-direction:column; }.chat-connect-copy>span { color:#41509D; font-size:9px; font-weight:800; letter-spacing:.12em; }.chat-connect-copy strong { margin-top:2px; font-size:13.5px; }.chat-connect-copy p { margin:3px 0; color:var(--ink-2); font-size:11.5px; line-height:1.45; }.chat-connect-scope { color:var(--ink-3); font-size:10.5px; }
.chat-account-picker { align-items:start; }
.chat-account-picker .chat-connect-options { grid-column:2/-1; display:grid; gap:8px; width:100%; min-width:0; }
.chat-account-option { width:100%; min-width:0; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:11px 13px; border:1px solid var(--line); border-radius:10px; background:var(--panel); color:var(--ink); text-align:left; cursor:pointer; }
.chat-account-option:hover,.chat-account-option:focus-visible { border-color:#41509D; box-shadow:0 0 0 2px rgba(65,80,157,.12); outline:none; }
.chat-account-option:disabled { cursor:wait; opacity:.6; }
.chat-account-option span { min-width:0; overflow-wrap:anywhere; font-size:12.5px; font-weight:700; }
.chat-account-option small { flex:0 0 auto; color:#41509D; font-size:10.5px; font-weight:750; }
@media (max-width:680px) { .chat-connect-card { grid-template-columns:38px minmax(0,1fr); }.chat-connect-card>.btn { grid-column:1/-1; width:100%; justify-content:center; } }
@media (max-width:680px) { .chat-account-picker .chat-connect-options { grid-column:1/-1; }.chat-account-option { align-items:flex-start; flex-direction:column; gap:3px; } }
.chat-schedule-card { max-width:660px; display:grid; grid-template-columns:42px minmax(0,1fr) auto; align-items:center; gap:12px; margin-top:9px; padding:14px; border:1px solid rgba(108,92,255,.3); border-radius:14px; background:linear-gradient(135deg,rgba(108,92,255,.1),var(--panel)); box-shadow:0 9px 24px rgba(39,39,39,.08); }
.chat-schedule-card { cursor: pointer; }
.routine-detail { display:flex; flex-direction:column; gap:18px; min-width:min(520px,80vw); }
.routine-state { display:flex; align-items:center; gap:8px; }
.routine-field { display:grid; gap:4px; padding:13px 0; border-top:1px solid var(--line); }
.routine-field > span { color:var(--ink-3); font-size:11px; letter-spacing:.08em; text-transform:uppercase; }
.routine-field small { color:var(--ink-3); }
.routine-run { display:grid; gap:3px; padding:8px 0; color:var(--ink); text-decoration:none; }
.routine-run + .routine-run { border-top:1px solid var(--line); }
.collaboration-event { width:100%; text-align:left; cursor:pointer; }
.collaboration-link { display:inline-block; margin-top:7px; color:var(--accent); font-size:12px; font-weight:650; }
.collaboration-thread { display:flex; flex-direction:column; gap:12px; min-width:min(560px,82vw); }
.collaboration-note { color:var(--ink-3); font-size:12px; }
.collaboration-message { display:grid; gap:7px; padding:14px; border:1px solid var(--line); border-radius:13px; background:var(--panel); }
.collaboration-message > span { color:var(--ink-3); font-size:11px; letter-spacing:.08em; text-transform:uppercase; }
.collaboration-message.agent { border-color:color-mix(in srgb,var(--accent) 32%,var(--line)); }
.collaboration-arrow { text-align:center; color:var(--ink-3); }
.chat-schedule-icon { display:grid; place-items:center; width:42px; height:42px; border-radius:12px; color:#fff; background:#6c5cff; }.chat-schedule-icon svg { width:20px; height:20px; }
.chat-schedule-copy { min-width:0; display:flex; flex-direction:column; }.chat-schedule-copy>span { color:#6c5cff; font-size:9px; font-weight:800; letter-spacing:.12em; }.chat-schedule-copy strong { margin-top:2px; font-size:13.5px; }.chat-schedule-copy p { margin:3px 0; color:var(--ink-2); font-size:11.5px; line-height:1.45; }.chat-schedule-copy small { color:var(--ink-3); font-size:10.5px; }
.chat-schedule-actions { display:flex; gap:7px; flex-wrap:wrap; justify-content:flex-end; }
.chat-schedule-card.confirmed { border-color:rgba(45,153,95,.35); background:linear-gradient(135deg,rgba(45,153,95,.1),var(--panel)); }.chat-schedule-card.confirmed .chat-schedule-icon { background:#2d995f; }
@media (max-width:680px) { .chat-schedule-card { grid-template-columns:38px minmax(0,1fr); }.chat-schedule-actions { grid-column:1/-1; }.chat-schedule-actions .btn { flex:1; justify-content:center; } }
.tc-banner { align-items: flex-start; margin-bottom: 20px; }
.tc-banner-sub { margin-top: 6px; color: var(--ink-2); font-weight: 400; }
.tc-card .int-foot { margin-top: 4px; }
.tc-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.tc-chip {
  font-size: 11px; font-family: var(--mono); color: var(--ink-2);
  background: var(--gray-soft); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px;
}
.tc-chip.none { font-family: var(--font); font-style: italic; color: var(--ink-3); }
.tc-grantcount { color: var(--ink-3); }
.tc-warn {
  display: flex; gap: 7px; align-items: flex-start; font-size: 11.5px; line-height: 1.45;
  color: var(--amber); background: var(--amber-soft); border: 1px solid rgba(242, 194, 101, 0.24);
  border-radius: 9px; padding: 8px 10px;
}
.tc-warn svg { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.tc-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.tc-provider.gated { opacity: 0.82; }
.tc-provider-note { font-size: 11.5px; color: var(--ink-3); line-height: 1.45; }

/* ---------- AI models & providers ---------- */
.provider-hero {
  display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:end; gap:24px;
  padding:28px; border:1px solid var(--line-2); border-radius:20px;
  background:linear-gradient(135deg,var(--panel-2),var(--panel)); overflow:hidden;
}
.provider-hero h2 { margin:7px 0 8px; max-width:660px; color:var(--ink-1); font-size:clamp(24px,3vw,36px); line-height:1.05; letter-spacing:-.04em; }
.provider-hero p,.provider-section-head p { max-width:680px; margin:0; color:var(--ink-2); font-size:13px; }
.provider-eyebrow { color:var(--brand); font-size:10px; font-weight:800; letter-spacing:.13em; }
.provider-hero-stat { min-width:150px; padding:15px 17px; border:1px solid var(--line-2); border-radius:14px; background:var(--gray-soft); }
.provider-hero-stat strong { display:block; color:var(--ink-1); font-size:29px; line-height:1; }.provider-hero-stat span { display:block; margin-top:5px; color:var(--ink-2); font-size:11.5px; }
.provider-section { margin-top:24px; padding:20px; border:1px solid var(--line); border-radius:16px; background:var(--panel); }
.provider-section-head { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; margin-bottom:15px; }
.provider-section-head h2 { margin:4px 0 3px; color:var(--ink-1); font-size:18px; letter-spacing:-.02em; }
.provider-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(280px,1fr)); gap:12px; }
.provider-card { min-width:0; padding:16px; border:1px solid var(--line-2); border-radius:14px; background:var(--panel-2); }
.provider-card-head { display:flex; align-items:center; gap:11px; }.provider-card-title { flex:1; min-width:0; display:flex; flex-direction:column; }
.provider-card-title strong { color:var(--ink-1); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }.provider-card-title span { margin-top:1px; color:var(--ink-2); font-size:11.5px; }
.provider-brand { display:grid; place-items:center; width:42px; height:42px; flex:0 0 42px; border:1px solid var(--line-2); border-radius:12px; background:var(--bg-input); color:var(--ink-1); }
.provider-brand svg { width:24px; height:24px; fill:currentColor; }.provider-brand-claude-cli { color:#d97757; }.provider-brand-gemini { color:#8ab4f8; }
.provider-models { margin-top:15px; padding-top:13px; border-top:1px solid var(--line); }.provider-label { display:block; margin-bottom:7px; color:var(--ink-2); font-size:10px; font-weight:750; letter-spacing:.07em; text-transform:uppercase; }
.provider-model-choice { display:flex; align-items:center; gap:9px; }.provider-model-choice>span:last-child { display:flex; flex-direction:column; }.provider-model-choice strong { color:var(--ink-1); font-size:12.5px; }.provider-model-choice small { color:var(--ink-3); font-size:10.5px; }
.provider-model-chips { display:flex; flex-wrap:wrap; gap:6px; }.provider-model-chips span { padding:3px 8px; border:1px solid var(--line); border-radius:99px; color:var(--ink-2); background:var(--gray-soft); font-size:11px; }
.provider-card-actions { display:flex; gap:7px; flex-wrap:wrap; margin-top:15px; }.provider-key-meta { display:flex; justify-content:space-between; gap:12px; margin-top:14px; color:var(--ink-2); font-size:11.5px; }.provider-key-meta .mono { color:var(--ink-3); font-size:10px; overflow:hidden; text-overflow:ellipsis; }
.provider-connect-card { padding:16px; border:1px solid var(--accent-line); border-radius:14px; background:var(--accent-soft); }.provider-connect-copy { display:flex; align-items:center; gap:11px; margin-bottom:15px; }.provider-connect-copy p { margin:2px 0 0; color:var(--ink-2); font-size:11.5px; }.provider-connect-mark { display:grid; place-items:center; width:36px; height:36px; flex:0 0 36px; border-radius:10px; color:var(--accent); background:var(--panel); }.provider-connect-mark svg { width:17px; height:17px; }
.provider-key-form { display:grid; grid-template-columns:minmax(150px,.65fr) minmax(190px,1fr) minmax(250px,1.4fr) auto; align-items:start; gap:10px; }.provider-key-form .field input,.provider-key-form .field select { min-height:39px; }.provider-save { align-self:end; min-height:39px; margin-bottom:20px; }
.provider-empty { display:flex; flex-direction:column; align-items:flex-start; gap:4px; margin-top:12px; padding:17px; border:1px dashed var(--line-2); border-radius:12px; color:var(--ink-2); }.provider-empty span { color:var(--ink-3); font-size:12px; }.provider-empty .btn { margin-top:7px; }
.provider-security-note { display:flex; align-items:center; gap:7px; margin-top:13px; color:var(--ink-2); font-size:11.5px; }.provider-security-note svg { width:14px; height:14px; color:var(--green); }
.routing-advanced { margin-top:24px; border:1px solid var(--line); border-radius:14px; background:var(--panel); overflow:hidden; }.routing-advanced>summary { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 18px; cursor:pointer; list-style:none; }.routing-advanced>summary::-webkit-details-marker { display:none; }.routing-advanced>summary span:first-child { display:flex; flex-direction:column; }.routing-advanced>summary small { margin-top:2px; color:var(--ink-3); font-weight:400; }.routing-advanced-chevron { color:var(--ink-2); font-size:18px; transition:transform .15s ease; }.routing-advanced[open] .routing-advanced-chevron { transform:rotate(180deg); }.routing-advanced-body { padding:0 18px 18px; border-top:1px solid var(--line); }
@media (max-width:900px) { .provider-key-form { grid-template-columns:1fr 1fr; }.provider-api-field { grid-column:1/-1; }.provider-save { margin:0; align-self:end; } }
@media (max-width:680px) { .provider-hero { grid-template-columns:1fr; padding:21px; }.provider-hero-stat { min-width:0; }.provider-section { padding:15px; }.provider-section-head { flex-direction:column; }.provider-grid,.provider-key-form { grid-template-columns:1fr; }.provider-api-field { grid-column:auto; }.provider-save { width:100%; justify-content:center; }.provider-key-meta { flex-direction:column; gap:3px; } }

.tc-log { display: flex; flex-direction: column; gap: 1px; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.tc-log-row {
  display: flex; align-items: center; gap: 9px; padding: 8px 12px; font-size: 12px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.tc-log-row:last-child { border-bottom: none; }
.tc-log-tool { color: var(--ink); flex: none; }
.tc-log-reason { color: var(--ink-3); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-log-actor { color: var(--ink-2); margin-left: auto; white-space: nowrap; }
.tc-log-row .right { margin-left: auto; color: var(--ink-3); }
.tc-log-actor + .right { margin-left: 0; }

.tc-roster { display: flex; flex-direction: column; gap: 8px; }
.tc-grant-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
.tc-grant-main { min-width: 0; flex: 1; }
.tc-grant-who { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.tc-grant-scopes { font-size: 11px; color: var(--ink-3); font-family: var(--mono); margin-top: 2px; }
.tc-divider { height: 1px; background: var(--line); }

/* ---------- projects ---------- */
.proj-kinds { display: flex; gap: 5px; flex-wrap: wrap; }

/* ---------- library ---------- */
.lib-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }

/* ---------- home recent-work rows: slightly richer cards ---------- */
.hw-row { padding: 11px 14px; border-radius: 12px; background: var(--panel); border-color: var(--line); }
.hw-row:hover { border-color: var(--line-2); background: var(--panel-2); }
.hw-ic.recent { background: var(--accent-soft); color: var(--accent); }

/* ---------- files tab (agent internals) ---------- */
.file-group { margin-bottom: 18px; }
.file-group:last-child { margin-bottom: 0; }
.file-group-title {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 6px;
}

/* ---------- mobile ---------- */
@media (max-width: 1000px) {
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-rail { position: static; }
}
@media (max-width: 900px) {
  .agent-hero-actions { width: 100%; padding-top: 8px; }
  .agent-stats { gap: 20px; }
  .agent-cover { height: 64px; }
}

/* keyboard hint chip in the sidebar search button */
.sb-kbd {
  margin-left: auto; font-size: 10px; font-weight: 600; color: var(--ink-3);
  border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px;
}

/* ============================================================
   Mobile + model-routing pass · 2026-07-08 (second Hyperagent pass)
   Phone-quality layouts, PWA shell, read-only routing surfaces.
   ============================================================ */

/* --- thread-header model chip (read-only, from the local registry) --- */
.model-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--ink-2);
  font-family: var(--mono);
  border: 1px solid var(--line); background: var(--gray-soft);
  border-radius: 99px; padding: 4px 10px;
  max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.model-select-wrap {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); background: var(--gray-soft);
  border-radius: 99px; padding: 3px 8px;
  max-width: min(320px, 42vw);
}
.thread-top #thread-model {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.model-label {
  font-size: 10px; font-weight: 750; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--ink-3); flex: none;
}
.model-dot { width: 7px; height: 7px; border-radius: 999px; background: var(--ink-3); flex: 0 0 auto; }
.model-dot.on { background: var(--brand); }
.model-provider-icon-slot { display: inline-flex; align-items: center; flex: 0 0 auto; }
.model-provider-icon {
  width: 18px; height: 18px; border-radius: 4px; flex: 0 0 18px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2); background: transparent;
}
.model-provider-icon svg { width: 16px; height: 16px; display: block; fill: currentColor; }
.model-provider-openai,
.model-provider-codex { color: var(--ink-2); }
.model-provider-anthropic,
.model-provider-claude-cli { color: #d97757; }
.model-provider-google { color: #5f9df7; background: rgba(95, 157, 247, 0.13); }
.model-provider-gemini { color: #8ab4f8; }
.model-provider-open-source { color: var(--ink-3); }
.model-cell {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.model-cell .model-provider-icon { width: 20px; height: 20px; flex-basis: 20px; }
.model-select {
  border: 0; outline: 0; background: transparent; color: var(--ink-2);
  font: 600 11px var(--mono); min-width: 92px; max-width: 270px;
  overflow: hidden; text-overflow: ellipsis;
}
.model-select:disabled { opacity: 0.65; cursor: not-allowed; }

/* --- Admin → AI Routing: mode cards (proposal-only, deliberately inert) --- */
.route-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.route-mode {
  border: 1px dashed var(--line-2); border-radius: 12px; padding: 12px 14px;
  background: var(--panel);
}
.route-mode .rm-name { font-weight: 700; font-size: 13px; color: var(--ink); }
.route-mode .rm-sub { font-size: 12px; color: var(--ink-2); margin-top: 4px; line-height: 1.5; }
.route-mode .rm-note { font-size: 11px; color: var(--ink-3); margin-top: 8px; }

/* --- mobile: the topbar must never set page width (root cause of the
       390px horizontal scroll on Agents/Skills/Integrations/Knowledge —
       the search box and top-action buttons refused to shrink). The search
       drops to its own full-width row; the title truncates instead of
       pushing; actions keep their right alignment. --- */
@media (max-width: 900px) {
  html, body { overflow-x: clip; }
  .layout,
  .main,
  .content,
  .content.bare,
  .content.bare > .inner,
  .chat-surface,
  .chat-wrap,
  .chat-empty,
  .chat-empty-inner {
    width: 100%;
    max-width: 100dvw;
    min-width: 0;
    overflow-x: clip;
  }
  .topbar { flex-wrap: wrap; gap: 10px 12px; }
  .topbar h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .topbar .search { order: 10; flex-basis: 100%; max-width: none; min-width: 0; }
  .topbar .spacer { display: none; }
  /* thread header: the agent picker owns its row; rename/share/model/gateway
     pills wrap below it instead of overlapping or clipping */
  .thread-top { flex-wrap: wrap; row-gap: 8px; }
  .thread-top .grow { flex: 1 1 100%; }
  .model-select-wrap { max-width: 100%; }
  .model-select { max-width: calc(100vw - 92px); }
  /* data tables (admin, routing): swipe inside the panel — never clipped
     columns, never page-wide overflow */
  .panel .sect { overflow-x: auto; }
  /* link tab bars (Admin) scroll like the agent-detail tabbar instead of
     wrapping mid-label */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { white-space: nowrap; }
}

/* --- app-like shell: respect phone safe areas (viewport-fit=cover) --- */
.composer-dock { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
.sidebar { padding-left: calc(10px + env(safe-area-inset-left, 0px)); }
.sidebar .foot { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
@media (max-width: 900px) {
  .content { padding-bottom: calc(40px + env(safe-area-inset-bottom, 0px)); }
}

/* --- mobile Home command center: the usable work surface must appear before
       onboarding copy. The first-run card is still available, but compact and
       below the composer so Home feels like an app, not a setup document. --- */
@media (max-width: 900px) {
  .chat-empty {
    justify-content: flex-start;
    padding: 18px 24px 28px;
    overflow-y: auto;
    min-width: 0;
    max-width: 100%;
  }
  .chat-empty-inner {
    align-items: stretch;
    width: min(100%, 560px);
    max-width: 100%;
    margin: 0 auto;
    min-width: 0;
  }
  .chat-empty-inner > *,
  .chat-empty-inner #home-notes,
  .chat-empty-inner #home-recent,
  .chat-empty-inner #home-workflows,
  .chat-empty-inner #home-leverage,
  .chat-empty-inner .home-grid,
  .chat-empty-inner .home-workflows,
  .chat-empty-inner .home-links,
  .chat-empty-inner .onboard-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .chat-empty-inner .ce-eyebrow {
    order: 1;
    justify-content: center;
    margin: 2px 0 10px;
    font-size: 10.5px;
    line-height: 1.3;
  }
  .chat-empty-inner .ce-title {
    order: 2;
    margin: 4px 0 18px;
    font-size: 30px;
    line-height: 1.08;
  }
  .chat-empty-inner .composer {
    order: 3;
    border-radius: 18px;
    padding: 10px;
    min-width: 0;
    max-width: 100%;
  }
  .chat-empty-inner .composer-input {
    min-height: 48px;
    font-size: 16px;
    padding: 8px 6px 0;
  }
  .chat-empty-inner .composer-tools {
    align-items: flex-end;
    min-width: 0;
    flex-wrap: wrap;
  }
  .chat-empty-inner .agent-pick {
    min-width: 0;
    flex: 1;
  }
  .chat-empty-inner .agent-pick-btn {
    width: 100%;
    max-width: 100%;
  }
  .chat-empty-inner .agent-pick-menu {
    width: min(320px, calc(100dvw - 32px));
    max-width: calc(100dvw - 32px);
    max-height: min(360px, calc(100dvh - 260px));
  }
  .chat-empty-inner .composer-hint {
    display: none;
  }
  .chat-empty-inner .composer-model-slot {
    flex: 1 1 auto;
    max-width: 100%;
  }
  .chat-empty-inner .model-pick {
    max-width: 100%;
  }
  .chat-empty-inner .model-pick-btn {
    max-width: min(280px, calc(100dvw - 120px));
  }
  .chat-empty-inner .model-pick-menu {
    width: min(320px, calc(100dvw - 32px));
    max-width: calc(100dvw - 32px);
    max-height: min(360px, calc(100dvh - 260px));
  }
  .chat-empty-inner .composer-model-wrap {
    max-width: 100%;
  }
  .chat-empty-inner .composer-model-wrap .model-select {
    max-width: min(280px, calc(100vw - 120px));
  }
  .chat-empty-inner .composer-privacy {
    order: 4;
    margin: 9px 4px 0;
    font-size: 11px;
  }
  .chat-empty-inner .starter-chips {
    order: 5;
    justify-content: stretch;
    margin-top: 14px;
    min-width: 0;
    max-width: 100%;
  }
  .chat-empty-inner .starter-chip {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    justify-content: center;
    min-height: 42px;
    white-space: normal;
    overflow-wrap: anywhere;
    text-align: center;
    line-height: 1.35;
  }
  .chat-empty-inner #onboard-card {
    order: 6;
    margin: 18px 0 0;
  }
  .chat-empty-inner .home-grid {
    order: 7;
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .chat-empty-inner #home-recent { order: initial; }
  .chat-empty-inner #home-workflows { order: initial; }
  .chat-empty-inner .home-links {
    order: 9;
    margin-top: 20px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .chat-empty-inner .home-link {
    justify-content: center;
    min-height: 40px;
    padding: 8px 10px;
  }
  .onboard-card {
    padding: 13px 14px;
    border-radius: 14px;
    box-shadow: none;
    background: rgba(18, 19, 24, 0.74);
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  .onboard-title {
    font-size: 13.5px;
    margin-bottom: 6px;
  }
  .onboard-body p {
    font-size: 12px;
    line-height: 1.45;
    margin-bottom: 7px;
  }
  .onboard-card .form-actions {
    margin-top: 8px !important;
    min-width: 0;
    max-width: 100%;
  }
  .onboard-card input {
    min-width: 0 !important;
    max-width: 100%;
  }
  .onboard-card .btn.primary {
    width: 100%;
    justify-content: center;
    min-height: 38px;
    white-space: normal;
    height: auto;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .home-workflows {
    margin-top: 18px;
  }
  .leverage-metrics,
  .leverage-bottom {
    grid-template-columns: 1fr 1fr;
  }
  .hw-row {
    padding: 12px;
  }
}

@media (max-width: 430px) {
  .chat-empty { padding-left: 16px; padding-right: 16px; }
  .chat-empty-inner .ce-title { font-size: 28px; }
  .chat-empty-inner .home-links { grid-template-columns: 1fr; }
  .leverage-metrics,
  .leverage-bottom {
    grid-template-columns: 1fr;
  }
  .leverage-row,
  .leverage-person {
    grid-template-columns: 28px minmax(0, 1fr);
  }
  .leverage-row em,
  .leverage-person em {
    grid-column: 2;
  }
}

/* ---------- thread workspace: work panel ---------- */

.chat-wrap.split { flex-direction: row; }
.chat-wrap.split .thread { flex: 1; min-width: 0; }
.work-panel {
  width: 400px; max-width: 45%; flex-shrink: 0;
  display: flex; flex-direction: column; min-height: 0;
  border-left: 1px solid var(--line);
  background: var(--panel);
}
/* display:flex would defeat the hidden attribute — keep [hidden] authoritative */
.work-panel[hidden] { display: none !important; }
.wp-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
}
.wp-tabs { display: flex; gap: 4px; flex: 1; }
.wp-tabs button {
  border: 1px solid transparent; background: none; color: var(--ink-2);
  font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 8px; cursor: pointer;
}
.wp-tabs button.active { background: var(--panel-2); color: var(--ink); border-color: var(--line-2); }
.wp-body { flex: 1; overflow-y: auto; padding: 12px; min-height: 0; }
.wp-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.wp-doc { cursor: pointer; }
.wp-doc:hover { background: var(--panel-2); }
.wp-doc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.wp-doc-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.wp-doc-body {
  width: 100%; min-height: 260px; resize: vertical;
  border: 1px solid var(--line-2); border-radius: 10px; padding: 10px;
  background: var(--bg-input); color: var(--ink); font-size: 12.5px; line-height: 1.55;
}
.wp-doc-view {
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  background: var(--panel-2); font-size: 13px; overflow-wrap: anywhere;
}
.wp-versions .list-row { padding: 8px 0; }
.output-frame-wrap {
  height: min(68vh, 720px); min-height: 360px;
  border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden;
  background: #fff;
}
.output-frame { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
.artifact-viewer { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.artifact-viewer-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.artifact-viewer-frame-wrap {
  flex: none; height: calc(100vh - 190px); min-height: 560px; border: 1px solid var(--line-2); border-radius: 14px;
  overflow: hidden; background: #fff; box-shadow: var(--shadow-sm);
}
.artifact-viewer-frame { width: 100%; height: 100%; min-height: 0; border: 0; display: block; background: #fff; }
.artifact-text-preview {
  min-height: 240px;
  padding: 22px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
}
.artifact-text-preview pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: inherit;
  line-height: 1.65;
  color: var(--ink);
}

@media (min-width: 1200px) {
  .work-panel { width: min(620px, 48vw); max-width: 48%; }
}

@media (max-width: 900px) {
  /* Mobile: the work panel is a full drawer over the thread, never a squeezed column. */
  .work-panel {
    position: fixed; inset: 0; top: 52px; width: 100%; max-width: 100%;
    z-index: 40; border-left: 0;
  }
  .output-frame-wrap { height: calc(100vh - 190px); min-height: 300px; }
  .artifact-viewer-frame-wrap { height: calc(100vh - 170px); min-height: 320px; }
  .artifact-viewer-frame { min-height: 0; }
}

/* ---------- plan-first mode ---------- */

#plan-bar { flex-shrink: 0; }
.plan-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 20px; padding: 9px 12px;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--panel-2); font-size: 12.5px; color: var(--ink-2);
}
.plan-bar-text { flex: 1; min-width: 180px; }
.plan-bar-text strong { color: var(--ink); }
.plan-bar-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- memory proposals ---------- */

.filter-strip {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px;
}
.filter-chip {
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink-2);
  font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px; cursor: pointer;
}
.filter-chip.active { background: var(--panel-2); color: var(--ink); border-color: var(--line-3); }
.filter-chip .n { opacity: 0.65; font-weight: 500; margin-left: 3px; }
.filter-strip select { font-size: 12px; padding: 5px 8px; border-radius: 8px; }
.filter-check { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-2); }
.mem-row .title { white-space: normal; overflow-wrap: anywhere; }
.mem-actions { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }

/* ---------- integrations governance ---------- */

.int-card.clickable { cursor: pointer; }
.int-card.clickable:hover { border-color: var(--line-3); background: var(--panel-2); }
.int-gov { padding: 0 12px 8px; }
.int-scope {
  font-size: 11.5px; color: var(--ink-2); margin-bottom: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.int-scope.none { color: var(--ink-3); font-style: italic; }
.int-badges { display: flex; gap: 4px; flex-wrap: wrap; }

/* ---------- command center ---------- */

.cc-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px;
}
.cc-card h4 { margin-bottom: 8px; }
.cc-card.cc-wide { grid-column: 1 / -1; }
.cc-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.cc-stat {
  flex: 1; min-width: 78px; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--panel-2); text-align: center;
}
.cc-stat .cc-v { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.cc-stat .cc-k { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }
.cc-stat.warn { border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }
.cc-stat.warn .cc-v { color: var(--amber); }
.cc-stat.bad { border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.cc-stat.bad .cc-v { color: var(--red); }

@media (max-width: 430px) {
  .plan-bar { margin: 0 12px; }
  .mem-actions { justify-content: flex-start; }
}

/* ---------- Stage 6: context window + compaction preview ---------- */
#thread-context { position: relative; display: inline-flex; align-items: center; }
.composer-context-slot:empty { display:none; }
.composer-context-slot .ctx-popover { bottom: calc(100% + 10px); top: auto; }
.composer-context-slot .ctx-trigger { cursor: pointer; }
.ctx-window {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 35;
}
.ctx-trigger {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-2);
  border-radius: 99px;
  background: var(--hover);
  color: var(--ink);
  padding: 5px 10px 5px 7px;
  font-size: 12.5px;
  font-weight: 650;
  cursor: default;
}
.ctx-chip-copy { display: inline-flex; flex-direction: column; line-height: 1.05; }
.ctx-chip-status { color: var(--ink-3); font-size: 9.5px; font-weight: 700; }
.ctx-window.amber .ctx-chip-status { color: var(--amber); }
.ctx-window.red .ctx-chip-status { color: var(--red); }
.ctx-window:hover .ctx-trigger,
.ctx-window:focus-within .ctx-trigger {
  border-color: var(--line-3);
  background: var(--hover-2);
}
.ctx-ring {
  --ring: var(--green);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: conic-gradient(var(--ring) calc(var(--pct) * 1%), var(--gray-soft) 0);
  box-shadow: inset 0 0 0 1px var(--line);
}
.ctx-ring span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--panel);
}
.ctx-window.amber .ctx-ring { --ring: var(--amber); }
.ctx-window.red .ctx-ring { --ring: var(--red); }
.ctx-chip-label {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ctx-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(460px, calc(100vw - 28px));
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  color: var(--ink);
  background: var(--menu);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  box-shadow: var(--shadow-pop);
}
.ctx-window:hover .ctx-popover,
.ctx-window:focus-within .ctx-popover {
  display: flex;
}
.ctx-pop-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: baseline;
  font-size: 15px;
  font-weight: 650;
}
.ctx-pop-head strong {
  font: 700 14px var(--mono);
  color: var(--green);
  white-space: nowrap;
}
.ctx-window.amber .ctx-pop-head strong { color: var(--amber); }
.ctx-window.red .ctx-pop-head strong { color: var(--red); }
.ctx-pop-track {
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--gray-soft);
}
.ctx-pop-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}
.ctx-window.amber .ctx-pop-track span { background: var(--amber); }
.ctx-window.red .ctx-pop-track span { background: var(--red); }
.ctx-pop-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.3;
}
.ctx-pop-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.ctx-pop-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.ctx-pop-legend .hit { background: var(--green); }
.ctx-pop-legend .cache { background: var(--amber); }
.ctx-pop-legend .fresh { background: #72a7ff; }
.ctx-pop-legend .out { background: #b56cff; }
.ctx-pop-note {
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.45;
}
.ctx-compact-btn {
  align-self: flex-start;
  border: 1px solid var(--line-2);
  background: var(--hover);
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.ctx-compact-btn:hover { border-color: var(--line-3); background: var(--hover-2); }
.ctx-compact-btn.hot { background: var(--brand); color: var(--brand-ink); border-color: transparent; }

.modal.dialog:has(.compact-preview) { max-width: 720px; }
.compact-cols { display: flex; gap: 16px; }
.compact-col { flex: 1 1 0; min-width: 0; }
.compact-col.compact-drop { flex: 0 0 34%; }
.compact-h { font-size: 12px; font-weight: 700; color: var(--ink); margin-bottom: 6px; }
.compact-h .sub { font-weight: 400; color: var(--ink-3); }
.compact-summary { width: 100%; font-family: var(--mono); font-size: 12px; line-height: 1.5; resize: vertical; }
.compact-drop .sub { font-size: 12px; color: var(--ink-3); line-height: 1.6; }
@media (max-width: 620px) {
  .compact-cols { flex-direction: column; }
  .compact-col.compact-drop { flex-basis: auto; }
}

/* Final cascade layer for the 2026-07-10 brand refinement. */
.layout { grid-template-columns:252px 1fr; }
.sidebar { padding:16px 12px 0; gap:0; }
.sidebar .ws { height:82px; padding:2px 9px 20px; border-bottom:1px solid var(--line); margin-bottom:12px; }
.brand-mark { display:block; width:42px; height:42px; flex:none; }
.brand-mark img { width:42px; height:42px; object-fit:contain; display:block; }
.brand-mark .brand-light { display:none; }
:root[data-theme="light"] .brand-mark .brand-dark { display:none; }
:root[data-theme="light"] .brand-mark .brand-light { display:block; }
.workspace-label { color:var(--ink-1); font-size:14px; font-weight:700; letter-spacing:-.015em; }
.sb-actions { gap:5px; padding:0 0 10px; }
.sb-btn { min-height:38px; border-radius:8px; padding:8px 10px; }
.sb-btn.newchat { background:var(--accent); border-color:var(--accent); color:#fff; box-shadow:none; }
.sb-btn.newchat svg { color:#fff; }
.nav a.item { min-height:35px; border-radius:7px; padding:7px 10px; font-weight:500; }
.nav a.item.active { background:var(--accent-soft); box-shadow:inset 2px 0 0 var(--accent); }
.nav a.item.active svg { color:var(--accent); }
.sidebar .foot { margin:8px -2px 0; padding:12px 8px 14px; border-top:1px solid var(--line); background:transparent; }
.powered-by { display:flex; align-items:baseline; gap:5px; margin:8px 8px 0; color:var(--ink-3); font-size:9px; letter-spacing:.045em; text-transform:uppercase; }
.powered-by strong { color:var(--ink-2); font-size:10px; letter-spacing:.02em; }
.sidebar .foot button { border:0; background:transparent; padding:3px; }
.topbar { min-height:64px; padding:13px 28px; border-bottom-color:var(--line); }
.topbar h1 { font-size:19px; font-weight:700; letter-spacing:-.025em; }
.content { padding:28px 30px 54px; }
.content .inner { max-width:1180px; }
.page-sect { margin-top:30px; }
.page-sect-head { margin-bottom:12px; }
.page-sect-head h2 { font-size:16px; letter-spacing:-.015em; }
.page-eyebrow,.tc-eyebrow { color:var(--accent); font-size:10px; font-weight:800; letter-spacing:.12em; }
.btn { min-height:34px; border-radius:7px; font-weight:600; box-shadow:none; }
.btn.primary { background:var(--accent); border-color:var(--accent); color:#fff; }
.badge { border-radius:5px; padding:2px 6px; font-size:10.5px; font-weight:600; }
.badge.neutral { background:transparent; border-color:var(--line-2); color:var(--ink-3); }
.role-text { color:var(--ink-2); font-size:12px; }
.admin-person { display:flex; flex-direction:column; gap:1px; }
.admin-person strong { color:var(--ink); font-size:13px; }
.admin-person small { color:var(--ink-3); font-size:10.5px; }
.grid { gap:13px; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); }
.premium-card { min-height:260px; height:260px; border-radius:10px; }
.premium-card-banner { height:78px; background-image:radial-gradient(115% 145% at 16% 0%,hsl(var(--h) 56% 54%/.38),transparent 58%),radial-gradient(110% 150% at 88% 16%,hsl(calc(var(--h) + 72) 58% 54%/.26),transparent 60%),linear-gradient(135deg,hsl(var(--h) 34% 17%),hsl(calc(var(--h) + 28) 28% 11%)); }
:root[data-theme="light"] .premium-card-banner { background-image:radial-gradient(115% 145% at 16% 0%,hsl(var(--h) 74% 64%/.34),transparent 58%),radial-gradient(110% 150% at 88% 16%,hsl(calc(var(--h) + 72) 74% 70%/.28),transparent 60%),linear-gradient(135deg,hsl(var(--h) 62% 86%),hsl(calc(var(--h) + 28) 56% 92%)); }
.premium-card-main { margin-top:-17px; }
.premium-card-icon { width:40px; height:40px; border-radius:10px; box-shadow:0 6px 18px rgba(0,0,0,.14); font-size:15px; }
.premium-card-copy { padding-top:18px; }
.premium-card-body { padding:0 13px 11px; gap:7px; }
.home-card-grid .premium-card { min-height:212px; height:212px; }
.home-card-grid .premium-card-banner { height:48px; }
.home-card-grid .premium-card-badges { display:none; }
.ce-title { font-size:clamp(34px,5vw,58px); font-weight:850; letter-spacing:-.052em; margin-bottom:24px; }
.home-brand-lockup { display:block; width:clamp(180px,24vw,252px); margin:0 auto 18px; }
.home-brand-lockup img { display:block; width:100%; height:auto; }
.home-brand-lockup .brand-light { display:none; }
:root[data-theme="light"] .home-brand-lockup .brand-dark { display:none; }
:root[data-theme="light"] .home-brand-lockup .brand-light { display:block; }
.composer.big { box-shadow:0 14px 44px rgba(0,0,0,.18); border-color:var(--line-2); }
.workflow-filters { display:inline-block; margin:0 0 16px; min-width:220px; }
.workflow-filters .count-strip { margin-top:10px; border-top:1px solid var(--line); padding-top:10px; }
.tc-experience-hero { color:#ffffff; background:#000000; border:1px solid rgba(255,255,255,.10); border-radius:14px; padding:30px; }
.tc-experience-hero::after { opacity:.13; background-image:radial-gradient(#8995da 1px,transparent 1px); }
.tc-experience-hero .btn.primary { background:#41509d; border-color:#41509d; color:#fff; }
.tc-app-grid,.int-grid { gap:10px; }
.tc-app-card,.int-card { border-radius:9px; box-shadow:none; }
.tc-banner { margin:14px 0 20px; }
.tc-help-body { padding:12px 2px 2px; color:var(--ink-2); line-height:1.55; max-width:820px; }
.conn-logo { background:var(--accent-soft)!important; color:var(--accent)!important; border:1px solid var(--accent-line); }
.library-intro,.ops-intro { display:flex; align-items:flex-end; justify-content:space-between; gap:28px; padding:28px 30px; border:1px solid var(--line); border-radius:13px; background:var(--panel); margin-bottom:16px; }
.library-intro h2,.ops-intro h2 { margin:6px 0 7px; font-size:clamp(25px,3vw,36px); line-height:1.05; letter-spacing:-.04em; }
.library-intro p,.ops-intro p { margin:0; max-width:670px; color:var(--ink-2); line-height:1.55; }
.library-count { min-width:120px; display:flex; flex-direction:column; align-items:flex-end; }
.library-count strong { font-size:40px; line-height:1; letter-spacing:-.05em; }
.library-count span { color:var(--ink-3); font-size:11px; margin-top:5px; }
.library-jump { display:flex; gap:6px; overflow-x:auto; padding:0 0 8px; }
.library-jump a { flex:none; color:var(--ink-2); border:1px solid var(--line); background:var(--panel); border-radius:7px; padding:7px 10px; font-size:11.5px; }
.health-summary { display:inline-flex; align-items:center; gap:8px; flex:none; color:var(--ink-2); font-size:12px; }
.cc-grid { gap:12px; }
.cc-card { border-radius:10px; }
.tabs { border-bottom:1px solid var(--line); gap:18px; padding:0 2px; }
.tabs a { border:0; border-bottom:2px solid transparent; border-radius:0; padding:10px 1px; background:transparent; }
.tabs a.active { background:transparent; border-bottom-color:var(--accent); color:var(--ink); }
@media(max-width:760px){.sidebar .ws{height:72px}.brand-mark,.brand-mark img{width:38px;height:38px}.content{padding:20px 16px 42px}.topbar{padding:11px 16px}.library-intro,.ops-intro{align-items:flex-start;flex-direction:column;padding:21px;gap:16px}.library-count{align-items:flex-start}.premium-card{height:242px;min-height:242px}.home-card-grid .premium-card{height:198px;min-height:198px}}

/* Keep this final: the compact duplicate desktop bundle above must not win
   over the mobile shell. Without this reset the hidden sidebar still owns a
   252px grid column and every settings surface is squeezed to that width. */
@media (max-width:900px) {
  .layout { grid-template-columns:minmax(0,1fr); width:100%; max-width:100%; }
  .main,.content,.content .inner { width:100%; max-width:100%; min-width:0; }
}
@media(max-width:760px){.chat-empty-inner .home-brand-lockup{order:2;width:190px;margin:2px auto 12px}.chat-empty-inner .ce-title{order:3}.chat-empty-inner .composer{order:4}.chat-empty-inner .starter-chips{order:5}.chat-empty-inner #home-leverage{order:7}.chat-empty-inner .home-grid{order:8}.chat-empty-inner .home-links{order:9}}
.api-connections-details { margin-top:12px; }
.api-connections-details > summary { color:var(--ink-2); font-weight:600; }

/* Appearance editor: compact searchable emoji catalog + bounded banner prep. */
.emoji-picker { border:1px solid var(--line); border-radius:10px; background:var(--panel-2); padding:10px; }
.emoji-picker-head { display:flex; align-items:center; gap:10px; }
.emoji-picker-head .dialog-input { flex:1; min-width:0; background:var(--panel); }
.emoji-selected { color:var(--ink-3); font-size:11px; white-space:nowrap; }
.emoji-categories { display:flex; gap:5px; overflow-x:auto; padding:8px 0; }
.emoji-categories button { flex:none; border:1px solid var(--line); border-radius:6px; background:var(--panel); color:var(--ink-2); padding:4px 7px; font-size:10.5px; }
.emoji-categories button:hover { border-color:var(--accent-line); color:var(--ink); }
.emoji-grid { display:grid; grid-template-columns:repeat(8,minmax(34px,1fr)); gap:5px; max-height:174px; overflow:auto; padding:2px; }
.emoji-grid button { display:grid; place-items:center; min-width:0; height:38px; padding:0; border:1px solid transparent; border-radius:7px; background:var(--panel); font-size:20px; }
.emoji-grid button:hover,.emoji-grid button:focus-visible { border-color:var(--accent-line); background:var(--accent-soft); outline:none; }
.emoji-grid button.selected { border-color:var(--accent); box-shadow:inset 0 0 0 1px var(--accent); background:var(--accent-soft); }
.emoji-grid button[hidden] { display:none; }
.emoji-custom { max-width:110px; font-size:20px; }
.banner-prep { display:flex; align-items:center; gap:12px; margin-top:8px; padding:9px; border:1px solid var(--line); border-radius:9px; background:var(--panel-2); }
.banner-preview { width:112px; height:48px; flex:none; border-radius:7px; border:1px solid var(--line); background:linear-gradient(135deg,var(--accent-soft),var(--panel)); background-size:cover; background-position:center; }
.banner-prep strong { font-size:11.5px; color:var(--ink-2); }
.banner-prep p { margin:2px 0 0; color:var(--ink-3); font-size:10.5px; line-height:1.35; }
@media(max-width:520px){.emoji-grid{grid-template-columns:repeat(6,minmax(34px,1fr))}.emoji-picker-head{align-items:stretch;flex-direction:column}.emoji-selected{white-space:normal}.banner-preview{width:84px}}
/* Plan and usage */
.plan-hero { display:flex; align-items:flex-start; justify-content:space-between; gap:24px; padding:26px 28px; border:1px solid var(--line); border-radius:20px; background:linear-gradient(135deg,rgba(137,151,236,.16),rgba(72,178,151,.08)); margin-bottom:16px; }
.plan-hero h2 { margin:5px 0 6px; font-size:34px; }
.plan-hero p { margin:0; color:var(--ink-3); max-width:620px; }
.plan-status { border:1px solid rgba(126,225,177,.34); color:var(--green); background:var(--green-soft); border-radius:999px; padding:7px 11px; font-size:12px; font-weight:700; white-space:nowrap; }
.credit-panel { margin:16px 0; padding:24px 26px; border:1px solid var(--line); border-radius:18px; background:var(--panel); box-shadow:var(--shadow-soft); }
.credit-head,.credit-foot { display:flex; justify-content:space-between; align-items:flex-end; gap:18px; }
.credit-head strong { display:inline-block; font-size:36px; margin:4px 8px 0 0; }
.credit-head span:not(.page-eyebrow),.credit-renew,.credit-foot { color:var(--ink-3); font-size:13px; }
.credit-track { height:12px; border-radius:999px; background:var(--panel-3); overflow:hidden; margin:18px 0 9px; }
.credit-track i { display:block; height:100%; min-width:2px; border-radius:inherit; background:linear-gradient(90deg,var(--accent),#74d7b6); }
.usage-stat-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; margin:16px 0 28px; }
.usage-stat { padding:18px; border:1px solid var(--line); border-radius:16px; background:var(--panel); display:grid; gap:6px; }
.usage-stat span,.usage-stat small { color:var(--ink-3); }
.usage-stat strong { font-size:25px; }
.plan-compare-head { margin-top:12px; }
.plan-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; align-items:stretch; }
.plan-card { position:relative; display:flex; flex-direction:column; padding:23px; border:1px solid var(--line); border-radius:18px; background:var(--panel); }
.plan-card.featured { border-color:rgba(137,151,236,.58); box-shadow:0 16px 50px rgba(75,88,170,.17); }
.plan-card.current::after { content:'Current'; position:absolute; top:16px; right:16px; border-radius:999px; padding:4px 8px; background:var(--accent-soft); color:var(--accent-2); font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.08em; }
.plan-kicker { color:var(--accent-2); font-size:11px; letter-spacing:.1em; font-weight:800; }
.plan-card h3 { margin:10px 0 15px; font-size:21px; }
.plan-credits { font-size:29px; font-weight:800; margin-bottom:15px; }
.plan-credits small { font-size:12px; color:var(--ink-3); font-weight:500; }
.plan-card ul { flex:1; padding:0; margin:0 0 21px; list-style:none; display:grid; gap:10px; }
.plan-card li { position:relative; padding-left:20px; color:var(--ink-2); font-size:13px; }
.plan-card li::before { content:'✓'; position:absolute; left:0; color:var(--green); font-weight:800; }
.plan-note { color:var(--ink-3); font-size:12px; max-width:880px; margin:18px 2px 0; }
@media (max-width: 900px) { .usage-stat-grid,.plan-grid { grid-template-columns:1fr; } .plan-hero { flex-direction:column; } }
@media (max-width: 560px) { .plan-hero,.credit-panel,.plan-card { padding:18px; } .credit-head { align-items:flex-start; flex-direction:column; } .credit-head strong { font-size:31px; } }
.agent-handoff-notice{margin:16px auto 8px;max-width:760px;padding:12px 14px;border:1px solid color-mix(in srgb,var(--accent) 28%,var(--line));border-radius:14px;background:color-mix(in srgb,var(--accent) 6%,var(--panel));display:flex;flex-direction:column;gap:4px;font-size:13px}.agent-handoff-notice span{color:var(--ink-3);line-height:1.45}
