:root {
  color-scheme: light;
  --bg: #f2f0ea;
  --paper: #fffdf7;
  --paper-warm: #faf7ef;
  --paper-cool: #f6f6f1;
  --surface: #fffdf7;
  --surface-2: #f8f5ed;
  --surface-3: #efebe2;
  --line: #d8d1c2;
  --line-strong: #b9ae9a;
  --text: #555555;
  --muted: #676154;
  --muted-2: #8a8374;
  --accent: #111111;
  --accent-strong: #000000;
  --accent-soft: #eee9ff;
  --secondary: #8b5cf6;
  --secondary-strong: #6d3fd7;
  --button-bg: #f6edf2;
  --button-bg-hover: #efe2ea;
  --button-border: rgba(139, 92, 246, 0.3);
  --button-border-hover: rgba(139, 92, 246, 0.5);
  --blue: #334155;
  --teal: #167344;
  --amber: #a15c0b;
  --rose: #b4232d;
  --focus: rgba(139, 92, 246, 0.26);
  --shadow: 0 18px 38px rgba(41, 36, 25, 0.14);
  --shadow-soft: 0 5px 14px rgba(41, 36, 25, 0.08);
  --radius: 6px;
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 1px 1px, rgba(17, 17, 17, 0.055) 1px, transparent 0) 0 0 / 18px 18px,
    linear-gradient(135deg, rgba(255, 253, 247, 0.55), rgba(239, 235, 226, 0.72)),
    var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

button {
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  color: rgb(22, 55, 104);
  cursor: pointer;
  border-radius: var(--radius);
  padding: 9px 12px;
  font-weight: 700;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

button:hover {
  background: var(--button-bg-hover);
  border-color: var(--button-border-hover);
  color: var(--secondary-strong);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--muted);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

body.auth-pending .app-shell,
body.auth-required .app-shell {
  display: none;
}

.auth-screen {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(255, 253, 247, 0.92), rgba(248, 245, 237, 0.72)),
    url("/office1.png") center / cover no-repeat;
}

body.auth-required .auth-screen {
  display: grid;
}

.login-panel {
  display: grid;
  gap: 18px;
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid rgba(216, 209, 194, 0.86);
  border-radius: 10px;
  background: rgba(255, 253, 247, 0.94);
  box-shadow: 0 24px 70px rgba(41, 36, 25, 0.18);
  backdrop-filter: blur(14px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  box-shadow: var(--shadow-soft);
}

.login-brand strong {
  display: block;
  color: var(--accent);
  font-size: 22px;
  line-height: 1.15;
}

.login-brand span {
  display: block;
  margin-top: 3px;
  color: var(--muted-2);
  font-size: 14px;
}

.login-panel label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  outline: none;
}

.login-panel input:focus {
  border-color: var(--button-border-hover);
  box-shadow: 0 0 0 3px var(--focus);
}

.login-panel button {
  min-height: 44px;
  border-radius: 8px;
}

.login-error {
  min-height: 18px;
  margin: -4px 0 0;
  color: var(--rose);
  font-size: 13px;
}

.login-success {
  margin: -4px 0 0;
  color: var(--teal);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.login-switch {
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.login-switch a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.login-switch a:hover {
  text-decoration: underline;
}

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

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

.captcha-image {
  height: 38px;
  border-radius: 4px;
  cursor: pointer;
  background: #f0f0f0;
  flex-shrink: 0;
}

.captcha-refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.captcha-refresh:hover {
  background: var(--hover);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 22vw) minmax(360px, 1fr) minmax(300px, 24vw);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.app-shell.inspector-collapsed {
  grid-template-columns: minmax(280px, 22vw) minmax(360px, 1fr) 56px;
}

.sidebar,
.inspector {
  background:
    linear-gradient(rgba(255, 253, 247, 0.94), rgba(250, 247, 239, 0.96)),
    var(--paper-warm);
  border-right: 1px solid var(--line);
  min-width: 0;
  min-height: 0;
}

.sidebar {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: hidden;
  padding-bottom: 0;
}

.inspector {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  border-left: 1px solid var(--line);
  border-right: 0;
  overflow: auto;
  padding: 18px;
  background:
    linear-gradient(rgba(255, 253, 247, 0.86), rgba(248, 245, 237, 0.94)),
    var(--paper-warm);
}

.inspector-toggle {
  display: inline-grid;
  place-items: center;
  justify-self: start;
  width: 30px;
  height: 30px;
  min-height: 0;
  padding: 0;
  border-color: var(--button-border);
  background: var(--button-bg);
  color: rgb(22, 55, 104);
}

.inspector-toggle-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(216, 209, 194, 0.92);
}

.inspector-toggle:hover,
.inspector-toggle:focus-visible {
  background: var(--button-bg-hover);
  border-color: var(--button-border-hover);
  color: rgb(22, 55, 104);
}

.inspector-toggle svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: rotate(180deg);
  transition: transform 0.16s ease;
}

.inspector-content {
  min-height: 0;
  overflow: auto;
}

