/* ============================================================
   Nexora Built-in Agent Copilot — Sleek Right-Docked Drawer
   Zero left-sidebar changes · Zero purple focus outlines
   ============================================================ */

.nx-agent-topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 12px 0 13px;
  border-radius: 999px;
  background: #11131b;
  color: #ffffff;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(17, 19, 27, 0.14);
  transition: background-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.nx-agent-topbar-btn .icon {
  width: 14px;
  height: 14px;
  color: #e6a8ff;
}

.nx-agent-topbar-btn kbd {
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
}

.nx-agent-topbar-btn:hover {
  background: #232635;
  transform: translateY(-1px);
}

.nx-agent-topbar-btn.is-active {
  background: linear-gradient(125deg, #251a3a, #11131b);
  box-shadow: 0 6px 18px rgba(125, 58, 239, 0.22);
}

.nx-agent-backdrop {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(20, 16, 28, 0.18);
  backdrop-filter: blur(2px);
}

.nx-agent-backdrop[hidden],
.nx-agent-drawer[hidden] {
  display: none;
}

.nx-agent-drawer {
  position: fixed;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: min(440px, calc(100vw - 24px));
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #e7e0ef;
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(20, 14, 34, 0.16), 0 2px 10px rgba(20, 14, 34, 0.05);
  overflow: hidden;
  animation: nx-agent-slide 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes nx-agent-slide {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: translateX(0); }
}

.nx-agent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px 13px;
  border-bottom: 1px solid #f1ecf6;
  background: #fdfcff;
  flex-shrink: 0;
}

.nx-agent-head-left {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.nx-agent-title-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nx-agent-brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7d3aef, #ed67b5 60%, #ff8c7b);
  flex-shrink: 0;
}

.nx-agent-title-line h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: #1b1823;
}

.nx-agent-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.nx-agent-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  background: #f4f1f8;
  color: #5b506a;
}

.nx-agent-pill i {
  width: 5.5px;
  height: 5.5px;
  border-radius: 50%;
  background: #8b7f98;
}

.nx-agent-pill.is-ok {
  background: #edf9f2;
  color: #1f6f43;
}

.nx-agent-pill.is-ok i {
  background: #249b5b;
}

.nx-agent-pill.is-warn {
  background: #fff4e6;
  color: #965913;
}

.nx-agent-pill.is-warn i {
  background: #d07814;
}

.nx-agent-head-right {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.nx-agent-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: transparent;
  color: #6c607a;
  transition: background-color 0.14s, color 0.14s;
}

.nx-agent-icon-btn:hover {
  background: #f3eef9;
  color: #1b1823;
}

.nx-agent-icon-btn .icon {
  width: 15px;
  height: 15px;
}

/* Skill Bar & Viral Skill Library */
.nx-agent-skill-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid #f0eaf6;
  background: #fbfaff;
  flex-shrink: 0;
}

.nx-agent-skill-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.nx-agent-skill-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 168px;
  padding: 3px 8px 3px 9px;
  border-radius: 999px;
  background: #f2ebfc;
  border: 1px solid #e1d2f7;
  color: #4d28a8;
  font-size: 11px;
  font-weight: 600;
}

.nx-agent-skill-chip > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nx-agent-skill-chip button {
  background: transparent;
  padding: 0 2px;
  color: #7c58c9;
  font-size: 13px;
  line-height: 1;
}

.nx-agent-skill-chip button:hover {
  color: #1b1823;
}

.nx-agent-skill-empty {
  font-size: 11.5px;
  color: #8b7f9a;
}

.nx-agent-skill-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid #e4dbef;
  color: #362c45;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background-color 0.14s, border-color 0.14s;
}

.nx-agent-skill-toggle-btn:hover,
.nx-agent-skill-toggle-btn.is-open {
  background: #11131b;
  border-color: #11131b;
  color: #ffffff;
}

.nx-agent-skill-toggle-btn .icon {
  width: 12px;
  height: 12px;
}

.nx-agent-skill-panel {
  margin-bottom: 14px;
  padding: 13px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #e7dff0;
  display: grid;
  gap: 10px;
  box-shadow: 0 4px 16px rgba(27, 24, 35, 0.04);
}

