﻿
.nx-dock {
  --nx-dock-w: 400px;

  position: relative;
  flex: 0 0 auto;
  width: min(var(--nx-dock-w), 100%);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  transition: width var(--nexus-transition-base);
}

.nx-dock--step-1 { width: min(var(--nx-dock-w), 100%); }
.nx-dock--step-2 { width: min(calc(var(--nx-dock-w) * 2), 100%); }
.nx-dock--step-3 { width: min(calc(var(--nx-dock-w) * 3), 100%); }
.nx-dock--step-4 { width: 100%; }

.nx-stage:has(.nx-dock--step-4) { gap: 0; }
.nx-stage:has(.nx-dock--step-4) > .nx-content { display: none; }

@media (prefers-reduced-motion: reduce) {
  .nx-dock { transition: none; }
}

.nx-dock__grip {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
  transition: background-color var(--nexus-transition-fast);
}

.nx-dock__grip-line {
  width: 2px;
  height: 28px;
  border-radius: var(--nexus-radius-pill);
  background: transparent;
  transition: background-color var(--nexus-transition-fast);
}

.nx-dock__grip:hover .nx-dock__grip-line,
.nx-dock__grip:focus-visible .nx-dock__grip-line { background: var(--nx-teal); }

.nx-dock__grip:focus-visible {
  outline: none;
  background: color-mix(in srgb, var(--nx-teal) 10%, transparent);
}

body.nx-resizing { cursor: col-resize; user-select: none; }

.nx-dock__resize:disabled {
  opacity: var(--nexus-opacity-disabled);
  cursor: default;
  background: transparent;
}

.nx-dock > .nx-chat,
.nx-dock > .nx-chat-notes-panel { order: 2; }
.nx-dock > .nx-chat-notes-btn { order: 3; }

@media (max-width: 1200px) {
  .nx-dock { --nx-dock-w: 340px; }
}

@media (max-width: 900px) {
  .nx-dock,
  .nx-dock.nx-dock--step-1,
  .nx-dock.nx-dock--step-2,
  .nx-dock.nx-dock--step-3,
  .nx-dock.nx-dock--step-4 {
    position: absolute;
    inset: 0;
    width: 100%;
    max-width: 100%;
    z-index: 40;
    box-shadow: var(--nx-shadow-float);
  }

  .nx-dock__resize { display: none; }

  .nx-smart-panel__pin { display: none; }
}

.nx-chat-workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: var(--nexus-space-4);
  height: clamp(420px, calc(100vh - 137px), 1100px);
  min-height: 0;
}

.nx-chat-workspace--full {
  position: fixed;
  inset: 0;
  z-index: 900;
  height: 100vh;
  max-height: 100vh;
  padding: var(--nexus-space-3);
  gap: var(--nexus-space-3);
  background: var(--nx-bg);
}

.nx-chat-workspace:focus { outline: none; }

.nx-chat__fullscreen { flex: 0 0 auto; }

.nx-chat-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: var(--nexus-space-2);
  padding: var(--nexus-space-3);
  border-radius: var(--nx-radius-card);
  background: var(--nx-surface);
  box-shadow: var(--nx-shadow-card);
}

.nx-chat-side__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--nexus-space-2);
}

.nx-chat-side__title {
  margin: 0;
  font-size: var(--nexus-fs-label);
  font-weight: var(--nexus-fw-semibold);
  color: var(--nx-text);
}

.nx-conv-list {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--nexus-space-2);
}

.nx-conv-list__filter {
  display: flex;
  flex-direction: column;
  gap: var(--nexus-space-1);
}

.nx-conv-list__search {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: var(--nexus-space-1) var(--nexus-space-2);
  border: 1px solid var(--nx-border);
  border-radius: var(--nexus-radius-md);
  background: var(--nx-surface);
  color: var(--nx-text);
  font-family: inherit;
  font-size: var(--nexus-fs-body-sm);
}

.nx-conv-list__chip {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: var(--nexus-space-1);
  height: 26px;
  padding: 0 var(--nexus-space-2);
  border: 1px solid var(--nx-border);
  border-radius: var(--nexus-radius-pill);
  background: transparent;
  color: var(--nx-text-muted);
  font-family: inherit;
  font-size: var(--nexus-fs-caption);
  cursor: pointer;
  transition: background-color var(--nexus-transition-fast),
              border-color var(--nexus-transition-fast),
              color var(--nexus-transition-fast);
}

.nx-conv-list__chip:hover:not(:disabled) { background: var(--nexus-hover-surface); color: var(--nx-text); }
.nx-conv-list__chip:disabled { opacity: var(--nexus-opacity-disabled); cursor: default; }
.nx-conv-list__chip:focus-visible { outline: none; box-shadow: var(--nexus-focus-ring); }

.nx-conv-list__chip.nx-active,
.nx-conv-list__chip.nx-active:hover:not(:disabled) {
  border-color: transparent;
  background: color-mix(in srgb, var(--nx-teal) 22%, var(--nx-surface));
  color: var(--nx-text);
}

.nx-conv-list__chip-icon { display: grid; place-items: center; opacity: .75; }
.nx-conv-list__chip.nx-active .nx-conv-list__chip-icon { opacity: 1; }