.inspector-content.protocol-active {
  display: grid;
  overflow: hidden;
}

.app-shell.inspector-collapsed .inspector {
  padding: 12px;
  overflow: hidden;
}

.app-shell.inspector-collapsed .inspector-content {
  display: none;
}

.app-shell.inspector-collapsed .inspector-toggle {
  justify-self: center;
}

.app-shell.inspector-collapsed .inspector-toggle-row {
  grid-template-columns: 1fr;
  justify-items: center;
}

.app-shell.inspector-collapsed .inspector-tabs {
  display: none;
}

.app-shell.inspector-collapsed .inspector-toggle svg {
  transform: rotate(0deg);
}

.workspace-mark {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 18px 16px 16px;
  border-bottom: 1px solid rgba(216, 209, 194, 0.7);
}

.workspace-mark strong,
h2 {
  font-family: Montserrat, Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

.workspace-mark strong,
.workspace-mark small {
  display: block;
}

.workspace-mark strong {
  color: rgb(22, 55, 104);
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
}

.workspace-mark small {
  color: var(--muted);
  margin-top: 12px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}

.workspace-logo {
  display: block;
  width: 96px;
  height: 96px;
  border: 0;
  border-radius: 0;
  background: transparent;
  object-fit: cover;
  box-shadow: none;
}

.sidebar-tabs {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 8px;
  align-items: center;
  padding: 12px 10px 8px;
}

.sidebar-tab-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.72);
}

.sidebar-tab {
  min-width: 0;
  min-height: 30px;
  padding: 5px 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-tab:hover {
  color: rgb(22, 55, 104);
  background: var(--surface);
}

.sidebar-tab.active {
  background: var(--surface);
  border-color: var(--line-strong);
  color: rgb(22, 55, 104);
  box-shadow: var(--shadow-soft);
}

.sidebar-panel {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.sidebar-user {
  position: relative;
  flex: 0 0 auto;
  z-index: 12;
  display: flex;
  justify-content: flex-end;
  padding: 10px;
  background:
    linear-gradient(rgba(255, 253, 247, 0), rgba(255, 253, 247, 0.92) 28%, rgba(250, 247, 239, 0.98)),
    var(--paper-warm);
}

.user-menu-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  min-height: 0;
  padding: 0;
  border-color: rgba(91, 141, 198, 0.26);
  background: rgba(255, 253, 247, 0.88);
  box-shadow: var(--shadow-soft);
}

.user-menu-button:hover,
.user-menu-button:focus-visible,
.user-menu-button.active {
  border-color: rgba(91, 141, 198, 0.42);
  background: rgba(235, 247, 255, 0.92);
  color: rgb(22, 55, 104);
}

.user-menu-avatar {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.user-menu {
  position: absolute;
  right: 10px;
  bottom: 50px;
  min-width: 118px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.98);
  box-shadow: 0 14px 34px rgba(41, 36, 25, 0.16);
}

.user-menu-item {
  width: 100%;
  min-height: 32px;
  padding: 7px 10px;
  border-color: transparent;
  background: transparent;
  color: var(--text);
  text-align: left;
  box-shadow: none;
}

.user-menu-item:hover,
.user-menu-item:focus-visible {
  border-color: rgba(190, 18, 60, 0.12);
  background: rgba(190, 18, 60, 0.08);
  color: var(--rose);
}

.sidebar-section {
  padding: 0 10px;
}

.sidebar-section-title {
  padding: 9px 2px 6px;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.section-toggle {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  min-height: 0;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted-2);
}

.section-toggle:hover,
.section-toggle:focus-visible {
  border-color: var(--line);
  background: var(--surface);
  color: rgb(22, 55, 104);
}

.section-toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.16s ease;
}

.section-toggle.collapsed svg {
  transform: rotate(-90deg);
}

.sidebar-divider {
  height: 1px;
  margin: 10px 10px 4px;
  background: rgba(216, 209, 194, 0.92);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
}

.icon-button:hover {
  background: var(--surface-3);
  border-color: var(--line-strong);
  color: var(--secondary-strong);
}

.nav-list,
.favorite-list,
.task-list,
.thread-list,
.human-list,
.agent-list,
.computer-list {
  display: grid;
  gap: 3px;
  padding: 0 10px;
}

.favorite-list,
.task-list,
.thread-list {
  padding: 0;
}

.favorite-list .empty-state,
.task-list .empty-state,
.thread-list .empty-state {
  padding: 8px 2px;
}

.nav-row,
.human-row,
.agent-row,
.computer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 4px;
  align-items: start;
}

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

