/* Агент Claude в чате (тестовая копия страницы). Слой поверх chat.css:
   переключатель режима, живая панель хода и сводка шагов. */

/* ----- Переключатель режима рядом с выбором версии ----- */
.chat-agent-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: transparent;
  color: var(--mut);
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  white-space: nowrap;
}

.chat-agent-switch[hidden] {
  display: none;
}

.chat-agent-switch:hover {
  color: var(--tx);
  border-color: var(--tx2);
}

.chat-agent-switch[aria-pressed="true"] {
  color: var(--acc);
  border-color: var(--acc);
  background: color-mix(in srgb, var(--acc) 9%, transparent);
}

/* ----- Живая панель хода ----- */
.agent-live__head {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: var(--tx2);
  margin-bottom: 9px;
}

.agent-live__spin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--acc);
  animation: agent-spin .8s linear infinite;
  flex: none;
}

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

@media (prefers-reduced-motion: reduce) {
  .agent-live__spin { animation-duration: 2.4s; }
}

.agent-live__now {
  margin: 0 0 9px;
  font-family: var(--mono);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* Текст, пока он приходит: разметка появится в готовом ответе. */
.agent-live__msg {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.65;
  margin-bottom: 11px;
}

.agent-live__msg:empty {
  display: none;
}

/* ----- Сводка шагов: «Выполнил 8 команд…» ----- */
.agent-steps {
  margin: 0 0 11px;
}

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

.agent-steps__sum {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 5px 11px 5px 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface2);
  color: var(--tx2);
  cursor: pointer;
  font: inherit;
  font-size: 12.5px;
  text-align: left;
}

.agent-steps__sum:hover {
  color: var(--tx);
}

.agent-steps__ic {
  display: inline-flex;
  flex: none;
  color: var(--mut);
}

.agent-steps__chev {
  flex: none;
  transition: transform .15s;
}

.agent-steps__sum[aria-expanded="true"] .agent-steps__chev {
  transform: rotate(180deg);
}

.agent-steps__list {
  list-style: none;
  margin: 8px 0 0;
  padding: 4px 0 4px 12px;
  border-left: 2px solid var(--line);
}

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

.agent-step {
  display: flex;
  gap: 8px;
  padding: 4px 0;
  font-size: 12.5px;
  color: var(--tx2);
}

.agent-step__ic {
  flex: none;
  margin-top: 2px;
  color: var(--mut);
}

.agent-step__body {
  min-width: 0;
}

.agent-step__body code {
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: none;
  border: 0;
  padding: 0;
  max-height: 4.5em;
  overflow: hidden;
}

.agent-step__out {
  margin: 4px 0 0;
  padding: 6px 9px;
  max-height: 7.5em;
  overflow: auto;
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--mut);
}

.agent-step--err .agent-step__ic,
.agent-step--err .agent-step__body code {
  color: var(--err, #c0392b);
}

/* ----- Подтверждение запуска агента (авторежим) ----- */
.agent-confirm__box {
  padding: 13px 15px;
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.agent-confirm__box p {
  margin: 6px 0 12px;
  color: var(--tx2);
  font-size: 13px;
  line-height: 1.55;
}

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

/* Сколько уже списано за ход: растёт по мере работы. */
.agent-live__spent {
  margin-left: auto;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

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

/* ===================== Агент в меню «+» и окно подтверждения ===================== */

.chat-plus__sub {
  position: relative;
}

.chat-plus__cur {
  margin-left: auto;
  color: var(--mut);
  font-size: 12px;
}

.chat-plus__chev {
  margin-left: -4px;
}

.chat-plus__item[aria-expanded="true"] {
  background: var(--surface2);
}

/* Вложенное меню рядом с пунктом, как «Усилие» в списке версий; на узком экране — списком под пунктом.
   chat.css грузится позже и задаёт .chat-effort position: fixed, поэтому селекторы тут на класс глубже. */
.chat-plus__sub .chat-plus__fly {
  position: absolute;
  left: calc(100% + 8px);
  bottom: -6px;
  width: 232px;
}

.chat-plus__sub .chat-plus__fly[hidden] {
  display: none;
}

.chat-plus__fly .chat-effort__opt {
  text-align: left;
  gap: 8px;
}

.chat-plus__fly .chat-effort__opt[aria-checked="true"] {
  color: var(--acc);
  font-weight: 600;
}

.chat-plus__fly .chat-effort__opt[aria-checked="true"] svg {
  opacity: 1;
}

@media (max-width: 560px) {
  .chat-plus__sub .chat-plus__fly {
    position: static;
    width: auto;
    margin-top: 2px;
    box-shadow: none;
  }
}

.agent-ask {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.45);
}

.agent-ask__card {
  width: 100%;
  max-width: 360px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface2);
}

.agent-ask__text {
  margin: 0 0 14px;
  color: var(--tx);
  font-size: 14px;
  line-height: 1.5;
}

.agent-ask__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
