:root {
  color-scheme: dark;
  --canvas: #0e100f;
  --sidebar: #111312;
  --surface: #151716;
  --surface-raised: #191b1a;
  --surface-hover: #1d201e;
  --line: #2a2e2b;
  --line-strong: #3a3f3b;
  --text: #f1f3f1;
  --text-soft: #c0c5c1;
  --muted: #858b87;
  --muted-2: #626863;
  --focus: #f1f3f1;
  --running: #78a9ff;
  --warning: #d8a84e;
  --danger: #e36a62;
  --success: #69b384;
  --sidebar-width: 228px;
  --topbar-height: 60px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--canvas);
  color: var(--text);
}

body,
button,
input,
textarea,
select {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

button,
input,
textarea,
select {
  font-size: inherit;
}

button {
  color: inherit;
}

button,
[role="button"],
input,
textarea,
select {
  outline: none;
}

button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.path,
.task-id,
.run-code,
.log,
.card-path,
.path-input,
.workspace-input {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.app-frame {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
}

.main-area {
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  z-index: 20;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface-raised);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.side-brand > div:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.side-brand strong {
  font-size: 14px;
  letter-spacing: -.01em;
}

.side-brand span {
  color: var(--muted);
  font-size: 11px;
}

.nav {
  overflow-y: auto;
  padding: 12px 10px 20px;
}

.nav-group + .nav-group {
  margin-top: 20px;
}

.nav-group h2 {
  margin: 0 8px 7px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 500;
}

.nav-item {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 7px 9px;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
}

.nav-item:hover {
  background: var(--surface);
  color: var(--text-soft);
}

.nav-item.active {
  border-color: var(--line);
  background: var(--surface-raised);
  color: var(--text);
}

.nav-count {
  min-width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  margin-left: auto;
  border: 1px solid color-mix(in srgb, var(--warning) 45%, var(--line));
  border-radius: 10px;
  color: var(--warning);
  font-size: 10px;
}

.side-foot {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.hub-state {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hub-state > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.hub-state strong {
  font-size: 11px;
  font-weight: 600;
}

.hub-state span {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  width: 7px;
  height: 7px;
  display: inline-block;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted-2);
}

.status-dot.success,
.hub-state > .status-dot {
  background: var(--success);
}

.status-dot.running {
  background: var(--running);
}

.status-dot.warning {
  background: var(--warning);
}

.status-dot.danger {
  background: var(--danger);
}

.status-dot.neutral {
  background: var(--muted-2);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--canvas);
}

.top-context {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.top-context h1 {
  margin: 0;
  font-size: 14px;
  font-weight: 620;
}

.top-context span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions,
.compact-status {
  display: flex;
  align-items: center;
}

.top-actions {
  gap: 14px;
}

.compact-status {
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.btn {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface-raised);
  color: var(--text-soft);
  padding: 7px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 550;
}

.btn:hover:not(:disabled) {
  border-color: #505650;
  background: var(--surface-hover);
  color: var(--text);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.btn.primary {
  border-color: var(--text);
  background: var(--text);
  color: #111312;
}

.btn.primary:hover:not(:disabled) {
  border-color: #d7dad8;
  background: #d7dad8;
  color: #111312;
}

.btn.subtle {
  background: transparent;
}

.btn.danger {
  border-color: color-mix(in srgb, var(--danger) 50%, var(--line));
  background: transparent;
  color: var(--danger);
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 3px;
  cursor: pointer;
  font-size: 11px;
}

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

.text-button:disabled {
  cursor: not-allowed;
  opacity: .42;
}

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

.danger-text:hover:not(:disabled) {
  color: #f08a82;
}

.page {
  width: 100%;
  min-height: calc(100vh - var(--topbar-height));
  padding: 30px 32px 60px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.section-heading > div:first-child {
  min-width: 0;
}

.section-context {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
}

.section-heading h2,
.today-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  font-weight: 620;
  letter-spacing: -.025em;
}

.section-heading p,
.today-head p {
  max-width: 680px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.today-page {
  max-width: 1220px;
  margin: 0 auto;
}

.today-head {
  margin: 4px 0 18px;
}

.composer {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.composer:focus-within {
  border-color: #555b56;
}

.composer-input {
  width: 100%;
  min-height: 92px;
  display: block;
  resize: vertical;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

.composer.compact .composer-input {
  min-height: 62px;
}

.composer-input::placeholder,
.input::placeholder,
.control::placeholder {
  color: var(--muted-2);
}

.composer-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.control,
.input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--canvas);
  color: var(--text-soft);
  padding: 8px 10px;
}

.control:focus,
.input:focus {
  border-color: var(--line-strong);
}

.provider-select {
  width: 105px;
}

.workspace-input {
  min-width: 0;
  flex: 1;
}

.composer-foot .btn {
  flex: 0 0 auto;
}

.today-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.module {
  min-width: 0;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 15px;
}

.module-head {
  min-height: 28px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 0 1px 10px;
}

.module-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 620;
}

.summary-row {
  width: 100%;
  min-height: 48px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  padding: 9px 2px;
  cursor: pointer;
  text-align: left;
}

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

.summary-copy {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.summary-copy strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 560;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-copy small,
.row-time {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-arrow {
  color: var(--muted-2);
  font-size: 18px;
}

.status-pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  padding: 4px 7px;
  font-size: 10px;
  white-space: nowrap;
}

.status-pill.running {
  border-color: color-mix(in srgb, var(--running) 35%, var(--line));
  color: var(--running);
}

.status-pill.warning {
  border-color: color-mix(in srgb, var(--warning) 35%, var(--line));
  color: var(--warning);
}

.status-pill.danger {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  color: var(--danger);
}

.status-pill.success {
  border-color: color-mix(in srgb, var(--success) 35%, var(--line));
  color: var(--success);
}

.status-pill.running .status-dot {
  background: var(--running);
}

.status-pill.warning .status-dot {
  background: var(--warning);
}

.status-pill.danger .status-dot {
  background: var(--danger);
}

.status-pill.success .status-dot {
  background: var(--success);
}

.provider-label,
.scope-label {
  width: fit-content;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.provider-label {
  min-width: 42px;
}

.health-row {
  min-height: 42px;
  display: grid;
  grid-template-columns: auto minmax(90px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.health-row strong {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 550;
}

.health-detail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  min-height: 130px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
  padding: 24px;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
}

.compact-empty {
  min-height: 150px;
}

.segmented {
  width: fit-content;
  display: flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 2px;
}

.segment {
  min-height: 30px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  padding: 5px 10px;
  cursor: pointer;
  font-size: 11px;
}

.segment:hover {
  color: var(--text-soft);
}

.segment.active {
  background: var(--surface-hover);
  color: var(--text);
}

.activity-list {
  display: grid;
  gap: 8px;
}

.activity-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(280px, 1.5fr) minmax(240px, 1fr) auto;
  align-items: center;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 14px;
  cursor: pointer;
}

.activity-row:hover {
  border-color: var(--line-strong);
  background: var(--surface-raised);
}

.activity-main {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 5px 10px;
}

.activity-main strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 580;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-main p {
  grid-column: 2;
  overflow: hidden;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-meta {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  color: var(--muted);
  font-size: 10px;
}

.activity-meta .path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.run-code {
  max-width: 100px;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 9px;
  text-overflow: ellipsis;
}

.work-controls {
  display: flex;
  align-items: center;
  gap: 14px;
}

.work-count {
  color: var(--muted);
  font-size: 11px;
}

.work-filters {
  display: grid;
  grid-template-columns: minmax(220px, 420px) 150px;
  gap: 8px;
  margin-bottom: 12px;
}

.work-search,
.work-status-filter {
  min-height: 36px;
}

.task-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.task-list-head,
.task-list-row {
  display: grid;
  grid-template-columns: minmax(250px, 1.35fr) 110px 90px minmax(180px, 1fr) 88px;
  align-items: center;
  gap: 14px;
}

.task-list-head {
  min-height: 38px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  padding: 0 14px;
  font-size: 10px;
}

.task-list-row {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text-soft);
  padding: 9px 14px;
  cursor: pointer;
  text-align: left;
  font-size: 11px;
}

.task-list-row:last-child {
  border-bottom: 0;
}

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

.task-list-title {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.task-list-title strong {
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 560;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-list-title small {
  color: var(--muted);
  font-size: 9px;
}

.task-list-row > .path {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board {
  display: grid;
  grid-template-columns: repeat(6, minmax(235px, 1fr));
  gap: 9px;
  overflow-x: auto;
  padding-bottom: 14px;
}

.board-column {
  min-height: 540px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 9px;
}

.board-column.dragover {
  border-color: var(--line-strong);
  background: var(--surface-raised);
}

.board-column-head {
  min-height: 37px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0 3px 8px;
  color: var(--text-soft);
  font-size: 11px;
}

.count {
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 9px;
}

.board-cards {
  display: grid;
  align-content: start;
  gap: 7px;
  padding-top: 8px;
}

.task-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-raised);
  padding: 11px;
  cursor: pointer;
}

.task-card:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
}

.task-card.running {
  border-left: 2px solid var(--running);
}

.task-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.task-id {
  color: var(--muted-2);
  font-size: 9px;
}

.priority {
  color: var(--muted);
  font-size: 9px;
}

.priority.P0 {
  color: var(--danger);
}

.priority.P1 {
  color: var(--warning);
}

.task-card h3 {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 12px;
  font-weight: 560;
  line-height: 1.45;
}

.task-meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  color: var(--muted);
  font-size: 9px;
}

.task-meta .path {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.board-empty {
  min-height: 72px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted-2);
  font-size: 10px;
}

.chat-page {
  height: calc(100vh - var(--topbar-height));
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
}

.chat-list {
  overflow-y: auto;
  border-right: 1px solid var(--line);
  padding: 14px 10px;
}

.chat-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 10px;
}

.chat-list-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
}

.chat-list-item {
  width: 100%;
  display: grid;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 9px;
  cursor: pointer;
  text-align: left;
}

.chat-list-item:hover,
.chat-list-item.active {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.chat-list-item strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-list-item small {
  color: var(--muted);
  font-size: 9px;
}

.chat-room {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 20px;
}

.mobile-chat-picker {
  display: none;
}

.new-conversation {
  width: min(760px, 100%);
  align-self: center;
  justify-self: center;
}

.new-conversation h2 {
  margin: 0;
  font-size: 22px;
}

.new-conversation > p {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 12px;
}

.chat-room-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  border-bottom: 1px solid var(--line);
  padding: 0 2px 14px;
}

.chat-room-head > div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.chat-room-head strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-room-head .path {
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-stream {
  min-height: 0;
  overflow-y: auto;
  padding: 22px max(0px, calc((100% - 760px) / 2));
}

.message {
  max-width: 82%;
  margin-bottom: 16px;
}

.message small {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
}

.message > div {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 11px 13px;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.message.user {
  margin-left: auto;
}

.message.user > div {
  border-color: var(--line-strong);
  background: var(--surface-raised);
  color: var(--text);
}

.thinking {
  color: var(--running);
  font-size: 11px;
}

.resource-grid,
.connection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.resource-card,
.connection-card,
.memory-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 15px;
}

.agent-builder,
.squad-builder {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
  background: var(--surface-raised);
}

.agent-builder-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.resource-section-title {
  margin: 26px 0 12px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 600;
}

.boundary-note,
.loop-readonly-notice {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  padding: 11px 13px;
  font-size: 11px;
  line-height: 1.55;
}

.skill-picker {
  overflow: hidden;
  min-height: 114px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--canvas);
}

.skill-search {
  width: 100%;
  min-height: 36px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text-soft);
  padding: 8px 10px;
}

.skill-options {
  max-height: 77px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 8px;
  overflow-y: auto;
  padding: 6px;
}

.skill-option {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  border-radius: 4px;
  color: var(--muted);
  padding: 4px;
  cursor: pointer;
  font-size: 10px;
}

.skill-option:hover {
  background: var(--surface-hover);
  color: var(--text-soft);
}

.skill-option input {
  accent-color: var(--text);
}

.skill-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-picker-empty {
  grid-column: 1 / -1;
  color: var(--muted-2);
  padding: 5px;
  font-size: 10px;
}

.boundary-note {
  margin-top: 12px;
}

.resource-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.agent-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface-raised);
  font-size: 13px;
  font-weight: 650;
}

