/* agent-tasks web console */

:root {
  color-scheme: light;
  --font: 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --bg: #f4f4f7;
  --surface: #ffffff;
  --surface-2: #f6f6f9;
  --surface-3: #eeeef3;
  --hover: rgba(24, 24, 40, 0.045);
  --active: rgba(24, 24, 40, 0.075);
  --border: #e7e7ee;
  --border-strong: #d8d8e2;
  --text: #17171f;
  --text-2: #55556a;
  --text-3: #8b8b9c;
  --accent: #7c5cff;
  --accent-strong: #6a48f5;
  --accent-text: #5f3df0;
  --accent-soft: rgba(124, 92, 255, 0.1);
  --accent-softer: rgba(124, 92, 255, 0.055);
  --on-solid: #ffffff;
  --bar-off: rgba(24, 24, 40, 0.14);
  --shadow-sm: 0 1px 2px rgba(20, 20, 40, 0.06);
  --shadow-card: 0 1px 2px rgba(20, 20, 40, 0.05), 0 0 0 1px var(--border);
  --shadow-pop: 0 12px 32px -8px rgba(20, 20, 50, 0.22), 0 0 0 1px rgba(20, 20, 50, 0.07);
  --shadow-drawer: -24px 0 48px -24px rgba(20, 20, 50, 0.28);
  --agent-l: 45%;
  --agent-s: 62%;
  --agent-bg-a: 0.13;

  --st-todo: #8e8e93;
  --st-in_progress: #3b82f6;
  --st-in_review: #a855f7;
  --st-blocked: #ef4444;
  --st-done: #22c55e;
  --st-cancelled: #8e8e93;

  --p0: #ef4444;
  --p1: #f97316;
  --p2: #eab308;
  --p3: #64748b;
  --p4: #a1a1aa;

  --k-progress: #3b82f6;
  --k-question: #f59e0b;
  --k-blocker: #ef4444;
  --k-review: #a855f7;
  --k-answer: #22c55e;
  --k-note: #8e8e93;

  --radius: 10px;
  --radius-sm: 7px;
  --side-w: 252px;
  --drawer-w: min(720px, 100vw);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0e0e12;
    --surface: #15151b;
    --surface-2: #1a1a21;
    --surface-3: #22222b;
    --hover: rgba(255, 255, 255, 0.045);
    --active: rgba(255, 255, 255, 0.08);
    --border: #25252e;
    --border-strong: #33333e;
    --text: #ececf2;
    --text-2: #a5a5b5;
    --text-3: #6d6d7e;
    --accent-text: #a891ff;
    --accent-soft: rgba(124, 92, 255, 0.18);
    --accent-softer: rgba(124, 92, 255, 0.09);
    --bar-off: rgba(255, 255, 255, 0.16);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--border);
    --shadow-pop: 0 16px 40px -8px rgba(0, 0, 0, 0.6), 0 0 0 1px #2e2e38;
    --shadow-drawer: -24px 0 60px -20px rgba(0, 0, 0, 0.7);
    --agent-l: 66%;
    --agent-s: 70%;
    --agent-bg-a: 0.18;
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0e0e12;
  --surface: #15151b;
  --surface-2: #1a1a21;
  --surface-3: #22222b;
  --hover: rgba(255, 255, 255, 0.045);
  --active: rgba(255, 255, 255, 0.08);
  --border: #25252e;
  --border-strong: #33333e;
  --text: #ececf2;
  --text-2: #a5a5b5;
  --text-3: #6d6d7e;
  --accent-text: #a891ff;
  --accent-soft: rgba(124, 92, 255, 0.18);
  --accent-softer: rgba(124, 92, 255, 0.09);
  --bar-off: rgba(255, 255, 255, 0.16);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.25), 0 0 0 1px var(--border);
  --shadow-pop: 0 16px 40px -8px rgba(0, 0, 0, 0.6), 0 0 0 1px #2e2e38;
  --shadow-drawer: -24px 0 60px -20px rgba(0, 0, 0, 0.7);
  --agent-l: 66%;
  --agent-s: 70%;
  --agent-bg-a: 0.18;
}

/* ------------------------------------------------------------------ base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.45 var(--font);
  font-feature-settings: 'ss01', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}

a {
  color: var(--accent-text);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

kbd {
  font: 500 11px/1 var(--font);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: 5px;
  color: var(--text-3);
  background: var(--surface-3);
  box-shadow: inset 0 -1px 0 var(--border-strong);
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.i {
  flex: none;
}

.ref {
  font: 500 12px/1 var(--mono);
  color: var(--text-3);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.meta-spacer,
.toolbar-spacer {
  flex: 1;
}

.hint {
  color: var(--text-3);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-weight: 550;
  font-size: 13px;
  white-space: nowrap;
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: background 0.12s, box-shadow 0.12s, transform 0.06s;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:active {
  transform: translateY(0.5px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(60, 30, 180, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.btn.primary:hover {
  background: var(--accent-strong);
}

.btn.primary kbd {
  background: rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.9);
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  box-shadow: none;
  color: var(--text-2);
}

.btn.ghost:hover {
  background: var(--hover);
  color: var(--text);
}

.btn.danger {
  background: var(--st-blocked);
  color: #fff;
  box-shadow: none;
}

.btn.danger-text {
  color: var(--st-blocked);
}

.btn.small {
  height: 26px;
  padding: 0 8px;
  font-size: 12px;
  border-radius: 7px;
}

.btn.wide {
  width: 100%;
  justify-content: center;
  height: 38px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  color: var(--text-3);
  flex: none;
  transition: background 0.12s, color 0.12s;
}

.icon-btn:hover,
.icon-btn.menu-open {
  background: var(--hover);
  color: var(--text);
}

/* ----------------------------------------------------------------- shell */