.nx-conv-list__badge {
  margin-left: var(--nexus-space-1);
  padding: 0 var(--nexus-space-1);
  border-radius: var(--nexus-radius-sm);
  background: var(--nexus-hover-surface);
  font-size: var(--nexus-fs-caption);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.nx-conv-list__item--archived .nx-conv-list__title { opacity: 0.7; }

.nx-conv-list__items {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nx-conv-list__item {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--nexus-space-1);
  border-radius: var(--nexus-radius-md);
}

.nx-conv-list__item:hover { background: var(--nexus-hover-surface); }

.nx-conv-list__item--current {
  background: var(--nx-row-selected);
  box-shadow: inset var(--nx-bracket-w) 0 0 var(--nx-bracket-color);
}

.nx-conv-list__open {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: var(--nexus-space-2);
  border: 0;
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.nx-conv-list__open--static { cursor: default; }

.nx-conv-list__title {
  display: block;
  font-size: var(--nexus-fs-body-sm);
  color: var(--nx-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nx-conv-list__meta {
  display: block;
  font-size: var(--nexus-fs-caption);
  color: var(--nx-text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nx-conv-list__archive {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-right: var(--nexus-space-1);
  padding: 0;
  border: 0;
  border-radius: var(--nexus-radius-sm);
  background: none;
  color: var(--nx-text-faint);
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--nexus-transition-fast), color var(--nexus-transition-fast);
}

.nx-conv-list__item:hover .nx-conv-list__archive,
.nx-conv-list__archive:focus-visible { opacity: 1; }
.nx-conv-list__archive:hover { color: var(--nx-danger-ink); }

.nx-conv-list__empty {
  padding: var(--nexus-space-3) var(--nexus-space-2);
  font-size: var(--nexus-fs-caption);
  color: var(--nx-text-faint);
}

.nx-conv-list--compact { gap: var(--nexus-space-1); }
.nx-conv-list--compact .nx-conv-list__open { padding: var(--nexus-space-1) var(--nexus-space-2); }

.nx-chat-notes-btn,
.nx-chat-side-btn {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--nexus-space-2);
  padding: var(--nexus-space-2);
  border: 0;
  border-radius: var(--nexus-radius-md);
  background: none;
  color: var(--nx-text-muted);
  font-family: inherit;
  font-size: var(--nexus-fs-caption);
  font-weight: var(--nexus-fw-medium);
  text-align: left;
  cursor: pointer;
  transition: background-color var(--nexus-transition-fast), color var(--nexus-transition-fast);
}

.nx-dock > .nx-chat-notes-btn {
  border-top: 1px solid var(--nx-line-soft);
  border-radius: 0 0 var(--nx-radius-card) var(--nx-radius-card);
}

.nx-chat-notes-btn {
  padding-inline: var(--nexus-space-3);
  gap: var(--nexus-space-3);
}

.nx-chat-notes-btn:hover:not(:disabled),
.nx-chat-side-btn:hover:not(:disabled) { background: var(--nexus-hover-surface); color: var(--nx-text); }
.nx-chat-notes-btn:focus-visible,
.nx-chat-side-btn:focus-visible { outline: none; box-shadow: var(--nexus-focus-ring); }
.nx-chat-side-btn:disabled { opacity: var(--nexus-opacity-disabled); cursor: default; }

.nx-chat-notes-btn.nx-active,
.nx-chat-side-btn.nx-active,
.nx-chat-notes-btn.nx-active:hover:not(:disabled),
.nx-chat-side-btn.nx-active:hover:not(:disabled) {
  background: var(--nx-row-selected);
  color: var(--nx-text);
  box-shadow: inset var(--nx-bracket-w) 0 0 var(--nx-bracket-color);
}

.nx-chat-side-btn__icon { flex: 0 0 auto; display: grid; place-items: center; opacity: .75; }
.nx-chat-side-btn.nx-active .nx-chat-side-btn__icon { opacity: 1; }

.nx-chat-notes-btn__label,
.nx-chat-side-btn__label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nx-chat-notes-btn__count,
.nx-chat-side-btn__count {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--nexus-radius-pill);
  background: var(--nexus-hover-surface);
  font-size: var(--nexus-fs-caption);
}

.nx-chat-side__foot {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--nexus-space-1);
  padding-top: var(--nexus-space-2);
  border-top: 1px solid var(--nx-line-soft);
}

.nx-chat-notes-panel {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.nx-chat-notes-panel__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--nexus-space-2);
  padding: var(--nexus-space-3) var(--nexus-space-4);
  border-bottom: 1px solid var(--nx-line-soft);
}

.nx-chat-notes-panel__title {
  flex: 1 1 auto;
  margin: 0;
  font-size: var(--nexus-fs-label);
  font-weight: var(--nexus-fw-semibold);
  color: var(--nx-text);
}

.nx-chat-notes__help,
.nx-chat-notes__item { max-width: 110ch; }

.nx-dock .nx-chat-notes-panel__head { padding: var(--nexus-space-3); }

.nx-chat-stage {
  display: flex;
  min-height: 0;
  border-radius: var(--nx-radius-card);
  background: var(--nx-surface);
  box-shadow: var(--nx-shadow-card);
  overflow: hidden;
}

@media (max-width: 1100px) {
  .nx-chat-workspace { grid-template-columns: 240px minmax(0, 1fr); }
}

@media (max-width: 860px) {
  .nx-chat-workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    height: calc(100vh - 137px);
  }
  .nx-chat-side { max-height: 220px; }
}

.nx-chat {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.nx-chat__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--nexus-space-2);
  padding: var(--nexus-space-3);
}

.nx-chat--page .nx-chat__head,
.nx-chat--page .nx-chat__thread { padding-inline: var(--nexus-space-4); }

.nx-chat--page .nx-chat__composer,
.nx-chat--page .nx-chat__banner { margin-inline: var(--nexus-space-4); }

.nx-chat__agent {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: var(--nexus-space-2);
}

.nx-chat__agent-label {
  flex: 0 0 auto;
  font-size: var(--nexus-fs-caption);
  color: var(--nx-text-faint);
}

.nx-chat__agent-select { flex: 1 1 auto; min-width: 0; max-width: 320px; }