.resource-card h3 {
  margin: 17px 0 5px;
  font-size: 15px;
  font-weight: 600;
}

.agent-role {
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 500;
}

.resource-card p {
  margin: 10px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.card-divider {
  height: 1px;
  margin: 14px 0 10px;
  background: var(--line);
}

.card-meta-copy {
  color: var(--muted);
  font-size: 10px;
}

.skill-card .scope-label {
  display: block;
  margin-bottom: 8px;
}

.skill-card h3 {
  margin-top: 0;
}

.card-path {
  display: block;
  overflow: hidden;
  color: var(--muted-2);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-form,
.automation-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.inline-form .input {
  flex: 1;
}

.knowledge-panel {
  max-width: 920px;
}

.memory-list,
.automation-list {
  display: grid;
  gap: 8px;
}

.memory-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.memory-card p {
  margin: 7px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.55;
}

.automation-form .input {
  flex: 1;
}

.automation-form .path-input {
  min-width: 220px;
}

.automation-form .interval-input {
  width: 86px;
  flex: 0 0 auto;
}

.automation-row {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) minmax(150px, auto) auto auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 13px;
}

.automation-copy {
  min-width: 0;
}

.automation-copy strong {
  font-size: 12px;
}

.automation-copy p {
  overflow: hidden;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.automation-schedule {
  display: grid;
  gap: 4px;
  color: var(--text-soft);
  font-size: 10px;
}

.automation-schedule small {
  color: var(--muted);
}

.infra-stack {
  display: grid;
  gap: 26px;
}

.infra-section > h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
}

.setup-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.setup-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 15px;
}