.app {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 10px 10px 8px;
  gap: 4px;
  overflow: hidden;
}

.main {
  margin: 8px 8px 8px 0;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--border), var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.topbar,
.sheet-scrim {
  display: none;
}

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

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.brand:hover {
  text-decoration: none;
}

.conn {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  opacity: 0.5;
  transition: background 0.3s;
}

.conn.on {
  background: var(--st-done);
  opacity: 1;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-done) 20%, transparent);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 10px;
}

.nav-item,
.project-link {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border-radius: 7px;
  color: var(--text-2);
  font-weight: 500;
  text-align: left;
  transition: background 0.1s, color 0.1s;
}

.nav-item:hover,
.project-link:hover {
  background: var(--hover);
  color: var(--text);
}

.nav-item.active,
.project-item.active .project-link {
  background: var(--active);
  color: var(--text);
}

.nav-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-count {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.nav-count.hot {
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 11px;
}

.side-section {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 12px;
  min-height: 0;
}

.side-section.agents {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 0;
}

.side-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 28px;
  padding: 0 4px 0 8px;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 550;
}

.side-title .icon-btn {
  width: 22px;
  height: 22px;
}

.side-meta {
  font-weight: 500;
  padding-right: 4px;
}

.project-item {
  position: relative;
  display: flex;
  align-items: center;
}

.project-item .project-link {
  padding-right: 30px;
}

.project-item.archived .project-link {
  opacity: 0.6;
}

.project-more {
  position: absolute;
  right: 3px;
  width: 24px;
  height: 24px;
  opacity: 0;
}

.project-item:hover .project-more,
.project-more.menu-open,
.project-more:focus-visible {
  opacity: 1;
}

.project-item:hover .nav-count {
  visibility: hidden;
}

.project-glyph {
  width: 18px;
  display: inline-grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
}

.project-dot {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: var(--pc, var(--accent));
  flex: none;
  display: inline-block;
}

.project-dot.small {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.side-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 8px;
  color: var(--text-3);
  font-size: 12px;
  border-radius: 6px;
}

.side-toggle:hover {
  color: var(--text-2);
}

.side-empty {
  margin: 2px 4px;
  padding: 10px;
  border-radius: 8px;
  border: 1px dashed var(--border-strong);
  color: var(--text-2);
  font-size: 13px;
}

.side-hint {
  margin: 2px 8px;
  color: var(--text-3);
  font-size: 12px;
}

.agent-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  border-radius: 7px;
  min-height: 40px;
}

.agent-row:not(.on) {
  opacity: 0.55;
}

.agent-av {
  position: relative;
  flex: none;
}

.presence {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-3);
  box-shadow: 0 0 0 2px var(--bg);
}

.agent-row.on .presence {
  background: var(--st-done);
}

.agent-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.agent-name {
  font-weight: 550;
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-task,
.agent-idle {
  font-size: 12px;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  line-height: 1.35;
}

.agent-task {
  color: var(--text-2);
}

.agent-task:hover {
  color: var(--accent-text);
}

.agent-task .ref {
  font-size: 11px;
  color: inherit;
}

.side-foot {
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 4px;
}

.me-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--text-2);
}

.me-btn:hover,
.me-btn.menu-open {
  background: var(--hover);
  color: var(--text);
}

.me-name {
  flex: 1;
  text-align: left;
  font-weight: 550;
}

/* --------------------------------------------------------------- avatars */

.avatar {
  --size: 24px;
  width: var(--size);
  height: var(--size);
  flex: none;
  display: inline-grid;
  place-items: center;
  position: relative;
  font-weight: 650;
  font-size: calc(var(--size) * 0.42);
  line-height: 1;
  letter-spacing: -0.02em;
  user-select: none;
}

.avatar.human {
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: calc(var(--size) * 0.46);
}

.avatar.agent {
  border-radius: calc(var(--size) * 0.3);
  background: hsl(var(--hue) var(--agent-s) var(--agent-l) / var(--agent-bg-a));
  color: hsl(var(--hue) var(--agent-s) var(--agent-l));
  box-shadow: inset 0 0 0 1px hsl(var(--hue) var(--agent-s) var(--agent-l) / 0.28);
}

.avatar-initials {
  font-size: calc(var(--size) * 0.38);
}

.avatar-spark {
  position: absolute;
  right: calc(var(--size) * -0.14);
  top: calc(var(--size) * -0.14);
  display: grid;
  place-items: center;
  color: hsl(var(--hue) var(--agent-s) var(--agent-l));
  filter: drop-shadow(0 0 1px var(--surface)) drop-shadow(0 0 1px var(--surface));
}

.avatar.system {
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-3);
}

.avatar.empty {
  border-radius: 50%;
  border: 1px dashed var(--border-strong);
}

.who {
  font-weight: 600;
  color: var(--text);
}