.nx-agent-skill-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.nx-agent-skill-panel-head strong {
  display: block;
  font-size: 13px;
  font-weight: 650;
  color: #1b1823;
}

.nx-agent-skill-panel-head small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: #776b86;
}

.nx-agent-skill-panel-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.nx-agent-skill-new-btn {
  height: 26px;
  padding: 0 9px;
  border-radius: 8px;
  background: #11131b;
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nx-agent-skill-new-btn .icon {
  width: 11px;
  height: 11px;
}

.nx-agent-skill-form {
  padding: 10px;
  border-radius: 11px;
  background: #faf8fc;
  border: 1px solid #eae2f3;
  display: grid;
  gap: 8px;
}

.nx-agent-skill-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 8px;
}

.nx-agent-skill-form input,
.nx-agent-skill-form select,
.nx-agent-skill-form textarea {
  width: 100%;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid #e3daee;
  background: #ffffff;
  color: #1b1823;
  font: inherit;
  font-size: 12px;
  outline: none !important;
  box-shadow: none !important;
}

.nx-agent-skill-form input:focus,
.nx-agent-skill-form select:focus,
.nx-agent-skill-form textarea:focus {
  border-color: rgba(27, 24, 35, 0.34);
}

.nx-agent-skill-form-foot {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.nx-agent-skill-list {
  display: grid;
  gap: 7px;
  max-height: 268px;
  overflow-y: auto;
  padding-right: 2px;
}

.nx-agent-skill-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
  padding: 10px 11px;
  border-radius: 11px;
  background: #faf9fc;
  border: 1px solid #ebe4f3;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.14s, background-color 0.14s;
}

.nx-agent-skill-card:hover {
  border-color: #d2c1e8;
  background: #ffffff;
}

.nx-agent-skill-card.is-active {
  background: #f8f4ff;
  border-color: #11131b;
}

.nx-agent-skill-card-top {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.nx-agent-skill-card-top strong {
  font-size: 12.5px;
  font-weight: 650;
  color: #1b1823;
}

.nx-agent-skill-cat {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 6px;
  background: #efeaf6;
  color: #5b4d6d;
}

.nx-agent-skill-card p {
  margin: 4px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: #6b6079;
}

.nx-agent-skill-card-right {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nx-agent-skill-check {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1.5px solid #d7cde4;
  background: #ffffff;
  color: transparent;
  display: grid;
  place-items: center;
}

.nx-agent-skill-card.is-active .nx-agent-skill-check {
  border-color: #11131b;
  background: #11131b;
  color: #ffffff;
}

.nx-agent-skill-check .icon {
  width: 11px;
  height: 11px;
}

.nx-agent-skill-del {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #8f829f;
  background: transparent;
}

.nx-agent-skill-del:hover {
  background: #fdebf0;
  color: #a63d58;
}

.nx-agent-skill-del .icon {
  width: 12px;
  height: 12px;
}

.nx-agent-msg-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.nx-agent-msg-skills span {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: #f3ecfc;
  color: #5632b3;
}

/* Body & Welcome */
.nx-agent-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 18px;
  background: #faf9fc;
  scrollbar-width: thin;
  scrollbar-color: #dfd6e8 transparent;
}

.nx-agent-welcome {
  display: grid;
  gap: 16px;
}

.nx-agent-welcome-head {
  display: grid;
  gap: 7px;
  padding: 16px;
  border-radius: 15px;
  background: #ffffff;
  border: 1px solid #ece5f4;
}

.nx-agent-logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f3ebfc, #fceef6 60%, #fff2ec);
  color: #6d34d1;
}

.nx-agent-logo-mark .icon {
  width: 17px;
  height: 17px;
}

.nx-agent-welcome-head h3 {
  margin: 2px 0 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: #1b1823;
}

.nx-agent-welcome-head p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: #675d74;
}

.nx-agent-recipes {
  display: grid;
  gap: 8px;
}

.nx-agent-section-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #7c708b;
  letter-spacing: 0.02em;
}