.setup-panel > strong {
  font-size: 12px;
  font-weight: 580;
}

.setup-panel > p {
  margin: 7px 0 14px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.runner-pair-panel {
  max-width: 720px;
}

.runner-advanced {
  margin-top: 12px;
}

.runner-advanced > summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 12px;
}

.infra-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.workspace-setup-form {
  grid-template-columns: minmax(110px, .7fr) minmax(130px, 1fr) minmax(130px, 1fr) auto;
}

.secret-box {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.secret-box code {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--warning);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.secret-hint {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.connection-card {
  min-height: 110px;
}

.connection-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
}

.connection-head strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 580;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-head span {
  color: var(--muted);
  font-size: 10px;
}

.connection-card p {
  margin: 14px 0 0 16px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 9px;
  line-height: 1.55;
}

.runner-card {
  display: grid;
  align-content: start;
}

.runner-card.revoked {
  border-color: color-mix(in srgb, var(--danger) 28%, var(--line));
}

.runner-credential-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 0 16px;
  color: var(--muted-2);
  font-size: 9px;
}

.runner-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.runner-token-reveal {
  margin-top: 10px;
  border: 1px solid color-mix(in srgb, var(--warning) 32%, var(--line));
  border-radius: 6px;
  background: color-mix(in srgb, var(--warning) 5%, var(--surface-raised));
  padding: 10px;
}