.who-agent {
  color: hsl(var(--hue) var(--agent-s) calc(var(--agent-l) - 4%));
}

.who-human {
  color: var(--accent-text);
}

.who-system {
  color: var(--text-3);
}

/* ---------------------------------------------------------- page chrome */

.page-head {
  padding: 26px 32px 14px;
}

.page-head h1 {
  font-size: 22px;
  letter-spacing: -0.025em;
}

.page-head p {
  margin: 4px 0 0;
  color: var(--text-2);
  max-width: 64ch;
}

.page-head.row-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 4px 32px 40px;
}

/* -------------------------------------------------------- project header */

.project-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(200px, 280px);
  gap: 16px;
  align-items: center;
  padding: 22px 28px 18px;
}

.project-emoji {
  width: 48px;
  height: 48px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 700;
  color: var(--pc);
  background: color-mix(in srgb, var(--pc) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pc) 26%, transparent);
}

.project-emoji.small {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 17px;
}

.project-name-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.project-name-row h1 {
  font-size: 22px;
  letter-spacing: -0.025em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-key {
  font: 500 11px/1 var(--mono);
  color: var(--text-3);
  padding: 4px 6px;
  border-radius: 5px;
  background: var(--surface-3);
}

.project-desc {
  margin: 3px 0 0;
  color: var(--text-2);
  max-width: 70ch;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.progress-text {
  display: flex;
  align-items: baseline;
  gap: 4px;
  color: var(--text-2);
  font-size: 13px;
  margin-bottom: 7px;
}

.progress-text strong {
  color: var(--text);
  font-weight: 650;
}

.progress-pct {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}

.progress-bar {
  display: flex;
  gap: 2px;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface-3);
}

.progress-bar .seg {
  min-width: 3px;
  border-radius: 2px;
}

.progress-bar .seg[title^='Todo'] {
  opacity: 0.35;
}

.progress-bar .seg.empty {
  flex: 1;
  background: var(--surface-3);
}

.chip {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
}

/* ---------------------------------------------------------------- toolbar */

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px 12px 28px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  border-radius: 8px;
  background: var(--surface-3);
}

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--text-2);
  font-weight: 550;
  font-size: 13px;
}

.segmented button.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-card);
}

.search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 6px 0 9px;
  border-radius: 8px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border);
  color: var(--text-3);
  width: 220px;
  transition: box-shadow 0.12s, width 0.2s;
}

.search:focus-within {
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft);
  width: 260px;
}

.search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: none;
  color: var(--text);
  font-size: 13px;
}

.search input::-webkit-search-cancel-button {
  display: none;
}

.search:focus-within kbd {
  display: none;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  box-shadow: inset 0 0 0 1px var(--border);
}

.filter-btn:hover,
.filter-btn.menu-open {
  background: var(--hover);
  color: var(--text);
}

.filter-btn.set {
  color: var(--accent-text);
  background: var(--accent-softer);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.filter-x {
  display: inline-grid;
  place-items: center;
  margin-right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 5px;
}

.filter-x:hover {
  background: var(--accent-soft);
}

.toolbar-count {
  color: var(--text-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ board */

.task-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.board {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(252px, 1fr);
  gap: 10px;
  padding: 14px 20px 16px;
  overflow-x: auto;
  background: var(--surface-2);
}

.col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: 12px;
  transition: background 0.12s, box-shadow 0.12s;
}

.col.drop {
  background: var(--accent-softer);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 45%, transparent);
}

.col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 6px 0 8px;
  flex: none;
}

.col-name {
  font-weight: 600;
  font-size: 13px;
}

.col-count {
  color: var(--text-3);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  flex: 1;
}

.col-head .icon-btn {
  width: 24px;
  height: 24px;
  opacity: 0;
}

.col:hover .col-head .icon-btn,
.col-head .icon-btn:focus-visible {
  opacity: 1;
}

.col-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 2px 4px 12px;
  min-height: 60px;
}

.col-empty {
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  height: 64px;
  display: grid;
  place-items: center;
  color: var(--text-3);
  font-size: 12px;
  opacity: 0.8;
}

body:not(.is-dragging) .col-empty {
  border-color: transparent;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 12px 9px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: box-shadow 0.12s, transform 0.12s;
  outline-offset: 1px;
}

.card:hover {
  box-shadow: 0 2px 8px -2px rgba(20, 20, 50, 0.1), 0 0 0 1px var(--border-strong);
}

.card.selected {
  box-shadow: 0 0 0 1.5px var(--accent), 0 4px 14px -6px rgba(124, 92, 255, 0.4);
}

.card.dragging {
  opacity: 0.4;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 20px;
}

.card-title {
  font-size: 13.5px;
  font-weight: 550;
  line-height: 1.38;
  letter-spacing: -0.005em;
  overflow-wrap: anywhere;
}

.col-done .card-title,
.col-cancelled .card-title {
  color: var(--text-2);
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 20px;
  color: var(--text-3);
  font-size: 12px;
}

.meta-prio {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  box-shadow: inset 0 0 0 1px var(--border);
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 6px;
  border-radius: 5px;
  font-size: 11.5px;
  color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--border);
  font-variant-numeric: tabular-nums;
}

.meta-pill.warn {
  color: #b45309;
  background: rgba(245, 158, 11, 0.1);
  box-shadow: none;
}