.nx-agent-recipe-btn {
  text-align: left;
  padding: 11px 13px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #ebe4f2;
  display: grid;
  gap: 3px;
  transition: border-color 0.14s, background-color 0.14s, transform 0.14s;
}

.nx-agent-recipe-btn:hover {
  border-color: #cfb7ea;
  background: #fcfaff;
  transform: translateY(-1px);
}

.nx-agent-recipe-btn strong {
  font-size: 13px;
  font-weight: 600;
  color: #1b1823;
}

.nx-agent-recipe-btn small {
  font-size: 11.5px;
  line-height: 1.45;
  color: #6e637c;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nx-agent-tools-disclosure {
  padding: 10px 13px;
  border-radius: 12px;
  background: #ffffff;
  border: 1px solid #ece6f3;
  font-size: 12px;
  color: #625670;
}

.nx-agent-tools-disclosure summary {
  cursor: pointer;
  font-weight: 600;
  color: #463a54;
}

.nx-agent-tools-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.nx-agent-tools-chips span {
  padding: 3px 8px;
  border-radius: 7px;
  background: #f5f1fa;
  color: #544765;
  font-size: 11px;
}

/* Conversation Thread */
.nx-agent-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nx-agent-msg.is-user {
  display: flex;
  justify-content: flex-end;
}

.nx-agent-bubble {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 15px 15px 4px 15px;
  background: #11131b;
  color: #ffffff;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.nx-agent-card {
  padding: 13px 14px;
  border-radius: 15px 15px 15px 4px;
  background: #ffffff;
  border: 1px solid #eae3f2;
  display: grid;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(27, 24, 35, 0.03);
}

.nx-agent-card.is-thinking {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  font-size: 12.5px;
  color: #5f536e;
}

.nx-agent-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #e3d6f5;
  border-top-color: #7d3aef;
  animation: nx-agent-spin 0.75s linear infinite;
  flex-shrink: 0;
}

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

.nx-agent-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nx-agent-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 650;
  color: #4f2bb3;
}

.nx-agent-badge .icon {
  width: 13px;
  height: 13px;
}

.nx-agent-card-meta small {
  font-size: 11px;
  color: #8b7f98;
}

.nx-agent-trace {
  display: grid;
  gap: 5px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #faf8fc;
  border: 1px solid #efe9f5;
}

.nx-agent-trace-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 11.5px;
  line-height: 1.45;
}

.nx-agent-trace-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.nx-agent-trace-dot .icon {
  width: 10px;
  height: 10px;
}

.nx-agent-trace-item.is-ok .nx-agent-trace-dot {
  background: #e7f7ee;
  color: #1f6f43;
}

.nx-agent-trace-item.is-err .nx-agent-trace-dot {
  background: #fdebf0;
  color: #a63d58;
}

.nx-agent-trace-item strong {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: #2c2436;
}

.nx-agent-trace-item small {
  display: block;
  font-size: 11px;
  color: #756982;
}

.nx-agent-md {
  font-size: 13px;
  line-height: 1.65;
  color: #251f2f;
  display: grid;
  gap: 7px;
  overflow-wrap: anywhere;
}

.nx-agent-md p {
  margin: 0;
}

.nx-agent-md code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11.5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: #f4f0f9;
  color: #4f2bb3;
}

.nx-agent-md-list {
  margin: 0;
  padding-left: 16px;
  display: grid;
  gap: 4px;
}

.nx-agent-md-list.is-ordered {
  list-style: none;
  padding-left: 0;
}

.nx-agent-md-quote {
  margin: 2px 0 0;
  padding: 7px 10px;
  border-left: 2px solid #d5c2eb;
  background: #faf7fe;
  border-radius: 0 8px 8px 0;
  font-size: 11.5px;
  color: #665a74;
}

.nx-agent-actions {
  display: grid;
  gap: 6px;
  padding-top: 2px;
}

.nx-agent-action-card {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 11px;
  background: #f7f4fb;
  border: 1px solid #e6dcf2;
  text-align: left;
  transition: background-color 0.14s, border-color 0.14s;
}

.nx-agent-action-card:hover {
  background: #efe7fb;
  border-color: #cbb5df;
}