.nav-item,
.favorite-nav-item,
.task-nav-item,
.thread-nav-item,
.human-item,
.agent-item,
.computer-item {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 9px;
  align-items: center;
  text-align: left;
  background: transparent;
  color: var(--text);
  padding: 8px 9px;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

.favorite-nav-item,
.task-nav-item,
.thread-nav-item {
  grid-template-columns: 28px minmax(0, 1fr);
}

.nav-item > span:last-child,
.favorite-nav-item > span:last-child,
.task-nav-item > span:last-child,
.thread-nav-item > span:last-child,
.human-item > span:last-child,
.agent-item > span:last-child,
.computer-item > span:last-child {
  min-width: 0;
}

.nav-item.active,
.favorite-nav-item.active,
.task-nav-item.active,
.thread-nav-item.active,
.agent-item.active,
.human-item:hover,
.agent-item:hover,
.computer-item:hover,
.favorite-nav-item:hover,
.task-nav-item:hover,
.thread-nav-item:hover,
.nav-item:hover {
  background: var(--surface);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.nav-item.active,
.favorite-nav-item.active,
.task-nav-item.active,
.thread-nav-item.active,
.agent-item.active {
  isolation: isolate;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(235, 247, 255, 0.96), rgba(247, 243, 255, 0.92)),
    var(--surface);
  border-color: rgba(91, 141, 198, 0.42);
  box-shadow:
    0 10px 24px rgba(22, 55, 104, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.78);
}

.nav-item.active::before {
  content: none;
}

.nav-item.active::after {
  content: "";
  position: absolute;
  inset: -45% -12% auto auto;
  width: 82px;
  height: 82px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(159, 184, 216, 0.42), transparent 64%);
  pointer-events: none;
  z-index: -1;
}

.nav-item.active .hash {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(91, 141, 198, 0.3);
  color: rgb(22, 55, 104);
}

.thread-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(91, 141, 198, 0.28);
  border-radius: var(--radius);
  background: rgba(235, 247, 255, 0.72);
  color: rgb(22, 55, 104);
  font-weight: 800;
  font-size: 14px;
}

.favorite-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(161, 92, 11, 0.26);
  border-radius: var(--radius);
  background: rgba(255, 244, 223, 0.74);
  color: var(--amber);
  font-weight: 900;
  font-size: 13px;
}

.task-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(161, 92, 11, 0.26);
  border-radius: var(--radius);
  background: rgba(255, 244, 223, 0.74);
  color: var(--amber);
  font-weight: 900;
  font-size: 13px;
}

.item-delete {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-top: 9px;
  padding: 0;
  background: transparent;
  color: var(--muted);
  opacity: 0;
}

.nav-row:hover .item-delete,
.nav-row:focus-within .item-delete,
.human-row:hover .item-delete,
.human-row:focus-within .item-delete,
.agent-row:hover .item-delete,
.agent-row:focus-within .item-delete {
  opacity: 1;
}

.item-delete.visible {
  opacity: 1;
}

.item-delete:hover,
.item-delete:focus-visible {
  background: rgba(190, 18, 60, 0.09);
  color: var(--rose);
}

.hash,
.avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #e7e1d3;
  color: var(--text);
  font-weight: 800;
  font-size: 13px;
}

.avatar {
  background: #eef4fb;
  color: rgb(22, 55, 104);
}

.computer-status {
  width: 10px;
  height: 10px;
  margin: 9px;
  border-radius: 999px;
  background: #cbd5e1;
  box-shadow: 0 0 0 4px rgba(203, 213, 225, 0.24);
}

.computer-status.online {
  background: var(--teal);
  box-shadow: 0 0 0 4px rgba(18, 112, 105, 0.12);
}

.nav-item strong,
.favorite-nav-item strong,
.task-nav-item strong,
.thread-nav-item strong,
.human-item strong,
.agent-item strong,
.computer-item strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.human-meta,
.agent-meta,
.computer-meta,
.favorite-meta,
.task-meta,
.thread-meta,
.nav-topic {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item:hover strong,
.nav-item:focus-visible strong,
.favorite-nav-item:hover strong,
.favorite-nav-item:focus-visible strong,
.task-nav-item:hover strong,
.task-nav-item:focus-visible strong,
.thread-nav-item:hover strong,
.thread-nav-item:focus-visible strong,
.human-item:hover strong,
.human-item:focus-within strong,
.agent-item:hover strong,
.agent-item:focus-visible strong,
.nav-item:hover .nav-topic,
.nav-item:focus-visible .nav-topic,
.favorite-nav-item:hover .favorite-meta,
.favorite-nav-item:focus-visible .favorite-meta,
.task-nav-item:hover .task-meta,
.task-nav-item:focus-visible .task-meta,
.thread-nav-item:hover .thread-meta,
.thread-nav-item:focus-visible .thread-meta,
.human-item:hover .human-meta,
.human-item:focus-within .human-meta,
.agent-item:hover .agent-meta,
.agent-item:focus-visible .agent-meta,
.computer-item:hover .computer-meta,
.computer-item:focus-within .computer-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  padding: 10px 9px;
  color: var(--muted);
  font-size: 12px;
}

.conversation {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  min-height: 0;
  background:
    linear-gradient(rgba(255, 253, 247, 0.94), rgba(255, 253, 247, 0.94)),
    var(--surface);
  border-left: 1px solid rgba(216, 209, 194, 0.84);
  border-right: 1px solid rgba(216, 209, 194, 0.84);
}

