.nia-root {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 70;
  font-family: Arial, sans-serif;
}

body.app-shell-activo:not(.sidebar-oculto) .nia-root {
  right: 24px;
}

.nia-launcher {
  width: 62px;
  height: 62px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(228, 20, 98, 0.22);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 16px 36px rgba(15, 34, 56, 0.18);
  cursor: pointer;
}

.nia-launcher:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 44px rgba(15, 34, 56, 0.22);
}

.nia-launcher img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  display: block;
}

.nia-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: min(390px, calc(100vw - 110px));
  height: min(560px, calc(100vh - 130px));
  display: none;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--axiona-border);
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(15, 34, 56, 0.24);
}

.nia-panel.abierto {
  display: grid;
}

.nia-header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 68px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--axiona-border);
  background: #fff;
}

.nia-header img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  flex: 0 0 auto;
}

.nia-title {
  min-width: 0;
  flex: 1;
}

.nia-title strong,
.nia-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nia-title strong {
  color: var(--axiona-navy);
  font-size: 15px;
}

.nia-title span {
  color: var(--axiona-muted);
  font-size: 12px;
  margin-top: 2px;
}

.nia-icon-btn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--axiona-border);
  border-radius: 8px;
  background: #fff;
  color: var(--axiona-navy);
  cursor: pointer;
}

.nia-icon-btn:hover {
  background: #f8fafc;
}

.nia-messages {
  min-height: 0;
  padding: 14px;
  overflow-y: auto;
  background: #f8fafc;
}

.nia-message {
  max-width: 92%;
  margin-bottom: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--axiona-border);
  background: #fff;
  color: var(--axiona-navy);
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.nia-message.usuario {
  margin-left: auto;
  border-color: rgba(31, 120, 209, 0.22);
  background: #eef6ff;
}

.nia-message.sistema {
  border-color: rgba(228, 20, 98, 0.22);
  background: #fff6fa;
}

.nia-message.error {
  border-color: rgba(220, 38, 38, 0.25);
  background: #fff5f5;
  color: #991b1b;
}

.nia-footer {
  padding: 12px;
  border-top: 1px solid var(--axiona-border);
  background: #fff;
}

.nia-form {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
  align-items: end;
}

.nia-form textarea {
  width: 100%;
  min-height: 42px;
  max-height: 110px;
  resize: none;
  padding: 10px 12px;
  border: 1px solid var(--axiona-border);
  border-radius: 8px;
  color: var(--axiona-navy);
  font: inherit;
  line-height: 1.35;
  outline: none;
}

.nia-form textarea:focus {
  border-color: rgba(228, 20, 98, 0.55);
  box-shadow: 0 0 0 3px rgba(228, 20, 98, 0.1);
}

.nia-send {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--axiona-pink);
  color: #fff;
  cursor: pointer;
}

.nia-send:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.nia-meta {
  margin-top: 8px;
  min-height: 16px;
  color: var(--axiona-muted);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

@media screen and (max-width: 820px) {
  .nia-root,
  body.app-shell-activo:not(.sidebar-oculto) .nia-root {
    right: 14px;
    bottom: 16px;
  }

  .nia-panel {
    left: 0;
    right: 0;
    width: auto;
    height: min(540px, calc(100vh - 118px));
  }
}