.nx-chat__agent-name {
  font-size: var(--nexus-fs-label);
  font-weight: var(--nexus-fw-semibold);
  color: var(--nx-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nx-chat__agent-name--none { color: var(--nx-text-faint); font-weight: var(--nexus-fw-regular); }

.nx-chat__agent-desc {
  min-width: 0;
  font-size: var(--nexus-fs-caption);
  color: var(--nx-text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nx-chat__ghost-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: var(--nexus-space-1);
  height: 30px;
  padding: 0 var(--nexus-space-2);
  border: 0;
  border-radius: var(--nexus-radius-md);
  background: transparent;
  color: var(--nx-text-muted);
  font-family: inherit;
  font-size: var(--nexus-fs-caption);
  cursor: pointer;
  transition: background-color var(--nexus-transition-fast), color var(--nexus-transition-fast);
}

.nx-chat__ghost-btn:hover:not(:disabled) { background: var(--nexus-hover-surface); color: var(--nx-text); }
.nx-chat__ghost-btn:disabled { opacity: var(--nexus-opacity-disabled); cursor: default; }
.nx-chat__ghost-btn:focus-visible { outline: none; box-shadow: var(--nexus-focus-ring); }
.nx-chat__btn-icon { display: grid; place-items: center; }

.nx-chat--compact .nx-chat__btn-text { display: none; }

.nx-chat__agent-btn {
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--nexus-space-1);
  height: 30px;
  padding: 0 var(--nexus-space-2);
  border: 0;
  border-radius: var(--nexus-radius-md);
  background: transparent;
  color: var(--nx-text);
  font-family: inherit;
  cursor: pointer;
  transition: background-color var(--nexus-transition-fast);
}

.nx-chat__agent-btn:hover:not(:disabled) { background: var(--nexus-hover-surface); }
.nx-chat__agent-btn:disabled { opacity: var(--nexus-opacity-disabled); cursor: default; }
.nx-chat__agent-btn:focus-visible { outline: none; box-shadow: var(--nexus-focus-ring); }

.nx-chat__scrim {
  position: fixed;
  inset: 0;
  z-index: 45;
}

.nx-chat__pop {
  position: absolute;
  top: 44px;
  left: var(--nexus-space-3);
  z-index: 46;
  width: min(340px, calc(100% - var(--nexus-space-3) * 2));
  max-height: 320px;
  overflow-y: auto;
  padding: var(--nexus-space-1);
  border: 1px solid var(--nx-line);
  border-radius: var(--nx-radius-card);
  background: var(--nx-surface);
  box-shadow: var(--nx-shadow-float);
}

.nx-chat__pop-item {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: var(--nexus-space-2);
  border: 0;
  border-radius: var(--nexus-radius-md);
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.nx-chat__pop-item:hover { background: var(--nexus-hover-surface); }
.nx-chat__pop-item:focus-visible { outline: none; box-shadow: var(--nexus-focus-ring); }

.nx-chat__pop-item--current {
  background: var(--nx-row-selected);
  box-shadow: inset var(--nx-bracket-w) 0 0 var(--nx-bracket-color);
}

.nx-chat__pop-name {
  font-size: var(--nexus-fs-body-sm);
  font-weight: var(--nexus-fw-medium);
  color: var(--nx-text);
}

.nx-chat__pop-desc {
  font-size: var(--nexus-fs-caption);
  line-height: 1.4;
  color: var(--nx-text-faint);
}

.nx-chat__pop-head {
  padding: var(--nexus-space-2) var(--nexus-space-2) var(--nexus-space-1);
  font-size: var(--nexus-fs-caption);
  font-weight: var(--nexus-fw-medium);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--nx-text-faint);
}

.nx-chat__pop-item--toggle .nx-chat__pop-name {
  display: flex;
  align-items: center;
  gap: var(--nexus-space-2);
}

.nx-chat__pop-check {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 1px solid var(--nx-line-strong, var(--nx-line));
  border-radius: 3px;
  background: var(--nx-surface);
}

.nx-chat__pop-item--checked .nx-chat__pop-check {
  border-color: var(--nx-bracket-color);
  background: var(--nx-bracket-color);
  box-shadow: inset 0 0 0 2px var(--nx-surface);
}

.nx-chat__pop-item--checked {
  background: var(--nx-row-selected);
}

.nx-chat__agent--chips {
  flex-wrap: nowrap;
  align-items: center;
}

.nx-chat__chips {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--nexus-space-1);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent 100%);
  mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent 100%);
}

.nx-chat__chips::-webkit-scrollbar { width: 0; height: 0; }

.nx-chat__chips::after {
  content: "";
  flex: 0 0 20px;
}

.nx-chat__chips > .nx-chat__chip { scroll-snap-align: start; }