.hover-tooltip {
  position: fixed;
  z-index: 2000;
  width: min(260px, calc(100vw - 24px));
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.98);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
  pointer-events: none;
  white-space: pre-line;
}

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-width: 0;
  gap: 16px;
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(rgba(255, 253, 247, 0.92), rgba(248, 245, 237, 0.94)),
    var(--paper);
}

.room-header > div:first-child {
  min-width: 0;
}

/* Room-actions toggle — hidden on desktop, shown on mobile */
.room-actions-toggle {
  display: none;
  place-items: center;
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  flex-shrink: 0;
  cursor: pointer;
}

.room-actions-toggle:hover {
  background: var(--surface-3);
  border-color: var(--line-strong);
  color: var(--text);
}

.room-actions-toggle svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: none;
}

.room-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.default-agent-control {
  display: grid;
  grid-template-columns: auto minmax(150px, 220px);
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  min-width: 260px;
}

.default-agent-control span {
  white-space: nowrap;
}

.default-agent-control select {
  min-height: 34px;
  padding: 6px 9px;
  background: var(--paper);
}

.eyebrow {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

h2 {
  margin: 0;
  letter-spacing: 0;
}

#room-name {
  display: inline-grid;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(91, 141, 198, 0.42);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(235, 247, 255, 0.96), rgba(247, 243, 255, 0.92)),
    var(--surface);
  color: rgb(22, 55, 104);
  box-shadow:
    0 8px 18px rgba(22, 55, 104, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.78);
  font-size: 16px;
  font-weight: 760;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

h2 {
  font-size: 16px;
  font-weight: 700;
}

.daemon-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  font-size: 12px;
  background: var(--paper);
  white-space: nowrap;
}

.daemon-chip.online {
  color: var(--teal);
  border-color: rgba(18, 112, 105, 0.28);
  background: rgba(18, 112, 105, 0.08);
}

.messages {
  min-height: 0;
  overflow: auto;
  padding: 18px 22px 28px;
  background:
    linear-gradient(
      90deg,
      rgba(255, 253, 247, 0.90) 0%,
      rgba(255, 253, 247, 0.58) 68%,
      rgba(255, 253, 247, 0.16) 100%
    ),
    var(--chat-background-image) center / cover no-repeat;
}

.messages.messages-dm {
  background:
    linear-gradient(
      90deg,
      rgba(255, 253, 247, 0.90) 0%,
      rgba(255, 253, 247, 0.58) 68%,
      rgba(255, 253, 247, 0.16) 100%
    ),
    var(--chat-dm-background-image) center / cover no-repeat;
}

.message {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 11px;
  padding: 8px 0;
}

.message.system .avatar {
  background: #eef1f5;
  border-color: #d4dbe6;
  color: #3f4f64;
}

.message.task .avatar {
  background: #fff4df;
  border-color: #ead7b2;
  color: #7a4a10;
}

.message-located .message-markdown,
.thread-message.message-located .message-markdown {
  border-color: rgba(161, 92, 11, 0.46);
  box-shadow:
    0 0 0 3px rgba(255, 244, 223, 0.88),
    0 10px 24px rgba(161, 92, 11, 0.12);
}

.message-header {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: baseline;
}

.message-name {
  font-weight: 760;
}

.message-time,
.message-kind {
  color: var(--muted);
  font-size: 12px;
}

.message-markdown {
  position: relative;
  width: 90%;
  margin-top: 7px;
  padding: 14px 16px 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.68)),
    var(--paper);
  box-shadow: 0 1px 0 rgba(41, 36, 25, 0.04);
  overflow-wrap: anywhere;
}

.message-inline-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
}

.thread-button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  min-height: 0;
  height: 28px;
  padding: 0;
  border-color: rgba(139, 92, 246, 0.24);
  background: rgba(255, 253, 247, 0.84);
  color: var(--muted-2);
  box-shadow: none;
}

.thread-button:hover,
.thread-button:focus-visible {
  background: var(--button-bg-hover);
  border-color: var(--button-border-hover);
  color: var(--secondary-strong);
}

.thread-button.active {
  border-color: rgba(91, 141, 198, 0.42);
  background: rgba(235, 247, 255, 0.92);
  color: rgb(22, 55, 104);
}

.thread-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.thread-panel {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 8;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(430px, 92%);
  height: 100%;
  border-left: 1px solid var(--line);
  background:
    linear-gradient(rgba(255, 253, 247, 0.95), rgba(250, 247, 239, 0.96)),
    var(--paper-warm);
  box-shadow: -18px 0 44px rgba(41, 36, 25, 0.14);
}

.thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
}

.thread-header strong {
  display: block;
  color: var(--accent);
  font-size: 16px;
  line-height: 1.2;
}

.thread-header span {
  display: block;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 12px;
}

.thread-root {
  min-width: 0;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(216, 209, 194, 0.72);
  background: rgba(255, 253, 247, 0.54);
}

.thread-messages {
  min-width: 0;
  overflow: auto;
  padding: 8px 14px 12px;
}