.nx-agent-act-ic {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #ffffff;
  color: #5d39bd;
  display: grid;
  place-items: center;
}

.nx-agent-act-ic .icon {
  width: 15px;
  height: 15px;
}

.nx-agent-act-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.nx-agent-act-copy strong {
  font-size: 12.5px;
  font-weight: 600;
  color: #1b1823;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nx-agent-act-copy small {
  font-size: 11px;
  color: #6f637e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nx-agent-act-go .icon {
  width: 14px;
  height: 14px;
  color: #746685;
}

/* Footer Composer & Asset Picker */
.nx-agent-foot {
  padding: 12px 14px 14px;
  background: #ffffff;
  border-top: 1px solid #f0eaf5;
  display: grid;
  gap: 8px;
  flex-shrink: 0;
}

.nx-agent-asset-picker {
  padding: 10px;
  border-radius: 12px;
  background: #faf8fc;
  border: 1px solid #eae2f2;
  display: grid;
  gap: 8px;
}

.nx-agent-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: #362c44;
}

.nx-agent-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  max-height: 156px;
  overflow-y: auto;
}

.nx-agent-picker-item {
  padding: 4px;
  border-radius: 9px;
  background: #ffffff;
  border: 1.5px solid #ebe4f2;
  display: grid;
  gap: 4px;
  text-align: left;
  min-width: 0;
}

.nx-agent-picker-item.is-selected {
  border-color: #11131b;
  background: #f5f2fa;
}

.nx-agent-picker-thumb {
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  overflow: hidden;
  background: #f2eef7;
  display: grid;
  place-items: center;
}

.nx-agent-picker-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nx-agent-picker-kind {
  font-size: 10px;
  font-weight: 700;
  color: #5d39bd;
}

.nx-agent-picker-item span {
  font-size: 10.5px;
  color: #463b54;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nx-agent-picker-empty {
  margin: 0;
  font-size: 12px;
  color: #7c708b;
  text-align: center;
  padding: 10px 0;
}

.nx-agent-attached-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.nx-agent-att-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 168px;
  padding: 3px 7px;
  border-radius: 8px;
  background: #f4f1f8;
  border: 1px solid #e6def0;
  font-size: 11px;
  color: #3f334f;
}

.nx-agent-att-chip > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nx-agent-att-chip button {
  background: transparent;
  padding: 0 2px;
  font-size: 13px;
  line-height: 1;
  color: #7e728d;
}

.nx-agent-composer {
  border: 1px solid #e5deee;
  border-radius: 14px;
  background: #faf9fc;
  padding: 10px 10px 8px;
  display: grid;
  gap: 8px;
  transition: border-color 0.14s, background-color 0.14s, box-shadow 0.14s;
}

.nx-agent-composer:focus-within {
  background: #ffffff;
  border-color: rgba(27, 24, 35, 0.24);
  box-shadow: 0 6px 20px rgba(27, 24, 35, 0.06);
}

.nx-agent-composer textarea {
  width: 100%;
  border: 0;
  outline: none !important;
  box-shadow: none !important;
  resize: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  line-height: 1.55;
  color: #1b1823;
  min-height: 44px;
  padding: 0 2px;
}

.nx-agent-composer textarea::placeholder {
  color: #9387a2;
}

.nx-agent-composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nx-agent-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid #e6def0;
  color: #5b5069;
  font-size: 11.5px;
  font-weight: 500;
}

.nx-agent-attach-btn:hover,
.nx-agent-attach-btn.is-active {
  background: #f3eef9;
  color: #1b1823;
  border-color: #d6c8e8;
}

.nx-agent-attach-btn .icon {
  width: 13px;
  height: 13px;
}

.nx-agent-send-btn {
  min-height: 32px;
  height: 32px;
  padding: 0 14px;
  border-radius: 9px;
  background: #11131b;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  gap: 5px;
}

.nx-agent-send-btn .icon {
  width: 13px;
  height: 13px;
}

.nx-agent-send-btn:hover:not(:disabled) {
  background: #232635;
}

@media (max-width: 900px) {
  .nx-agent-topbar-btn kbd {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nx-agent-drawer,
  .nx-agent-spinner {
    animation: none;
  }
}