@supports (animation-timeline: scroll(x)) {
  .nx-chat__chips {
    animation: nx-chat-chips-fade linear;
    animation-timeline: scroll(self x);
  }

  @keyframes nx-chat-chips-fade {
    to {
      -webkit-mask-image: linear-gradient(to right, #000 100%, #000 100%);
      mask-image: linear-gradient(to right, #000 100%, #000 100%);
    }
  }
}

.nx-chat__chip {
  flex: 0 0 auto;
  min-width: 0;
  max-width: 220px;
  display: inline-flex;
  align-items: center;
  gap: var(--nexus-space-1);
  height: 26px;
  padding: 0 var(--nexus-space-1) 0 var(--nexus-space-2);
  border: 1px solid var(--nx-line);
  border-radius: 999px;
  background: var(--nx-surface);
  color: var(--nx-text);
  font-size: var(--nexus-fs-caption);
  font-weight: var(--nexus-fw-medium);
}

.nx-chat__chip--focus {
  border-color: var(--nx-bracket-color);
  background: var(--nx-row-selected);
  color: var(--nx-bracket-color);
}

.nx-chat__chip--agent {
  border-color: var(--nx-line);
  background: var(--nx-surface);
  color: var(--nx-text);
}

.nx-chat__chip-icon { display: grid; place-items: center; flex: 0 0 auto; }

.nx-chat__chip-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nx-chat__chip-x {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  transition: background-color var(--nexus-transition-fast), opacity var(--nexus-transition-fast);
}

.nx-chat__chip-x:hover:not(:disabled) { opacity: 1; background: var(--nexus-hover-surface); }
.nx-chat__chip-x:disabled { opacity: var(--nexus-opacity-disabled); cursor: default; }
.nx-chat__chip-x:focus-visible { outline: none; box-shadow: var(--nexus-focus-ring); }

.nx-chat__agent-btn--add {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  justify-content: center;
  border: 1px dashed var(--nx-line);
  border-radius: 50%;
  color: var(--nx-text-muted);
}

.nx-chat__agent-btn--add:hover:not(:disabled) { color: var(--nx-text); border-color: var(--nx-line-strong, var(--nx-line)); }

.nx-chat__pop--picker { max-height: 380px; }

.nx-chat__pop-search {
  position: sticky;
  top: calc(-1 * var(--nexus-space-1));
  z-index: 1;
  margin: calc(-1 * var(--nexus-space-1)) calc(-1 * var(--nexus-space-1)) var(--nexus-space-1);
  padding: var(--nexus-space-2);
  background: var(--nx-surface);
  border-bottom: 1px solid var(--nx-line);
}

.nx-chat__pop-input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: var(--nexus-space-1) var(--nexus-space-2);
  border: 1px solid var(--nx-border);
  border-radius: var(--nexus-radius-md);
  background: var(--nx-surface);
  color: var(--nx-text);
  font-family: inherit;
  font-size: var(--nexus-fs-body-sm);
}

.nx-chat__pop-input:focus-visible { outline: none; box-shadow: var(--nexus-focus-ring); }

.nx-chat__pop-item--add .nx-chat__pop-name {
  display: flex;
  align-items: center;
  gap: var(--nexus-space-2);
}

.nx-chat__pop-kind { flex: 0 0 auto; display: grid; place-items: center; color: var(--nx-text-faint); }

.nx-chat__pop-empty {
  padding: var(--nexus-space-3) var(--nexus-space-2);
  font-size: var(--nexus-fs-caption);
  color: var(--nx-text-faint);
  text-align: center;
}

.nx-chat__list-panel {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  padding: 0 var(--nexus-space-3) var(--nexus-space-2);
}

.nx-chat__convs { flex: 0 0 auto; }

.nx-chat__notes-toggle {
  flex: 0 0 auto;
  position: relative;
}

.nx-chat__notes-count {
  position: absolute;
  top: 0;
  inset-inline-end: 0;
  min-width: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--nx-bracket-color, #14b8a6);
  color: #06202a;
  font-size: 10px;
  line-height: 15px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}

.nx-chat__notes-panel { padding: 0; }

.nx-chat__notes-panel > .nx-chat-notes-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.nx-chat--compact .nx-chat-notes-panel__head { padding: var(--nexus-space-3); }

.nx-chat__banner {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: var(--nexus-space-2);
  margin: 0 var(--nexus-space-3) var(--nexus-space-2);
  padding: var(--nexus-space-2) var(--nexus-space-3);
  border-radius: var(--nexus-radius-md);
  font-size: var(--nexus-fs-body-sm);
}

.nx-chat__banner--error { background: var(--nx-error-bg); color: var(--nx-error-ink); }
.nx-chat__banner--notice { background: var(--nx-warning-bg); color: var(--nx-warning-ink); }

.nx-chat__banner-close {
  margin-left: auto;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  cursor: pointer;
  opacity: .7;
}

.nx-chat__banner-close:hover { opacity: 1; }

.nx-chat__thread {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--nexus-space-3);
  padding: var(--nexus-space-3);
  scroll-behavior: smooth;
  background: var(--nx-bg);
}

.nx-chat__thread--hidden { display: none; }

.nx-chat__jump-slot {
  position: sticky;
  bottom: 0;
  z-index: 3;
  height: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
  margin-top: calc(var(--nexus-space-3) * -1);
}

.nx-chat__jump {
  pointer-events: auto;
  position: relative;
  bottom: calc(32px + var(--nexus-space-2));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--nx-line);
  border-radius: 50%;
  background: var(--nx-surface);
  color: var(--nx-text);
  box-shadow: var(--nx-shadow-float);
  cursor: pointer;
  transition: color .12s ease, border-color .12s ease, transform .12s ease;
}

.nx-chat__jump:hover {
  color: var(--nx-teal);
  border-color: var(--nx-teal);
  transform: translateY(1px);
}

@media (prefers-reduced-motion: reduce) {
  .nx-chat__jump { transition: none; }
  .nx-chat__jump:hover { transform: none; }
}

.nx-chat__msg { display: flex; }
.nx-chat__msg--user { justify-content: flex-end; }

.nx-chat__msg--assistant {
  justify-content: flex-start;
  flex-wrap: wrap;
  align-items: flex-start;
}

.nx-chat__msg--assistant > .nx-chat__sources,
.nx-chat__msg--assistant > .nx-chat__trace,
.nx-chat__msg--assistant > .nx-chat__meta { flex: 0 0 100%; }

.nx-chat__msg--tool { justify-content: center; }

.nx-chat__bubble {
  max-width: 88%;
  padding: var(--nexus-space-2) var(--nexus-space-3);
  border-radius: var(--nx-radius-card);
  font-size: var(--nexus-fs-body-sm);
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.nx-chat__msg--user .nx-chat__bubble {
  background: color-mix(in srgb, var(--nx-teal) 20%, var(--nx-surface));
  color: var(--nx-text);
  border-bottom-right-radius: var(--nexus-radius-sm);
}

.nx-chat__msg--assistant .nx-chat__bubble {
  background: var(--nx-surface);
  color: var(--nx-text);
  border: 1px solid var(--nx-line);
  box-shadow: var(--nx-shadow-card);
  border-bottom-left-radius: var(--nexus-radius-sm);
}

.nx-chat__msg--tool .nx-chat__bubble {
  background: none;
  color: var(--nx-text-faint);
  font-family: var(--nx-font-mono);
  font-size: var(--nexus-fs-caption);
}

.nx-chat__bubble--pending {
  display: flex;
  align-items: center;
  gap: var(--nexus-space-2);
  color: var(--nx-text-muted);
}

.nx-chat__dots { display: inline-flex; align-items: center; gap: 5px; }

.nx-chat__dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--nx-teal);
  animation: nx-chat-dot 1.05s infinite ease-in-out both;
  will-change: transform, opacity;
}

.nx-chat__dots span:nth-child(2) { animation-delay: .14s; }
.nx-chat__dots span:nth-child(3) { animation-delay: .28s; }

@keyframes nx-chat-dot {
  0%, 62%, 100% { opacity: .18; transform: translateY(0) scale(.8); }
  28% { opacity: 1; transform: translateY(-4px) scale(1.18); }
}