.thread-message {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 0;
}

.thread-message .avatar {
  width: 30px;
  height: 30px;
  font-size: 11px;
}

.thread-message .message-markdown {
  width: 100%;
}

.thread-root-message .message-markdown {
  background:
    linear-gradient(rgba(255, 255, 255, 0.76), rgba(255, 255, 255, 0.76)),
    var(--paper);
}

.thread-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 8px;
  align-items: end;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.92);
}

.thread-composer textarea {
  min-height: 54px;
  max-height: 140px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 11px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  outline: none;
}

.thread-composer textarea:focus {
  border-color: var(--button-border-hover);
  box-shadow: 0 0 0 3px var(--focus);
}

.thread-composer .compose-send {
  position: static;
  transform: none;
}

.message-copy {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  min-height: 0;
  padding: 0;
  border: 1px solid rgba(139, 92, 246, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.84);
  color: var(--muted-2);
  box-shadow: none;
}

.message-copy svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.message-copy:hover,
.message-copy:focus-visible {
  background: var(--button-bg-hover);
  border-color: var(--button-border-hover);
  color: var(--secondary-strong);
}

.message-copy.copied {
  border-color: rgba(22, 115, 68, 0.34);
  background: rgba(22, 115, 68, 0.08);
  color: var(--teal);
}

.message-favorite.active {
  border-color: rgba(161, 92, 11, 0.34);
  background: rgba(255, 244, 223, 0.86);
  color: var(--amber);
}

.message-markdown h2,
.message-markdown h3,
.message-markdown h4 {
  color: var(--text-strong);
}

.message-markdown h2:first-child,
.message-markdown h3:first-child,
.message-markdown h4:first-child,
.message-markdown p:first-child {
  margin-top: 0;
}

.message-markdown p:last-child,
.message-markdown ul:last-child,
.message-markdown ol:last-child,
.message-markdown pre:last-child,
.message-markdown blockquote:last-child {
  margin-bottom: 0;
}

.message-mention {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin: 0 1px;
  padding: 1px 7px;
  border: 1px solid rgba(139, 92, 246, 0.38);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--secondary-strong);
  font-weight: 760;
  white-space: nowrap;
}

.markdown-card {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: min(620px, 100%);
  margin-top: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-cool);
  color: var(--text);
  text-align: left;
  box-shadow: 0 1px 0 rgba(41, 36, 25, 0.04);
}

.markdown-card:hover,
.markdown-card:focus-visible {
  background: var(--paper);
  color: var(--text);
  border-color: rgba(139, 92, 246, 0.38);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.markdown-card:active {
  transform: translateY(0);
}

.markdown-card-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 48px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--secondary-strong);
  font-size: 11px;
  font-weight: 800;
  border: 1px solid rgba(139, 92, 246, 0.22);
}

.markdown-card:hover .markdown-card-icon,
.markdown-card:focus-visible .markdown-card-icon {
  background: #f4f0ff;
  border-color: rgba(139, 92, 246, 0.42);
  color: var(--secondary-strong);
}

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

.markdown-card-copy strong,
.markdown-card-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.markdown-card-copy small {
  color: var(--muted);
  font-size: 12px;
}

.markdown-card:hover .markdown-card-copy small,
.markdown-card:focus-visible .markdown-card-copy small,
.markdown-card:hover .markdown-card-copy span,
.markdown-card:focus-visible .markdown-card-copy span {
  color: var(--muted);
}

.markdown-card-action {
  color: var(--secondary-strong);
  font-size: 12px;
  font-weight: 750;
}

.markdown-card:hover .markdown-card-action,
.markdown-card:focus-visible .markdown-card-action {
  color: var(--secondary-strong);
}

.composer {
  border-top: 1px solid var(--line);
  padding: 12px 16px 16px;
  background:
    linear-gradient(rgba(250, 247, 239, 0.96), rgba(250, 247, 239, 0.96)),
    var(--paper-warm);
}

.mention-row {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 9px;
}
.mention-row:empty {
  display: none;
}

.mention-button {
  display: inline-grid;
  place-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--text);
  padding: 6px 10px;
  white-space: nowrap;
  font-size: 13px;
}

.mention-button:hover {
  background: var(--accent-soft);
  border-color: rgba(139, 92, 246, 0.38);
  color: var(--secondary-strong);
}

.mention-button-all {
  font-weight: 600;
  border-color: rgba(245, 158, 11, 0.3);
  color: #d97706;
}

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