.runner-token-reveal > strong,
.runner-token-reveal > small {
  display: block;
}

.runner-token-reveal > strong {
  color: var(--text-soft);
  font-size: 10px;
}

.runner-token-reveal > small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.45;
}

.runner-token-reveal .secret-box {
  flex-wrap: wrap;
}

.device-card {
  display: grid;
  align-content: start;
}

.device-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 0 16px;
  color: var(--muted);
  font-size: 9px;
}

.device-meta .run-code {
  overflow: hidden;
  color: var(--muted-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-pair-card > p {
  font-family: inherit;
  font-size: 10px;
}

.device-pair-card > .btn {
  width: fit-content;
  margin: 14px 0 0 16px;
}

.pairing-reveal {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.pairing-code-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pairing-code {
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: .18em;
}

.pairing-details {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 6px 10px;
  margin: 12px 0 0;
  font-size: 9px;
  line-height: 1.5;
}

.pairing-details dt {
  color: var(--muted-2);
}

.pairing-details dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--text-soft);
}

.pairing-reveal > small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, .68);
}

.modal {
  position: fixed;
  z-index: 41;
  top: 50%;
  left: 50%;
  width: min(580px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  transform: translate(-50%, -50%);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  padding: 20px;
}

.modal-head,
.drawer-head-top,
.run-head,
.run-head-actions,
.review-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.modal h2,
.drawer h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 620;
  letter-spacing: -.02em;
}