:root[data-theme='dark'] .meta-pill.warn {
  color: #fbbf24;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .meta-pill.warn {
    color: #fbbf24;
  }
}

.meta-plain {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-variant-numeric: tabular-nums;
}

.meta-more {
  font-size: 11px;
}

.label {
  --hue: 200;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--border);
  white-space: nowrap;
}

.label-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: hsl(var(--hue) 65% 55%);
}

.label-x {
  display: inline-grid;
  place-items: center;
  color: var(--text-3);
  margin-right: -3px;
  width: 14px;
  height: 14px;
  border-radius: 4px;
}

.label-x:hover {
  color: var(--text);
  background: var(--hover);
}

/* ------------------------------------------------------------------- list */

.list {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 32px;
}

.list-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 28px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
}

.list-head .col-count {
  flex: none;
}

.row {
  display: grid;
  grid-template-columns: 20px 64px 18px minmax(0, 1fr) auto 36px 22px 64px;
  gap: 10px;
  align-items: center;
  height: 42px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.08s;
}

.row:hover {
  background: var(--hover);
}

.row.selected {
  background: var(--accent-softer);
  box-shadow: inset 2px 0 0 var(--accent);
}

.row-prio,
.row-status {
  display: inline-grid;
  place-items: center;
}

.row-title {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-labels {
  display: flex;
  gap: 4px;
  overflow: hidden;
}

.row-comments {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--text-3);
  font-size: 12px;
}

.row-time {
  color: var(--text-3);
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ inbox */

.inbox {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 860px;
}

.inbox-item {
  display: flex;
  gap: 14px;
  text-align: left;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.12s, background 0.12s;
}

.inbox-item:hover {
  box-shadow: 0 2px 10px -3px rgba(20, 20, 50, 0.12), 0 0 0 1px var(--border-strong);
}

.inbox-item.selected {
  box-shadow: 0 0 0 1.5px var(--accent);
}

.inbox-lead {
  padding-top: 2px;
}

.inbox-status {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
}

.inbox-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.inbox-top {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
}

.inbox-title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.inbox-quote {
  display: flex;
  gap: 6px;
  font-size: 13.5px;
  color: var(--text-2);
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  line-height: 1.5;
}

.inbox-quote .who {
  flex: none;
}

.quote-text {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.inbox-reasons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.proj-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-2);
  white-space: nowrap;
}

button.proj-tag {
  padding: 3px 7px;
  margin-left: -7px;
  border-radius: 6px;
}

button.proj-tag:hover {
  background: var(--hover);
  color: var(--text);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 550;
  color: var(--sc);
  background: color-mix(in srgb, var(--sc) 12%, transparent);
}

/* ------------------------------------------------------------ comment kind */

.kind {
  --kc: var(--k-note);
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--kc);
  background: color-mix(in srgb, var(--kc) 13%, transparent);
  white-space: nowrap;
}

.kind-progress {
  --kc: var(--k-progress);
}
.kind-question {
  --kc: var(--k-question);
}
.kind-blocker {
  --kc: var(--k-blocker);
}
.kind-review {
  --kc: var(--k-review);
}
.kind-answer {
  --kc: var(--k-answer);
}
.kind-note {
  --kc: var(--k-note);
}

.kind.kind-question {
  color: #b76e00;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .kind.kind-question {
    color: #fbbf24;
  }
}

:root[data-theme='dark'] .kind.kind-question {
  color: #fbbf24;
}

.kind-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--kc);
  display: inline-block;
}

/* --------------------------------------------------------------- activity */

.feed {
  max-width: 820px;
}

.feed-day + .feed-day {
  margin-top: 18px;
}

.feed-date {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  padding: 8px 0 6px;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.feed-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  width: calc(100% + 20px);
  padding: 9px 10px;
  margin: 0 -10px 2px;
  border-radius: 9px;
  text-align: left;
  position: relative;
}

button.feed-item:hover {
  background: var(--hover);
}

.feed-human {
  background: var(--accent-softer);
}

button.feed-human:hover {
  background: var(--accent-soft);
}

.feed-line {
  line-height: 1.5;
  padding-top: 3px;
  color: var(--text-2);
}

.feed-line .ref {
  font-size: 11.5px;
}

.ev-title {
  color: var(--text);
  font-weight: 500;
}

.feed-detail {
  margin-top: 5px;
  display: flex;
  gap: 8px;
  align-items: baseline;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
}

.feed-detail > span:last-child {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.feed-time {
  color: var(--text-3);
  font-size: 12px;
  padding-top: 4px;
  white-space: nowrap;
}

.fresh {
  animation: fresh 2.4s ease-out;
}

@keyframes fresh {
  0%,
  30% {
    background-color: var(--accent-soft);
  }
  100% {
    background-color: transparent;
  }
}

/* ----------------------------------------------------------------- drawer */

.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 20, 0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 20;
}

.drawer {
  position: fixed;
  top: 8px;
  right: 8px;
  bottom: 8px;
  width: var(--drawer-w);
  max-width: calc(100vw - 16px);
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-drawer), 0 0 0 1px var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(calc(100% + 24px));
  transition: transform 0.26s cubic-bezier(0.22, 0.8, 0.24, 1);
  z-index: 21;
  overflow: hidden;
  visibility: hidden;
}

