:root {
  color-scheme: light;
  --accent: #3b5bdb;
  --accent-soft: color-mix(in srgb, var(--accent) 8%, transparent);
  --accent-ink: #ffffff;
  --ink: #15171c;
  --ink-2: #3f444b;
  --muted: #5b6169;
  --line: #e3e5e8;
  --line-input: #c9ced4;
  --ground: #f6f7f5;
  --surface: #ffffff;
  --canvas: var(--ground);
  --paper: var(--surface);
  --sidebar: #15171c;
  --sidebar-text: #c9cdd3;
  --sidebar-muted: #a3a9b2;
  --sidebar-raise: #22252c;
  --switch-bg: #1d2026;
  --switch-line: #2e323a;
  --mark: var(--accent);
  --banner-bg: #fff8f1;
  --banner-ink: #8a4b0b;
  --agent-edge: var(--accent);
  --ok: #166534;
  --ok-bg: #e9f5ec;
  --ok-dot: #16a34a;
  --warn: #8a4b0b;
  --warn-bg: #fff8f1;
  --warn-line: #f1d9c0;
  --danger: #b42318;
  --shadow: 0 16px 40px rgba(21, 23, 28, 0.08);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-pill: 999px;
  --font: "Instrument Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  font-family: var(--font);
  font-size: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--ground); color: var(--ink); }
a { color: var(--accent); }
a:hover { color: color-mix(in srgb, var(--accent) 80%, #000); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.mark {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}
.brand-lockup {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  color: inherit;
}
.brand-lockup:hover { color: inherit; opacity: 0.88; }
.brand-lockup img {
  display: block;
  height: 28px;
  width: auto;
}
.gate > .brand-lockup { margin-bottom: 0.35rem; }

.lede { color: var(--muted); line-height: 1.5; }
.fine { color: var(--muted); font-size: 0.92rem; }
.handle { color: var(--accent); font-weight: 600; }

.banner {
  background: var(--banner-bg);
  color: var(--banner-ink);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
}
.banner.inset { margin: 0.75rem 1rem 0; }
.is-hidden { display: none; }

.oauth-row { display: flex; flex-direction: column; gap: 0.6rem; margin: 1rem 0; }
.oauth {
  display: flex; align-items: center; justify-content: center; height: 48px;
  border: 1px solid var(--line-input); border-radius: 12px; color: var(--ink);
  background: var(--surface); text-decoration: none; font-weight: 500;
}
.oauth:hover { background: var(--ground); color: var(--ink); }
.center { text-align: center; }
.gate {
  max-width: 28rem;
  margin: 8vh auto;
  background: var(--paper);
  padding: 2rem;
  border-radius: 18px;
  box-shadow: var(--shadow);
}
.gate.wide { max-width: 40rem; }
.gate-top { display: flex; justify-content: space-between; align-items: center; }
.stack { display: grid; gap: 0.85rem; margin-top: 1.25rem; }
label { display: grid; gap: 0.35rem; font-weight: 600; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  border-radius: 10px;
  padding: 0.7rem 0.75rem;
}
textarea { resize: vertical; }
textarea.agent-instructions { min-height: 32rem; line-height: 1.5; }
.instruction-field { display: grid; gap: 0.35rem; }
.instruction-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.instruction-head label { margin: 0; }
button.icon-button.instruction-wand { color: var(--accent); }
button.icon-button.instruction-wand svg {
  width: 1.35rem;
  height: 1.35rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.enhance-log { display: grid; gap: 0.65rem; max-height: 16rem; overflow: auto; margin: 0.85rem 0; }
.enhance-line { margin: 0; border-radius: 12px; padding: 0.65rem 0.75rem; line-height: 1.45; white-space: pre-wrap; }
.enhance-line.assistant { background: var(--accent-soft); }
.enhance-line.user { background: var(--ground); }
.enhance-draft { min-height: 12rem; line-height: 1.45; }
.channel-description { min-height: 9rem; line-height: 1.45; }
.visibility { display: grid; gap: 0.55rem; }
.private-roster { display: none; gap: 0.45rem; margin-top: 0.35rem; padding-top: 0.75rem; border-top: 1px solid var(--line); }
.visibility:has(#visibility-private:checked) .private-roster { display: grid; }
.roster-head { margin: 0.45rem 0 0; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
fieldset {
  border: 1px solid var(--line);
  border-radius: 12px;
  display: grid;
  gap: 0.45rem;
}
.choice { font-weight: 500; display: flex; gap: 0.5rem; align-items: center; }
.choice input { width: auto; }

button, .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  font-weight: 700;
}
button:disabled, .button:disabled {
  background: #c9cdd3;
  color: #5b6169;
  cursor: not-allowed;
}
button.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
button.icon-button svg { width: 1.25rem; height: 1.25rem; fill: currentColor; }
button.ghost, a.ghost, .ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-input);
  text-decoration: none;
}
button.ghost:hover, a.ghost:hover {
  background: var(--ground);
  color: var(--ink);
  border-color: #b8bec6;
}
button.text {
  background: transparent;
  color: var(--danger);
  padding: 0.2rem 0.4rem;
}
.org-directory { list-style: none; padding: 0; margin: 0.8rem 0 1.25rem; display: grid; gap: 0.5rem; }
.org-directory li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
}
.org-directory p { margin: 0.15rem 0 0; }
.logo-preview, .org-thumb { object-fit: contain; background: white; border: 1px solid var(--line); border-radius: 12px; }
.logo-preview { width: 8rem; height: 4.5rem; }
.org-thumb { width: 2.6rem; height: 2.6rem; flex: none; }
.org-list { list-style: none; padding: 0; display: grid; gap: 0.5rem; }
.org-list a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  text-decoration: none;
}
.cards li {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
}

