.crm-main.is-agent {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: var(--page);
}

.crm-main.is-agent .crm-mobile-brand,
.crm-main.is-agent ~ .crm-page-scroll {
  display: none;
}

.crm-main.is-agent .crm-view--agent.is-active,
.ai-agent-workspace {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.ai-agent-workspace {
  color-scheme: light;
  --surface: #FFFFFF;
  --surface-alt: #F8FBFD;
  --surface-muted: #EDF5F9;
  --text: #0C1319;
  --secondary: #2C3E4A;
  --muted: #5B6871;
  --primary: #4A7A9A;
  --primary-dark: #2D4C63;
  --border: rgba(74, 122, 154, .22);
  --border-strong: rgba(74, 122, 154, .38);
  --success: #3A7B62;
  --warning: #C97C2A;
  --danger: #B94B4B;
  font-family: inherit;
  -webkit-font-smoothing: antialiased;
  display: grid;
  grid-template-columns: 293px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  background: var(--page);
  color: var(--text);
}

.ai-agent-stage {
  position: relative;
  grid-column: 2;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 68px minmax(0, 1fr);
  overflow: hidden;
}

.ai-agent-stage::after {
  position: absolute;
  z-index: 4;
  right: 0;
  bottom: 0;
  left: 0;
  height: 185px;
  background: linear-gradient(to bottom, rgba(243, 247, 250, 0), var(--page) 52px, var(--page));
  content: '';
  pointer-events: none;
}

.ai-agent-history {
  grid-column: 1;
  grid-row: 1;
  z-index: 8;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  border-right: 1px solid var(--border);
  background: #202020;
  color: var(--text);
}

.ai-agent-history__head {
  position: relative;
  z-index: 2;
  flex: 0 0 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 0;
}

.ai-agent-history__head strong {
  font-size: 13px;
}

.ai-agent-history__head-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 3px;
}

.ai-agent-history__head-actions .icon-btn {
  flex: 0 0 20px;
  width: 20px;
  min-width: 20px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #979797;
  box-shadow: none;
}

.ai-agent-history__head-actions .icon-btn:hover,
.ai-agent-history__head-actions .icon-btn:focus-visible {
  border: 0;
  background: transparent;
  color: #dedede;
}

.ai-agent-sidebar-search-icon,
.ai-agent-new-chat-icon svg,
.ai-agent-new-chat-plus svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-agent-history__search {
  min-width: 0;
  flex: 1;
  width: auto;
  height: 26px;
  margin: 0;
  padding: 0 9px;
  border: 1px solid #3a3a3a;
  border-radius: 7px;
  outline: 0;
  background: #292929;
  color: #dedede;
  font-size: 12px;
}

.ai-agent-history__search::placeholder {
  color: #767676;
}

.ai-agent-history__close {
  display: none;
}

.ai-agent-history__new {
  flex: 0 0 44px;
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 0 15px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}

.ai-agent-history__new:hover,
.ai-agent-history__new:focus-visible {
  background: #272727;
}

.ai-agent-new-chat-icon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: #bcbcbc;
}

.ai-agent-new-chat-plus {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: auto;
  color: #9b9b9b;
}

.ai-agent-session-list {
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0 7px 20px;
}

.ai-agent-session-list::-webkit-scrollbar {
  width: 9px;
}

.ai-agent-session-list::-webkit-scrollbar-track {
  background: transparent;
}

.ai-agent-session-list::-webkit-scrollbar-thumb {
  border: 2px solid #202020;
  border-radius: 999px;
  background: #444;
}

.ai-agent-history__section {
  margin: 0;
}

.ai-agent-projects-header,
.ai-agent-chats-header {
  display: flex;
  align-items: center;
  width: 100%;
  height: 34px;
}