.compose-actions {
  position: absolute;
  right: 22px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.compose-hint {
  color: #9ca3af;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.voice-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #6b7280;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.voice-status[data-voice-status="recording"] {
  color: #b91c1c;
}

.voice-status[data-voice-status="error"] {
  color: #b45309;
}

.voice-wave {
  display: none;
  width: 28px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.voice-status[data-voice-status="recording"] .voice-wave {
  display: block;
}

.voice-status[data-voice-status="recording"] .voice-wave path {
  animation: voice-wave-pulse 0.86s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.voice-status[data-voice-status="recording"] .voice-wave path:nth-child(2) {
  animation-delay: 0.08s;
}

.voice-status[data-voice-status="recording"] .voice-wave path:nth-child(3) {
  animation-delay: 0.16s;
}

.voice-status[data-voice-status="recording"] .voice-wave path:nth-child(4) {
  animation-delay: 0.24s;
}

.voice-status[data-voice-status="recording"] .voice-wave path:nth-child(5) {
  animation-delay: 0.32s;
}

@keyframes voice-wave-pulse {
  0%,
  100% {
    transform: scaleY(0.55);
    opacity: 0.5;
  }

  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

.voice-control {
  display: inline-grid;
  place-items: center;
}

.voice-button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  border-radius: 999px;
  background: #ffffff;
  border-color: var(--line);
  color: #4b5563;
}

.voice-button:hover,
.voice-button:focus-visible {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.voice-button[data-state="recording"] {
  background: #fee2e2;
  border-color: #fecaca;
  color: #b91c1c;
}

.voice-button[data-state="error"] {
  background: #fffbeb;
  border-color: #fde68a;
  color: #b45309;
}

.voice-button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.voice-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.compose-send {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  border-radius: 999px;
  background: var(--button-bg);
  border-color: var(--button-border);
  color: rgb(22, 55, 104);
  box-shadow: 0 8px 16px rgba(139, 92, 246, 0.1);
}

.compose-send:hover,
.compose-send:focus-visible {
  background: var(--button-bg-hover);
  border-color: var(--button-border-hover);
  color: rgb(22, 55, 104);
}

.compose-send svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.compose-input-wrap {
  position: relative;
  min-width: 0;
  display: grid;
}

.compose-input-wrap textarea {
  min-height: 76px;
  padding-right: 178px;
  padding-bottom: 52px;
}

.mention-suggestions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 20;
  display: grid;
  gap: 4px;
  max-height: 240px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.mention-suggestions[hidden] {
  display: none;
}

.mention-suggestion {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 7px 8px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.mention-suggestion:hover,
.mention-suggestion.active {
  background: var(--accent-soft);
}

.mention-suggestion .avatar {
  width: 30px;
  height: 30px;
  font-size: 13px;
}

.mention-suggestion span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.mention-suggestion strong,
.mention-suggestion small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-suggestion small {
  color: var(--muted);
  font-size: 12px;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--text);
  padding: 10px;
  min-width: 0;
}

textarea {
  resize: vertical;
  max-height: 180px;
}

select {
  min-height: 38px;
  line-height: 1.2;
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(139, 92, 246, 0.72);
  outline: 3px solid var(--focus);
}

.panel {
  border-bottom: 1px solid rgba(216, 209, 194, 0.92);
  padding: 0 0 17px;
  margin-bottom: 17px;
}

.inspector-tabs {
  min-width: 0;
}

.inspector-tab-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  min-width: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.72);
}

.inspector-tab {
  min-width: 0;
  min-height: 32px;
  padding: 6px 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inspector-tab:hover {
  color: rgb(22, 55, 104);
  background: var(--surface);
}

.inspector-tab.active {
  background: var(--surface);
  border-color: var(--line-strong);
  color: rgb(22, 55, 104);
  box-shadow: var(--shadow-soft);
}

.inspector-panel {
  border-bottom: 0;
  min-width: 0;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.panel-heading span {
  color: var(--muted);
  font-size: 12px;
}

.muted {
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}

.assign-panel {
  display: grid;
  gap: 10px;
}

.assign-panel button {
  background: var(--button-bg);
  border-color: var(--button-border);
  color: rgb(22, 55, 104);
}

.assign-panel button:hover,
.assign-panel button:focus-visible {
  background: var(--button-bg-hover);
  border-color: var(--button-border-hover);
  color: rgb(22, 55, 104);
}

.event-list {
  display: grid;
  gap: 6px;
  max-height: 210px;
  overflow: auto;
}

.protocol-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  height: 100%;
  margin-bottom: 0;
  min-height: 0;
  padding-bottom: 0;
}

.event-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.event-row:hover {
  background: var(--paper-cool);
  border-color: var(--line-strong);
}

.event-row.active {
  isolation: isolate;
  overflow: hidden;
  border-color: rgba(91, 141, 198, 0.44);
  background:
    linear-gradient(135deg, rgba(235, 247, 255, 0.95), rgba(247, 243, 255, 0.9)),
    var(--surface);
  box-shadow:
    0 10px 24px rgba(22, 55, 104, 0.11),
    inset 0 0 0 1px rgba(255, 255, 255, 0.78);
}

.event-row.active::before {
  content: none;
}

.event-row.active::after {
  content: "";
  position: absolute;
  inset: -36px -28px auto auto;
  width: 92px;
  height: 92px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(159, 184, 216, 0.34), transparent 66%);
  pointer-events: none;
  z-index: -1;
}

.event-row.active code {
  color: rgb(22, 55, 104);
}

.event-row code {
  position: relative;
  z-index: 1;
  color: var(--secondary-strong);
  font-weight: 760;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-row span {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.event-detail {
  min-height: 0;
  height: 100%;
  overflow: auto;
  margin: 12px 0 0;
  padding: 10px;
  border-radius: var(--radius);
  background: #fafafa;
  color: #24292e;
  border: 1px solid var(--line);
  font-size: 12px;
  line-height: 1.45;
  font-family: "PT Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.event-detail code.hljs {
  background: transparent;
  padding: 0;
}

dialog {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(440px, calc(100vw - 28px));
  padding: 18px;
  background: var(--paper);
}

dialog::backdrop {
  background: rgba(17, 17, 17, 0.28);
  backdrop-filter: blur(2px);
}

#agent-dialog {
  width: min(560px, calc(100vw - 28px));
}

.dialog-body {
  display: grid;
  gap: 13px;
}

.dialog-error {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #f2b8b5;
  border-radius: var(--radius);
  background: #fff4f2;
  color: #9b1c1c;
  font-size: 13px;
  line-height: 1.4;
}

.dialog-body label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.markdown-dialog {
  width: min(900px, calc(100vw - 28px));
  max-height: min(840px, calc(100vh - 28px));
  padding: 0;
  overflow: hidden;
}

.markdown-dialog-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(840px, calc(100vh - 28px));
  background: var(--paper);
  overflow: hidden;
}

.markdown-dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-warm);
}