.app {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  height: 100%;
  overflow: hidden;
}
.app.with-members { grid-template-columns: 272px minmax(0, 1fr) 300px; }
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.side-head, .side-foot { padding: 1rem; }
.side-head .mark { color: var(--mark); }
.org-logo { display: block; width: auto; max-width: 100%; max-height: 3.4rem; object-fit: contain; object-position: left center; margin: 0 0 0.2rem; }
.org-switch select {
  margin-top: 0.8rem;
  background: var(--switch-bg);
  color: var(--sidebar-text);
  border-color: var(--switch-line);
}
.side-nav { padding: 0 0.75rem 1rem; overflow: auto; flex: 1; display: flex; flex-direction: column; }
.side-nav .channel-list { margin-bottom: 0.75rem; }
.side-label, .nav-link, .channel-list a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}
.side-label { color: var(--sidebar-muted); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; margin: 0.5rem 0.4rem; }
.icon-add {
  width: 1.45rem;
  height: 1.45rem;
  margin: 0;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--sidebar-text);
  background: var(--sidebar-raise);
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
}
.icon-add:hover { background: var(--switch-line); }
.channel-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.invite-row { display: flex; gap: 0.35rem; align-items: center; flex-wrap: wrap; padding: 0.2rem 0.45rem; }
.invite-row form { margin: 0; }
.channel-list a, .nav-link {
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  color: var(--sidebar-text);
  justify-content: flex-start;
}
.channel-list a.is-active, .nav-link.is-active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.channel-list a.is-active .hash, .channel-list a.is-active svg { color: #fff; opacity: 0.9; }
.channel-group a {
  color: var(--sidebar-muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding-bottom: 0.15rem;
}
.channel-child a { padding-left: 1.35rem; }
.hash { color: var(--sidebar-muted); margin-right: 0.15rem; display: inline-flex; }
.side-icon { width: 15px; height: 15px; flex: none; opacity: 0.9; }
.pa-pin {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin: 0 0.25rem 0.65rem;
  border-radius: var(--radius);
  background: var(--sidebar-raise);
  color: #fff;
  text-decoration: none;
  font-weight: 500;
}
.pa-pin .badge {
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--radius-pill);
  padding: 1px 7px;
  margin-left: auto;
}
.admin-nav {
  margin-top: auto;
  border-top: 1px solid #2a2e35;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  margin-top: 6px;
  border-radius: var(--radius);
  background: var(--switch-bg);
}
.side-user .avatar-person { width: 30px; height: 30px; font-size: 11px; }
.side-user strong { color: #fff; font-weight: 500; display: block; }
.side-user span { color: var(--sidebar-muted); font-size: 12px; }
.side-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.side-profile:hover strong { text-decoration: underline; }
.side-foot { border-top: 1px solid var(--sidebar-raise); display: flex; justify-content: space-between; gap: 0.5rem; align-items: center; }
.side-foot span { display: block; color: var(--sidebar-muted); font-size: 0.8rem; }
.side-foot .ghost { color: var(--sidebar-text); border-color: var(--switch-line); }
.org-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px; }
.org-mark {
  width: 36px; height: 36px; border-radius: var(--radius); background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; flex: none;
}
.org-brand .org-logo { width: 36px; height: 36px; max-height: none; border-radius: var(--radius); margin: 0; object-fit: cover; }
.org-brand .org-logo.brand-fallback { object-fit: contain; background: transparent; border-radius: 0; }
.org-brand strong { color: #fff; font-weight: 600; font-size: 15px; display: block; }
.org-brand .slug { font-family: var(--mono); font-size: 11px; color: var(--sidebar-muted); }
.unread-pill {
  background: #3a3f48; color: #fff; font-size: 11px; border-radius: var(--radius-pill); padding: 1px 7px; margin-left: auto;
}

.stage { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: auto; background: var(--ground); }
.stage:has(.workspace-main) { overflow: hidden; }
.workspace-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-wrap: nowrap; align-items: stretch; overflow: hidden; background: var(--ground); }
.conversation {
  flex: 999 1 520px;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.thread-panel {
  flex: 1 1 380px;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-left: 1px solid var(--line);
}
.conv-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
}
.conv-head .title-block { display: flex; flex-direction: column; gap: 2px; flex: 1 1 260px; min-width: 0; }
.conv-head h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.conv-meta { font-size: 13px; color: var(--muted); }
.conv-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.head-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: var(--radius);
  border: 1px solid #d5d9de;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}
.head-btn.icon { padding: 8px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-weight: 500;
}
.status-pill.ok { background: var(--ok-bg); color: var(--ok); }
.status-pill.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); }
.status-pill.neutral { background: #eef0f3; color: var(--ink-2); }
.status-pill .dot {
  width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}
.status-pill.ok .dot { background: var(--ok-dot); }
.panel {
  width: min(68rem, calc(100% - 2.5rem));
  margin: 1.25rem auto;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.4rem 1.5rem 1.6rem;
  box-shadow: var(--shadow);
}
.conv-head h1, .panel h1 { margin: 0; font-size: 1.45rem; }
.panel h1 + .lede, .split .lede { margin: 0.35rem 0 0; }
.conv-head p { margin: 0.25rem 0 0.8rem; color: var(--muted); }
.lock {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--banner-bg);
  color: var(--banner-ink);
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  vertical-align: middle;
}
.conv-head, .composer { flex: none; }
.transcript { flex: 1; min-height: 0; overflow: auto; padding: 12px 0; }
.day-rule {
  display: flex; align-items: center; gap: 12px; padding: 8px 24px;
  font-size: 12px; color: var(--muted); font-weight: 500;
}
.day-rule::before, .day-rule::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.msg {
  display: flex;
  gap: 12px;
  padding: 10px 24px;
}
.msg.agent { background: var(--accent-soft); }
.msg.system { color: var(--muted); font-size: 0.92rem; }
.msg.system .avatar { display: none; }
.avatar, .avatar-person, .avatar-agent {
  width: 36px; height: 36px; flex: none;
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; overflow: hidden; font-size: 12px;
}
.avatar-person { border-radius: 50%; }
.avatar-agent {
  border-radius: 9px;
  background: var(--ink);
  box-shadow: inset 0 0 0 2px var(--accent);
  font-family: var(--mono); font-size: 11px;
}
.avatar img, .mini-avatar, .avatar-person img, .avatar-agent img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mini-avatar { width: 1.7rem; height: 1.7rem; border-radius: 8px; }
.who-line { display: inline-flex; align-items: center; gap: 0.45rem; }
.avatar-editor { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr); gap: 1rem; align-items: start; }
.avatar-preview.is-hidden, .avatar-fallback.is-hidden { display: none; }
.avatar-preview, .avatar-fallback { width: 4.5rem; height: 4.5rem; border-radius: 16px; object-fit: cover; }
.avatar-fallback { display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 1.4rem; }
.avatar-editor .stack { margin-top: 0; }
#avatar-status { min-height: 1.2rem; }
#avatar-status.is-busy { color: var(--ink-2); font-weight: 600; }
#avatar-status.is-error { color: var(--danger); }
#avatar-status.is-ok { color: var(--ok); }
.msg-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.msg-main header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.msg-main header strong { font-weight: 600; }
.agent-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: #eef0f3;
  color: var(--ink-2);
}
.msg.agent .agent-tag { background: var(--surface); }
.msg-main time, .tool-line { color: var(--muted); font-size: 12px; }
.tool-chips { display: flex; flex-wrap: wrap; gap: 6px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.tool-chips span { padding: 2px 6px; background: #f1f3f5; border-radius: 4px; }
.msg.agent .tool-chips span { background: var(--surface); }
.citation-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.citation-chips a {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  padding: 3px 9px; border: 1px solid #d5d9de; border-radius: var(--radius-pill);
  color: var(--ink-2); text-decoration: none; background: var(--surface);
}
.citation-chips .n { font-family: var(--mono); color: var(--accent); font-weight: 500; }
.action-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid #e1e4e8; border-radius: var(--radius-md);
  background: #fafafb; max-width: 520px;
}
.action-card .check { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid #8a9099; flex: none; }
.body { margin: 0; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.body.rich { white-space: normal; }
.body.rich > *:first-child { margin-top: 0; }
.body.rich > *:last-child { margin-bottom: 0; }
.body.rich h2, .body.rich h3, .body.rich h4 {
  margin: 16px 0 8px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
}
.body.rich h2 { font-size: 16px; }
.body.rich h3 { font-size: 15px; }
.body.rich h4 { font-size: 14px; }
.body.rich p { margin: 0 0 10px; }
.body.rich ul, .body.rich ol { margin: 0 0 12px; padding-left: 1.2em; }
.body.rich li { margin: 4px 0; }
.body.rich strong { font-weight: 700; }
.body.rich a { color: var(--accent); }
.body.rich blockquote {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-left: 3px solid var(--line);
  color: var(--ink-2);
}
.body.rich pre {
  margin: 0 0 12px;
  padding: 10px 12px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: 12px;
}
.msg-table {
  margin: 8px 0 14px;
  max-width: 480px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.msg-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.msg-table th, .msg-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #eef0f3;
  vertical-align: top;
}
.msg-table th {
  font-weight: 600;
  color: var(--ink-2);
  background: #fafafb;
}
.msg-table td:last-child, .msg-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.msg-table tbody tr:last-child td { border-bottom: 0; }
.working {
  display: none;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin: 6px 0 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}
.msg[data-status="streaming"] .working { display: flex; }
.msg[data-status="streaming"] .tool-chips { display: none; }
.working-now {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.working-steps {
  list-style: none;
  margin: 0;
  padding: 0 0 0 22px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.working-steps li { position: relative; line-height: 1.35; }
.working-steps li::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 0.45em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #c9cdd3;
}
.working-steps li.is-done::before { background: var(--accent); opacity: 0.35; }
.working-steps li.is-current { color: var(--accent); font-weight: 600; }
.working-steps li.is-current::before { background: var(--accent); opacity: 1; }
.working-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.working-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  animation: working-bounce 1s ease-in-out infinite;
}
.working-dots i:nth-child(2) { animation-delay: 0.15s; }
.working-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes working-bounce {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}
@media (prefers-reduced-motion: reduce) {
  .working-dots i { animation: none; opacity: 0.7; }
}
.composer-busy {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}
.composer {
  padding: 12px 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
}
.composer-hint { font-size: 12px; color: var(--muted); margin: 0; }
.composer-busy + .composer-box { margin-top: 2px; }
.composer-box {
  background: var(--surface);
  border: 1px solid var(--line-input);
  border-radius: var(--radius-lg);
  padding: 0;
  display: flex;
  flex-direction: column;
}
.composer-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer-box textarea {
  display: block;
  width: 100%;
  min-height: 2.5rem;
  max-height: 9rem;
  border: 0;
  padding: 12px 14px 4px;
  resize: none;
  background: transparent;
  box-shadow: none;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
}
.composer-box textarea:focus { outline: none; }
.composer-tools { display: flex; align-items: center; gap: 4px; padding: 6px 8px; }
.icon-btn {
  position: relative;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { background: var(--canvas); color: var(--ink); }
button.icon-btn {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}
button.icon-btn.is-listening {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}
.icon-btn input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.icon-btn svg, .send-btn svg { width: 1.15rem; height: 1.15rem; }
.send-btn {
  width: auto;
  height: auto;
  padding: 8px 10px;
  border-radius: var(--radius);
  margin-left: auto;
}
.thread-panel .conv-head { padding: 16px 20px; }
.thread-panel .transcript { padding: 12px 0; }
.thread-panel .msg { padding: 10px 20px; gap: 10px; }
.thread-panel .avatar-person, .thread-panel .avatar-agent { width: 30px; height: 30px; font-size: 10px; }
.thread-panel .composer { padding: 12px 20px 18px; border-top: 1px solid var(--line); }
.thread-composer {
  display: flex; gap: 8px; align-items: center;
}
.thread-composer input {
  flex: 1; min-width: 0; font: inherit; font-size: 14px;
  padding: 10px 12px; border: 1px solid var(--line-input); border-radius: var(--radius-md);
}
.thread-count {
  display: flex; align-items: center; gap: 10px; padding: 4px 20px;
  font-size: 12px; color: var(--muted);
}
.thread-count::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.mono { font-family: var(--mono); }
.file-chip.is-hidden { display: none; }
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  max-width: 100%;
  margin-bottom: 0.3rem;
  padding: 0.15rem 0.2rem 0.15rem 0.65rem;
  border-radius: 999px;
  background: var(--banner-bg);
  color: var(--banner-ink);
  font-size: 0.85rem;
  font-weight: 600;
}
.file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip button {
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--banner-ink);
  font-size: 1rem;
  line-height: 1;
}

.members { border-left: 1px solid var(--line); background: var(--paper); padding: 1rem; overflow: auto; min-height: 0; }
.members h2 { margin: 0 0 0.4rem; font-size: 1rem; }
.members h3 { margin: 1.1rem 0 0.4rem; font-size: 0.82rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.member-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.35rem; }
.member-list li { display: flex; justify-content: space-between; gap: 0.4rem; align-items: center; }
.member-list em { color: var(--muted); font-style: normal; font-size: 0.82rem; }
.inline-form { display: flex; gap: 0.4rem; margin-top: 0.55rem; }
.inline-form select { flex: 1; }
.split { display: flex; justify-content: space-between; gap: 1.25rem; align-items: center; }
.split .button { flex: none; }
.section-label {
  margin: 1.5rem 0 0.55rem;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.connector-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin: 0.55rem 0;
}
.connector-card p { margin: 0.2rem 0 0; }
.connector-list { margin-bottom: 1.25rem; }
.connector-dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.25rem 1.35rem 1rem;
  max-width: 34rem;
  width: calc(100% - 2rem);
  background: var(--paper, #fff);
}
.connector-dialog::backdrop { background: rgba(40, 28, 18, 0.45); }
.connector-dialog h2 { margin: 0 0 0.35rem; }
.connector-dialog > form > p { margin: 0 0 0.8rem; }
.region-list { display: grid; gap: 0.15rem; max-height: 22rem; overflow: auto; margin: 0.4rem 0 0.2rem; }
.connector-dialog .region-list label {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.45rem 0.35rem;
  font-weight: 500;
}
.connector-dialog .region-list input[type="radio"] {
  width: 1.05rem;
  height: 1.05rem;
  min-width: 1.05rem;
  margin: 0.2rem 0 0;
  padding: 0;
  flex: 0 0 auto;
  accent-color: var(--accent, #c45c26);
}
.connector-dialog .region-list label > span { display: grid; gap: 0.1rem; min-width: 0; }
.connector-dialog .region-list strong { font-weight: 700; }
.connector-dialog .action-row { justify-content: flex-end; margin-top: 0.8rem; }
.server-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  margin: 0.8rem 0;
  display: grid;
  gap: 0.75rem;
}
.cards { list-style: none; padding: 0; margin: 0.8rem 0 0; display: grid; gap: 0.65rem; }
.cards li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
}
.cards li.empty { display: block; color: var(--muted); }
.who { display: grid; gap: 0.15rem; min-width: 0; }
.who strong, .who span { overflow-wrap: anywhere; }
.pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 999px;
  background: var(--banner-bg);
  color: var(--banner-ink);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.12rem 0.5rem;
  text-transform: capitalize;
}
.row-actions { display: flex; gap: 0.45rem; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.action-row { display: flex; align-items: center; gap: 0.4rem; margin: 0; flex-wrap: wrap; justify-content: flex-end; }
.action-row select { width: auto; min-width: 7.25rem; height: 2.45rem; padding: 0 0.65rem; }
button.compact, a.compact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 2.45rem;
  padding: 0 0.9rem;
  border-radius: 10px;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  box-sizing: border-box;
}
button.compact svg, a.compact svg {
  width: 15px;
  height: 15px;
  flex: none;
}
.invite-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: end;
  margin-top: 1.25rem;
}
.invite-row button { height: 2.7rem; }
.files { list-style: none; padding: 0; margin: 0.35rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.files a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 16rem;
  padding: 0.4rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}