.form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.field {
  display: grid;
  gap: 7px;
}

.field label {
  color: var(--muted);
  font-size: 11px;
}

textarea.input {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}

.form-row {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.drawer {
  position: fixed;
  z-index: 41;
  top: 0;
  right: 0;
  width: min(680px, 100vw);
  height: 100vh;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  border-left: 1px solid var(--line-strong);
  background: var(--canvas);
}

.drawer-head {
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  margin: 13px 0 8px;
}

.detail-list {
  display: grid;
  grid-template-columns: 120px 120px minmax(0, 1fr);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.detail-item {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 12px 16px;
  border-right: 1px solid var(--line);
}

.detail-item:last-child {
  border-right: 0;
}

.detail-item span {
  color: var(--muted);
  font-size: 9px;
}

.detail-item strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-body {
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px;
}

.detail-section + .detail-section {
  margin-top: 24px;
}

.detail-section > h3,
.run-head h3 {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 550;
}

.description {
  margin: 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.run-head {
  margin-bottom: 9px;
}

.run-head h3 {
  margin: 0;
}

.log {
  min-height: 220px;
  max-height: 48vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0a0c0b;
  color: #b9bfba;
  padding: 12px;
  font-size: 10px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-line + .log-line {
  border-top: 1px solid #1c201d;
  padding-top: 5px;
}

.log-line.tool {
  color: var(--running);
}

.log-line.stderr {
  color: var(--danger);
}

.log-line.status {
  color: var(--warning);
}

.log-line.result {
  color: var(--success);
}

.artifact-list {
  display: grid;
  gap: 7px;
}

.artifact-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.artifact-item[open] {
  border-color: var(--line-strong);
}

.artifact-summary {
  min-height: 38px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
}

.artifact-summary::-webkit-details-marker {
  display: none;
}

.artifact-summary::after {
  content: "›";
  grid-column: 4;
  color: var(--muted-2);
  transform: rotate(90deg);
}

.artifact-item[open] .artifact-summary::after {
  transform: rotate(-90deg);
}

.artifact-kind {
  min-width: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  padding: 3px 6px;
  text-align: center;
  font-size: 8px;
  line-height: 1;
  white-space: nowrap;
}

.artifact-summary strong {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 10px;
  font-weight: 550;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.artifact-summary time {
  color: var(--muted-2);
  font-size: 9px;
  white-space: nowrap;
}

.artifact-content {
  max-height: 42vh;
  margin: 0;
  overflow: auto;
  border-top: 1px solid var(--line);
  background: #0a0c0b;
  color: #b9bfba;
  padding: 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 9px;
  line-height: 1.65;
  tab-size: 2;
}

.artifact-empty {
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
  font-size: 10px;
}

.drawer-footer {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 13px 18px;
}

.review-actions {
  justify-content: flex-end;
}

.launch-form {
  display: grid;
  grid-template-columns: minmax(130px, .8fr) 105px minmax(0, 1.2fr) auto;
  gap: 7px;
}

.error-toast {
  position: fixed;
  z-index: 100;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  border: 1px solid color-mix(in srgb, var(--danger) 55%, var(--line));
  border-radius: 7px;
  background: #251312;
  color: #f0aaa4;
  padding: 11px 14px;
  font-size: 12px;
}

.token-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.token-box {
  width: min(410px, 100%);
  display: grid;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  padding: 28px;
}

.gate-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 34px;
  font-size: 13px;
}

.token-box h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 620;
  letter-spacing: -.025em;
}

.token-box p {
  margin: 10px 0 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.token-box .input {
  margin-bottom: 9px;
}

.mobile-dock,
.mobile-menu {
  display: none;
}

@media (max-width: 960px) {
  :root {
    --topbar-height: 54px;
  }

  .app-frame {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    padding: 0 15px;
  }

  .top-context span,
  .compact-status,
  .desktop-create {
    display: none;
  }

  .page {
    min-height: calc(100vh - var(--topbar-height));
    padding: 22px 14px calc(82px + env(safe-area-inset-bottom));
  }

  .mobile-dock {
    position: fixed;
    z-index: 35;
    right: 0;
    bottom: 0;
    left: 0;
    height: calc(62px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: start;
    border-top: 1px solid var(--line);
    background: var(--sidebar);
    padding: 5px 5px env(safe-area-inset-bottom);
  }

  .dock-item,
  .dock-create {
    position: relative;
    height: 48px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 10px;
  }

  .dock-item.active {
    background: var(--surface-raised);
    color: var(--text);
  }

  .dock-create {
    width: 42px;
    height: 42px;
    align-self: center;
    justify-self: center;
    border: 1px solid var(--text);
    border-radius: 50%;
    background: var(--text);
    color: var(--canvas);
    font-size: 20px;
  }

  .dock-count {
    position: absolute;
    top: 4px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: var(--warning);
    color: var(--canvas);
    font-size: 9px;
  }

  .mobile-menu {
    position: fixed;
    z-index: 42;
    right: 8px;
    bottom: calc(68px + env(safe-area-inset-bottom));
    left: 8px;
    max-height: calc(100vh - 100px);
    display: grid;
    gap: 18px;
    overflow-y: auto;
    border: 1px solid var(--line-strong);
    border-radius: 9px;
    background: var(--surface);
    padding: 18px;
  }

  .mobile-menu-overlay {
    z-index: 41;
  }

  .mobile-menu h2 {
    margin: 0;
    font-size: 16px;
  }

  .mobile-menu-group h3 {
    margin: 0 0 7px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
  }

  .mobile-menu-item {
    width: 100%;
    min-height: 38px;
    border: 0;
    border-top: 1px solid var(--line);
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    text-align: left;
    font-size: 12px;
  }

  .mobile-menu-item.active {
    color: var(--text);
    font-weight: 600;
  }

  .today-grid {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
  }

  .activity-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .activity-meta {
    grid-column: 1;
  }

  .activity-actions,
  .activity-row > .row-arrow {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .task-list-head,
  .task-list-row {
    grid-template-columns: minmax(220px, 1.4fr) 105px 80px minmax(160px, 1fr) 80px;
  }

  .task-list {
    overflow-x: auto;
  }

  .chat-page {
    height: calc(100vh - var(--topbar-height) - 62px - env(safe-area-inset-bottom));
    grid-template-columns: 1fr;
  }

  .chat-list {
    display: none;
  }

  .chat-room {
    padding: 12px;
  }

  .mobile-chat-picker {
    display: block;
    margin-bottom: 9px;
  }

  .message-stream {
    padding: 16px 0;
  }

  .automation-form {
    display: grid;
    grid-template-columns: 1fr 100px;
  }

  .automation-form .input,
  .automation-form .path-input {
    min-width: 0;
    grid-column: 1 / -1;
  }

  .automation-form .interval-input {
    grid-column: 1;
  }

  .automation-form .btn {
    grid-column: 2;
  }

  .automation-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .automation-schedule {
    grid-column: 2;
  }

  .automation-row .provider-label {
    display: none;
  }

  .automation-row .btn {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
}

@media (max-width: 680px) {
  .section-heading {
    display: grid;
    gap: 15px;
  }

  .section-heading h2,
  .today-head h2 {
    font-size: 21px;
  }

  .section-heading > .segmented,
  .work-controls {
    width: 100%;
  }

  .work-controls {
    justify-content: space-between;
  }

  .work-filters {
    grid-template-columns: minmax(0, 1fr) 118px;
  }

  .composer-foot {
    display: grid;
    grid-template-columns: 100px minmax(0, 1fr) auto;
  }

  .composer-foot .workspace-input {
    width: 100%;
  }

  .module {
    min-height: 0;
  }

  .summary-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .summary-row > .status-pill,
  .summary-row > .provider-label {
    grid-column: 1 / -1;
    margin-top: 1px;
  }

  .summary-row .summary-copy {
    grid-column: 1;
  }

  .conversation-summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .health-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 8px 0;
  }

  .health-detail {
    grid-column: 2 / -1;
  }

  .activity-row {
    grid-template-columns: 1fr;
    gap: 11px;
    padding: 12px;
  }

  .activity-main {
    grid-template-columns: 1fr;
  }

  .activity-main p {
    grid-column: 1;
    white-space: normal;
  }

  .activity-meta {
    grid-column: 1;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .activity-meta > span:last-child {
    display: none;
  }

  .activity-actions,
  .activity-row > .row-arrow {
    grid-column: 1;
    grid-row: auto;
    justify-self: end;
  }

  .task-list {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .task-list-head {
    display: none;
  }

  .task-list-row {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    padding: 13px;
  }

  .task-list-row > .status-pill {
    grid-column: 2;
    grid-row: 1;
  }

  .task-list-row > span:nth-child(3) {
    grid-column: 1;
    color: var(--muted);
  }

  .task-list-row > .path {
    grid-column: 1 / -1;
  }

  .task-list-row > span:last-child {
    display: none;
  }

  .board {
    grid-template-columns: repeat(6, 250px);
  }

  .resource-grid,
  .connection-grid,
  .setup-grid {
    grid-template-columns: 1fr;
  }

  .agent-builder-grid {
    grid-template-columns: 1fr;
  }

  .inline-form {
    display: grid;
  }

  .workspace-setup-form {
    grid-template-columns: 1fr;
  }

  .runner-credential-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .runner-actions {
    justify-content: flex-start;
  }

  .runner-token-reveal .secret-box code {
    flex-basis: 100%;
  }

  .device-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .pairing-code {
    font-size: 20px;
    letter-spacing: .14em;
  }

  .artifact-summary time {
    display: none;
  }

  .artifact-summary::after {
    grid-column: 3;
  }

  .memory-card {
    gap: 10px;
  }

  .message {
    max-width: 94%;
  }

  .drawer {
    width: 100vw;
    border-left: 0;
  }

  .drawer-head {
    padding: 16px;
  }

  .detail-list {
    grid-template-columns: 1fr 1fr;
  }

  .detail-item:nth-child(2) {
    border-right: 0;
  }

  .detail-item:last-child {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
  }

  .drawer-body {
    padding: 16px;
  }

  .drawer-footer {
    padding: 10px;
  }

  .launch-form {
    grid-template-columns: minmax(0, 1fr) 96px;
  }

  .launch-form .agent-select {
    grid-column: 1 / -1;
  }

  .launch-form .btn {
    grid-column: 1 / -1;
  }

  .form-row {
    grid-template-columns: 90px minmax(0, 1fr);
  }

  .modal {
    top: auto;
    bottom: 0;
    left: 0;
    width: 100vw;
    max-height: calc(100vh - 20px);
    transform: none;
    border-width: 1px 0 0;
    border-radius: 9px 9px 0 0;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }
}

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