.markdown-dialog-header h2 {
  margin-top: 3px;
  font-size: 18px;
  line-height: 1.28;
}

.markdown-dialog-meta {
  color: var(--muted);
  font-size: 12px;
}

.markdown-body {
  overflow: auto;
  padding: 22px 28px 32px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.66;
}

.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 20px 0 9px;
  line-height: 1.28;
}

.markdown-body h2 {
  font-size: 19px;
}

.markdown-body h3 {
  font-size: 16px;
}

.markdown-body h4 {
  font-size: 15px;
}

.markdown-body h2:first-child,
.markdown-body h3:first-child,
.markdown-body h4:first-child {
  margin-top: 0;
}

.markdown-body p {
  margin: 0 0 11px;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 13px 20px;
  padding: 0;
}

.markdown-body li {
  margin: 4px 0;
}

.markdown-body code {
  background: var(--surface-3);
  border-radius: 4px;
  padding: 1px 4px;
  color: var(--text);
  font-size: 0.92em;
  font-family: "PT Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.markdown-body pre {
  overflow: auto;
  margin: 12px 0 15px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafafa;
  color: #24292e;
  font-size: 13px;
  line-height: 1.5;
}

.markdown-body pre code {
  display: block;
  background: transparent;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  white-space: pre;
}

.markdown-body pre code.hljs {
  background: transparent;
  padding: 0;
}

.markdown-body .mermaid {
  display: grid;
  justify-items: center;
  overflow: auto;
  margin: 12px 0 15px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.78);
  color: var(--text);
}

.markdown-body .mermaid svg {
  max-width: 100%;
  height: auto;
}

.markdown-body .mermaid-error {
  display: block;
  justify-items: stretch;
  white-space: pre-wrap;
  color: var(--rose);
}

.markdown-body .infographic-block {
  overflow: auto;
  margin: 12px 0 15px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.78);
  color: var(--text);
}

.markdown-body .infographic-canvas {
  width: 100%;
  min-height: 420px;
}

.markdown-body .infographic-canvas svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.markdown-body .infographic-error {
  white-space: pre-wrap;
  color: var(--rose);
  font-family: "PT Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.markdown-body .math-block {
  overflow-x: auto;
  margin: 12px 0 15px;
  padding: 6px 0;
}

.markdown-body mjx-container {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.markdown-body blockquote {
  margin: 0 0 14px;
  padding-left: 12px;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

.runtime-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0;
  margin: 0;
}

menu button:first-child {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
}

menu button:first-child:hover {
  background: var(--surface-3);
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 280px minmax(340px, 1fr) 300px;
  }

  .app-shell.inspector-collapsed {
    grid-template-columns: 280px minmax(340px, 1fr) 56px;
  }

  .inspector {
    padding: 14px;
  }

  .room-header {
    padding: 10px 18px;
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: minmax(220px, 28vw) minmax(0, 1fr);
  }

  .app-shell.inspector-collapsed {
    grid-template-columns: minmax(220px, 28vw) minmax(0, 1fr);
  }

  .inspector {
    display: none;
  }
}

/* Sidebar toggle button — hidden on desktop */
.sidebar-toggle {
  display: none;
  place-items: center;
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: var(--surface-3);
  border-color: var(--line-strong);
  color: rgb(22, 55, 104);
}

.sidebar-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Overlay behind full-screen sidebar on mobile */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(17, 17, 17, 0.32);
  backdrop-filter: blur(2px);
}