.files a:hover { border-color: var(--accent); }
.file-mark {
  width: 0.55rem;
  height: 0.7rem;
  border: 1.5px solid currentColor;
  border-radius: 1px;
  position: relative;
}
.file-mark::after {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  border-top: 4px solid var(--canvas);
  border-left: 4px solid currentColor;
}
.thread-link { color: var(--accent); font-size: 0.88rem; }

.people-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.5rem;
  margin-bottom: 1rem;
}
.people-head .lede { margin: 0.25rem 0 0; }
.people-title { display: flex; align-items: center; gap: 0.55rem; }
.people-title h1 { margin: 0; }
.people-add {
  width: 1.7rem;
  height: 1.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.people-add:hover { background: var(--accent-soft); }
.people-add:disabled { opacity: 0.45; cursor: not-allowed; }
.meter {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 11rem;
}
.meter-label { font-size: 0.75rem; color: var(--warn); font-weight: 600; }
.meter-value { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 1.1rem; color: var(--warn); }
.meter-bar {
  height: 6px;
  border-radius: 3px;
  background: #f6e6d4;
  display: flex;
  overflow: hidden;
}
.meter-bar > span { display: block; background: #c2410c; border-radius: 3px; }
.meter.is-full .meter-value { color: var(--danger); }
.cap-alert {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn);
  margin-bottom: 1rem;
}
.cap-alert .button {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85rem;
}
.table-card {
  background: var(--surface, #fff);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}
.people-table { width: 100%; border-collapse: collapse; min-width: 32rem; }
.people-table th {
  text-align: left;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.75rem 1rem;
  font-weight: 600;
}
.people-table td {
  padding: 0.75rem 1rem;
  border-top: 1px solid #eef0f3;
  vertical-align: middle;
}
.people-table .who {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.people-table .who > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.people-table .avatar-person {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #eef0f3;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  flex: none;
}

.skill-grid {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16.5rem, 1fr));
  gap: 0.85rem;
}
button.skill-card {
  display: grid;
  gap: 0.4rem;
  width: 100%;
  min-height: 11rem;
  padding: 1rem 1.05rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 400;
  text-align: left;
  align-items: start;
  justify-content: stretch;
  box-shadow: none;
}
button.skill-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
  color: var(--ink);
}
button.skill-card strong {
  font-weight: 700;
  font-size: 1.02rem;
}
button.skill-card .fine {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.skill-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  min-height: 3.6rem;
  align-items: center;
  margin-bottom: 0.25rem;
}
.skill-thumbs img {
  height: 3.4rem;
  max-width: 7.25rem;
  object-fit: contain;
  border-radius: 8px;
  padding: 0.3rem 0.45rem;
  background: #fff;
  border: 1px solid var(--line);
}
.skill-thumbs img.is-reversed {
  background: #1a1a2e;
  border-color: #1a1a2e;
}
.skill-mark {
  width: 3.4rem;
  height: 3.4rem;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 1.15rem;
}
.skill-dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  max-width: 42rem;
  width: calc(100% - 2rem);
  max-height: calc(100vh - 3rem);
  background: var(--paper, #fff);
  box-shadow: var(--shadow);
}
.skill-dialog::backdrop { background: rgba(21, 23, 28, 0.45); }
.skill-dialog-body {
  padding: 1.2rem 1.3rem 1.15rem;
  overflow: auto;
  max-height: calc(100vh - 3rem);
}
.skill-dialog-body > .split { margin-bottom: 0.85rem; }
.skill-dialog h2 { margin: 0; font-size: 1.2rem; }
.skill-dialog .stack { margin-top: 0.9rem; }
.skill-previews {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem;
  margin: 0 0 0.85rem;
}
.skill-previews figure {
  margin: 0;
  padding: 1rem 0.85rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f4f6fa;
}
.skill-previews figure.is-reversed { background: #1a1a2e; border-color: #1a1a2e; }
.skill-previews img {
  display: block;
  max-width: 100%;
  max-height: 7.5rem;
  margin: 0 auto;
  object-fit: contain;
}
.skill-previews figcaption {
  margin-top: 0.55rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}
.skill-previews figure.is-reversed figcaption { color: #c9cdd3; }
.skill-dialog .files { margin: 0 0 0.4rem; }
.skill-dialog .section-label { margin: 0.35rem 0 0; }
.skill-dialog form.stack + form.stack {
  margin-top: 1.15rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}
.profile-nav { display: flex; gap: 0.85rem; align-items: center; }
.profile-nav a { color: var(--ink-2); font-size: 0.9rem; }
.profile-page section { margin: 1.6rem 0; }
.profile-page h2 { margin: 0 0 0.6rem; }
.avatar-editor.person .avatar-preview,
.avatar-editor.person .avatar-fallback { border-radius: 50%; }
.legal-page h2 { margin: 1.4rem 0 0.5rem; }
.legal-page ul { padding-left: 1.2rem; color: var(--ink-2); }
.danger-zone { border-top: 1px solid var(--line); padding-top: 1.2rem; }
button.danger {
  background: var(--danger);
  color: #fff;
}

@media (max-width: 960px) {
  .app, .app.with-members { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .sidebar, .members, .conversation, .stage, .thread-panel { min-height: auto; overflow: visible; }
  .stage:has(.workspace-main) { overflow: visible; }
  .workspace-main { flex-wrap: wrap; overflow: visible; }
  .transcript { overflow: visible; }
  .sidebar { position: sticky; top: 0; z-index: 2; }
  .side-nav { max-height: 40vh; overflow: auto; }
  .members { border-left: 0; border-top: 1px solid var(--line); }
}