@media (prefers-reduced-motion: reduce) {
  .nx-chat__dots span {
    animation: nx-chat-dot-soft 1.4s infinite ease-in-out both;
  }
  .nx-chat__thread { scroll-behavior: auto; }
}

@keyframes nx-chat-dot-soft {
  0%, 62%, 100% { opacity: .22; transform: translateY(0) scale(.85); }
  30% { opacity: 1; transform: translateY(-1px) scale(1.1); }
}

.nx-chat__pending-text {
  font-size: var(--nexus-fs-caption);
  color: var(--nx-text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nx-chat__clock {
  flex: 0 0 auto;
  font-size: var(--nexus-fs-caption);
  color: var(--nx-text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.nx-chat__bubble--rich {
  padding: var(--nexus-space-3);
  white-space: normal;
}

.nx-chat__bubble--streaming {
  padding: var(--nexus-space-3);
}

.nx-md__pending {
  margin: var(--nexus-space-2) 0;
  padding: var(--nexus-space-2) var(--nexus-space-3);
  border-radius: var(--nx-radius, 8px);
  background: var(--nx-field);
  color: var(--nx-text-faint);
  font-size: var(--nexus-fs-caption);
}

.nx-chat__bubble--streaming::after {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: currentColor;
  opacity: 0.55;
  animation: nx-chat-caret 1s steps(2, start) infinite;
}

@keyframes nx-chat-caret {
  to { visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  .nx-chat__bubble--streaming::after { animation: none; }
}

.nx-md > :first-child { margin-top: 0; }
.nx-md > :last-child { margin-bottom: 0; }

.nx-md-p { margin: 0 0 var(--nexus-space-2); }

.nx-md-heading {
  margin: var(--nexus-space-3) 0 var(--nexus-space-1);
  font-size: var(--nexus-fs-body-sm);
  font-weight: var(--nexus-fw-semibold);
  color: var(--nx-text);
}

.nx-md-list {
  margin: 0 0 var(--nexus-space-2);
  padding-left: var(--nexus-space-4);
}

.nx-md-list li { margin: 2px 0; }

.nx-md-inline-code,
.nx-md-code {
  font-family: var(--nx-font-mono);
  font-size: var(--nexus-fs-caption);
}

.nx-md-inline-code {
  padding: 1px 4px;
  border-radius: var(--nexus-radius-sm);
  background: var(--nx-field);
}

.nx-md-code {
  margin: 0 0 var(--nexus-space-2);
  padding: var(--nexus-space-2);
  border-radius: var(--nexus-radius-md);
  background: var(--nx-field);
  overflow-x: auto;
  white-space: pre;
}

.nx-md-table-wrap {
  margin: 0 0 var(--nexus-space-2);
  overflow-x: auto;
}

.nx-md-table {
  border-collapse: collapse;
  font-size: var(--nexus-fs-caption);
}

.nx-md-table th,
.nx-md-table td {
  padding: 4px var(--nexus-space-2);
  border-bottom: 1px solid var(--nx-line-soft);
  text-align: left;
  white-space: nowrap;
}

.nx-md-table th {
  color: var(--nx-text-faint);
  font-weight: var(--nexus-fw-semibold);
}

.nx-chart {
  margin: 0;
  padding: var(--nexus-space-2) 0 0;
  width: 560px;
  max-width: 100%;
}

.nx-chart__title {
  margin-bottom: var(--nexus-space-1);
  font-size: var(--nexus-fs-body-sm);
  font-weight: var(--nexus-fw-semibold);
  color: var(--nx-text);
}

.nx-chart__plot {
  position: relative;
  width: 100%;
  height: 240px;
  overflow: hidden;
  contain: inline-size;
}

.nx-chart__canvas { max-width: 100%; }

.nx-chart__source {
  margin-top: var(--nexus-space-1);
  font-size: var(--nexus-fs-caption);
  color: var(--nx-text-faint);
}

.nx-chat__empty {
  margin: auto;
  max-width: 380px;
  padding: var(--nexus-space-4);
  text-align: center;
}

.nx-chat__empty-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 auto var(--nexus-space-3);
  border-radius: 50%;
  background: color-mix(in srgb, var(--nx-teal) 12%, transparent);
  color: var(--nx-teal-ink);
}

.nx-chat__empty-title {
  margin: 0 0 var(--nexus-space-1);
  font-size: var(--nexus-fs-label);
  font-weight: var(--nexus-fw-semibold);
  color: var(--nx-text);
}

.nx-chat__empty-text {
  margin: 0;
  font-size: var(--nexus-fs-body-sm);
  color: var(--nx-text-muted);
}

.nx-chat__empty-note {
  margin: var(--nexus-space-3) auto 0;
  padding-top: var(--nexus-space-2);
  max-width: 34rem;
  border-top: 1px solid var(--nx-border-subtle, var(--nexus-border));
  font-size: var(--nexus-fs-caption, 12px);
  line-height: 1.45;
  color: var(--nx-text-muted);
}
.nx-chat__composer {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  gap: var(--nexus-space-2);
  margin: 4px var(--nexus-space-3) var(--nexus-space-2);
  padding: var(--nexus-space-3) var(--nexus-space-2);
  border-radius: var(--nx-radius-card);
  background: var(--nx-field);
  transition: box-shadow var(--nexus-transition-fast);
  position: relative;
  z-index: 1;
}

.nx-chat__composer:focus-within { box-shadow: var(--nexus-focus-ring); }

.nx-chat__input {
  --nx-composer-rows: 3;
  --nx-composer-rows-max: 4;
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: none;
  resize: none;
  padding: var(--nexus-space-1) var(--nexus-space-1);
  color: var(--nx-text);
  font-family: inherit;
  font-size: var(--nexus-fs-body-sm);
  line-height: 1.5;
  min-height: calc(var(--nx-composer-rows) * 1.5em + 2 * var(--nexus-space-1));
  max-height: calc(var(--nx-composer-rows-max) * 1.5em + 2 * var(--nexus-space-1));
  overflow-y: auto;
  box-sizing: border-box;
}

.nx-chat--page .nx-chat__input {
  --nx-composer-rows: 4.5;
  --nx-composer-rows-max: 6;
}

.nx-chat__input:focus { outline: none; }
.nx-chat__input::placeholder { color: var(--nx-text-faint); }
.nx-chat__input:disabled { color: var(--nexus-disabled-fg); }

.nx-chat__send {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--nexus-space-1);
  height: 32px;
  padding: 0 var(--nexus-space-3);
  border: 0;
  border-radius: var(--nexus-radius-md);
  background: var(--nx-teal);
  color: var(--nx-navy-deep);
  box-shadow: var(--nx-shadow-cta);
  font-family: inherit;
  font-size: var(--nexus-fs-caption);
  font-weight: var(--nexus-fw-semibold);
  cursor: pointer;
  transition: background-color var(--nexus-transition-fast), box-shadow var(--nexus-transition-fast);
}

.nx-chat__send:hover:not(:disabled) { background: var(--nx-teal-hover); }

.nx-chat__send--stop:hover { filter: brightness(0.96); }
.nx-chat__send:disabled {
  background: var(--nexus-disabled-bg);
  color: var(--nexus-disabled-fg);
  box-shadow: none;
  cursor: default;
}
.nx-chat__send:focus-visible { outline: none; box-shadow: var(--nexus-focus-ring); }

.nx-chat--compact .nx-chat__send { padding: 0 var(--nexus-space-2); }
.nx-chat--compact .nx-chat__send-text { display: none; }

.nx-chat__attach {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--nexus-radius-md);
  color: var(--nx-text-muted);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: background-color var(--nexus-transition-fast), color var(--nexus-transition-fast);
}

.nx-chat__attach:hover {
  background: color-mix(in srgb, var(--nx-teal) 12%, transparent);
  color: var(--nx-teal-ink);
}

.nx-chat__attach--disabled {
  color: var(--nexus-disabled-fg);
  cursor: default;
  pointer-events: none;
}

.nx-chat__attach input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.nx-chat__attach:focus-within { box-shadow: var(--nexus-focus-ring); }

.nx-chat__pending-files {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--nexus-space-1);
  margin: 0 var(--nexus-space-3);
  padding: var(--nexus-space-1) 0 0;
}

.nx-chat__file {
  display: inline-flex;
  align-items: center;
  gap: var(--nexus-space-1);
  max-width: 100%;
  padding: 2px var(--nexus-space-2);
  border-radius: var(--nexus-radius-md);
  background: color-mix(in srgb, var(--nx-teal) 10%, transparent);
  color: var(--nx-text);
  font-size: var(--nexus-fs-caption);
  line-height: 1.4;
}

.nx-chat__file--pending { padding-right: 2px; }

.nx-chat__file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

.nx-chat__file-thumb {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  object-fit: cover;
}

.nx-chat__file-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--nx-text-muted);
  cursor: pointer;
}