@media (max-width: 760px) {
  .sidebar-toggle {
    display: inline-grid;
  }

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

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    width: min(340px, 85vw);
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border-right: 1px solid var(--line-strong);
    box-shadow: 18px 0 44px rgba(41, 36, 25, 0.18);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    overflow-y: auto;
  }

  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .workspace-mark {
    padding: 12px 14px 10px;
  }

  .conversation {
    min-height: 0;
  }

  .room-header {
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
  }

  .sidebar-toggle {
    width: 32px;
    height: 32px;
  }

  #room-name {
    font-size: 14px;
    min-height: 28px;
    padding: 4px 8px;
    border-width: 0;
    box-shadow: none;
    background: transparent;
  }

  .room-actions-toggle {
    display: inline-grid;
    width: 32px;
    height: 32px;
  }

  .room-actions {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 80;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    padding: 10px;
    gap: 8px;
    min-width: 240px;
  }

  .room-header {
    position: relative;
  }

  .room-header.room-actions-open .room-actions {
    display: flex;
    flex-direction: column;
  }

  .default-agent-control {
    flex: 0 0 auto;
    min-width: 0;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .default-agent-control span {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted-2);
  }

  .default-agent-control select {
    width: 100%;
    min-height: 40px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23676154' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    box-shadow: 0 1px 3px rgba(41, 36, 25, 0.06);
  }

  .default-agent-control select:focus {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 0 3px var(--focus);
  }

  .daemon-chip {
    text-align: center;
  }

  .messages {
    padding: 14px 16px 22px;
  }

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

  .compose-input-wrap textarea {
    padding-right: 12px;
    padding-bottom: 28px;
    min-height: 76px;
  }

  .compose-actions {
    position: relative;
    right: auto;
    bottom: auto;
    justify-content: flex-end;
    padding-top: 6px;
    padding-bottom: 2px;
  }

  .markdown-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .markdown-dialog-shell {
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

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

@media (max-width: 620px) {
  .room-header {
    padding: 4px 8px;
  }

  .workspace-mark {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
  }

  .workspace-mark strong,
  .workspace-mark small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workspace-mark strong {
    font-size: 36px;
  }

  .workspace-mark small {
    margin-top: 10px;
    font-size: 16px;
  }

  .workspace-logo {
    width: 96px;
    height: 96px;
  }

  .nav-list,
  .human-list,
  .agent-list {
    padding: 0 8px;
  }

  .nav-row,
  .human-row,
  .agent-row {
    grid-template-columns: minmax(0, 1fr) 26px;
  }

  .nav-item,
  .human-item,
  .agent-item {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .hash,
  .avatar,
  .item-delete {
    height: 24px;
  }

  .item-delete {
    width: 24px;
  }

  .item-delete {
    margin-top: 8px;
  }

  .message {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
  }

  .markdown-card {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }

  .markdown-card-icon {
    width: 36px;
    height: 44px;
  }

  .markdown-card-action {
    display: none;
  }

  .mention-suggestions {
    max-height: min(220px, 44vh);
  }

  dialog {
    width: calc(100vw - 16px);
  }

  .markdown-dialog-header {
    padding: 14px;
  }

  .markdown-dialog-header h2 {
    font-size: 16px;
  }

  .markdown-body {
    padding: 16px 14px 22px;
  }
}

@media (max-width: 420px) {
  .room-header {
    padding: 3px 8px;
  }

  .messages {
    padding: 12px 12px 18px;
  }

  .composer {
    padding-left: 10px;
    padding-right: 10px;
  }

  .mention-row {
    gap: 6px;
  }

  .mention-button {
    padding: 6px 8px;
  }
}

/* Settings panel */
.settings-panel {
  flex: 1;
  overflow-y: auto;
  background: var(--paper);
  padding: 28px 36px;
}

.settings-tab-list {
  display: inline-grid;
  grid-template-columns: repeat(2, auto);
  gap: 4px;
  padding: 3px;
  margin-bottom: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 247, 0.72);
}

.settings-tab {
  min-height: 34px;
  padding: 7px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s ease;
}

.settings-tab:hover {
  color: rgb(22, 55, 104);
  background: var(--surface);
}

.settings-tab.active {
  background: var(--surface);
  border-color: var(--line-strong);
  color: rgb(22, 55, 104);
  box-shadow: var(--shadow-soft);
}

.settings-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

#settings-content-profile {
  max-width: 640px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.settings-field-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-username-display {
  flex: 1;
  font-size: 15px;
  min-height: 36px;
  display: flex;
  align-items: center;
}

.settings-input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--text);
  font-size: 15px;
  outline: none;
}

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

.settings-action-btn {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.settings-action-btn:hover {
  background: var(--bg);
}

.settings-action-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.settings-action-danger {
  color: #be123c;
  border-color: #fecdd3;
}

.settings-action-danger:hover {
  background: #fff1f2;
}

.settings-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.settings-field span {
  font-size: 16px;
  color: var(--text);
  line-height: 1.4;
}

.settings-apikey {
  flex: 1;
  font-family: var(--mono-font, monospace);
  font-size: 14px;
  word-break: break-all;
  color: var(--text);
  background: none;
}