.drawer-open .drawer {
  transform: none;
  visibility: visible;
}

.drawer-open .drawer-scrim {
  opacity: 1;
  pointer-events: auto;
}

.drawer-head {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 52px;
  padding: 0 12px 0 20px;
  border-bottom: 1px solid var(--border);
  flex: none;
}

.crumb-sep {
  color: var(--text-3);
}

.ref-strong {
  color: var(--text-2);
  font-size: 12.5px;
}

.drawer-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.drawer-main {
  padding: 18px 28px 8px;
}

.drawer-loading {
  flex: 1;
  display: grid;
  place-items: center;
}

.title-input {
  width: 100%;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.3;
  padding: 4px 8px;
  margin: 0 -8px 10px;
  border-radius: 8px;
  overflow: hidden;
  width: calc(100% + 16px);
}

.title-input:hover {
  background: var(--hover);
}

.title-input:focus {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.props {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  row-gap: 4px;
  margin-bottom: 14px;
}

.prop {
  display: contents;
}

.prop-label {
  color: var(--text-3);
  font-size: 13px;
  line-height: 30px;
}

.prop-value {
  min-height: 30px;
  display: flex;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 9px;
  margin-left: -9px;
  border-radius: 7px;
  font-weight: 550;
  font-size: 13px;
  white-space: nowrap;
}

.pill:hover,
.pill.menu-open {
  background: var(--hover);
}

.pill.muted {
  color: var(--text-3);
  font-weight: 500;
}

.label-editor {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 28px;
}

.label-input {
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12.5px;
  color: var(--text-2);
  height: 22px;
  padding: 0 4px;
  border-radius: 5px;
  min-width: 60px;
}

.label-input:focus {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.label-input::placeholder {
  color: var(--text-3);
}

.lease {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  border-radius: 10px;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--text-2);
  background: color-mix(in srgb, var(--st-in_progress) 8%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--st-in_progress) 22%, transparent);
}

.lease .time {
  color: var(--text-2);
}

.lease-left {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  color: var(--st-in_progress);
  font-variant-numeric: tabular-nums;
}

.lease.expired {
  background: color-mix(in srgb, var(--st-blocked) 8%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--st-blocked) 25%, transparent);
}

.lease.expired .lease-left {
  color: var(--st-blocked);
}

.block {
  padding: 14px 0 6px;
  border-top: 1px solid var(--border);
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  min-height: 26px;
}

.block-head h2,
.thread-head h2 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.block-head .time {
  color: var(--text-3);
  font-size: 12px;
}

.placeholder {
  color: var(--text-3);
  padding: 6px 0 10px;
  font-size: 14px;
}

.placeholder:hover {
  color: var(--text-2);
}

.textarea,
.field input,
.field textarea {
  width: 100%;
  border: 0;
  outline: 0;
  border-radius: 9px;
  padding: 9px 11px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
  transition: box-shadow 0.12s;
}

.textarea:focus,
.field input:focus,
.field textarea:focus {
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft);
  background: var(--surface);
}

.textarea {
  min-height: 140px;
  font-family: var(--font);
}

.editor-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 8px;
}

.editor-actions kbd {
  margin-left: 2px;
}

.dep-group {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.dep-label {
  width: 88px;
  color: var(--text-3);
  font-size: 13px;
  line-height: 28px;
  flex: none;
}

.dep {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  max-width: 100%;
  box-shadow: inset 0 0 0 1px var(--border);
  font-size: 13px;
}

.dep:hover {
  background: var(--hover);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.dep-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 300px;
}

.dep.done .dep-title,
.dep.cancelled .dep-title {
  color: var(--text-3);
  text-decoration: line-through;
  text-decoration-color: var(--border-strong);
}

.result .md {
  padding: 10px 12px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--st-done) 7%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--st-done) 20%, transparent);
}

.created-by {
  color: var(--text-3);
  font-size: 12px;
  margin: 10px 0 4px;
}

.created-by .who {
  font-weight: 550;
}

.version {
  font-family: var(--mono);
  font-size: 11px;
  margin-left: 4px;
}

/* --------------------------------------------------------------- markdown */

.md {
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.md > :first-child {
  margin-top: 0;
}

.md > :last-child {
  margin-bottom: 0;
}

.md p,
.md ul,
.md ol,
.md pre,
.md blockquote {
  margin: 0 0 0.7em;
}

.md ul,
.md ol {
  padding-left: 1.35em;
}

.md li + li {
  margin-top: 2px;
}

.md li::marker {
  color: var(--text-3);
}

.md h3,
.md h4,
.md h5,
.md h6,
.md h7,
.md h8 {
  font-size: 14px;
  font-weight: 650;
  margin: 1em 0 0.4em;
}

.md h3 {
  font-size: 15.5px;
}

.md code {
  font: 0.86em/1 var(--mono);
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--surface-3);
}

.md pre.code {
  padding: 11px 13px;
  border-radius: 9px;
  background: var(--surface-3);
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.55;
}

.md pre.code code {
  background: none;
  padding: 0;
  font-size: inherit;
  line-height: inherit;
  white-space: pre;
}

.md blockquote {
  padding-left: 12px;
  border-left: 3px solid var(--border-strong);
  color: var(--text-2);
}