.nx-chat__file-remove:hover {
  background: color-mix(in srgb, var(--nx-text) 12%, transparent);
  color: var(--nx-text);
}

.nx-chat__file-error {
  font-size: var(--nexus-fs-caption);
  color: var(--nexus-danger, #b3261e);
}

.nx-chat__bubble .nx-chat__files {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nexus-space-1);
  margin-bottom: var(--nexus-space-1);
}

.nx-chat__bubble .nx-chat__file {
  background: color-mix(in srgb, var(--nx-navy-deep) 10%, transparent);
}

.nx-chat-notes {
  --nx-notes-pad: var(--nexus-space-4);
  flex: 0 0 auto;
  padding: var(--nexus-space-3) 0;
  font-size: var(--nexus-fs-body-sm);
}

.nx-dock .nx-chat-notes { --nx-notes-pad: var(--nexus-space-3); }

.nx-chat-notes__help {
  margin: 0 var(--nx-notes-pad) var(--nexus-space-2);
  font-size: var(--nexus-fs-caption);
  line-height: 1.45;
  color: var(--nx-text-faint);
}

.nx-chat-notes__list {
  margin: 0 var(--nx-notes-pad) var(--nexus-space-2);
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--nexus-space-1);
  max-height: 190px;
  overflow-y: auto;
}

.nx-chat-notes__item {
  display: flex;
  align-items: baseline;
  gap: var(--nexus-space-2);
  padding: var(--nexus-space-1) var(--nexus-space-2);
  border-radius: var(--nexus-radius-sm);
  background: var(--nx-surface-alt);
}

.nx-chat-notes__scope {
  flex: 0 0 auto;
  font-family: var(--nx-font-mono);
  font-size: var(--nexus-fs-caption);
  color: var(--nx-text-faint);
}

.nx-chat-notes__text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: var(--nexus-fs-caption);
  color: var(--nx-text);
  overflow-wrap: anywhere;
}

.nx-chat-notes__forget {
  flex: 0 0 auto;
  align-self: center;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: var(--nexus-radius-sm);
  background: none;
  color: var(--nx-text-faint);
  cursor: pointer;
}

.nx-chat-notes__forget:hover { color: var(--nx-danger-ink); }

.nx-chat-notes__add {
  display: flex;
  align-items: center;
  gap: var(--nexus-space-2);
  margin: 0 var(--nx-notes-pad) var(--nexus-space-3);
}

.nx-chat-notes__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 30px;
  padding: 0 var(--nexus-space-2);
  border: 0;
  border-radius: var(--nexus-radius-md);
  background: var(--nx-field);
  color: var(--nx-text);
  font-family: inherit;
  font-size: var(--nexus-fs-caption);
}

.nx-chat-notes__input:focus { outline: none; box-shadow: var(--nexus-focus-ring); }
.nx-chat-notes__input::placeholder { color: var(--nx-text-faint); }

.nx-chat-window {
  display: flex;
  flex-direction: column;
  gap: var(--nexus-space-2);
  height: 100dvh;
  padding: var(--nexus-space-3);
  background: var(--nx-bg);
}

.nx-chat-window__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: var(--nexus-space-2);
  padding: 0 var(--nexus-space-1);
}

.nx-chat-window__mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  color: var(--nx-text-muted);
}