.ai-agent-history__section-heading {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  width: auto;
  margin: 0;
  padding: 0 15px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.ai-agent-history__section-heading:hover,
.ai-agent-history__section-heading:focus-visible {
  color: var(--secondary);
}

.ai-agent-project-list.is-collapsed,
.ai-agent-chat-list.is-collapsed {
  display: none;
}

.ai-agent-project-list {
  max-height: none;
  overflow: visible;
}

.ai-agent-project-group {
  min-width: 0;
  margin: 0;
}

.ai-agent-project-heading {
  display: flex;
  width: 100%;
  min-width: 0;
  height: 31px;
  min-height: 31px;
  align-items: center;
  gap: 9px;
  padding: 0 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #d0d0d0;
  text-align: left;
  cursor: pointer;
}

.ai-agent-project-heading:hover,
.ai-agent-project-heading:focus-visible {
  background: #282828;
}

.ai-agent-project-folder-icon {
  position: relative;
  flex: 0 0 auto;
  display: inline-block;
  width: 14px;
  height: 10px;
  border: 1.15px solid #a5a5a5;
  border-radius: 2px;
}

.ai-agent-project-folder-icon::before {
  position: absolute;
  top: -4px;
  left: 1px;
  width: 6px;
  height: 4px;
  border: 1.15px solid #a5a5a5;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  content: '';
}

.ai-agent-project-name {
  overflow: hidden;
  flex: 1;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-agent-project-count {
  display: none;
}

.ai-agent-project-chevron {
  flex: 0 0 auto;
  transform: rotate(0deg);
  color: #747474;
  font-size: 16px;
  line-height: 1;
  transition: transform 120ms ease;
}

.ai-agent-project-heading[aria-expanded="true"] .ai-agent-project-chevron {
  transform: rotate(90deg);
}

.ai-agent-project-sessions {
  padding-left: 0;
}

.ai-agent-project-sessions .ai-agent-chat-item {
  min-height: 31px;
}

.ai-agent-history__section--chats {
  min-height: 0;
}

.ai-agent-chat-list {
  min-height: 0;
  overflow: visible;
}

.ai-agent-new-chat-dialog {
  width: min(480px, calc(100vw - 32px));
  max-width: 100%;
  padding: 19px;
  border: 1px solid #414141;
  border-radius: 13px;
  background: #242424;
  color: var(--text);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
}

.ai-agent-new-chat-dialog::backdrop {
  background: rgba(0, 0, 0, .66);
}

.ai-agent-new-chat-form {
  display: grid;
  gap: 14px;
  padding: 0;
}

.ai-agent-new-chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.ai-agent-new-chat-head h2,
.ai-agent-new-chat-head p {
  margin: 0;
}

.ai-agent-new-chat-head h2 {
  font-size: 15px;
}

.ai-agent-new-chat-head p {
  margin-top: 9px;
  color: #999;
  font-size: 12px;
  line-height: 1.5;
}

.ai-agent-new-chat-form > label {
  display: grid;
  gap: 6px;
  color: #bdbdbd;
  font-size: 11px;
}

.ai-agent-new-chat-form input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #414141;
  border-radius: 8px;
  outline: none;
  background: #181818;
  color: #eee;
  font-size: 12px;
}

.ai-agent-new-chat-location {
  display: grid;
  gap: 11px;
  padding: 11px;
  border: 1px solid #3d3d3d;
  border-radius: 9px;
  background: #202020;
}

.ai-agent-new-chat-location > div:first-child {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.ai-agent-new-chat-location strong,
.ai-agent-new-chat-location small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-agent-new-chat-location small {
  color: #858585;
  font-size: 10.5px;
}

.ai-agent-new-chat-location strong {
  color: #dedede;
  font-size: 12px;
  font-weight: 500;
}

.ai-agent-new-chat-location__actions,
.ai-agent-new-chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.ai-agent-new-chat-location__actions .outline-btn {
  min-height: 29px;
  height: 29px;
  padding: 0 10px;
  border: 1px solid #404040;
  border-radius: 7px;
  background: #292929;
  color: #a9a9a9;
  cursor: pointer;
  font-size: 10.5px;
}

.ai-agent-new-chat-location__actions .outline-btn:hover,
.ai-agent-new-chat-location__actions .is-active {
  border-color: #575757;
  background: #333;
  color: #ededed;
}

.ai-agent-new-chat-actions {
  justify-content: flex-end;
  gap: 8px;
  margin-top: 2px;
}

.ai-agent-new-chat-actions .outline-btn,
.ai-agent-new-chat-actions .primary-btn {
  min-height: 32px;
  height: 32px;
  padding: 0 13px;
  border: 1px solid #454545;
  border-radius: 7px;
  background: #303030;
  color: #d0d0d0;
  cursor: pointer;
  font-size: 11px;
}

.ai-agent-new-chat-actions .primary-btn {
  background: #dedede;
  color: #1f1f1f;
}

.ai-agent-chat-row {
  display: block;
  align-items: center;
}

.ai-agent-chat-item {
  display: block;
  width: 100%;
  min-width: 0;
  height: 31px;
  min-height: 31px;
  padding: 0 9px 0 31px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #bdbdbd;
  cursor: pointer;
  text-align: left;
}

.ai-agent-chat-item:hover {
  background: #292929;
  color: #ececec;
}

.ai-agent-chat-item.is-active {
  position: relative;
  background: #313131;
  color: #e4e4e4;
}

.ai-agent-session-title,
.ai-agent-session-time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-agent-session-title {
  color: inherit;
  font-size: 12.5px;
  line-height: 31px;
}

.ai-agent-session-time {
  display: none;
}

.ai-agent-session-empty {
  padding: 12px 9px;
  color: #707070;
  font-size: 12px;
}

.ai-agent-sidebar-context-menu {
  position: fixed;
  z-index: 10020;
  width: 190px;
  padding: 5px;
  border: 1px solid #414141;
  border-radius: 9px;
  background: #292929;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .42);
}

.ai-agent-sidebar-context-menu[hidden] {
  display: none;
}

.ai-agent-sidebar-context-menu button {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #d0d0d0;
  cursor: pointer;
  font-size: 11px;
  text-align: left;
}

.ai-agent-sidebar-context-menu button:hover,
.ai-agent-sidebar-context-menu button:focus-visible {
  background: #383838;
  color: #f1f1f1;
  outline: 0;
}

.ai-agent-history__status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.ai-agent-history-toggle {
  display: none;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--primary);
}

.ai-agent-history-backdrop[hidden] {
  display: none;
}

.ai-agent-history-backdrop {
  display: none;
}

.ai-agent-topbar {
  position: relative;
  z-index: 5;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 68px 0 16px;
  border-bottom: 1px solid var(--border);
  background: #181818;
}

.ai-agent-topbar__identity,
.ai-agent-topbar__actions,
.ai-agent-message__identity,
.ai-agent-composer__toolbar,
.ai-agent-composer__left,
.ai-agent-composer__right {
  display: flex;
  align-items: center;
}

.ai-agent-topbar__identity {
  min-width: 0;
  gap: 12px;
}

.ai-agent-topbar__identity > div {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.ai-agent-topbar__identity strong,
.ai-agent-topbar__identity span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-agent-topbar__identity strong {
  color: #dadada;
  font-size: 13px;
  font-weight: 600;
}

.ai-agent-topbar__identity span {
  color: var(--muted);
  font-size: 12px;
}

#aiAgentProjectLabel,
#aiAgentFileCount,
.ai-agent-topbar__actions > .ai-agent-readonly,
.ai-agent-topbar__actions > [data-ai-agent-new] {
  display: none;
}

.ai-agent-topbar__actions {
  flex: 0 0 auto;
  gap: 8px;
}

.ai-agent-readonly,
.ai-agent-mode,
.ai-agent-file-count,
.ai-agent-context-usage,
.ai-agent-token-stats {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.ai-agent-token-stats {
  width: 100%;
  margin-top: 5px;
  padding: 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: #8f8f8f;
  font-size: 10.5px;
  font-weight: 400;
  line-height: 1.35;
  text-align: right;
}

.ai-agent-context-usage {
  display: none;
}

.ai-agent-file-count {
  display: none;
}

.ai-agent-readonly {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ai-agent-readonly i {
  color: var(--success);
}

.ai-agent-topbar__actions .icon-btn {
  width: 36px;
  height: 36px;
  min-height: 36px;
  border-color: transparent;
  color: var(--primary);
}

.ai-agent-conversation {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  overflow-anchor: none;
  scrollbar-gutter: stable;
  scroll-behavior: smooth;
}

.ai-agent-conversation::-webkit-scrollbar {
  width: 0;
}

.ai-agent-conversation-scrollbar {
  position: absolute;
  z-index: 8;
  top: 66px;
  right: 2px;
  bottom: 19px;
  width: 6px;
  border-radius: 999px;
  background: transparent;
}

.ai-agent-conversation-scrollbar[hidden] {
  display: none;
}

.ai-agent-conversation-scroll-thumb {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  min-height: 42px;
  border-radius: 999px;
  background: #2b2b2b;
  cursor: ns-resize;
}

.ai-agent-conversation-scroll-thumb:hover,
.ai-agent-conversation-scrollbar.is-dragging .ai-agent-conversation-scroll-thumb {
  background: #3b3b3b;
}

.ai-agent-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 24px 72px;
  text-align: center;
}

.ai-agent-empty[hidden] {
  display: none;
}

.ai-agent-empty__icon {
  display: none;
}

.ai-agent-empty h1 {
  margin: 0;
  color: var(--text);
  font-size: 19px;
  font-weight: 570;
}

.ai-agent-empty p {
  max-width: 520px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.ai-agent-empty__tips {
  width: min(560px, 100%);
  margin-top: 22px;
  display: grid;
  gap: 8px;
  text-align: left;
}

.ai-agent-empty__tip {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .44);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.ai-agent-empty__tip > i {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: var(--primary);
  font-size: 12px;
}

.ai-agent-empty__tip strong {
  color: var(--text);
  font-weight: 600;
}

.ai-agent-empty__tip--warning {
  border-color: rgba(176, 121, 38, .25);
  background: rgba(255, 247, 229, .68);
}

.ai-agent-empty__tip--warning > i {
  color: #a46d1f;
}

.ai-agent-messages {
  width: min(738px, calc(100% - 54px));
  min-height: 100%;
  margin: 0 auto;
  padding: 30px 0 178px;
  transform: translateX(6px);
}

.ai-agent-message {
  min-width: 0;
}

.ai-agent-message--user {
  width: fit-content;
  max-width: 568px;
  margin: 0 0 34px auto;
  padding: 10px 13px;
  border: 0;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
}

.ai-agent-message--user p {
  margin: 0;
  font-size: 13px;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ai-agent-message-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.ai-agent-message-images img {
  width: auto;
  max-width: 280px;
  max-height: 210px;
  border: 1px solid #383838;
  border-radius: 9px;
  object-fit: cover;
  cursor: zoom-in;
}

.ai-agent-message--agent {
  margin-bottom: 34px;
  padding: 0;
}

.ai-agent-live-output + .ai-agent-live-output {
  margin-top: 34px;
}

.ai-agent-live-output + .ai-agent-live-output--continuation {
  margin-top: 0;
}

.ai-agent-run-prelude:empty {
  display: none;
}

.ai-agent-message__head {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.ai-agent-message__identity {
  min-width: 0;
  gap: 10px;
}

.ai-agent-message__identity > span {
  flex: 0 0 32px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
}

.ai-agent-message__identity > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.ai-agent-message__identity strong {
  color: var(--text);
  font-size: 14px;
}

.ai-agent-message__identity small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-agent-message__copy {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.ai-agent-message__copy:hover {
  border-color: var(--border);
  background: var(--surface-muted);
  color: var(--primary);
}

.ai-agent-timeline {
  display: block;
  margin: 0;
  padding: 7px 0 4px;
  border-left: 0;
  list-style: none;
}

.ai-agent-timeline:empty {
  display: none;
}

.ai-agent-timeline li {
  position: relative;
  min-height: 0;
  display: block;
  margin: 0 0 12px;
  padding: 0 0 0 11px;
  border-left: 2px solid #383838;
  color: #858585;
  font-size: 12px;
  line-height: 1.45;
}

.ai-agent-timeline__content {
  min-width: 0;
  width: 100%;
}

.ai-agent-timeline > .ai-agent-tool-activity {
  display: block;
  min-height: 0;
  margin: 0 0 12px;
  padding: 0 0 0 11px;
  border-left: 2px solid #383838;
  color: #858585;
  font-size: 12px;
}

.ai-agent-live-tool-block > summary {
  cursor: pointer;
  color: #747474;
  font-size: 11px;
  user-select: none;
}

.ai-agent-live-tool-content {
  margin-top: 7px;
}

.ai-agent-live-tool-card {
  margin: 9px 0;
  overflow: hidden;
  border: 1px solid #353535;
  border-radius: 8px;
  background: #191919;
}

.ai-agent-live-tool-content .ai-agent-live-tool-card:first-child {
  margin-top: 0;
}

.ai-agent-live-tool-content .ai-agent-live-tool-card:last-child {
  margin-bottom: 0;
}

.ai-agent-live-tool-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 10px;
  color: #aaa;
  font: 11px/1.4 "Cascadia Code", Consolas, monospace;
  overflow-wrap: anywhere;
}

.ai-agent-live-tool-state {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #9c9c9c;
}

.ai-agent-live-tool-card.running .ai-agent-live-tool-state {
  animation: ai-agent-tool-pulse 1s infinite;
}

.ai-agent-live-tool-card.error .ai-agent-live-tool-state {
  background: #686868;
}

@keyframes ai-agent-tool-pulse {
  50% { opacity: .3; }
}

.ai-agent-live-tool-output {
  max-height: 240px;
  padding: 9px 10px 11px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  border-top: 1px solid #303030;
  color: #7f7f7f;
  font: 11px/1.5 "Cascadia Code", Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ai-agent-tool-images {
  display: block;
  margin: 0;
  padding: 10px;
  border-top: 1px solid #303030;
}

.ai-agent-tool-images img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 480px;
  margin: 0 auto;
  border: 0;
  border-radius: 6px;
  background: #111;
  cursor: zoom-in;
}

.ai-agent-tool-images img:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.ai-agent-timeline > .ai-agent-compaction-block,
.ai-agent-timeline > .ai-agent-compaction-status {
  display: block;
  min-height: 0;
  margin: 0 0 12px;
  padding: 0 0 0 11px;
  border-left: 2px solid #383838;
  color: #7f7f7f;
  font-size: 11px;
}

.ai-agent-timeline > .ai-agent-compaction-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-agent-timeline > .ai-agent-compaction-status.failed {
  color: #a78787;
}

.ai-agent-compaction-block summary {
  cursor: pointer;
  color: #747474;
  font-size: 11px;
  user-select: none;
}

.ai-agent-compaction-content {
  max-height: 460px;
  margin-top: 12px;
  padding-right: 12px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  color: #b8b8b8;
  font-size: 12px;
  line-height: 1.6;
}

.ai-agent-compaction-spinner {
  width: 11px;
  height: 11px;
  box-sizing: border-box;
  border: 2px solid #4b4b4b;
  border-top-color: #bdbdbd;
  border-radius: 50%;
  animation: ai-agent-compaction-spin .8s linear infinite;
}

@keyframes ai-agent-compaction-spin {
  to { transform: rotate(360deg); }
}

.ai-agent-timeline__icon {
  display: none;
}

.ai-agent-timeline li.is-done .ai-agent-timeline__icon {
  border-color: rgba(58, 123, 98, .3);
  color: var(--success);
}

.ai-agent-timeline li.is-error .ai-agent-timeline__icon {
  border-color: rgba(185, 75, 75, .3);
  color: var(--danger);
}

.ai-agent-run-history {
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}

.ai-agent-run-history > summary {
  width: max-content;
  padding: 3px 0 6px;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  user-select: none;
}

.ai-agent-message--activity {
  margin-bottom: 14px;
}

.ai-agent-message--agent:has(+ .ai-agent-message--activity) {
  margin-bottom: 12px;
}

.ai-agent-run-history__content {
  padding: 7px 0 4px;
}

.ai-agent-run-history__tool {
  margin: 0 0 12px;
  padding-left: 11px;
  border-left: 2px solid #383838;
}

.ai-agent-run-history__status {
  margin: 0 0 12px;
  padding-left: 11px;
  border-left: 2px solid #383838;
  color: #858585;
  font-size: 12px;
}

.ai-agent-run-history__status.is-error {
  color: #a78787;
}

.ai-agent-working-indicator {
  margin: 0 0 26px;
  color: #777;
  font-size: 11px;
}

.ai-agent-working-elapsed {
  line-height: 1.4;
}

.ai-agent-working-rule {
  height: 1px;
  margin-top: 9px;
  background: var(--border);
}

.ai-agent-working-phase {
  margin-top: 19px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.ai-agent-working-indicator > .status {
  width: max-content;
  margin-top: 12px;
}

.ai-agent-reasoning {
  margin: 0 0 17px;
  padding-left: 11px;
  border-left: 2px solid #383838;
}

.ai-agent-reasoning summary {
  padding: 0;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.ai-agent-reasoning pre,
.ai-agent-result pre {
  margin: 0;
  color: var(--text);
  font: inherit;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ai-agent-reasoning pre {
  max-height: 340px;
  margin-top: 8px;
  overflow: auto;
  overflow-anchor: none;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  font-style: italic;
  line-height: 1.55;
}

.ai-agent-message__text {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.68;
  white-space: normal;
  overflow-wrap: anywhere;
}

.assistant-message p,
.assistant-text {
  margin: 0 0 12px;
  overflow-wrap: anywhere;
}

.assistant-message > :last-child,
.assistant-text:last-child {
  margin-bottom: 0;
}

.assistant-message strong,
.assistant-text strong {
  color: var(--text);
  font-weight: 700;
}

.assistant-message em,
.assistant-text em {
  color: var(--secondary);
}

.inline-link {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--primary), transparent 56%);
  text-underline-offset: 2px;
}

.md-heading,
.assistant-message h1,
.assistant-message h2,
.assistant-message h3,
.assistant-message h4,
.assistant-message h5,
.assistant-message h6 {
  margin: 19px 0 9px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.assistant-message h1:first-child,
.assistant-message h2:first-child,
.assistant-message h3:first-child,
.assistant-message h4:first-child,
.assistant-message h5:first-child,
.assistant-message h6:first-child,
.md-heading:first-child {
  margin-top: 0;
}

.assistant-message h1,
.md-heading-1 { font-size: 17px; }
.assistant-message h2 { font-size: 16px; }
.assistant-message h3 { font-size: 15px; }

.md-list,
.assistant-message ul,
.assistant-message ol {
  margin: 7px 0 14px;
  padding-left: 22px;
}

.md-list li,
.assistant-message li {
  margin: 4px 0;
  padding-left: 2px;
}

.assistant-message li > p { margin: 0; }

.md-quote,
.assistant-message blockquote {
  margin: 10px 0 14px;
  padding: 2px 0 2px 12px;
  border-left: 2px solid var(--border-strong, var(--border));
  color: var(--muted);
}

.assistant-message hr {
  height: 1px;
  margin: 18px 0;
  border: 0;
  background: var(--border);
}

.md-table-wrap {
  max-width: 100%;
  overflow-x: auto;
  margin: 10px 0 17px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.assistant-message table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  line-height: 1.48;
}

.assistant-message th,
.assistant-message td {
  padding: 7px 10px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.assistant-message th {
  background: var(--surface-muted);
  color: var(--text);
  font-weight: 700;
}

.assistant-message tr:last-child td { border-bottom: 0; }
.assistant-message th:last-child,
.assistant-message td:last-child { border-right: 0; }

.inline-code,
.assistant-message :not(pre) > code {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-muted);
  color: var(--text);
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: .9em;
}

.assistant-message pre {
  position: relative;
  max-width: 100%;
  overflow: auto;
  margin: 12px 0;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #f5f8fa;
  color: var(--text);
  font: 11px/1.58 "Cascadia Code", Consolas, monospace;
  white-space: pre;
}

.ai-agent-artifacts {
  display: grid;
  gap: 6px;
  margin: 16px 0 0;
  padding-top: 11px;
  border-top: 1px solid #303030;
}

.ai-agent-artifacts__title {
  color: #858585;
  font-size: 11px;
  line-height: 1.4;
}

.ai-agent-artifact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  padding: 3px 0;
}

.ai-agent-artifact > span,
.ai-agent-artifact > span strong,
.ai-agent-artifact > span small {
  display: block;
  min-width: 0;
}

.ai-agent-artifact > span strong {
  overflow-wrap: anywhere;
}

.ai-agent-artifact > span small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.ai-agent-artifact > div {
  display: flex;
  flex: 0 0 auto;
  gap: 7px;
}

.ai-agent-artifact .outline-btn,
.ai-agent-retry {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #454545;
  background: #303030;
  color: var(--text);
  font-size: 12px;
}

.ai-agent-artifact .outline-btn:hover,
.ai-agent-artifact .outline-btn:focus-visible,
.ai-agent-retry:hover,
.ai-agent-retry:focus-visible {
  border-color: #5a5a5a;
  background: #383838;
  color: #f1f1f1;
}

.ai-agent-checkpoint-action {
  display: flex;
  justify-content: flex-start;
  margin: 10px 0 18px;
}

.ai-agent-artifacts.has-checkpoint-action {
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 16px;
}

.ai-agent-artifacts.has-checkpoint-action > .ai-agent-artifacts__title {
  grid-column: 1 / -1;
}

.ai-agent-artifacts.has-checkpoint-action > .ai-agent-artifact {
  grid-column: 1;
}

.ai-agent-artifacts.has-checkpoint-action > .ai-agent-checkpoint-action {
  grid-column: 2;
  grid-row: 2;
  align-self: center;
  margin: 0;
}

.ai-agent-checkpoint-action__button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #454545;
  background: #242424;
  color: #bdbdbd;
  font-size: 12px;
}

.ai-agent-checkpoint-action__button:hover,
.ai-agent-checkpoint-action__button:focus-visible {
  border-color: #5a5a5a;
  background: #303030;
  color: #f1f1f1;
}

.ai-agent-checkpoint-action__button:disabled {
  opacity: .5;
  cursor: default;
}

.ai-agent-retry {
  margin: 18px 0 0;
}

.ai-agent-reasoning pre {
  max-height: 150px;
  overflow: auto;
  padding: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  scrollbar-color: #4b4b4b transparent;
  scrollbar-width: thin;
}

.ai-agent-reasoning pre::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.ai-agent-reasoning pre::-webkit-scrollbar-track {
  background: transparent;
}

.ai-agent-reasoning pre::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #4b4b4b;
}

.ai-agent-reasoning pre::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.ai-agent-result {
  margin: 18px 0 0;
}

.ai-agent-result pre {
  font-size: 14px;
  line-height: 1.65;
}

.ai-agent-composer-wrap {
  position: absolute;
  z-index: 5;
  right: 0;
  bottom: 15px;
  left: 0;
  width: min(738px, calc(100% - 64px));
  min-width: 0;
  margin: 0 auto;
  padding: 0;
}

.ai-agent-composer-wrap.is-dragging::after {
  position: absolute;
  z-index: 8;
  inset: -8px 0 0;
  display: grid;
  place-items: center;
  border: 1px dashed #686868;
  border-radius: 17px;
  background: rgba(35, 35, 35, .94);
  color: #d0d0d0;
  font-size: 13px;
  content: 'Отпустите файлы здесь';
  pointer-events: none;
}

.ai-agent-image-viewer {
  position: fixed;
  z-index: 10100;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: rgba(16, 16, 16, .985);
}

.ai-agent-image-viewer[hidden],
.ai-agent-image-editor-tools[hidden],
.ai-agent-image-viewer__actions [hidden] {
  display: none !important;
}

.ai-agent-image-viewer__toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 8px 12px 8px 16px;
  border-bottom: 1px solid #343434;
  background: #202020;
}

.ai-agent-image-viewer__title {
  flex: 1 1 180px;
  min-width: 80px;
  overflow: hidden;
  color: #d6d6d6;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-agent-image-editor-tools,
.ai-agent-image-viewer__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ai-agent-image-editor-tools {
  flex: 0 1 auto;
  min-width: 0;
}

.ai-agent-image-editor-tools button,
.ai-agent-image-viewer__actions button {
  height: 31px;
  padding: 0 10px;
  border: 1px solid #454545;
  border-radius: 7px;
  background: #2c2c2c;
  color: #bdbdbd;
  cursor: pointer;
  font-size: 11px;
}

.ai-agent-image-editor-tools button:hover,
.ai-agent-image-viewer__actions button:hover,
.ai-agent-image-editor-tools button.is-active {
  border-color: #5a5a5a;
  background: #383838;
  color: #f1f1f1;
}

.ai-agent-image-editor-tools button:disabled,
.ai-agent-image-viewer__actions button:disabled {
  cursor: default;
  opacity: .42;
}

.ai-agent-image-editor-tools button.is-active {
  box-shadow: inset 0 -2px #e04444;
}

.ai-agent-image-editor-tools input {
  width: min(190px, 18vw);
  height: 31px;
  padding: 0 9px;
  border: 1px solid #454545;
  border-radius: 7px;
  outline: none;
  background: #171717;
  color: #d8d8d8;
  font-size: 11px;
}

.ai-agent-image-editor-tools input:focus {
  border-color: #626262;
}

.ai-agent-image-editor-tools input:disabled {
  color: #686868;
  cursor: default;
  opacity: .65;
}

.ai-agent-image-viewer__actions button.is-primary {
  border-color: #dedede;
  background: #dedede;
  color: #1f1f1f;
}

.ai-agent-image-viewer__stage {
  flex: 1 1 auto;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  overflow: auto;
  padding: 18px;
  background: #111;
}

.ai-agent-image-viewer__stage canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border: 1px solid #3a3a3a;
  border-radius: 3px;
  background: #0c0c0c;
  box-shadow: 0 16px 55px rgba(0, 0, 0, .45);
  cursor: zoom-out;
  touch-action: none;
}

.ai-agent-image-viewer.is-editable .ai-agent-image-viewer__stage canvas {
  cursor: crosshair;
}

.ai-agent-image-viewer__hint {
  flex: 0 0 auto;
  min-height: 28px;
  padding: 6px 14px;
  border-top: 1px solid #303030;
  background: #1b1b1b;
  color: #777;
  font-size: 10px;
  text-align: center;
}

@media (max-width: 920px) {
  .ai-agent-image-viewer__toolbar {
    flex-wrap: wrap;
  }

  .ai-agent-image-viewer__title {
    order: 1;
  }

  .ai-agent-image-viewer__actions {
    order: 2;
  }

  .ai-agent-image-editor-tools {
    order: 3;
    flex: 1 0 100%;
    overflow-x: auto;
    padding-bottom: 1px;
  }

  .ai-agent-image-editor-tools button {
    flex: 0 0 auto;
  }

  .ai-agent-image-editor-tools input {
    flex: 0 0 180px;
    width: 180px;
  }
}

.ai-agent-files {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 8px;
}

.ai-agent-files[hidden],
.ai-agent-files__empty {
  display: none;
}

.ai-agent-file {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  max-width: 230px;
  height: 40px;
  padding: 4px 28px 4px 6px;
  border: 1px solid #383838;
  border-radius: 9px;
  background: #222;
}

.ai-agent-file__preview {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: #2d2d2d;
  color: #888;
  font-size: 10px;
  object-fit: cover;
}

.ai-agent-file.is-image .ai-agent-file__preview {
  cursor: crosshair;
}

.ai-agent-message__attachments {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 7px;
}

.ai-agent-message__attachment {
  display: inline-flex;
  max-width: 220px;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, .44);
  border-radius: 8px;
  color: inherit;
  font-size: 11px;
}

.ai-agent-message__attachment span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-agent-file__name {
  overflow: hidden;
  color: #bbb;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-agent-file__remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: #777;
  cursor: pointer;
}

.ai-agent-file__remove:hover {
  background: #373737;
  color: #eee;
}

.ai-agent-composer {
  min-width: 0;
  min-height: 100px;
  padding: 14px 13px 9px;
  border: 0;
  border-radius: 20px;
  background: #2a2a2a;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .045);
  transition: border-color .16s ease, box-shadow .16s ease;
}

.ai-agent-composer:focus-within {
  box-shadow: 0 8px 30px rgba(0, 0, 0, .045);
}

.ai-agent-composer textarea {
  display: block;
  width: 100%;
  min-height: 46px;
  max-height: 178px;
  resize: none;
  overflow-y: auto;
  padding: 0 0 8px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
}

.ai-agent-composer textarea::placeholder {
  color: #6f6f6f;
}

.ai-agent-composer__toolbar {
  width: 100%;
  min-width: 0;
  min-height: 31px;
  justify-content: space-between;
  gap: 12px;
}

.ai-agent-composer__left {
  flex: 1 1 auto;
  min-width: 0;
  gap: 10px;
  transform: translate(1px, 1px);
}

.ai-agent-composer__right {
  flex: 0 0 auto;
  gap: 8px;
  transform: translate(5px, 1px);
}

.ai-agent-mode-control {
  position: relative;
  flex: 0 0 auto;
}

.ai-agent-mode-trigger {
  width: max-content;
  max-width: 220px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  padding: 0 6px;
  border: 0;
  border-radius: 7px;
  outline: 0;
  background: transparent;
  color: #a7a7a7;
  cursor: pointer;
  font-size: 12px;
}

.ai-agent-mode-trigger:hover,
.ai-agent-mode-trigger:focus-visible,
.ai-agent-mode-trigger[aria-expanded="true"] {
  background: #323232;
  color: #e2e2e2;
}

.ai-agent-mode-trigger:disabled {
  cursor: default;
  opacity: .45;
}

.ai-agent-mode-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-agent-mode-chevron {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: #8a8a8a;
}

.ai-agent-mode-menu {
  position: absolute;
  z-index: 22;
  right: 0;
  bottom: 35px;
  width: 174px;
  padding: 5px;
  border: 1px solid #414141;
  border-radius: 10px;
  background: #292929;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .35);
}

.ai-agent-mode-menu[hidden] {
  display: none;
}

.ai-agent-mode-menu button {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #c4c4c4;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.ai-agent-mode-menu button:hover,
.ai-agent-mode-menu button:focus-visible,
.ai-agent-mode-menu button.is-active {
  background: #353535;
  color: #f0f0f0;
}

.ai-agent-mode-menu [role="menuitemcheckbox"] {
  position: relative;
  padding-left: 29px;
}

.ai-agent-mode-menu [role="menuitemcheckbox"]::before {
  position: absolute;
  top: 9px;
  left: 10px;
  width: 12px;
  height: 12px;
  box-sizing: border-box;
  border: 1px solid #666;
  border-radius: 3px;
  content: '';
}

.ai-agent-mode-menu [role="menuitemcheckbox"][aria-checked="true"]::before {
  border-color: #d2d2d2;
  background: #d2d2d2;
  box-shadow: inset 0 0 0 3px #3a3a3a;
}

.ai-agent-mode-separator {
  height: 1px;
  margin: 5px 7px;
  background: #414141;
}

.ai-agent-resource-control {
  position: relative;
  flex: 0 0 auto;
}

.ai-agent-composer__icon,
.ai-agent-send,
.ai-agent-stop {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  font: inherit;
  cursor: pointer;
}

.ai-agent-composer__icon {
  background: transparent;
  color: #a8a8a8;
}

.ai-agent-composer-plus-icon {
  display: block;
  width: 16px;
  height: 16px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.4;
}

.ai-agent-composer__icon:hover,
.ai-agent-composer__icon[aria-expanded="true"] {
  background: #353535;
  color: #efefef;
}

.ai-agent-send {
  background: #e4e4e4;
  color: #252525;
}

.ai-agent-send:hover:not(:disabled) {
  background: #e4e4e4;
}

.ai-agent-send:disabled {
  cursor: default;
  opacity: .45;
}

.ai-agent-stop {
  background: #e4e4e4;
  color: #252525;
}

.ai-agent-send-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-agent-stop > span {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: #2b2b2b;
}

.ai-agent-resource-menu {
  position: absolute;
  z-index: 35;
  bottom: 36px;
  left: 0;
  width: min(292px, calc(100vw - 34px));
  max-height: calc(100vh - 180px);
  padding: 6px;
  overflow-y: auto;
  border: 1px solid #414141;
  border-radius: 12px;
  background: #292929;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .42);
}

.ai-agent-resource-menu[hidden] {
  display: none;
}

.ai-agent-resource-menu > button {
  width: 100%;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  min-height: 48px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #d7d7d7;
  cursor: pointer;
  text-align: left;
}

.ai-agent-resource-menu > button.ai-agent-resource-toggle {
  grid-template-columns: 28px minmax(0, 1fr) 30px;
}

.ai-agent-resource-menu > button.ai-agent-extension-commands-trigger {
  grid-template-columns: 28px minmax(0, 1fr) 18px;
}

.ai-agent-resource-menu > button:hover {
  background: #363636;
}

.ai-agent-resource-menu__icon,
.ai-agent-resource-menu > button > i {
  color: #a5a5a5;
  text-align: center;
}

.ai-agent-resource-menu > button > span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.ai-agent-resource-menu strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-agent-resource-menu small {
  overflow: hidden;
  color: #8e8e8e;
  font-size: 10px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-agent-resource-menu__label {
  padding: 5px 9px 3px;
  color: #868686;
  font-size: 10px;
  font-weight: 500;
}

.ai-agent-resource-menu__separator {
  height: 1px;
  margin: 5px 7px;
  background: #3a3a3a;
}

.ai-agent-resource-menu__separator--formats {
  margin-top: 6px;
  margin-bottom: 6px;
}

.ai-agent-resource-menu-chevron {
  color: #858585;
  font-size: 16px;
  transition: transform 120ms ease;
}

.ai-agent-extension-commands-trigger[aria-expanded="true"] .ai-agent-resource-menu-chevron {
  transform: rotate(90deg);
}

.ai-agent-resource-command-list {
  display: grid;
  max-height: 210px;
  margin: 2px 0 5px 28px;
  padding-left: 7px;
  overflow-y: auto;
  border-left: 1px solid #414141;
}

.ai-agent-resource-command-list[hidden] {
  display: none;
}

.ai-agent-resource-command-item {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 42px;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #d2d2d2;
  cursor: pointer;
  text-align: left;
}

.ai-agent-resource-command-item:hover,
.ai-agent-resource-command-item:focus-visible {
  background: #363636;
  outline: none;
}

.ai-agent-resource-command-item strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-agent-resource-command-item small {
  overflow: hidden;
  color: #8e8e8e;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-agent-resource-switch {
  position: relative;
  width: 28px;
  height: 16px;
  border: 1px solid #565656;
  border-radius: 999px;
  background: #3a3a3a;
  transition: background 120ms ease, border-color 120ms ease;
}

.ai-agent-resource-switch > span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #a3a3a3;
  transition: transform 120ms ease, background 120ms ease;
}

.ai-agent-resource-toggle.is-active .ai-agent-resource-switch {
  border-color: #777;
  background: #666;
}

.ai-agent-resource-toggle.is-active .ai-agent-resource-switch > span {
  background: #ededed;
  transform: translateX(12px);
}

.ai-agent-active-resources {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.ai-agent-active-resources[hidden] {
  display: none;
}

.ai-agent-active-resources::-webkit-scrollbar {
  display: none;
}

.ai-agent-active-resources span {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 7px;
  box-sizing: border-box;
  border: 1px solid #484848;
  border-radius: 999px;
  color: #a9a9a9;
  font-size: 9px;
  line-height: 1;
  white-space: nowrap;
}

.ai-agent-office-format-icon {
  display: inline-flex;
  width: 17px;
  height: 17px;
  align-items: center;
  justify-content: center;
  margin: auto;
  border: 1px solid #9c9c9c;
  border-radius: 3px;
  color: #aaa;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
}

.ai-agent-office-pdf-icon {
  font-size: 8px;
  font-weight: 650;
  letter-spacing: -.2px;
}

.ai-agent-capabilities {
  margin-top: 4px;
  padding: 8px 9px 3px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.ai-agent-capabilities i {
  margin-right: 5px;
  color: var(--success);
}

.ai-agent-privacy {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.ai-agent-privacy i {
  margin-right: 4px;
  color: var(--primary);
}

@media (max-width: 980px) {
  .ai-agent-messages {
    width: calc(100% - 34px);
  }

  .ai-agent-composer-wrap {
    width: calc(100% - 44px);
  }
}

@media (max-width: 900px) {
  .ai-agent-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-agent-stage {
    grid-column: 1;
  }

  .ai-agent-history {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 230;
    width: min(282px, 86vw);
    box-shadow: 16px 0 34px rgba(35, 55, 70, .18);
    transform: translateX(-104%);
    transition: transform .18s ease;
  }

  .ai-agent-history.is-open {
    transform: translateX(0);
  }

  .ai-agent-history__close {
    flex: 0 0 28px;
    width: 28px;
    min-width: 28px;
    height: 28px;
    min-height: 28px;
    margin-left: auto;
    padding: 0;
    place-items: center;
  }

  .ai-agent-history__close,
  .ai-agent-history-toggle {
    display: grid;
  }

  .ai-agent-history-backdrop {
    position: fixed;
    inset: 0;
    z-index: 220;
    display: block;
    padding: 0;
    border: 0;
    background: rgba(26, 43, 54, .28);
  }
}

@media (max-width: 620px) {
  .ai-agent-stage {
    grid-template-rows: 68px minmax(0, 1fr);
  }

  .ai-agent-topbar {
    padding: 12px 68px 12px 16px;
  }

  .ai-agent-topbar__identity > div span,
  .ai-agent-readonly {
    display: none;
  }

  .ai-agent-topbar__actions .icon-btn {
    width: 34px;
    height: 34px;
    min-height: 34px;
  }

  .ai-agent-empty {
    padding: 0 24px 72px;
  }

  .ai-agent-empty__icon {
    width: 44px;
    height: 44px;
    margin-bottom: 13px;
  }

  .ai-agent-empty h1 {
    font-size: 22px;
  }

  .ai-agent-empty p {
    font-size: 13px;
  }

  .ai-agent-empty__tips {
    margin-top: 17px;
  }

  .ai-agent-empty__tip {
    padding: 9px 10px;
    font-size: 12px;
  }

  .ai-agent-messages {
    width: calc(100% - 34px);
    padding: 30px 0 178px;
  }

  .ai-agent-message--user {
    margin-bottom: 26px;
  }

  .ai-agent-message__head {
    gap: 8px;
  }

  .ai-agent-message__identity small {
    max-width: 190px;
  }

  .ai-agent-reasoning,
  .ai-agent-result,
  .ai-agent-message__text,
  .ai-agent-artifacts,
  .ai-agent-checkpoint-action,
  .ai-agent-retry {
    margin-left: 0;
  }

  .ai-agent-artifact {
    align-items: stretch;
    flex-direction: column;
  }

  .ai-agent-artifacts.has-checkpoint-action {
    grid-template-columns: 1fr;
  }

  .ai-agent-artifacts.has-checkpoint-action > .ai-agent-artifacts__title,
  .ai-agent-artifacts.has-checkpoint-action > .ai-agent-artifact,
  .ai-agent-artifacts.has-checkpoint-action > .ai-agent-checkpoint-action {
    grid-column: 1;
    grid-row: auto;
  }

  .ai-agent-artifacts.has-checkpoint-action > .ai-agent-checkpoint-action {
    margin-top: 2px;
  }

  .ai-agent-artifact > div {
    width: 100%;
  }

  .ai-agent-artifact .outline-btn {
    flex: 1 1 0;
  }

  .ai-agent-composer-wrap {
    bottom: max(15px, env(safe-area-inset-bottom));
    width: calc(100% - 44px);
  }

  .ai-agent-stage::after {
    height: 167px;
  }

  .ai-agent-file-count {
    max-width: 142px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ai-agent-token-stats,
  .ai-agent-context-usage {
    display: none;
  }

  .ai-agent-mode-trigger {
    max-width: 116px;
    padding-inline: 5px;
  }

  .ai-agent-mode-menu {
    right: -34px;
  }

  .ai-agent-privacy {
    padding: 0 6px;
    font-size: 10px;
  }
}

/* CRM skin: PiCodex geometry and behavior stay intact; only visual tokens change. */
.ai-agent-stage {
  background: var(--page);
}

.ai-agent-history {
  background: linear-gradient(180deg, var(--surface-alt) 0%, var(--surface-muted) 100%);
  box-shadow: 4px 0 20px rgba(44, 62, 74, .07);
}

.ai-agent-history__head-actions .icon-btn {
  color: var(--muted);
}

.ai-agent-history__head-actions .icon-btn:hover,
.ai-agent-history__head-actions .icon-btn:focus-visible {
  color: var(--primary-dark);
}

.ai-agent-history__search {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: inset 0 1px 2px rgba(44, 62, 74, .04);
}

.ai-agent-history__search::placeholder {
  color: #7B8992;
}

.ai-agent-history__new:hover,
.ai-agent-history__new:focus-visible,
.ai-agent-project-heading:hover,
.ai-agent-project-heading:focus-visible,
.ai-agent-chat-item:hover {
  background: rgba(74, 122, 154, .08);
  color: var(--primary-dark);
}

.ai-agent-new-chat-icon,
.ai-agent-new-chat-plus,
.ai-agent-project-chevron {
  color: var(--primary);
}

.ai-agent-project-heading {
  color: var(--secondary);
}

.ai-agent-project-folder-icon,
.ai-agent-project-folder-icon::before {
  border-color: rgba(74, 122, 154, .7);
}

.ai-agent-session-list::-webkit-scrollbar-thumb {
  border-color: var(--surface-muted);
  background: rgba(74, 122, 154, .34);
}

.ai-agent-history__section-heading,
.ai-agent-session-empty {
  color: var(--muted);
}

.ai-agent-chat-item {
  color: var(--secondary);
}

.ai-agent-chat-item.is-active {
  background: rgba(74, 122, 154, .15);
  color: var(--primary-dark);
  font-weight: 600;
}

.ai-agent-new-chat-dialog,
.ai-agent-sidebar-context-menu,
.ai-agent-mode-menu,
.ai-agent-resource-menu {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 18px 44px rgba(44, 62, 74, .16);
}

.ai-agent-new-chat-dialog::backdrop {
  background: rgba(12, 19, 25, .42);
}

.ai-agent-new-chat-head h2,
.ai-agent-new-chat-location strong {
  color: var(--secondary);
}

.ai-agent-new-chat-head p,
.ai-agent-new-chat-location small,
.ai-agent-new-chat-form > label {
  color: var(--muted);
}

.ai-agent-new-chat-form input {
  border-color: var(--border);
  background: var(--surface-alt);
  color: var(--text);
}

.ai-agent-new-chat-form input:focus,
.ai-agent-image-editor-tools input:focus {
  border-color: var(--primary);
  outline: 0;
  box-shadow: none;
}

.ai-agent-new-chat-location {
  border-color: var(--border);
  background: var(--surface-alt);
}

.ai-agent-new-chat-location__actions .outline-btn,
.ai-agent-new-chat-actions .outline-btn,
.ai-agent-artifact .outline-btn,
.ai-agent-retry,
.ai-agent-checkpoint-action__button {
  border-color: rgba(74, 122, 154, .34);
  background: var(--surface);
  color: var(--primary-dark);
}

.ai-agent-new-chat-location__actions .outline-btn:hover,
.ai-agent-new-chat-location__actions .is-active,
.ai-agent-new-chat-actions .outline-btn:hover,
.ai-agent-artifact .outline-btn:hover,
.ai-agent-artifact .outline-btn:focus-visible,
.ai-agent-retry:hover,
.ai-agent-retry:focus-visible,
.ai-agent-checkpoint-action__button:hover,
.ai-agent-checkpoint-action__button:focus-visible {
  border-color: var(--primary);
  background: var(--surface-muted);
  color: var(--primary-dark);
}

.ai-agent-new-chat-actions .primary-btn {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.ai-agent-sidebar-context-menu button,
.ai-agent-mode-menu button,
.ai-agent-resource-menu > button,
.ai-agent-resource-command-item {
  color: var(--secondary);
}

.ai-agent-sidebar-context-menu button:hover,
.ai-agent-sidebar-context-menu button:focus-visible,
.ai-agent-mode-menu button:hover,
.ai-agent-mode-menu button:focus-visible,
.ai-agent-mode-menu button.is-active,
.ai-agent-resource-menu > button:hover,
.ai-agent-resource-command-item:hover,
.ai-agent-resource-command-item:focus-visible {
  background: var(--surface-muted);
  color: var(--primary-dark);
}

.ai-agent-topbar {
  border-color: var(--border);
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 2px 10px rgba(44, 62, 74, .045);
}

.ai-agent-topbar__identity strong {
  color: var(--secondary);
  font-size: 15px;
}

.ai-agent-token-stats {
  color: var(--muted);
}

.ai-agent-conversation-scroll-thumb {
  background: rgba(74, 122, 154, .28);
}

.ai-agent-conversation-scroll-thumb:hover,
.ai-agent-conversation-scrollbar.is-dragging .ai-agent-conversation-scroll-thumb {
  background: rgba(74, 122, 154, .52);
}

.ai-agent-empty h1 {
  color: var(--secondary);
  font-weight: 500;
}

.ai-agent-message--user {
  border: 1px solid rgba(74, 122, 154, .18);
  background: var(--surface-muted);
  color: var(--text);
  box-shadow: 0 5px 16px rgba(44, 62, 74, .05);
}

.ai-agent-message-images img,
.ai-agent-file,
.ai-agent-message__attachment {
  border-color: var(--border);
}

.ai-agent-timeline li,
.ai-agent-timeline > .ai-agent-tool-activity,
.ai-agent-timeline > .ai-agent-compaction-block,
.ai-agent-timeline > .ai-agent-compaction-status,
.ai-agent-run-history__tool,
.ai-agent-run-history__status,
.ai-agent-reasoning {
  border-left-color: rgba(74, 122, 154, .32);
}

.ai-agent-timeline li,
.ai-agent-timeline > .ai-agent-tool-activity,
.ai-agent-run-history__status,
.ai-agent-working-indicator,
.ai-agent-live-tool-block > summary,
.ai-agent-compaction-block summary {
  color: var(--muted);
}

.ai-agent-live-tool-card {
  border-color: var(--border);
  background: var(--surface-alt);
}

.ai-agent-live-tool-heading {
  color: var(--secondary);
}

.ai-agent-live-tool-state {
  background: var(--primary);
}

.ai-agent-live-tool-card.error .ai-agent-live-tool-state {
  background: var(--danger);
}

.ai-agent-timeline > .ai-agent-compaction-status.failed,
.ai-agent-run-history__status.is-error {
  color: var(--danger);
}

.ai-agent-live-tool-output,
.ai-agent-tool-images {
  border-top-color: var(--border);
  color: var(--muted);
}

.ai-agent-tool-images img {
  background: var(--surface-muted);
}

.ai-agent-compaction-content {
  color: var(--secondary);
}

.ai-agent-compaction-spinner {
  border-color: rgba(74, 122, 154, .22);
  border-top-color: var(--primary);
}

.ai-agent-run-history,
.ai-agent-artifacts {
  border-color: var(--border);
}

.ai-agent-artifacts__title {
  color: var(--muted);
}

.assistant-message pre {
  background: var(--surface-alt);
}

.ai-agent-reasoning pre {
  scrollbar-color: rgba(74, 122, 154, .38) transparent;
}

.ai-agent-reasoning pre::-webkit-scrollbar-thumb {
  background: rgba(74, 122, 154, .38);
}

.ai-agent-composer-wrap.is-dragging::after {
  border-color: var(--primary);
  background: rgba(237, 245, 249, .96);
  color: var(--primary-dark);
  box-shadow: 0 12px 34px rgba(44, 62, 74, .14);
}

.ai-agent-files {
  filter: none;
}

.ai-agent-file {
  background: var(--surface);
  box-shadow: 0 4px 12px rgba(44, 62, 74, .06);
}

.ai-agent-file__preview {
  background: var(--surface-muted);
  color: var(--primary-dark);
}

.ai-agent-file__name {
  color: var(--secondary);
}

.ai-agent-file__remove {
  color: var(--muted);
}

.ai-agent-file__remove:hover {
  background: rgba(185, 75, 75, .1);
  color: var(--danger);
}

.ai-agent-composer {
  border: 1px solid rgba(74, 122, 154, .24);
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(44, 62, 74, .12);
}

.ai-agent-composer:focus-within {
  border-color: rgba(74, 122, 154, .46);
  box-shadow: 0 13px 34px rgba(44, 62, 74, .13), 0 0 0 2px rgba(74, 122, 154, .08);
}

.ai-agent-composer textarea:focus-visible {
  outline: 0;
}

.ai-agent-composer textarea::placeholder {
  color: #78858E;
}

.ai-agent-mode-trigger,
.ai-agent-composer__icon {
  color: var(--muted);
}

.ai-agent-mode-trigger:hover,
.ai-agent-mode-trigger:focus-visible,
.ai-agent-mode-trigger[aria-expanded="true"],
.ai-agent-composer__icon:hover,
.ai-agent-composer__icon[aria-expanded="true"] {
  background: var(--surface-muted);
  color: var(--primary-dark);
}

.ai-agent-mode-chevron,
.ai-agent-resource-menu__icon,
.ai-agent-resource-menu > button > i,
.ai-agent-resource-menu-chevron,
.ai-agent-resource-menu__label,
.ai-agent-resource-menu small,
.ai-agent-resource-command-item small {
  color: var(--muted);
}

.ai-agent-mode-menu [role="menuitemcheckbox"]::before {
  border-color: rgba(74, 122, 154, .42);
  background: var(--surface);
}

.ai-agent-mode-menu [role="menuitemcheckbox"][aria-checked="true"]::before {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: inset 0 0 0 3px var(--surface);
}

.ai-agent-mode-separator,
.ai-agent-resource-menu__separator,
.ai-agent-resource-command-list {
  border-color: var(--border);
  background-color: transparent;
}

.ai-agent-mode-separator,
.ai-agent-resource-menu__separator {
  background: var(--border);
}

.ai-agent-send {
  background: var(--primary);
  color: #fff;
}

.ai-agent-send:hover:not(:disabled) {
  background: var(--primary-dark);
}

.ai-agent-stop {
  background: var(--danger);
  color: #fff;
}

.ai-agent-stop > span {
  background: #fff;
}

.ai-agent-resource-switch {
  border-color: rgba(74, 122, 154, .34);
  background: var(--surface-muted);
}

.ai-agent-resource-switch > span {
  background: #91A4B1;
}

.ai-agent-resource-toggle.is-active .ai-agent-resource-switch {
  border-color: var(--primary);
  background: var(--primary);
}

.ai-agent-resource-toggle.is-active .ai-agent-resource-switch > span {
  background: #fff;
}

.ai-agent-active-resources span {
  border-color: rgba(74, 122, 154, .3);
  background: var(--surface-muted);
  color: var(--primary-dark);
}

.ai-agent-office-format-icon {
  border-color: rgba(74, 122, 154, .48);
  color: var(--primary-dark);
}

.ai-agent-image-viewer__toolbar {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: 0 3px 14px rgba(44, 62, 74, .1);
}

.ai-agent-image-viewer__title {
  color: var(--secondary);
}

.ai-agent-image-editor-tools button,
.ai-agent-image-viewer__actions button {
  border-color: var(--border);
  background: var(--surface-alt);
  color: var(--primary-dark);
}

.ai-agent-image-editor-tools button:hover,
.ai-agent-image-viewer__actions button:hover,
.ai-agent-image-editor-tools button.is-active {
  border-color: var(--primary);
  background: var(--surface-muted);
  color: var(--primary-dark);
}

.ai-agent-image-editor-tools button.is-active {
  box-shadow: inset 0 -2px var(--primary);
}

.ai-agent-image-editor-tools input {
  border-color: var(--border);
  background: var(--surface-alt);
  color: var(--text);
}

.ai-agent-image-editor-tools input:disabled {
  color: var(--muted);
}

.ai-agent-image-viewer__actions button.is-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

.ai-agent-image-viewer__hint {
  border-color: rgba(255, 255, 255, .12);
  background: var(--primary-dark);
  color: rgba(255, 255, 255, .76);
}

.ai-agent-workspace :where(input, textarea, select):focus-visible {
  outline: 0;
}

.ai-agent-workspace :where(button, summary):focus-visible {
  outline: 3px solid rgba(74, 122, 154, .2);
  outline-offset: 2px;
}
.ai-agent-crm-mutation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ai-agent-crm-mutation-actions .outline-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  text-decoration: none;
}