.md hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1em 0;
}

.md strong {
  font-weight: 650;
}

.md a {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 2px;
}

.md a.ref-link {
  font: 500 0.88em var(--mono);
  text-decoration: none;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--accent-softer);
}

.check-item {
  list-style: none;
  margin-left: -1.35em;
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.check-box {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1.5px var(--border-strong);
  display: inline-grid;
  place-items: center;
  flex: none;
  transform: translateY(2px);
}

.check-box.on {
  background: var(--st-done);
  box-shadow: none;
  color: #fff;
}

/* ----------------------------------------------------------------- thread */

.thread {
  padding: 4px 28px 20px;
  border-top: 1px solid var(--border);
  background: linear-gradient(var(--surface-2), var(--surface-2)) padding-box;
  min-height: 180px;
}

.thread-head {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  position: sticky;
  top: 0;
  background: var(--surface-2);
  z-index: 2;
  margin: 0 -28px;
  padding: 0 28px;
}

.thread-count {
  font-size: 12px;
  color: var(--text-3);
}

.thread-empty {
  color: var(--text-3);
  text-align: center;
  padding: 24px 12px;
  max-width: 44ch;
  margin: 0 auto;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  width: 26px;
  height: 16px;
  border-radius: 8px;
  background: var(--border-strong);
  position: relative;
  transition: background 0.15s;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}

.switch input:checked + .switch-track {
  background: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(10px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.messages {
  display: flex;
  flex-direction: column;
  padding-top: 4px;
}

.msg {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  max-width: 100%;
  border-radius: 12px;
}

.msg.grouped {
  margin-top: 4px;
}

.msg-av {
  width: 30px;
  flex: none;
  padding-top: 2px;
}

.msg-col {
  min-width: 0;
  max-width: min(560px, 86%);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  min-height: 20px;
}

.msg-head .time {
  color: var(--text-3);
  font-size: 12px;
}

.bubble {
  padding: 9px 13px;
  border-radius: 4px 14px 14px 14px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.msg.grouped.agent .bubble {
  border-radius: 14px;
}

.bubble .md {
  font-size: 14px;
  line-height: 1.55;
}

.msg-question .bubble {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--k-question) 50%, transparent), 0 2px 10px -4px color-mix(in srgb, var(--k-question) 40%, transparent);
  background: color-mix(in srgb, var(--k-question) 5%, var(--surface));
}

.msg-blocker .bubble {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--k-blocker) 50%, transparent), 0 2px 10px -4px color-mix(in srgb, var(--k-blocker) 40%, transparent);
  background: color-mix(in srgb, var(--k-blocker) 5%, var(--surface));
}

.msg.mine {
  flex-direction: row-reverse;
  align-self: flex-end;
}

.msg.mine .msg-col {
  align-items: flex-end;
}

.msg.mine .msg-head {
  flex-direction: row-reverse;
}

.msg.mine .bubble {
  background: var(--accent);
  color: #fff;
  border-radius: 14px 4px 14px 14px;
  box-shadow: 0 1px 2px rgba(60, 30, 180, 0.25);
}

.msg.mine.grouped .bubble {
  border-radius: 14px;
}

.msg.mine .bubble .md a {
  color: #fff;
  text-decoration-color: rgba(255, 255, 255, 0.6);
}

.msg.mine .bubble .md code,
.msg.mine .bubble .md pre.code {
  background: rgba(255, 255, 255, 0.16);
}

.msg.mine .bubble .md a.ref-link {
  background: rgba(255, 255, 255, 0.18);
}

.msg.mine .bubble .md blockquote {
  color: rgba(255, 255, 255, 0.85);
  border-color: rgba(255, 255, 255, 0.4);
}

.msg.mine .bubble .md li::marker {
  color: rgba(255, 255, 255, 0.7);
}

.msg.fresh .bubble {
  animation: fresh-bubble 2.6s ease-out;
}

@keyframes fresh-bubble {
  0%,
  25% {
    box-shadow: 0 0 0 2px var(--accent), 0 6px 20px -6px rgba(124, 92, 255, 0.5);
  }
}

.msg.fresh {
  animation: arrive 0.32s cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.sys-line,
.ev-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 12px auto 0;
  max-width: 90%;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.sys-line {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-3);
}

.sys-line .time,
.ev-line .time {
  flex: none;
  opacity: 0.8;
}

.ev-line {
  margin-top: 10px;
}

.ev-line .who {
  font-weight: 550;
}

.ev-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.ev-dot[style] {
  background: hsl(var(--hue) var(--agent-s) var(--agent-l));
}

.ev-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ev-detail {
  color: var(--text-3);
}

/* --------------------------------------------------------------- composer */

.composer {
  flex: none;
  padding: 10px 16px 14px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

.composer-box {
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.12s;
}

.composer-box:focus-within {
  box-shadow: 0 0 0 1px var(--accent), 0 0 0 4px var(--accent-soft);
}

.composer textarea {
  display: block;
  width: 100%;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  padding: 11px 14px 4px;
  min-height: 44px;
  max-height: 200px;
  line-height: 1.5;
}

.composer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 6px 8px;
}

.kind-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 8px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}

.kind-picker:hover,
.kind-picker.menu-open {
  background: var(--hover);
}

.send {
  gap: 4px;
}