.nx-chat-window__title {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--nx-text);
  font-family: var(--nexus-font-heading);
  font-size: var(--nexus-fs-body);
  font-weight: var(--nexus-fw-semibold);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nx-chat-window__back { flex: 0 0 auto; }

.nx-chat-window__body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-radius: var(--nx-radius-card);
  background: var(--nx-surface);
  box-shadow: var(--nx-shadow-card);
  overflow: hidden;
}

.nx-chat-window__body > .nx-chat-notes-btn {
  border-top: 1px solid var(--nx-line-soft);
  border-radius: 0 0 var(--nx-radius-card) var(--nx-radius-card);
}

.nx-dock__detach { flex: 0 0 auto; }

.nx-chat__mic {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: var(--nexus-radius-md);
  background: none;
  color: var(--nx-text-muted);
  cursor: pointer;
  transition: background-color var(--nexus-transition-fast), color var(--nexus-transition-fast);
}

.nx-chat__mic:disabled {
  opacity: 0.45;
  cursor: default;
}

.nx-chat__mic--on {
  background: var(--nx-error-bg);
  color: var(--nx-error-ink);
}

.nx-chat__sources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--nexus-space-1);
  margin: 0 var(--nexus-space-3);
  padding: var(--nexus-space-1) 0 0;
  font-size: var(--nexus-fs-caption);
  color: var(--nx-text-muted, var(--nx-text));
}

.nx-chat__sources-label {
  opacity: 0.75;
}

.nx-chat__sources-label::after {
  content: ":";
}

.nx-chat__trace {
  margin: 0 var(--nexus-space-3) var(--nexus-space-1);
  padding: 0;
  font-size: var(--nexus-fs-caption);
  color: var(--nx-text-faint);
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.nx-chat__trace .nx-md-table-wrap { max-width: 100%; }

.nx-chat__trace-head {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.nx-chat__trace-head:hover { color: var(--nx-text-muted, var(--nx-text)); }
.nx-chat__trace-head:focus-visible { outline: none; box-shadow: var(--nexus-focus-ring); border-radius: var(--nx-radius-sm, 4px); }

.nx-chat__trace-caret {
  display: grid;
  place-items: center;
  transform: rotate(-90deg);
  transition: transform var(--nexus-transition-fast);
}

.nx-chat__trace-caret--open { transform: rotate(0deg); }

.nx-chat__trace-list {
  margin: var(--nexus-space-1) 0 0;
  padding: 0 0 0 var(--nexus-space-3);
  list-style: decimal;
}

.nx-chat__trace-step {
  margin: 0;
  padding: 2px 0;
  overflow-wrap: anywhere;
}

.nx-chat__trace-said {
  display: block;
  color: var(--nx-text-muted, var(--nx-text));
  line-height: 1.5;
}

.nx-chat__trace-did {
  display: block;
  color: var(--nx-text-faint);
  font-variant-numeric: tabular-nums;
}

.nx-chat__trace-said + .nx-chat__trace-did { margin-top: 2px; }

.nx-chat__trace-count {
  min-width: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--nexus-hover-surface, rgba(127, 127, 127, 0.12));
  font-variant-numeric: tabular-nums;
  line-height: 1.6;
}

.nx-chat__trace-reply {
  display: block;
  margin-top: 2px;
  padding-left: var(--nexus-space-2);
  border-left: 2px solid var(--nx-border, rgba(127, 127, 127, 0.3));
  color: var(--nx-text-muted, var(--nx-text));
  line-height: 1.5;
}

.nx-chat__trace-step--now { list-style: none; margin-left: calc(-1 * var(--nexus-space-3)); }

.nx-chat__trace-now::after {
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: currentColor;
  opacity: 0.55;
  animation: nx-chat-caret 1s steps(2, start) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .nx-chat__trace-now::after { animation: none; }
}

.nx-chat__pending-now {
  display: flex;
  align-items: center;
  gap: var(--nexus-space-2);
}

.nx-chat__followups {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nexus-space-1);
  margin-top: var(--nexus-space-2);
}

.nx-chat__followup {
  max-width: 100%;
  padding: 2px var(--nexus-space-2);
  border: 1px solid var(--nx-border);
  border-radius: 999px;
  background: transparent;
  color: var(--nx-text);
  font-size: var(--nexus-fs-caption);
  font-family: inherit;
  line-height: 1.6;
  text-align: left;
  cursor: pointer;
}

.nx-chat__followup:hover,
.nx-chat__followup:focus-visible {
  background: var(--nx-surface-hover, rgba(127, 127, 127, 0.12));
}

.nx-chat__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--nexus-space-2);
  margin: 0 var(--nexus-space-3);
  padding: var(--nexus-space-1) 0 0;
  font-size: var(--nexus-fs-caption);
  color: var(--nx-text-faint);
  font-variant-numeric: tabular-nums;
}

.nx-chat__elapsed,
.nx-chat__tokens { white-space: nowrap; }

.nx-chat__meta > span + span::before {
  content: "\00B7";
  margin-right: var(--nexus-space-2);
  opacity: .65;
}

.nx-chat__meter {
  flex: 0 0 auto;
  font-size: var(--nexus-fs-caption);
  color: var(--nx-text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.nx-chat__bubble--interrupted {
  border-inline-start: 2px solid color-mix(in srgb, var(--nx-warning-ink, var(--nx-text)) 45%, transparent);
}

.nx-chat__stopped {
  display: flex;
  align-items: center;
  gap: var(--nexus-space-1);
  margin-bottom: var(--nexus-space-2);
  font-size: var(--nexus-fs-caption);
  color: var(--nx-warning-ink, var(--nx-text));
}

.nx-chat__stopped-empty {
  font-size: var(--nexus-fs-caption);
  color: var(--nx-text-faint);
  font-style: italic;
}

.nx-chat__source {
  display: inline-flex;
  align-items: center;
  padding: 1px var(--nexus-space-2);
  border-radius: var(--nexus-radius-md);
  background: color-mix(in srgb, var(--nx-teal) 10%, transparent);
  color: var(--nx-text);
  line-height: 1.4;
}

.nx-chat__rating {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--nexus-space-1);
  margin: 0 var(--nexus-space-3);
  padding: var(--nexus-space-1) 0 0;
}

.nx-chat__rate {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: var(--nx-radius-input, 6px);
  background: transparent;
  color: var(--nx-text-faint);
  cursor: pointer;
  opacity: 0.6;
}

.nx-chat__rate:hover,
.nx-chat__rate:focus-visible { opacity: 1; }

.nx-chat__rate--on {
  opacity: 1;
  border-color: var(--nx-border);
  color: var(--nx-text);
}

.nx-chat__rating-why {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--nexus-space-2);
  flex: 1 1 100%;
  padding-top: var(--nexus-space-1);
  font-size: var(--nexus-fs-caption);
}

.nx-chat__rating-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.nx-chat__rating-text {
  flex: 1 1 180px;
  min-width: 0;
  padding: 2px 6px;
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius-input, 6px);
  background: transparent;
  color: var(--nx-text);
  font-family: inherit;
  font-size: var(--nexus-fs-caption);
}

.nx-chat__rating-send {
  padding: 2px var(--nexus-space-2);
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius-input, 6px);
  background: transparent;
  color: var(--nx-text);
  font-family: inherit;
  font-size: var(--nexus-fs-caption);
  cursor: pointer;
}

.nx-chat__approval {
  margin: var(--nexus-space-2) var(--nexus-space-3);
  padding: var(--nexus-space-3);
  border: 1px solid var(--nx-warning, #c88a00);
  border-radius: var(--nx-radius-card);
  background: var(--nx-surface);
}

.nx-chat__approval-head {
  display: flex;
  align-items: center;
  gap: var(--nexus-space-2);
  font-weight: 600;
}

.nx-chat__approval-name {
  margin-top: var(--nexus-space-2);
  font-weight: 600;
}

.nx-chat__approval-tool {
  margin-top: 2px;
  font-family: var(--nx-font-mono, ui-monospace, monospace);
  font-size: var(--nexus-fs-caption);
  color: var(--nx-text-faint, var(--nx-text-muted, var(--nx-text)));
}

.nx-chat__approval-what {
  margin-top: var(--nexus-space-1);
  font-size: var(--nexus-fs-caption);
}

.nx-chat__approval-label {
  display: block;
  margin-top: var(--nexus-space-2);
  font-size: var(--nexus-fs-caption);
  opacity: 0.8;
}

.nx-chat__approval-summary {
  margin: 4px 0 0;
  padding: var(--nexus-space-2) var(--nexus-space-3);
  border-left: 3px solid var(--nx-accent, currentColor);
  background: var(--nx-surface-sunken, transparent);
  border-radius: var(--nx-radius-input, 6px);
  font-size: var(--nexus-fs-body, 0.95rem);
  line-height: 1.4;
}

.nx-chat__approval-fields {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 2px var(--nexus-space-3);
  margin: 4px 0 0;
  padding: var(--nexus-space-2) var(--nexus-space-3);
  background: var(--nx-surface-sunken, transparent);
  border-radius: var(--nx-radius-input, 6px);
  font-size: var(--nexus-fs-caption);
}

.nx-chat__approval-fields dt {
  opacity: 0.7;
  font-family: var(--nx-font-mono, ui-monospace, monospace);
}

.nx-chat__approval-fields dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.nx-chat__approval-args {
  width: 100%;
  margin-top: 4px;
  padding: var(--nexus-space-2);
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius-input, 6px);
  background: var(--nx-surface-sunken, transparent);
  color: var(--nx-text);
  font-family: var(--nx-font-mono, ui-monospace, monospace);
  font-size: var(--nexus-fs-caption);
  resize: vertical;
}

.nx-chat__approval-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--nexus-space-2);
  margin-top: var(--nexus-space-3);
}

.nx-chat__approval-yes {
  display: flex;
  flex-wrap: wrap;
  gap: var(--nexus-space-2);
}

.nx-chat__approval-no {
  margin-inline-start: auto;
}

.nx-chat__approval-ok,
.nx-chat__approval-edit,
.nx-chat__approval-no {
  padding: 6px var(--nexus-space-3);
  border: 1px solid var(--nx-border);
  border-radius: var(--nx-radius-input, 6px);
  background: transparent;
  color: var(--nx-text);
  font-family: inherit;
  font-size: var(--nexus-fs-body, inherit);
  line-height: 1.35;
  cursor: pointer;
}

.nx-chat__approval-ok {
  border-color: transparent;
  background: var(--nx-teal);
  color: var(--nx-navy-deep);
  box-shadow: var(--nx-shadow-cta);
  font-weight: var(--nexus-fw-semibold, 600);
}

.nx-chat__approval-ok:hover { background: var(--nx-teal-hover); }

.nx-chat__approval-edit {
  border-color: color-mix(in srgb, var(--nx-teal) 60%, transparent);
  font-weight: var(--nexus-fw-semibold, 600);
}

.nx-chat__approval-edit:hover {
  background: color-mix(in srgb, var(--nx-teal) 14%, transparent);
  border-color: var(--nx-teal);
}

.nx-chat__approval-no {
  color: var(--nx-text-muted, var(--nx-text));
}

.nx-chat__approval-no:hover {
  border-color: color-mix(in srgb, var(--nx-danger-ink, #b3261e) 50%, transparent);
  color: var(--nx-danger-ink, #b3261e);
}

@media (max-width: 520px) {
  .nx-chat__approval-buttons,
  .nx-chat__approval-yes {
    display: grid;
    gap: var(--nexus-space-2);
    width: 100%;
  }

  .nx-chat__approval-no {
    margin-inline-start: 0;
  }

  .nx-chat__approval-ok,
  .nx-chat__approval-edit,
  .nx-chat__approval-no {
    width: 100%;
    padding: 10px var(--nexus-space-3);
    text-align: center;
  }
}

.nx-chat__approval-note {
  margin: var(--nexus-space-2) 0 0;
  font-size: var(--nexus-fs-caption);
  color: var(--nx-text-faint);
}