/* ------------------------------------------------------------------ menus */

.menu {
  position: fixed;
  inset: auto;
  margin: 0;
  border: 0;
  color: var(--text);
  overflow: visible;
  z-index: 100;
  min-width: 200px;
  max-width: 300px;
  padding: 4px;
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  outline: 0;
  animation: pop 0.12s ease-out;
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(-2px);
  }
}

.menu-search {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 7px 9px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  font-size: 13px;
}

.menu-list {
  max-height: 320px;
  overflow-y: auto;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border-radius: 6px;
  text-align: left;
  font-size: 13px;
}

.menu-item:hover,
.menu-item.hover {
  background: var(--hover);
}

.menu-item.danger {
  color: var(--st-blocked);
}

.menu-icon {
  width: 18px;
  display: inline-grid;
  place-items: center;
  color: var(--text-3);
  flex: none;
}

.menu-item.danger .menu-icon {
  color: inherit;
}

.menu-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-check {
  color: var(--accent-text);
  display: inline-grid;
}

.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px -4px;
}

.menu-header {
  padding: 6px 8px 4px;
  font-size: 12px;
  color: var(--text-3);
}

.menu-emoji {
  display: inline-grid;
  place-items: center;
  width: 18px;
  font-size: 14px;
  line-height: 1;
}

/* ----------------------------------------------------------------- modals */

.modal {
  border: 0;
  padding: 0;
  width: min(520px, calc(100vw - 24px));
  max-height: calc(100dvh - 48px);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-pop);
}

.modal.wide {
  width: min(680px, calc(100vw - 24px));
}

.modal[open] {
  animation: modal-in 0.18s cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}

.modal::backdrop {
  background: rgba(12, 10, 24, 0.36);
  backdrop-filter: blur(2px);
}

.modal-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 48px);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 4px 20px;
}

.modal-head h2 {
  font-size: 14px;
  color: var(--text-2);
  font-weight: 600;
}

.modal-body {
  padding: 8px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 14px 20px;
  border-top: 1px solid var(--border);
}

.modal-text {
  margin: 0;
  color: var(--text-2);
}

.task-modal .modal-body {
  gap: 6px;
}

.title-field {
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.02em;
  padding: 4px 0;
}

.body-field {
  border: 0;
  outline: 0;
  resize: vertical;
  background: transparent;
  font-size: 14px;
  line-height: 1.55;
  padding: 4px 0;
  min-height: 110px;
  color: var(--text);
}

.title-field::placeholder,
.body-field::placeholder {
  color: var(--text-3);
}

.picker-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 8px;
}

.picker-row .pill {
  margin-left: 0;
  box-shadow: inset 0 0 0 1px var(--border);
  height: 28px;
  font-size: 12.5px;
}

.label-editor.in-modal {
  padding-left: 4px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-2);
}

.field-row {
  display: flex;
  gap: 12px;
}

.field.grow {
  flex: 1;
}

.key-field {
  width: 110px;
}

.key-field input {
  font-family: var(--mono);
  text-transform: uppercase;
}

.field input:disabled {
  opacity: 0.6;
}

.project-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
}

.preview-name {
  font-weight: 600;
  font-size: 15px;
}

.emoji-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.field input.emoji-input {
  width: 48px;
  text-align: center;
  font-size: 18px;
  padding: 5px;
}

.emoji-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}

.emoji-pick {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 17px;
  display: grid;
  place-items: center;
}

.emoji-pick:hover {
  background: var(--hover);
}

.emoji-pick.on {
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
  transition: transform 0.1s;
}

.swatch:hover {
  transform: scale(1.1);
}

.swatch.on {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c);
}

/* ----------------------------------------------------------------- toasts */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 14px;
  border-radius: 10px;
  background: #1d1d26;
  color: #f2f2f6;
  font-size: 13px;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  animation: toast-in 0.22s cubic-bezier(0.2, 0.8, 0.3, 1);
  max-width: 520px;
}

.toast:not(:has(.toast-action)) {
  padding-right: 14px;
}

:root[data-theme='dark'] .toast {
  background: #2a2a35;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .toast {
    background: #2a2a35;
  }
}

.toast.leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--st-blocked);
  flex: none;
}

.toast-action {
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 600;
  font-size: 12px;
}

.toast-action:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ------------------------------------------------------- empty & loading */

.empty-state {
  margin: auto;
  padding: 56px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 420px;
}

.empty-state h2 {
  font-size: 17px;
}

.empty-state p {
  margin: 0 0 8px;
  color: var(--text-2);
}

.empty-art {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--st-done) 10%, transparent);
  margin-bottom: 6px;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-3);
  padding: 40px;
  font-size: 13px;
}

.loading.full {
  flex: 1;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------------------------------------------------------------- sign in */

.signin {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(600px 400px at 50% 0%, var(--accent-soft), transparent 70%),
    var(--bg);
  overflow-y: auto;
}

.signin-card {
  width: min(380px, 100%);
  padding: 32px 28px 24px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.signin-mark {
  margin-bottom: 4px;
}

.signin-card h1 {
  font-size: 21px;
  letter-spacing: -0.025em;
}

.signin-sub {
  margin: -6px 0 4px;
  color: var(--text-2);
  line-height: 1.5;
}

.signin-sub code {
  font: 12px var(--mono);
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--surface-3);
}

.signin-error {
  margin: -4px 0 0;
  min-height: 1em;
  color: var(--st-blocked);
  font-size: 13px;
}

.signin-error:empty {
  display: none;
}

.signin-foot {
  margin: 0;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .project-head {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .project-head .progress {
    grid-column: 1 / -1;
  }

  .row {
    grid-template-columns: 20px 64px 18px minmax(0, 1fr) 36px 22px 64px;
  }

  .row-labels {
    display: none;
  }
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    background: var(--bg);
    z-index: 30;
    transform: translateX(-100%);
    transition: transform 0.24s cubic-bezier(0.22, 0.8, 0.24, 1);
    box-shadow: 0 0 0 1px var(--border);
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .sheet-open .sidebar {
    transform: none;
  }

  .sheet-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 20, 0.3);
    z-index: 29;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }

  .sheet-open .sheet-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .main {
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .topbar {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    padding: 0 10px;
    padding-top: env(safe-area-inset-top);
    border-bottom: 1px solid var(--border);
    flex: none;
  }

  .top-title {
    font-weight: 600;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-head,
  .project-head {
    padding: 16px 16px 10px;
  }

  .page-head h1 {
    display: none;
  }

  .page-head p {
    margin: 0;
  }

  .page-scroll {
    padding: 4px 16px 32px;
  }

  .project-emoji {
    width: 40px;
    height: 40px;
    font-size: 22px;
    border-radius: 11px;
  }

  .project-name-row h1 {
    font-size: 19px;
  }

  .toolbar {
    padding: 8px 16px 10px;
    gap: 6px;
  }

  .search,
  .search:focus-within {
    order: 10;
    width: 100%;
  }

  .search kbd,
  .btn kbd,
  .toolbar-count {
    display: none;
  }

  .board {
    grid-auto-columns: minmax(80vw, 1fr);
    scroll-snap-type: x mandatory;
    padding: 12px 12px 16px;
  }

  .col {
    scroll-snap-align: start;
  }

  .row {
    grid-template-columns: 18px minmax(0, 1fr) 20px;
    height: auto;
    min-height: 46px;
    padding: 8px 16px;
    gap: 10px;
  }

  .row-ref,
  .row-status,
  .row-labels,
  .row-comments,
  .row-time {
    display: none;
  }

  .row-title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .list-head {
    padding: 0 16px;
  }

  .drawer {
    inset: 0;
    width: 100%;
    max-width: none;
    border-radius: 0;
  }

  .drawer-head {
    padding: 0 8px 0 16px;
    padding-top: env(safe-area-inset-top);
    height: calc(50px + env(safe-area-inset-top));
  }

  .drawer-main {
    padding: 14px 16px 8px;
  }

  .thread {
    padding: 4px 16px 16px;
  }

  .thread-head {
    margin: 0 -16px;
    padding: 0 16px;
  }

  .composer {
    padding: 8px 10px max(10px, env(safe-area-inset-bottom));
  }

  .composer .hint {
    display: none;
  }

  .props {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .msg-col {
    max-width: 88%;
  }

  .dep-title {
    max-width: 180px;
  }

  .feed-item {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .feed-time {
    grid-column: 2;
    padding-top: 0;
  }

  .field-row {
    flex-direction: column;
  }

  .key-field {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .btn-text {
    display: none;
  }

  .filter-btn span:not(.filter-x) {
    display: none;
  }

  .filter-btn.set span {
    display: inline;
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------------------------------------------------------- screenshots */

.shots {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 160px));
  gap: 6px;
  margin: 4px 0;
}
.shots.single { grid-template-columns: minmax(0, 320px); }
.msg.mine .shots { justify-content: end; }
.shot {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  background: var(--hover);
  box-shadow: 0 0 0 1px var(--border);
  aspect-ratio: 4 / 3;
}
.shots.single .shot { aspect-ratio: auto; max-height: 360px; }
.shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}
.shots.single .shot img { object-fit: contain; max-height: 360px; }
.shot:hover img { transform: scale(1.02); }

.composer .attach { padding: 4px 8px; color: var(--text-2, inherit); }
.composer.dropping .composer-box {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
  background: var(--accent-softer);
}
.pending {
  display: flex;
  gap: 8px;
  padding: 8px 8px 2px;
  overflow-x: auto;
}
.pending-shot {
  position: relative;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 10px;
  overflow: visible;
}
.pending-shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 0 0 1px var(--border);
}
.pending-x {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: var(--text);
  color: var(--surface);
  cursor: pointer;
}

/* Markdown tables in task text and comments */
.md-table { overflow-x: auto; margin: 6px 0; }
.md-table table { border-collapse: collapse; font-size: 0.92em; }
.md-table th, .md-table td { padding: 5px 12px 5px 0; text-align: left; vertical-align: top; }
.md-table th { font-weight: 600; border-bottom: 1px solid var(--border-strong); }
.md-table tr + tr td { border-top: 1px solid var(--border); }

/* An agent's `agt done` report in the thread */
.report-card {
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}
.report-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 13px;
}
.report-by { color: var(--text-2, inherit); opacity: 0.75; }
.report-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--hover);
}
.report-icon.ok { background: var(--st-done); color: var(--on-solid); }
.report-card .time { font-size: 12px; opacity: 0.7; }
